Magellan Linux

Annotation of /trunk/mkinitrd-magellan/busybox/scripts/randomtest

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1123 - (hide annotations) (download)
Wed Aug 18 21:56:57 2010 UTC (13 years, 9 months ago) by niro
File size: 2754 byte(s)
-updated to busybox-1.17.1
1 niro 816 #!/bin/sh
2    
3 niro 1123 # If not specified in environment...
4     if ! test "$LIBC"; then
5     # Select which libc to build against
6     LIBC="glibc"
7     LIBC="uclibc"
8     fi
9 niro 816 # x86 32-bit:
10 niro 1123 #CROSS_COMPILER_PREFIX="i486-linux-uclibc-"
11 niro 816 # My system has strange prefix for x86 64-bit uclibc:
12 niro 1123 #CROSS_COMPILER_PREFIX="x86_64-pc-linux-gnu-"
13 niro 816
14 niro 1123 if test $# -lt 2 || ! test -d "$1" || test -e "$2"; then
15     echo "Usage: $0 SRC_DIR TMP_DIR"
16     echo
17     echo "SRC_DIR will be copied to TMP_DIR directory."
18     echo "Then a random build will be performed."
19     echo
20     echo "Useful variables:"
21     echo "\$LIBC, \$CROSS_COMPILER_PREFIX, \$MAKEOPTS"
22     exit 1
23     fi
24 niro 816
25 niro 1123 cp -dpr -- "$1" "$2" || { echo "copy error"; exit 1; }
26     cd -- "$2" || { echo "cd $dir error"; exit 1; }
27 niro 816
28 niro 1123 # Generate random config
29     make randconfig >/dev/null || { echo "randconfig error"; exit 1; }
30 niro 816
31 niro 1123 # Tweak resulting config
32 niro 816 cat .config \
33 niro 1123 | grep -v CONFIG_DEBUG_PESSIMIZE \
34 niro 816 | grep -v CONFIG_WERROR \
35 niro 1123 | grep -v CONFIG_CROSS_COMPILER_PREFIX \
36 niro 984 | grep -v CONFIG_SELINUX \
37     | grep -v CONFIG_EFENCE \
38     | grep -v CONFIG_DMALLOC \
39 niro 1123 \
40     | grep -v CONFIG_RFKILL \
41     >.config.new
42 niro 816 mv .config.new .config
43 niro 1123 echo '# CONFIG_DEBUG_PESSIMIZE is not set' >>.config
44     echo '# CONFIG_WERROR is not set' >>.config
45     echo "CONFIG_CROSS_COMPILER_PREFIX=\"${CROSS_COMPILER_PREFIX}\"" >>.config
46     echo '# CONFIG_SELINUX is not set' >>.config
47     echo '# CONFIG_EFENCE is not set' >>.config
48     echo '# CONFIG_DMALLOC is not set' >>.config
49     echo '# CONFIG_RFKILL is not set' >>.config
50 niro 816
51 niro 1123 # If glibc, don't build static
52     if test x"$LIBC" = x"glibc"; then
53     cat .config \
54     | grep -v CONFIG_STATIC \
55     >.config.new
56     mv .config.new .config
57     echo '# CONFIG_STATIC is not set' >>.config
58     fi
59 niro 816
60 niro 1123 # If uclibc, build static, and remove some things
61     # likely to not work on uclibc.
62     if test x"$LIBC" = x"uclibc"; then
63     cat .config \
64     | grep -v CONFIG_STATIC \
65     | grep -v CONFIG_BUILD_LIBBUSYBOX \
66     | grep -v CONFIG_PIE \
67     \
68     | grep -v CONFIG_FEATURE_2_4_MODULES \
69     >.config.new
70     mv .config.new .config
71     echo 'CONFIG_STATIC=y' >>.config
72     echo '# CONFIG_BUILD_LIBBUSYBOX is not set' >>.config
73     echo '# CONFIG_PIE is not set' >>.config
74     echo '# CONFIG_FEATURE_2_4_MODULES is not set' >>.config
75     fi
76    
77     # If STATIC, remove some things.
78 niro 816 # PAM with static linking is probably pointless
79     # (but I need to try - now I don't have libpam.a on my system, only libpam.so)
80 niro 1123 if grep -q "^CONFIG_STATIC=y" .config; then
81     cat .config \
82     | grep -v CONFIG_PAM \
83     >.config.new
84     mv .config.new .config
85     echo '# CONFIG_PAM is not set' >>.config
86     fi
87 niro 816
88     # Regenerate .config with default answers for yanked-off options
89 niro 1123 # (most of default answers are "no").
90     { yes "" | make oldconfig >/dev/null; } || { echo "oldconfig error"; exit 1; }
91 niro 816
92 niro 1123 # Build!
93     nice -n 10 make $MAKEOPTS 2>&1 | tee make.log
94 niro 816
95 niro 1123 # Return exitcode 1 if busybox executable does not exist
96     test -x busybox