Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/scripts
- Timestamp:
- Dec 20, 2016, 4:07:32 PM (9 years ago)
- Location:
- branches/3.3
- Files:
-
- 1 added
- 6 deleted
- 13 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mindi-busybox/scripts/Makefile.build
r2725 r3621 256 256 quiet_cmd_link_o_target = LD $@ 257 257 # If the list of objects to link is empty, just create an empty built-in.o 258 # -nostdlib is added to make "make LD=gcc ..." work (some people use that) 258 259 cmd_link_o_target = $(if $(strip $(obj-y)),\ 259 $(LD) $(ld_flags) -r -o $@ $(filter $(obj-y), $^),\260 $(LD) -nostdlib $(ld_flags) -r -o $@ $(filter $(obj-y), $^),\ 260 261 rm -f $@; $(AR) rcs $@) 261 262 -
branches/3.3/mindi-busybox/scripts/basic/docproc.c
r3232 r3621 40 40 #include <sys/types.h> 41 41 #include <sys/wait.h> 42 #include <alloca.h>42 //bbox disabled: #include <alloca.h> 43 43 44 44 /* exitstatus is used to keep track of any failing calls to kernel-doc, … … 265 265 vec[idx++] = DOCBOOK; 266 266 267 /* Split line up in individual parameters prece eded by FUNCTION */267 /* Split line up in individual parameters preceded by FUNCTION */ 268 268 for (i=0; line[i]; i++) { 269 269 if (isspace(line[i])) { -
branches/3.3/mindi-busybox/scripts/basic/fixdep.c
r3232 r3621 114 114 #include <ctype.h> 115 115 #include <arpa/inet.h> 116 #include <alloca.h>116 //bbox disabled: #include <alloca.h> 117 117 118 118 /* bbox: not needed -
branches/3.3/mindi-busybox/scripts/bloat-o-meter
r3232 r3621 8 8 # of the GNU General Public License, incorporated herein by reference. 9 9 10 import sys, os #, re10 import sys, os 11 11 12 12 def usage(): 13 sys.stderr.write("usage: %s [-t] file1 file2\n" % sys.argv[0]) 14 sys.exit(-1) 13 sys.stderr.write("usage: %s [-t] file1 file2 [-- <readelf options>]\n" 14 % sys.argv[0]) 15 sys.stderr.write("\t-t\tShow time spent on parsing/processing\n") 16 sys.stderr.write("\t--\tPass additional parameters to readelf\n") 17 sys.exit(1) 15 18 16 19 f1, f2 = (None, None) … … 32 35 elif f2 is None: 33 36 f2 = f 37 else: 38 usage() 34 39 if flag_timing: 35 40 import time -
branches/3.3/mindi-busybox/scripts/gen_build_files.sh
r3232 r3621 32 32 cat 33 33 # print everything after INSERT line 34 sed -n '/^INSERT$/ { :l; n; p; bl }' "${src}" 34 sed -n '/^INSERT$/ { 35 :l 36 n 37 p 38 bl 39 }' "${src}" 35 40 } >"${dst}.tmp" 36 41 if ! cmp -s "${dst}" "${dst}.tmp"; then … … 53 58 # and insert empty line before each line which doesn't start 54 59 # with space or tab 55 sed -n -e 's@^//usage:\([ \t].*\)$@\1 \\@p' -e 's@^//usage:\([^ \t].*\)$@\n\1 \\@p' \ 60 TAB="$(printf '\tX')" 61 TAB="${TAB%X}" 62 LF="$(printf '\nX')" 63 LF="${LF%X}" 64 sed -n -e 's@^//usage:\([ '"$TAB"'].*\)$@\1 \\@p' \ 65 -e 's@^//usage:\([^ '"$TAB"'].*\)$@\'"$LF"'\1 \\@p' \ 56 66 "$srctree"/*/*.c "$srctree"/*/*/*.c \ 57 67 | generate \ … … 62 72 # (Re)generate */Kbuild and */Config.in 63 73 # We skip .dotdirs - makes git/svn/etc users happier 64 { cd -- "$srctree" && find . -type d -not'(' -name '.?*' -prune ')'; } \74 { cd -- "$srctree" && find . -type d ! '(' -name '.?*' -prune ')'; } \ 65 75 | while read -r d; do 66 76 d="${d#./}" -
branches/3.3/mindi-busybox/scripts/kconfig/Makefile
r3232 r3621 151 151 HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK 152 152 153 HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` 153 HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` -ldl 154 154 HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ 155 155 -D LKC_DIRECT_LINK -
branches/3.3/mindi-busybox/scripts/kconfig/confdata.c
r2725 r3621 125 125 case S_HEX: 126 126 case S_STRING: 127 if (sym->user.val) 128 free(sym->user.val); 127 free(sym->user.val); 129 128 default: 130 129 sym->user.val = NULL; … … 475 474 /* bbox */ 476 475 fprintf(out_h, "#define ENABLE_%s 1\n", sym->name); 477 fprintf(out_h, "#define IF_%s(...) __VA_ARGS__\n", sym->name); 476 fprintf(out_h, "#ifdef MAKE_SUID\n"); 477 fprintf(out_h, "# define IF_%s(...) __VA_ARGS__ \"CONFIG_%s\"\n", sym->name, sym->name); 478 fprintf(out_h, "#else\n"); 479 fprintf(out_h, "# define IF_%s(...) __VA_ARGS__\n", sym->name); 480 fprintf(out_h, "#endif\n"); 478 481 fprintf(out_h, "#define IF_NOT_%s(...)\n", sym->name); 479 482 } … … 507 510 /* bbox */ 508 511 fprintf(out_h, "#define ENABLE_%s 1\n", sym->name); 509 fprintf(out_h, "#define IF_%s(...) __VA_ARGS__\n", sym->name); 512 fprintf(out_h, "#ifdef MAKE_SUID\n"); 513 fprintf(out_h, "# define IF_%s(...) __VA_ARGS__ \"CONFIG_%s\"\n", sym->name, sym->name); 514 fprintf(out_h, "#else\n"); 515 fprintf(out_h, "# define IF_%s(...) __VA_ARGS__\n", sym->name); 516 fprintf(out_h, "#endif\n"); 510 517 fprintf(out_h, "#define IF_NOT_%s(...)\n", sym->name); 511 518 } … … 519 526 /* bbox */ 520 527 fprintf(out_h, "#define ENABLE_%s 1\n", sym->name); 521 fprintf(out_h, "#define IF_%s(...) __VA_ARGS__\n", sym->name); 528 fprintf(out_h, "#ifdef MAKE_SUID\n"); 529 fprintf(out_h, "# define IF_%s(...) __VA_ARGS__ \"CONFIG_%s\"\n", sym->name, sym->name); 530 fprintf(out_h, "#else\n"); 531 fprintf(out_h, "# define IF_%s(...) __VA_ARGS__\n", sym->name); 532 fprintf(out_h, "#endif\n"); 522 533 fprintf(out_h, "#define IF_NOT_%s(...)\n", sym->name); 523 534 } … … 533 544 /* bbox */ 534 545 fprintf(out_h, "#define ENABLE_%s 1\n", sym->name); 535 fprintf(out_h, "#define IF_%s(...) __VA_ARGS__\n", sym->name); 546 fprintf(out_h, "#ifdef MAKE_SUID\n"); 547 fprintf(out_h, "# define IF_%s(...) __VA_ARGS__ \"CONFIG_%s\"\n", sym->name, sym->name); 548 fprintf(out_h, "#else\n"); 549 fprintf(out_h, "# define IF_%s(...) __VA_ARGS__\n", sym->name); 550 fprintf(out_h, "#endif\n"); 536 551 fprintf(out_h, "#define IF_NOT_%s(...)\n", sym->name); 537 552 } -
branches/3.3/mindi-busybox/scripts/kconfig/lxdialog/check-lxdialog.sh
r2725 r3621 5 5 ldflags() 6 6 { 7 for ext in so a dylib ; do 7 pkg-config --libs ncursesw 2>/dev/null && exit 8 pkg-config --libs ncurses 2>/dev/null && exit 9 for ext in so a dll.a dylib ; do 8 10 for lib in ncursesw ncurses curses ; do 9 11 $cc -print-file-name=lib${lib}.${ext} | grep -q / … … 20 22 ccflags() 21 23 { 22 if [ -f /usr/include/ncursesw/ncurses.h ]; then 23 echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncurses.h>"' 24 if pkg-config --cflags ncursesw 2>/dev/null; then 25 echo '-DCURSES_LOC="<ncurses.h>" -DNCURSES_WIDECHAR=1' 26 elif pkg-config --cflags ncurses 2>/dev/null; then 27 echo '-DCURSES_LOC="<ncurses.h>"' 24 28 elif [ -f /usr/include/ncursesw/curses.h ]; then 25 echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>"' 29 echo '-I/usr/include/ncursesw -DCURSES_LOC="<curses.h>"' 30 echo ' -DNCURSES_WIDECHAR=1' 26 31 elif [ -f /usr/include/ncurses/ncurses.h ]; then 27 32 echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"' 28 33 elif [ -f /usr/include/ncurses/curses.h ]; then 29 echo '-I/usr/include/ncurses -DCURSES_LOC="< ncurses/curses.h>"'34 echo '-I/usr/include/ncurses -DCURSES_LOC="<curses.h>"' 30 35 elif [ -f /usr/include/ncurses.h ]; then 31 36 echo '-DCURSES_LOC="<ncurses.h>"' … … 41 46 # Check if we can link to ncurses 42 47 check() { 43 $cc -x c - -o $tmp 2>/dev/null <<'EOF'48 $cc -x c - -o $tmp 2>/dev/null <<'EOF' 44 49 #include CURSES_LOC 45 50 main() {} -
branches/3.3/mindi-busybox/scripts/kconfig/util.c
r2725 r3621 80 80 void str_free(struct gstr *gs) 81 81 { 82 if (gs->s) 83 free(gs->s); 82 free(gs->s); 84 83 gs->s = NULL; 85 84 gs->len = 0; -
branches/3.3/mindi-busybox/scripts/kconfig/zconf.hash.c_shipped
r2725 r3621 33 33 /* maximum key range = 45, duplicates = 0 */ 34 34 35 #ifdef __GNUC__ 36 __inline 37 #else 38 #ifdef __cplusplus 39 inline 40 #endif 41 #endif 42 static unsigned int 35 unsigned int 43 36 kconf_id_hash (register const char *str, register unsigned int len) 44 37 { … … 120 113 char kconf_id_strings_str46[sizeof("prompt")]; 121 114 }; 122 st atic struct kconf_id_strings_t kconf_id_strings_contents =115 struct kconf_id_strings_t kconf_id_strings_contents = 123 116 { 124 117 "if", … … 154 147 }; 155 148 #define kconf_id_strings ((const char *) &kconf_id_strings_contents) 156 #ifdef __GNUC__157 __inline158 #endif159 149 struct kconf_id * 160 150 kconf_id_lookup (register const char *str, register unsigned int len) -
branches/3.3/mindi-busybox/scripts/mkconfigs
r2859 r3621 66 66 grep -e '^# CONFIG_' -e '^CONFIG_' "$config" \ 67 67 | bzip2 -1 | dd bs=2 skip=1 2>/dev/null \ 68 | od -v - t x1\68 | od -v -b \ 69 69 | sed -e 's/^[^ ]*//' \ 70 70 -e 's/ //g' \ 71 71 -e '/^$/d' \ 72 -e 's/\(.. \)/0x\1,/g'72 -e 's/\(...\)/0\1,/g' 73 73 74 74 echo "};" -
branches/3.3/mindi-busybox/scripts/randomtest
r2725 r3621 53 53 cat .config \ 54 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 59 >.config.new 56 60 mv .config.new .config 57 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 67 fi 59 68 … … 67 76 \ 68 77 | grep -v CONFIG_FEATURE_2_4_MODULES \ 78 | grep -v CONFIG_FEATURE_SYNC_FANCY \ 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 \ 69 85 >.config.new 70 86 mv .config.new .config … … 73 89 echo '# CONFIG_PIE is not set' >>.config 74 90 echo '# CONFIG_FEATURE_2_4_MODULES is not set' >>.config 91 echo '# CONFIG_FEATURE_SYNC_FANCY 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 75 99 fi 76 100 … … 92 116 # Build! 93 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 94 120 95 121 # Return exitcode 1 if busybox executable does not exist -
branches/3.3/mindi-busybox/scripts/trylink
r3232 r3621 47 47 48 48 check_cc() { 49 local tempname="/tmp/temp.$$.$RANDOM" 49 local tempname="$(mktemp)" 50 local r 51 echo "int main(int argc,char**argv){return argv?argc:0;}" >"$tempname".c 50 52 # Can use "-o /dev/null", but older gcc tend to *unlink it* on failure! :( 51 # "-xc": C language. "/dev/null" is an empty source file. 52 if $CC $1 -shared -xc /dev/null -o "$tempname".o >/dev/null 2>&1; then 53 echo "$1"; 54 else 55 echo "$2"; 56 fi 57 rm "$tempname".o 2>/dev/null 53 # Was using "-xc /dev/null", but we need a valid C program. 54 # "eval" may be needed if CFLAGS can contain 55 # '... -D"BB_VER=KBUILD_STR(1.N.M)" ...' 56 # and we need shell to process quotes! 57 $CC $CFLAGS $LDFLAGS $1 "$tempname".c -o "$tempname" >/dev/null 2>&1 58 r=$? 59 rm -f "$tempname" "$tempname".c "$tempname".o 60 return $r 58 61 } 59 62 60 63 check_libc_is_glibc() { 61 local tempname="/tmp/temp.$$.$RANDOM" 64 local tempname="$(mktemp)" 65 local r 62 66 echo "\ 63 67 #include <stdlib.h> … … 67 71 #endif 68 72 " >"$tempname".c 69 if $CC "$tempname".c -c -o "$tempname".o >/dev/null 2>&1; then 70 echo "$2"; 71 else 72 echo "$1"; 73 fi 74 rm "$tempname".c "$tempname".o 2>/dev/null 73 ! $CC $CFLAGS "$tempname".c -c -o "$tempname".o >/dev/null 2>&1 74 r=$? 75 rm -f "$tempname" "$tempname".c "$tempname".o 76 return $r 75 77 } 76 78 … … 84 86 85 87 # The --sort-section option is not supported by older versions of ld 86 SORT_SECTION=`check_cc "-Wl,--sort-section,alignment" ""` 88 SORT_SECTION="-Wl,--sort-section,alignment" 89 if ! check_cc "-Wl,--sort-section,alignment"; then 90 echo "Your linker does not support --sort-section,alignment" 91 SORT_SECTION="" 92 fi 87 93 88 94 START_GROUP="-Wl,--start-group" … … 91 97 92 98 # gold may not support --sort-common (yet) 93 SORT_COMMON=`check_cc "-Wl,--sort-common" ""` 99 SORT_COMMON="-Wl,--sort-common" 100 if ! check_cc "-Wl,--sort-common"; then 101 echo "Your linker does not support --sort-common" 102 SORT_COMMON="" 103 fi 94 104 95 105 # Static linking against glibc produces buggy executables … … 98 108 # Note that glibc is unsuitable for static linking anyway. 99 109 # We are removing -Wl,--gc-sections from link command line. 100 GC_SECTIONS=`( 101 . ./.config 102 if test x"$CONFIG_STATIC" = x"y"; then 103 check_libc_is_glibc "" "-Wl,--gc-sections" 104 else 105 echo "-Wl,--gc-sections" 106 fi 107 )` 108 110 GC_SECTIONS="-Wl,--gc-sections" 111 if (. ./.config && test x"$CONFIG_STATIC" = x"y") then 112 if check_libc_is_glibc; then 113 echo "Static linking against glibc, can't use --gc-sections" 114 GC_SECTIONS="" 115 fi 116 fi 109 117 # The --gc-sections option is not supported by older versions of ld 110 118 if test -n "$GC_SECTIONS"; then 111 GC_SECTIONS=`check_cc "$GC_SECTIONS" ""` 119 if ! check_cc "$GC_SECTIONS"; then 120 echo "Your linker does not support $GC_SECTIONS" 121 GC_SECTIONS="" 122 fi 112 123 fi 113 124 … … 118 129 echo "Trying libraries: $LDLIBS" 119 130 # "lib1 lib2 lib3" -> "-llib1 -llib2 -llib3" 120 l_list=`echo " $LDLIBS" | sed -e 's/ / -l/g' -e 's/^/-l/' -e 's/^-l$//'`131 l_list=`echo " $LDLIBS " | sed -e 's: \([^- ][^ ]*\): -l\1:g'` 121 132 test "x$l_list" != "x" && l_list="$START_GROUP $l_list $END_GROUP" 122 133 try $CC $CFLAGS $LDFLAGS \ … … 130 141 echo "Failed: $l_list" 131 142 cat $EXE.out 143 echo 'Note: if build needs additional libraries, put them in CONFIG_EXTRA_LDLIBS.' 144 echo 'Example: CONFIG_EXTRA_LDLIBS="pthread dl tirpc audit pam"' 132 145 exit 1 133 146 } … … 142 155 without_one=`echo " $LDLIBS " | sed "s/ $one / /g" | xargs` 143 156 # "lib1 lib2 lib3" -> "-llib1 -llib2 -llib3" 144 l_list=`echo " $without_one" | sed -e 's/ / -l/g' -e 's/^/-l/' -e 's/^-l$//'`157 l_list=`echo " $without_one " | sed -e 's: \([^- ][^ ]*\): -l\1:g'` 145 158 test x"$l_list" != x"" && l_list="$START_GROUP $l_list $END_GROUP" 146 159 $debug && echo "Trying -l options: '$l_list'" … … 173 186 # Make the binary with final, minimal list of libs 174 187 echo "Final link with: ${LDLIBS:-<none>}" 175 l_list=`echo " $LDLIBS" | sed -e 's/ / -l/g' -e 's/^/-l/' -e 's/^-l$//'`188 l_list=`echo " $LDLIBS " | sed -e 's: \([^- ][^ ]*\): -l\1:g'` 176 189 test "x$l_list" != "x" && l_list="$START_GROUP $l_list $END_GROUP" 177 190 # --verbose gives us gobs of info to stdout (e.g. linker script used) … … 197 210 # This will eliminate most of the padding (~3kb). 198 211 # Hmm, "ld --sort-section alignment" should do it too. 212 # 213 # There is a ld hack which is meant to decrease disk usage 214 # at the cost of more RAM usage (??!!) in standard ld script: 215 # /* Adjust the address for the data segment. We want to adjust up to 216 # the same address within the page on the next page up. */ 217 # . = ALIGN (0x1000) - ((0x1000 - .) & (0x1000 - 1)); . = DATA_SEGMENT_ALIGN (0x1000, 0x1000); 218 # Replace it with: 219 # . = ALIGN (0x1000); . = DATA_SEGMENT_ALIGN (0x1000, 0x1000); 220 # to unconditionally align .data to the next page boundary, 221 # instead of "next page, plus current offset in this page" 199 222 try $CC $CFLAGS $LDFLAGS \ 200 223 -o $EXE \ … … 269 292 if test "$CONFIG_FEATURE_INDIVIDUAL" = y; then 270 293 echo "Linking individual applets against libbusybox (see $sharedlib_dir/*)" 271 gcc -DNAME_MAIN _CNAME-E -include include/autoconf.h include/applets.h \294 gcc -DNAME_MAIN -E -include include/autoconf.h include/applets.h \ 272 295 | grep -v "^#" \ 273 | grep -v "^ $" \296 | grep -v "^ *$" \ 274 297 > applet_lst.tmp 275 298 while read name main junk; do … … 301 324 rm -- "$sharedlib_dir/applet.c" $EXE.out 302 325 $STRIP -s --remove-section=.note --remove-section=.comment $EXE 326 # Let user see that we do something - list the names of created binaries: 327 echo "$EXE" 303 328 304 329 done <applet_lst.tmp
Note:
See TracChangeset
for help on using the changeset viewer.