[RFC] modprobe-small: optimizations for single applet build
Denys Vlasenko
vda.linux at googlemail.com
Mon Jan 9 15:22:04 UTC 2017
On Mon, Jan 9, 2017 at 1:18 PM, Kang-Che Sung <explorer09 at gmail.com> wrote:
> On Mon, Jan 9, 2017 at 4:49 PM, Denys Vlasenko <vda.linux at googlemail.com> wrote:
>> CONFIG_MODPROBE_SMALL=y
>> CONFIG_DEPMOD=y
>> # CONFIG_INSMOD is not set
>> CONFIG_LSMOD=y
>> # CONFIG_FEATURE_LSMOD_PRETTY_2_6_OUTPUT is not set
>> CONFIG_MODINFO=y
>> # CONFIG_MODPROBE is not set
>> # CONFIG_FEATURE_MODPROBE_BLACKLIST is not set
>> # CONFIG_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE is not set
>> CONFIG_FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED=y
>> # CONFIG_RMMOD is not set
>>
>> error: unused variable 'exitcode'
>>
>> modutils/modprobe-small.c: In function 'modprobe_main':
>> modutils/modprobe-small.c:1060: error: control reaches end of non-void function
>>
> Acknowledged. But I thought it was only a warning...
I use CONFIG_WERROR=y
> (The make_single_applets.sh didn't show compiler's or make's stderr to the
> screen, and so I didn't notice. By the way, would make_single_applets.sh try to
> do this trick? https://stackoverflow.com/questions/2871233/)
How about this:
diff --git a/make_single_applets.sh b/make_single_applets.sh
index 00f502e..03a5c32 100755
--- a/make_single_applets.sh
+++ b/make_single_applets.sh
@@ -28,6 +28,8 @@ for app in $apps; do
done
#echo "$allno" >.config_allno
+trap 'test -f .config.SV && mv .config.SV .config && touch .config' EXIT
+
# Turn on each applet individually and build single-applet executable
fail=0
for app in $apps; do
@@ -54,16 +56,20 @@ for app in $apps; do
mv .config busybox_config_${app}
elif ! make $makeopts >>busybox_make_${app}.log 2>&1; then
: $((fail++))
+ grep -i -e error: -e warning: busybox_make_${app}.log
echo "Build error for ${app}"
mv .config busybox_config_${app}
elif ! grep -q '^#define NUM_APPLETS 1$' include/NUM_APPLETS.h; then
+ grep -i -e error: -e warning: busybox_make_${app}.log
mv busybox busybox_${app}
: $((fail++))
echo "NUM_APPLETS != 1 for ${app}: `cat include/NUM_APPLETS.h`"
mv .config busybox_config_${app}
else
+ grep -i -e error: -e warning: busybox_make_${app}.log \
+ || rm busybox_make_${app}.log
mv busybox busybox_${app}
- rm busybox_make_${app}.log
+ #mv .config busybox_config_${app}
fi
mv .config.SV .config
#exit
-------------- next part --------------
diff --git a/make_single_applets.sh b/make_single_applets.sh
index 00f502e..03a5c32 100755
--- a/make_single_applets.sh
+++ b/make_single_applets.sh
@@ -28,6 +28,8 @@ for app in $apps; do
done
#echo "$allno" >.config_allno
+trap 'test -f .config.SV && mv .config.SV .config && touch .config' EXIT
+
# Turn on each applet individually and build single-applet executable
fail=0
for app in $apps; do
@@ -54,16 +56,20 @@ for app in $apps; do
mv .config busybox_config_${app}
elif ! make $makeopts >>busybox_make_${app}.log 2>&1; then
: $((fail++))
+ grep -i -e error: -e warning: busybox_make_${app}.log
echo "Build error for ${app}"
mv .config busybox_config_${app}
elif ! grep -q '^#define NUM_APPLETS 1$' include/NUM_APPLETS.h; then
+ grep -i -e error: -e warning: busybox_make_${app}.log
mv busybox busybox_${app}
: $((fail++))
echo "NUM_APPLETS != 1 for ${app}: `cat include/NUM_APPLETS.h`"
mv .config busybox_config_${app}
else
+ grep -i -e error: -e warning: busybox_make_${app}.log \
+ || rm busybox_make_${app}.log
mv busybox busybox_${app}
- rm busybox_make_${app}.log
+ #mv .config busybox_config_${app}
fi
mv .config.SV .config
#exit
diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c
index 75b36f7..21fa9db 100644
--- a/modutils/modprobe-small.c
+++ b/modutils/modprobe-small.c
@@ -59,7 +59,12 @@
#define DEPFILE_BB CONFIG_DEFAULT_DEPMOD_FILE".bb"
#define MOD_APPLET_CNT (ENABLE_MODPROBE + ENABLE_DEPMOD + ENABLE_INSMOD + ENABLE_LSMOD + ENABLE_RMMOD)
-#define ONLY_APPLET (MOD_APPLET_CNT <= 1)
+
+/* Do not bother if MODPROBE_SMALL=y but no applets selected. */
+/* The rest of the file is in this if block. */
+#if MOD_APPLET_CNT > 0
+
+#define ONLY_APPLET (MOD_APPLET_CNT == 1)
#define is_modprobe (ENABLE_MODPROBE && (ONLY_APPLET || applet_name[0] == 'm'))
#define is_depmod (ENABLE_DEPMOD && (ONLY_APPLET || applet_name[0] == 'd'))
#define is_insmod (ENABLE_INSMOD && (ONLY_APPLET || applet_name[0] == 'i'))
@@ -1063,3 +1068,5 @@ int modprobe_main(int argc UNUSED_PARAM, char **argv)
return exitcode;
#endif /* MODPROBE || INSMOD || RMMOD */
}
+
+#endif /* MOD_APPLET_CNT > 0 */
More information about the busybox
mailing list