3 # If not specified in environment...
4 if ! test "$LIBC"; then
5 # Select which libc to build against
10 #CROSS_COMPILER_PREFIX="i486-linux-uclibc-"
11 # My system has strange prefix for x86 64-bit uclibc:
12 #CROSS_COMPILER_PREFIX="x86_64-pc-linux-gnu-"
14 if test $# -lt 2 || ! test -d "$1" || test -e "$2"; then
15 echo "Usage: $0 SRC_DIR TMP_DIR"
17 echo "SRC_DIR will be copied to TMP_DIR directory."
18 echo "Then a random build will be performed."
20 echo "Useful variables:"
21 echo "\$LIBC, \$CROSS_COMPILER_PREFIX, \$MAKEOPTS"
25 cp -dpr -- "$1" "$2" || { echo "copy error"; exit 1; }
26 cd -- "$2" || { echo "cd $dir error"; exit 1; }
28 # Generate random config
29 make randconfig >/dev/null || { echo "randconfig error"; exit 1; }
31 # Tweak resulting config
33 | grep -v CONFIG_DEBUG_PESSIMIZE \
34 | grep -v CONFIG_WERROR \
35 | grep -v CONFIG_CROSS_COMPILER_PREFIX \
36 | grep -v CONFIG_SELINUX \
37 | grep -v CONFIG_EFENCE \
38 | grep -v CONFIG_DMALLOC \
40 | grep -v CONFIG_RFKILL \
42 mv .config.new .config
43 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
47 # If glibc, don't build static
48 if test x"$LIBC" = x"glibc"; then
50 | grep -v CONFIG_STATIC \
52 mv .config.new .config
53 echo '# CONFIG_STATIC is not set' >>.config
56 # If glibc, build static, and remove some things
57 # likely to not work on uclibc.
58 if test x"$LIBC" = x"uclibc"; then
60 | grep -v CONFIG_STATIC \
61 | grep -v CONFIG_BUILD_LIBBUSYBOX \
62 | grep -v CONFIG_TASKSET \
63 | grep -v CONFIG_UNICODE_SUPPORT \
64 | grep -v CONFIG_PIE \
66 mv .config.new .config
67 echo 'CONFIG_STATIC=y' >>.config
70 # If STATIC, remove some things.
71 # PAM with static linking is probably pointless
72 # (but I need to try - now I don't have libpam.a on my system, only libpam.so)
73 if grep -q "^CONFIG_STATIC=y" .config; then
75 | grep -v CONFIG_PAM \
77 mv .config.new .config
80 # Regenerate .config with default answers for yanked-off options
81 # (most of default answers are "no").
82 { yes "" | make oldconfig >/dev/null; } || { echo "oldconfig error"; exit 1; }
85 nice -n 10 make $MAKEOPTS 2>&1 | tee make.log
87 # Return exitcode 1 if busybox executable does not exist