diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/generate_BUFSIZ.sh | 100 | ||||
-rw-r--r-- | scripts/kconfig/zconf.hash.c_shipped | 14 | ||||
-rwxr-xr-x | scripts/randomtest | 22 | ||||
-rwxr-xr-x | scripts/trylink | 2 |
4 files changed, 53 insertions, 85 deletions
diff --git a/scripts/generate_BUFSIZ.sh b/scripts/generate_BUFSIZ.sh index 844261906..718788e0b 100755 --- a/scripts/generate_BUFSIZ.sh +++ b/scripts/generate_BUFSIZ.sh | |||
@@ -36,11 +36,10 @@ generate_std_and_exit() { | |||
36 | } | 36 | } |
37 | 37 | ||
38 | generate_big_and_exit() { | 38 | generate_big_and_exit() { |
39 | $debug && echo "Configuring: bb_common_bufsiz1[] in _end[], COMMON_BUFSIZE = $1" | 39 | $debug && echo "Configuring: bb_common_bufsiz1[] in bss, COMMON_BUFSIZE = $1" |
40 | { | 40 | { |
41 | echo "enum { COMMON_BUFSIZE = $1 };" | 41 | echo "enum { COMMON_BUFSIZE = $1 };" |
42 | echo "extern char _end[]; /* linker-provided label */" | 42 | echo "extern char bb_common_bufsiz1[];" |
43 | echo "#define bb_common_bufsiz1 _end" | ||
44 | echo "#define setup_common_bufsiz() ((void)0)" | 43 | echo "#define setup_common_bufsiz() ((void)0)" |
45 | } | regenerate "$common_bufsiz_h" | 44 | } | regenerate "$common_bufsiz_h" |
46 | echo "$2" >"$common_bufsiz_h.method" | 45 | echo "$2" >"$common_bufsiz_h.method" |
@@ -51,20 +50,10 @@ generate_1k_and_exit() { | |||
51 | generate_big_and_exit 1024 "1k" | 50 | generate_big_and_exit 1024 "1k" |
52 | } | 51 | } |
53 | 52 | ||
54 | |||
55 | generate_malloc_and_exit() { | ||
56 | $debug && echo "Configuring: bb_common_bufsiz1[] is malloced" | ||
57 | { | ||
58 | echo "enum { COMMON_BUFSIZE = 1024 };" | ||
59 | echo "extern char *const bb_common_bufsiz1;" | ||
60 | echo "void setup_common_bufsiz(void);" | ||
61 | } | regenerate "$common_bufsiz_h" | ||
62 | echo "malloc" >"$common_bufsiz_h.method" | ||
63 | $exitcmd | ||
64 | } | ||
65 | |||
66 | round_down_COMMON_BUFSIZE() { | 53 | round_down_COMMON_BUFSIZE() { |
67 | COMMON_BUFSIZE=$(( ($1-32) & 0xfffffe0 )) | 54 | COMMON_BUFSIZE=1024 |
55 | test "$1" -le 32 && return | ||
56 | COMMON_BUFSIZE=$(( ($1-32) & 0x0ffffff0 )) | ||
68 | COMMON_BUFSIZE=$(( COMMON_BUFSIZE < 1024 ? 1024 : COMMON_BUFSIZE )) | 57 | COMMON_BUFSIZE=$(( COMMON_BUFSIZE < 1024 ? 1024 : COMMON_BUFSIZE )) |
69 | } | 58 | } |
70 | 59 | ||
@@ -104,77 +93,44 @@ if $postcompile; then | |||
104 | test x"$PAGE_SIZE" = x"" && exit 1 | 93 | test x"$PAGE_SIZE" = x"" && exit 1 |
105 | $debug && echo "PAGE_SIZE:0x$PAGE_SIZE $((0x$PAGE_SIZE))" | 94 | $debug && echo "PAGE_SIZE:0x$PAGE_SIZE $((0x$PAGE_SIZE))" |
106 | PAGE_SIZE=$((0x$PAGE_SIZE)) | 95 | PAGE_SIZE=$((0x$PAGE_SIZE)) |
107 | test $PAGE_SIZE -lt 512 && exit 1 | 96 | test $PAGE_SIZE -lt 1024 && exit 1 |
108 | 97 | ||
109 | # How much space between _end[] and next page? | 98 | # How much space between _end[] and next page? |
110 | PAGE_MASK=$((PAGE_SIZE-1)) | 99 | PAGE_MASK=$((PAGE_SIZE-1)) |
111 | TAIL_SIZE=$(( (-END) & PAGE_MASK )) | 100 | TAIL_SIZE=$(( (-END) & PAGE_MASK )) |
112 | $debug && echo "TAIL_SIZE:$TAIL_SIZE bytes" | 101 | $debug && echo "TAIL_SIZE:$TAIL_SIZE bytes" |
113 | 102 | ||
114 | if test x"$method" = x"1k" || test x"$method" = x"big"; then | 103 | if test x"$method" = x"1k"; then |
115 | if test $TAIL_SIZE -lt 1024; then | 104 | { |
116 | # _end[] has no enough space for bb_common_bufsiz1[] | 105 | echo $TAIL_SIZE |
117 | echo "Warning! Space in _end[] is too small ($TAIL_SIZE bytes)!" | 106 | md5sum <.config | cut -d' ' -f1 |
118 | echo "Rerun make to build a binary which doesn't use it!" | 107 | stat -c "%Y" .config |
119 | rm -- "$common_bufsiz_h.1k.OK" 2>/dev/null | 108 | } >"$common_bufsiz_h.1k.OK" |
120 | { md5sum <.config | cut -d' ' -f1; stat -c "%Y" .config; } >"$common_bufsiz_h.1k.FAIL" | 109 | round_down_COMMON_BUFSIZE $((1024 + TAIL_SIZE)) |
121 | rm busybox_unstripped busybox 2>/dev/null | 110 | # emit message only if COMMON_BUFSIZE is indeed larger |
122 | # Note: here we can do either a "malloc" or "std" build. | 111 | test $COMMON_BUFSIZE -gt 1024 \ |
123 | # "malloc" gives a bit bigger code: | 112 | && echo "Rerun make to use larger COMMON_BUFSIZE ($COMMON_BUFSIZE)" |
124 | # text bss filename | 113 | test $COMMON_BUFSIZE = 1024 && generate_1k_and_exit |
125 | # 804355 5385 busybox.std | 114 | generate_big_and_exit $COMMON_BUFSIZE "big" |
126 | # 804618 4361 busybox.malloc | ||
127 | # but may have a smaller .bss (not guaranteed!). Use "pmap -x" to verify. | ||
128 | exitcmd="exit 1" | ||
129 | generate_malloc_and_exit | ||
130 | else | ||
131 | PREV_SIZE=1024 | ||
132 | test x"$method" = x"big" && PREV_SIZE=`cat -- "$common_bufsiz_h.1k.OK"` | ||
133 | round_down_COMMON_BUFSIZE $PREV_SIZE | ||
134 | PREV_BUFSIZE=$COMMON_BUFSIZE | ||
135 | |||
136 | rm -- "$common_bufsiz_h.1k.FAIL" 2>/dev/null | ||
137 | echo $TAIL_SIZE >"$common_bufsiz_h.1k.OK" | ||
138 | round_down_COMMON_BUFSIZE $TAIL_SIZE | ||
139 | # emit message only if COMMON_BUFSIZE is indeed larger | ||
140 | test $COMMON_BUFSIZE -gt $PREV_BUFSIZE \ | ||
141 | && echo "Rerun make to use larger COMMON_BUFSIZE ($COMMON_BUFSIZE)" | ||
142 | #TODO: test $PREV_BUFSIZE -lt $TAIL_SIZE && PANIC!!! | ||
143 | #Code size with COMMON_BUFSIZE > 1024 may be bigger than code with COMMON_BUFSIZE = 1024! | ||
144 | #(currently we just hope "-32 and round down to 32" saves us) | ||
145 | |||
146 | test $COMMON_BUFSIZE = 1024 && generate_1k_and_exit | ||
147 | generate_big_and_exit $COMMON_BUFSIZE "big" | ||
148 | fi | ||
149 | fi | 115 | fi |
150 | fi | 116 | fi |
151 | 117 | ||
152 | # Based on past success/fail of 1k build, decide next build type | 118 | # Based on past success/fail of 1k build, decide next build type |
153 | 119 | ||
154 | if test -f "$common_bufsiz_h.1k.OK"; then | 120 | if test -f "$common_bufsiz_h.1k.OK"; then |
155 | # Previous build succeeded fitting 1k into _end[]. | 121 | # previous 1k build succeeded |
156 | # Try bigger COMMON_BUFSIZE if possible. | 122 | oldcfg=`tail -n2 -- "$common_bufsiz_h.1k.OK"` |
157 | TAIL_SIZE=`cat -- "$common_bufsiz_h.1k.OK"` | ||
158 | round_down_COMMON_BUFSIZE $TAIL_SIZE | ||
159 | test $COMMON_BUFSIZE = 1024 && generate_1k_and_exit | ||
160 | generate_big_and_exit $COMMON_BUFSIZE "big" | ||
161 | fi | ||
162 | |||
163 | if test -f "$common_bufsiz_h.1k.FAIL"; then | ||
164 | # Previous build FAILED to fit 1k into _end[]. | ||
165 | # Was it with same .config? | ||
166 | oldcfg=`cat -- "$common_bufsiz_h.1k.FAIL"` | ||
167 | curcfg=`md5sum <.config | cut -d' ' -f1; stat -c "%Y" .config` | 123 | curcfg=`md5sum <.config | cut -d' ' -f1; stat -c "%Y" .config` |
168 | # If yes, then build a "malloced" version | 124 | # config did not change |
169 | if test x"$oldcfg" = x"$curcfg"; then | 125 | if test x"$oldcfg" = x"$curcfg"; then |
170 | echo "Will not try 1k build, it failed before. Touch .config to override" | 126 | # Try bigger COMMON_BUFSIZE if possible |
171 | # Note: here we can do either a "malloc" or "std" build. | 127 | TAIL_SIZE=`head -n1 -- "$common_bufsiz_h.1k.OK"` |
172 | generate_malloc_and_exit | 128 | round_down_COMMON_BUFSIZE $((1024 + TAIL_SIZE)) |
129 | test $COMMON_BUFSIZE = 1024 && generate_1k_and_exit | ||
130 | generate_big_and_exit $COMMON_BUFSIZE "big" | ||
173 | fi | 131 | fi |
174 | # else: try 1k version | 132 | # config did change |
175 | echo "New .config, will try 1k build" | 133 | rm -rf -- "$common_bufsiz_h.1k.OK" |
176 | rm -- "$common_bufsiz_h.1k.FAIL" | ||
177 | generate_1k_and_exit | ||
178 | fi | 134 | fi |
179 | 135 | ||
180 | # There was no 1k build yet. Try it. | 136 | # There was no 1k build yet. Try it. |
diff --git a/scripts/kconfig/zconf.hash.c_shipped b/scripts/kconfig/zconf.hash.c_shipped index d39cf189a..29d9cf6cc 100644 --- a/scripts/kconfig/zconf.hash.c_shipped +++ b/scripts/kconfig/zconf.hash.c_shipped | |||
@@ -32,14 +32,7 @@ | |||
32 | struct kconf_id; | 32 | struct kconf_id; |
33 | /* maximum key range = 45, duplicates = 0 */ | 33 | /* maximum key range = 45, duplicates = 0 */ |
34 | 34 | ||
35 | #ifdef __GNUC__ | 35 | unsigned int |
36 | __inline | ||
37 | #else | ||
38 | #ifdef __cplusplus | ||
39 | inline | ||
40 | #endif | ||
41 | #endif | ||
42 | static unsigned int | ||
43 | kconf_id_hash (register const char *str, register unsigned int len) | 36 | kconf_id_hash (register const char *str, register unsigned int len) |
44 | { | 37 | { |
45 | static unsigned char asso_values[] = | 38 | static unsigned char asso_values[] = |
@@ -119,7 +112,7 @@ struct kconf_id_strings_t | |||
119 | char kconf_id_strings_str41[sizeof("choice")]; | 112 | char kconf_id_strings_str41[sizeof("choice")]; |
120 | char kconf_id_strings_str46[sizeof("prompt")]; | 113 | char kconf_id_strings_str46[sizeof("prompt")]; |
121 | }; | 114 | }; |
122 | static struct kconf_id_strings_t kconf_id_strings_contents = | 115 | struct kconf_id_strings_t kconf_id_strings_contents = |
123 | { | 116 | { |
124 | "if", | 117 | "if", |
125 | "int", | 118 | "int", |
@@ -153,9 +146,6 @@ static struct kconf_id_strings_t kconf_id_strings_contents = | |||
153 | "prompt" | 146 | "prompt" |
154 | }; | 147 | }; |
155 | #define kconf_id_strings ((const char *) &kconf_id_strings_contents) | 148 | #define kconf_id_strings ((const char *) &kconf_id_strings_contents) |
156 | #ifdef __GNUC__ | ||
157 | __inline | ||
158 | #endif | ||
159 | struct kconf_id * | 149 | struct kconf_id * |
160 | kconf_id_lookup (register const char *str, register unsigned int len) | 150 | kconf_id_lookup (register const char *str, register unsigned int len) |
161 | { | 151 | { |
diff --git a/scripts/randomtest b/scripts/randomtest index e2513d058..287f1c771 100755 --- a/scripts/randomtest +++ b/scripts/randomtest | |||
@@ -52,9 +52,18 @@ echo '# CONFIG_RFKILL is not set' >>.config | |||
52 | if test x"$LIBC" = x"glibc"; then | 52 | if test x"$LIBC" = x"glibc"; then |
53 | cat .config \ | 53 | cat .config \ |
54 | | grep -v CONFIG_STATIC \ | 54 | | grep -v CONFIG_STATIC \ |
55 | \ | ||
56 | | grep -v CONFIG_FEATURE_2_4_MODULES \ | ||
57 | | grep -v CONFIG_FEATURE_USE_BSS_TAIL \ | ||
58 | | grep -v CONFIG_DEBUG_SANITIZE \ | ||
55 | >.config.new | 59 | >.config.new |
56 | mv .config.new .config | 60 | mv .config.new .config |
57 | echo '# CONFIG_STATIC is not set' >>.config | 61 | echo '# CONFIG_STATIC is not set' >>.config |
62 | # newer glibc (at least 2.23) no longer supply query_module() ABI. | ||
63 | # People who target 2.4 kernels would likely use older glibc (and older bbox). | ||
64 | echo '# CONFIG_FEATURE_2_4_MODULES is not set' >>.config | ||
65 | echo '# CONFIG_FEATURE_USE_BSS_TAIL is not set' >>.config | ||
66 | echo '# CONFIG_DEBUG_SANITIZE is not set' >>.config | ||
58 | fi | 67 | fi |
59 | 68 | ||
60 | # If uclibc, build static, and remove some things | 69 | # If uclibc, build static, and remove some things |
@@ -68,6 +77,11 @@ if test x"$LIBC" = x"uclibc"; then | |||
68 | | grep -v CONFIG_FEATURE_2_4_MODULES \ | 77 | | grep -v CONFIG_FEATURE_2_4_MODULES \ |
69 | | grep -v CONFIG_FEATURE_SYNC_FANCY \ | 78 | | grep -v CONFIG_FEATURE_SYNC_FANCY \ |
70 | | grep -v CONFIG_FEATURE_TOUCH_NODEREF \ | 79 | | grep -v CONFIG_FEATURE_TOUCH_NODEREF \ |
80 | | grep -v CONFIG_NANDWRITE \ | ||
81 | | grep -v CONFIG_NANDDUMP \ | ||
82 | | grep -v CONFIG_BLKDISCARD \ | ||
83 | | grep -v CONFIG_NSENTER \ | ||
84 | | grep -v CONFIG_UNSHARE \ | ||
71 | >.config.new | 85 | >.config.new |
72 | mv .config.new .config | 86 | mv .config.new .config |
73 | echo 'CONFIG_STATIC=y' >>.config | 87 | echo 'CONFIG_STATIC=y' >>.config |
@@ -76,6 +90,12 @@ if test x"$LIBC" = x"uclibc"; then | |||
76 | echo '# CONFIG_FEATURE_2_4_MODULES is not set' >>.config | 90 | echo '# CONFIG_FEATURE_2_4_MODULES is not set' >>.config |
77 | echo '# CONFIG_FEATURE_SYNC_FANCY is not set' >>.config | 91 | echo '# CONFIG_FEATURE_SYNC_FANCY is not set' >>.config |
78 | echo '# CONFIG_FEATURE_TOUCH_NODEREF is not set' >>.config | 92 | echo '# CONFIG_FEATURE_TOUCH_NODEREF is not set' >>.config |
93 | # My uclibc installation does not support some needed APIs... | ||
94 | echo '# CONFIG_NANDWRITE is not set' >>.config | ||
95 | echo '# CONFIG_NANDDUMP is not set' >>.config | ||
96 | echo '# CONFIG_BLKDISCARD is not set' >>.config | ||
97 | echo '# CONFIG_NSENTER is not set' >>.config | ||
98 | echo '# CONFIG_UNSHARE is not set' >>.config | ||
79 | fi | 99 | fi |
80 | 100 | ||
81 | # If STATIC, remove some things. | 101 | # If STATIC, remove some things. |
@@ -95,6 +115,8 @@ fi | |||
95 | 115 | ||
96 | # Build! | 116 | # Build! |
97 | nice -n 10 make $MAKEOPTS 2>&1 | tee make.log | 117 | nice -n 10 make $MAKEOPTS 2>&1 | tee make.log |
118 | grep 'Rerun make' make.log \ | ||
119 | && nice -n 10 make $MAKEOPTS 2>&1 | tee -a make.log | ||
98 | 120 | ||
99 | # Return exitcode 1 if busybox executable does not exist | 121 | # Return exitcode 1 if busybox executable does not exist |
100 | test -x busybox | 122 | test -x busybox |
diff --git a/scripts/trylink b/scripts/trylink index 129570a60..145df9959 100755 --- a/scripts/trylink +++ b/scripts/trylink | |||
@@ -293,7 +293,7 @@ if test "$CONFIG_FEATURE_INDIVIDUAL" = y; then | |||
293 | echo "Linking individual applets against libbusybox (see $sharedlib_dir/*)" | 293 | echo "Linking individual applets against libbusybox (see $sharedlib_dir/*)" |
294 | gcc -DNAME_MAIN -E -include include/autoconf.h include/applets.h \ | 294 | gcc -DNAME_MAIN -E -include include/autoconf.h include/applets.h \ |
295 | | grep -v "^#" \ | 295 | | grep -v "^#" \ |
296 | | grep -v "^$" \ | 296 | | grep -v "^ *$" \ |
297 | > applet_lst.tmp | 297 | > applet_lst.tmp |
298 | while read name main junk; do | 298 | while read name main junk; do |
299 | 299 | ||