2016-12-23 18:09:22 +05:30
|
|
|
#!/bin/sh
|
|
|
|
# This script expects that the tree was built with the desired .config:
|
|
|
|
# in particular, it expects that include/applets.h is generated already.
|
|
|
|
#
|
|
|
|
# The script will try to rebuild each enabled applet in isolation.
|
|
|
|
# All other options which chose general bbox config, applet features, etc,
|
|
|
|
# are not modified for the builds.
|
|
|
|
|
|
|
|
makeopts="-j9"
|
|
|
|
|
|
|
|
# The list of all applet config symbols
|
|
|
|
test -f include/applets.h || { echo "No include/applets.h file"; exit 1; }
|
|
|
|
apps="`
|
|
|
|
grep ^IF_ include/applets.h \
|
2017-12-31 22:00:02 +05:30
|
|
|
| grep -v '^IF_FEATURE_' \
|
2016-12-23 18:09:22 +05:30
|
|
|
| sed 's/IF_\([A-Z0-9._-]*\)(.*/\1/' \
|
2017-12-31 22:00:02 +05:30
|
|
|
| grep -v '^BUSYBOX$' \
|
2016-12-23 18:09:22 +05:30
|
|
|
| sort | uniq
|
|
|
|
`"
|
|
|
|
|
|
|
|
# Take existing config
|
|
|
|
test -f .config || { echo "No .config file"; exit 1; }
|
|
|
|
cfg="`cat .config`"
|
|
|
|
|
|
|
|
# Make a config with all applet symbols off
|
|
|
|
allno="$cfg"
|
|
|
|
for app in $apps; do
|
|
|
|
allno="`echo "$allno" | sed "s/^CONFIG_${app}=y\$/# CONFIG_${app} is not set/"`"
|
|
|
|
done
|
2018-12-06 18:40:10 +05:30
|
|
|
# remove "busybox" as well
|
|
|
|
allno="`echo "$allno" | sed "s/^CONFIG_BUSYBOX=y\$/# CONFIG_BUSYBOX is not set/"`"
|
2016-12-23 21:19:07 +05:30
|
|
|
#echo "$allno" >.config_allno
|
2016-12-23 18:09:22 +05:30
|
|
|
|
2017-01-09 21:01:21 +05:30
|
|
|
trap 'test -f .config.SV && mv .config.SV .config && touch .config' EXIT
|
|
|
|
|
2017-01-16 00:46:27 +05:30
|
|
|
|
2016-12-23 18:09:22 +05:30
|
|
|
# Turn on each applet individually and build single-applet executable
|
2017-01-16 00:46:27 +05:30
|
|
|
# (give config names on command line to build only those)
|
|
|
|
test $# = 0 && set -- $apps
|
2016-12-23 18:09:22 +05:30
|
|
|
fail=0
|
2017-01-16 00:46:27 +05:30
|
|
|
for app; do
|
2016-12-23 18:09:22 +05:30
|
|
|
# Only if it was indeed originally enabled...
|
|
|
|
{ echo "$cfg" | grep -q "^CONFIG_${app}=y\$"; } || continue
|
|
|
|
|
|
|
|
echo "Making ${app}..."
|
|
|
|
mv .config .config.SV
|
|
|
|
echo "CONFIG_${app}=y" >.config
|
|
|
|
echo "$allno" | sed "/^# CONFIG_${app} is not set\$/d" >>.config
|
2016-12-23 21:19:07 +05:30
|
|
|
|
2016-12-24 00:12:53 +05:30
|
|
|
if test x"${app}" != x"SH_IS_ASH" && test x"${app}" != x"SH_IS_HUSH"; then
|
|
|
|
# $allno has all choices for "sh" aliasing set to off.
|
2016-12-23 21:19:07 +05:30
|
|
|
# "sh" aliasing defaults to "ash", not none.
|
|
|
|
# without this fix, "make oldconfig" sets it wrong,
|
2016-12-24 00:12:53 +05:30
|
|
|
# resulting in NUM_APPLETS = 2 (the second applet is "sh")
|
2016-12-23 21:19:07 +05:30
|
|
|
sed '/CONFIG_SH_IS_NONE/d' -i .config
|
|
|
|
echo "CONFIG_SH_IS_NONE=y" >>.config
|
|
|
|
fi
|
|
|
|
|
2016-12-23 18:09:22 +05:30
|
|
|
if ! yes '' | make oldconfig >busybox_make_${app}.log 2>&1; then
|
2017-07-15 09:08:58 +05:30
|
|
|
fail=$((fail+1))
|
2016-12-23 18:09:22 +05:30
|
|
|
echo "Config error for ${app}"
|
|
|
|
mv .config busybox_config_${app}
|
2016-12-24 00:12:53 +05:30
|
|
|
elif ! make $makeopts >>busybox_make_${app}.log 2>&1; then
|
2017-07-15 09:08:58 +05:30
|
|
|
fail=$((fail+1))
|
2017-01-09 21:01:21 +05:30
|
|
|
grep -i -e error: -e warning: busybox_make_${app}.log
|
2016-12-23 18:09:22 +05:30
|
|
|
echo "Build error for ${app}"
|
|
|
|
mv .config busybox_config_${app}
|
2016-12-23 19:42:27 +05:30
|
|
|
elif ! grep -q '^#define NUM_APPLETS 1$' include/NUM_APPLETS.h; then
|
2017-01-09 21:01:21 +05:30
|
|
|
grep -i -e error: -e warning: busybox_make_${app}.log
|
2016-12-23 19:42:27 +05:30
|
|
|
mv busybox busybox_${app}
|
2017-07-15 09:08:58 +05:30
|
|
|
fail=$((fail+1))
|
2016-12-23 19:42:27 +05:30
|
|
|
echo "NUM_APPLETS != 1 for ${app}: `cat include/NUM_APPLETS.h`"
|
|
|
|
mv .config busybox_config_${app}
|
2016-12-23 18:09:22 +05:30
|
|
|
else
|
2017-01-09 21:01:21 +05:30
|
|
|
grep -i -e error: -e warning: busybox_make_${app}.log \
|
|
|
|
|| rm busybox_make_${app}.log
|
2016-12-23 18:09:22 +05:30
|
|
|
mv busybox busybox_${app}
|
2017-01-09 21:01:21 +05:30
|
|
|
#mv .config busybox_config_${app}
|
2016-12-23 18:09:22 +05:30
|
|
|
fi
|
|
|
|
mv .config.SV .config
|
|
|
|
#exit
|
|
|
|
done
|
2016-12-23 19:42:27 +05:30
|
|
|
touch .config # or else next "make" can be confused
|
2016-12-23 18:09:22 +05:30
|
|
|
echo "Failures: $fail"
|
|
|
|
test $fail = 0 # set exitcode
|