3 # Select which libc to build against
4 libc="glibc" # assumed native
5 # static, cross-compilation
8 uclibc_cross="i486-linux-uclibc-"
9 # My system has strange prefix for x86 64-bit uclibc:
10 #uclibc_cross="x86_64-pc-linux-gnu-"
12 test -d tree || exit 1
15 while test -e "$dir" -o -e failed."$dir"; do
19 cp -dpr tree "$dir" || exit 1
22 echo "Running randconfig test in $dir..." >&2
24 make randconfig >/dev/null || exit 1
27 | grep -v ^CONFIG_DEBUG_PESSIMIZE= \
28 | grep -v CONFIG_WERROR \
30 mv .config.new .config
31 echo CONFIG_WERROR=y >>.config
33 test "$libc" = glibc && {
35 | grep -v ^CONFIG_SELINUX= \
36 | grep -v ^CONFIG_EFENCE= \
37 | grep -v ^CONFIG_DMALLOC= \
39 mv .config.new .config
42 test "$libc" = uclibc && {
44 | grep -v ^CONFIG_SELINUX= \
45 | grep -v ^CONFIG_EFENCE= \
46 | grep -v ^CONFIG_DMALLOC= \
47 | grep -v ^CONFIG_BUILD_LIBBUSYBOX= \
48 | grep -v ^CONFIG_PAM= \
49 | grep -v ^CONFIG_TASKSET= \
50 | grep -v ^CONFIG_FEATURE_ASSUME_UNICODE= \
51 | grep -v ^CONFIG_PIE= \
52 | grep -v CONFIG_STATIC \
53 | grep -v CONFIG_CROSS_COMPILER_PREFIX \
55 mv .config.new .config
56 echo 'CONFIG_CROSS_COMPILER_PREFIX="'"$uclibc_cross"'"' >>.config
57 echo 'CONFIG_STATIC=y' >>.config
60 # If NOMMU, remove some things
61 grep -q ^CONFIG_NOMMU= .config && {
63 | grep -v ^CONFIG_ASH= \
64 | grep -v ^CONFIG_FEATURE_SH_IS_ASH= \
66 mv .config.new .config
69 # If STATIC, remove some things
70 # PAM with static linking is probably pointless
71 # (but I need to try - now I don't have libpam.a on my system, only libpam.so)
72 grep -q ^CONFIG_STATIC= .config && {
74 | grep -v ^CONFIG_PAM= \
76 mv .config.new .config
79 # CONFIG_NOMMU + CONFIG_HUSH + CONFIG_WERROR don't mix
81 grep -q ^CONFIG_NOMMU= .config && \
82 grep -q ^CONFIG_HUSH= .config && \
85 | grep -v ^CONFIG_WERROR= \
87 mv .config.new .config
90 # Regenerate .config with default answers for yanked-off options
91 { yes "" | make oldconfig >/dev/null; } || exit 1
102 mv "$dir" failed."$dir"