Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/scripts


Ignore:
Timestamp:
Dec 20, 2016, 4:07:32 PM (9 years ago)
Author:
Bruno Cornec
Message:

New 3?3 banch for incorporation of latest busybox 1.25. Changing minor version to handle potential incompatibilities.

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  
    256256quiet_cmd_link_o_target = LD      $@
    257257# 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)
    258259cmd_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), $^),\
    260261        rm -f $@; $(AR) rcs $@)
    261262
  • branches/3.3/mindi-busybox/scripts/basic/docproc.c

    r3232 r3621  
    4040#include <sys/types.h>
    4141#include <sys/wait.h>
    42 #include <alloca.h>
     42//bbox disabled: #include <alloca.h>
    4343
    4444/* exitstatus is used to keep track of any failing calls to kernel-doc,
     
    265265    vec[idx++] = DOCBOOK;
    266266
    267     /* Split line up in individual parameters preceeded by FUNCTION */
     267    /* Split line up in individual parameters preceded by FUNCTION */
    268268    for (i=0; line[i]; i++) {
    269269        if (isspace(line[i])) {
  • branches/3.3/mindi-busybox/scripts/basic/fixdep.c

    r3232 r3621  
    114114#include <ctype.h>
    115115#include <arpa/inet.h>
    116 #include <alloca.h>
     116//bbox disabled: #include <alloca.h>
    117117
    118118/* bbox: not needed
  • branches/3.3/mindi-busybox/scripts/bloat-o-meter

    r3232 r3621  
    88# of the GNU General Public License, incorporated herein by reference.
    99
    10 import sys, os#, re
     10import sys, os
    1111
    1212def 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)
    1518
    1619f1, f2 = (None, None)
     
    3235        elif f2 is None:
    3336            f2 = f
     37        else:
     38            usage()
    3439if flag_timing:
    3540    import time
  • branches/3.3/mindi-busybox/scripts/gen_build_files.sh

    r3232 r3621  
    3232        cat
    3333        # 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}"
    3540    } >"${dst}.tmp"
    3641    if ! cmp -s "${dst}" "${dst}.tmp"; then
     
    5358# and insert empty line before each line which doesn't start
    5459# with space or tab
    55 sed -n -e 's@^//usage:\([ \t].*\)$@\1 \\@p' -e 's@^//usage:\([^ \t].*\)$@\n\1 \\@p' \
     60TAB="$(printf '\tX')"
     61TAB="${TAB%X}"
     62LF="$(printf '\nX')"
     63LF="${LF%X}"
     64sed -n -e 's@^//usage:\([ '"$TAB"'].*\)$@\1 \\@p' \
     65       -e 's@^//usage:\([^ '"$TAB"'].*\)$@\'"$LF"'\1 \\@p' \
    5666    "$srctree"/*/*.c "$srctree"/*/*/*.c \
    5767| generate \
     
    6272# (Re)generate */Kbuild and */Config.in
    6373# 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 ')'; } \
    6575| while read -r d; do
    6676    d="${d#./}"
  • branches/3.3/mindi-busybox/scripts/kconfig/Makefile

    r3232 r3621  
    151151HOSTCXXFLAGS_qconf.o    = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK
    152152
    153 HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0`
     153HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` -ldl
    154154HOSTCFLAGS_gconf.o  = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
    155155                          -D LKC_DIRECT_LINK
  • branches/3.3/mindi-busybox/scripts/kconfig/confdata.c

    r2725 r3621  
    125125        case S_HEX:
    126126        case S_STRING:
    127             if (sym->user.val)
    128                 free(sym->user.val);
     127            free(sym->user.val);
    129128        default:
    130129            sym->user.val = NULL;
     
    475474                        /* bbox */
    476475                        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");
    478481                        fprintf(out_h, "#define IF_NOT_%s(...)\n", sym->name);
    479482                    }
     
    507510                    /* bbox */
    508511                    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");
    510517                    fprintf(out_h, "#define IF_NOT_%s(...)\n", sym->name);
    511518                }
     
    519526                        /* bbox */
    520527                        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");
    522533                        fprintf(out_h, "#define IF_NOT_%s(...)\n", sym->name);
    523534                    }
     
    533544                    /* bbox */
    534545                    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");
    536551                    fprintf(out_h, "#define IF_NOT_%s(...)\n", sym->name);
    537552                }
  • branches/3.3/mindi-busybox/scripts/kconfig/lxdialog/check-lxdialog.sh

    r2725 r3621  
    55ldflags()
    66{
    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
    810        for lib in ncursesw ncurses curses ; do
    911            $cc -print-file-name=lib${lib}.${ext} | grep -q /
     
    2022ccflags()
    2123{
    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>"'
    2428    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'
    2631    elif [ -f /usr/include/ncurses/ncurses.h ]; then
    2732        echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
    2833    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>"'
    3035    elif [ -f /usr/include/ncurses.h ]; then
    3136        echo '-DCURSES_LOC="<ncurses.h>"'
     
    4146# Check if we can link to ncurses
    4247check() {
    43         $cc -xc - -o $tmp 2>/dev/null <<'EOF'
     48        $cc -x c - -o $tmp 2>/dev/null <<'EOF'
    4449#include CURSES_LOC
    4550main() {}
  • branches/3.3/mindi-busybox/scripts/kconfig/util.c

    r2725 r3621  
    8080void str_free(struct gstr *gs)
    8181{
    82     if (gs->s)
    83         free(gs->s);
     82    free(gs->s);
    8483    gs->s = NULL;
    8584    gs->len = 0;
  • branches/3.3/mindi-busybox/scripts/kconfig/zconf.hash.c_shipped

    r2725 r3621  
    3333/* maximum key range = 45, duplicates = 0 */
    3434
    35 #ifdef __GNUC__
    36 __inline
    37 #else
    38 #ifdef __cplusplus
    39 inline
    40 #endif
    41 #endif
    42 static unsigned int
     35unsigned int
    4336kconf_id_hash (register const char *str, register unsigned int len)
    4437{
     
    120113    char kconf_id_strings_str46[sizeof("prompt")];
    121114  };
    122 static struct kconf_id_strings_t kconf_id_strings_contents =
     115struct kconf_id_strings_t kconf_id_strings_contents =
    123116  {
    124117    "if",
     
    154147  };
    155148#define kconf_id_strings ((const char *) &kconf_id_strings_contents)
    156 #ifdef __GNUC__
    157 __inline
    158 #endif
    159149struct kconf_id *
    160150kconf_id_lookup (register const char *str, register unsigned int len)
  • branches/3.3/mindi-busybox/scripts/mkconfigs

    r2859 r3621  
    6666grep -e '^# CONFIG_' -e '^CONFIG_' "$config" \
    6767| bzip2 -1 | dd bs=2 skip=1 2>/dev/null \
    68 | od -v -t x1 \
     68| od -v -b \
    6969| sed -e 's/^[^ ]*//' \
    7070        -e 's/ //g' \
    7171        -e '/^$/d' \
    72         -e 's/\(..\)/0x\1,/g'
     72        -e 's/\(...\)/0\1,/g'
    7373
    7474echo "};"
  • branches/3.3/mindi-busybox/scripts/randomtest

    r2725 r3621  
    5353    cat .config \
    5454    | 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 \
    5559    >.config.new
    5660    mv .config.new .config
    5761    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
    5867fi
    5968
     
    6776    \
    6877    | 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 \
    6985    >.config.new
    7086    mv .config.new .config
     
    7389    echo '# CONFIG_PIE is not set' >>.config
    7490    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
    7599fi
    76100
     
    92116# Build!
    93117nice -n 10 make $MAKEOPTS 2>&1 | tee make.log
     118grep 'Rerun make' make.log \
     119&& nice -n 10 make $MAKEOPTS 2>&1 | tee -a make.log
    94120
    95121# Return exitcode 1 if busybox executable does not exist
  • branches/3.3/mindi-busybox/scripts/trylink

    r3232 r3621  
    4747
    4848check_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
    5052    # 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
    5861}
    5962
    6063check_libc_is_glibc() {
    61     local tempname="/tmp/temp.$$.$RANDOM"
     64    local tempname="$(mktemp)"
     65    local r
    6266    echo "\
    6367    #include <stdlib.h>
     
    6771    #endif
    6872    " >"$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
    7577}
    7678
     
    8486
    8587# The --sort-section option is not supported by older versions of ld
    86 SORT_SECTION=`check_cc "-Wl,--sort-section,alignment" ""`
     88SORT_SECTION="-Wl,--sort-section,alignment"
     89if ! check_cc "-Wl,--sort-section,alignment"; then
     90    echo "Your linker does not support --sort-section,alignment"
     91    SORT_SECTION=""
     92fi
    8793
    8894START_GROUP="-Wl,--start-group"
     
    9197
    9298# gold may not support --sort-common (yet)
    93 SORT_COMMON=`check_cc "-Wl,--sort-common" ""`
     99SORT_COMMON="-Wl,--sort-common"
     100if ! check_cc "-Wl,--sort-common"; then
     101    echo "Your linker does not support --sort-common"
     102    SORT_COMMON=""
     103fi
    94104
    95105# Static linking against glibc produces buggy executables
     
    98108# Note that glibc is unsuitable for static linking anyway.
    99109# 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 
     110GC_SECTIONS="-Wl,--gc-sections"
     111if (. ./.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
     116fi
    109117# The --gc-sections option is not supported by older versions of ld
    110118if 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
    112123fi
    113124
     
    118129echo "Trying libraries: $LDLIBS"
    119130# "lib1 lib2 lib3" -> "-llib1 -llib2 -llib3"
    120 l_list=`echo "$LDLIBS" | sed -e 's/ / -l/g' -e 's/^/-l/' -e 's/^-l$//'`
     131l_list=`echo " $LDLIBS " | sed -e 's: \([^- ][^ ]*\): -l\1:g'`
    121132test "x$l_list" != "x" && l_list="$START_GROUP $l_list $END_GROUP"
    122133try $CC $CFLAGS $LDFLAGS \
     
    130141    echo "Failed: $l_list"
    131142    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"'
    132145    exit 1
    133146}
     
    142155    without_one=`echo " $LDLIBS " | sed "s/ $one / /g" | xargs`
    143156    # "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'`
    145158    test x"$l_list" != x"" && l_list="$START_GROUP $l_list $END_GROUP"
    146159    $debug && echo "Trying -l options: '$l_list'"
     
    173186# Make the binary with final, minimal list of libs
    174187echo "Final link with: ${LDLIBS:-<none>}"
    175 l_list=`echo "$LDLIBS" | sed -e 's/ / -l/g' -e 's/^/-l/' -e 's/^-l$//'`
     188l_list=`echo " $LDLIBS " | sed -e 's: \([^- ][^ ]*\): -l\1:g'`
    176189test "x$l_list" != "x" && l_list="$START_GROUP $l_list $END_GROUP"
    177190# --verbose gives us gobs of info to stdout (e.g. linker script used)
     
    197210    # This will eliminate most of the padding (~3kb).
    198211    # 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"
    199222    try $CC $CFLAGS $LDFLAGS \
    200223        -o $EXE \
     
    269292if test "$CONFIG_FEATURE_INDIVIDUAL" = y; then
    270293    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 \
    272295    | grep -v "^#" \
    273     | grep -v "^$" \
     296    | grep -v "^ *$" \
    274297    > applet_lst.tmp
    275298    while read name main junk; do
     
    301324    rm -- "$sharedlib_dir/applet.c" $EXE.out
    302325    $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"
    303328
    304329    done <applet_lst.tmp
Note: See TracChangeset for help on using the changeset viewer.