blob: bd5ef4bfee86e94b2190b9571b21e6cb77d8e1e1 [file] [log] [blame]
Denis Vlasenko27e15012008-09-28 17:19:02 +00001#!/bin/sh
2
3# Select which libc to build against
4libc="glibc" # assumed native
Denis Vlasenko62e0dc22008-11-09 16:08:31 +00005# static, cross-compilation
Denis Vlasenko27e15012008-09-28 17:19:02 +00006libc="uclibc"
Denis Vlasenko62e0dc22008-11-09 16:08:31 +00007# x86 32-bit:
8uclibc_cross="i486-linux-uclibc-"
9# My system has strange prefix for x86 64-bit uclibc:
10#uclibc_cross="x86_64-pc-linux-gnu-"
Denis Vlasenko27e15012008-09-28 17:19:02 +000011
12test -d tree || exit 1
13
14dir=test.$$
15while test -e "$dir" -o -e failed."$dir"; do
16 dir=test."$RANDOM"
17done
18
19cp -dpr tree "$dir" || exit 1
20cd "$dir" || exit 1
21
22echo "Running randconfig test in $dir..." >&2
23
24make randconfig >/dev/null || exit 1
25
26cat .config \
27| grep -v ^CONFIG_DEBUG_PESSIMIZE= \
28| grep -v CONFIG_WERROR \
29| cat >.config.new
30mv .config.new .config
31echo CONFIG_WERROR=y >>.config
32
33test "$libc" = glibc && {
34cat .config \
35| grep -v ^CONFIG_SELINUX= \
36| grep -v ^CONFIG_EFENCE= \
37| grep -v ^CONFIG_DMALLOC= \
Denys Vlasenko0568b6e2009-08-08 03:20:12 +020038| grep -v ^CONFIG_ACPID= \
39| grep -v ^CONFIG_FLASH_ERASEALL= \
40| grep -v ^CONFIG_FLASH_LOCK= \
41| grep -v ^CONFIG_FLASH_UNLOCK= \
Denis Vlasenko27e15012008-09-28 17:19:02 +000042| cat >.config.new
43mv .config.new .config
44}
45
46test "$libc" = uclibc && {
47cat .config \
48| grep -v ^CONFIG_SELINUX= \
49| grep -v ^CONFIG_EFENCE= \
50| grep -v ^CONFIG_DMALLOC= \
51| grep -v ^CONFIG_BUILD_LIBBUSYBOX= \
52| grep -v ^CONFIG_PAM= \
53| grep -v ^CONFIG_TASKSET= \
54| grep -v ^CONFIG_FEATURE_ASSUME_UNICODE= \
55| grep -v ^CONFIG_PIE= \
56| grep -v CONFIG_STATIC \
57| grep -v CONFIG_CROSS_COMPILER_PREFIX \
58| cat >.config.new
59mv .config.new .config
Denis Vlasenko62e0dc22008-11-09 16:08:31 +000060echo 'CONFIG_CROSS_COMPILER_PREFIX="'"$uclibc_cross"'"' >>.config
Denis Vlasenko27e15012008-09-28 17:19:02 +000061echo 'CONFIG_STATIC=y' >>.config
62}
63
64# If NOMMU, remove some things
65grep -q ^CONFIG_NOMMU= .config && {
66cat .config \
67| grep -v ^CONFIG_ASH= \
68| grep -v ^CONFIG_FEATURE_SH_IS_ASH= \
69| cat >.config.new
70mv .config.new .config
71}
72
73# If STATIC, remove some things
74# PAM with static linking is probably pointless
75# (but I need to try - now I don't have libpam.a on my system, only libpam.so)
76grep -q ^CONFIG_STATIC= .config && {
77cat .config \
78| grep -v ^CONFIG_PAM= \
79| cat >.config.new
80mv .config.new .config
81}
82
Denis Vlasenko27e15012008-09-28 17:19:02 +000083# Regenerate .config with default answers for yanked-off options
84{ yes "" | make oldconfig >/dev/null; } || exit 1
85
Denis Vlasenkoa2333c82009-03-28 19:08:23 +000086nice -n 10 make 2>&1 | tee -a make.log
Denis Vlasenko27e15012008-09-28 17:19:02 +000087
88test -x busybox && {
89 cd ..
90 rm -rf "$dir"
91 exit 0
92}
93
94cd ..
Denis Vlasenkoa2333c82009-03-28 19:08:23 +000095mv "$dir" "failed.$dir"
Denis Vlasenko27e15012008-09-28 17:19:02 +000096exit 1