mirror of https://github.com/mirror/busybox.git
Make busybox an optional applet
If it's disabled, code shrinks by about 900 bytes: function old new delta usr_bin 10 - -10 usr_sbin 11 - -11 install_dir 20 - -20 applet_install_loc 184 - -184 run_applet_and_exit 686 21 -665 ------------------------------------------------------------------------------ (add/remove: 0/4 grow/shrink: 0/1 up/down: 0/-890) Total: -890 bytes text data bss dec hex filename 911327 493 7336 919156 e0674 busybox_old 909848 493 7336 917677 e00ad busybox_unstripped but busybox executable by itself does not say anything useful: $ busybox busybox: applet not found Based on the patch by Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>1_25_stable
parent
877dedb825
commit
8e95068c7f
12
Config.in
12
Config.in
|
@ -116,9 +116,21 @@ config FEATURE_COMPRESS_USAGE
|
||||||
and have very little memory, this might not be a win. Otherwise,
|
and have very little memory, this might not be a win. Otherwise,
|
||||||
you probably want this.
|
you probably want this.
|
||||||
|
|
||||||
|
config BUSYBOX
|
||||||
|
bool "Include busybox applet"
|
||||||
|
default y
|
||||||
|
help
|
||||||
|
The busybox applet provides general help regarding busybox and
|
||||||
|
allows the included applets to be listed. It's also required
|
||||||
|
if applet links are to be installed at runtime.
|
||||||
|
|
||||||
|
If you can live without these features disabling this will save
|
||||||
|
some space.
|
||||||
|
|
||||||
config FEATURE_INSTALLER
|
config FEATURE_INSTALLER
|
||||||
bool "Support --install [-s] to install applet links at runtime"
|
bool "Support --install [-s] to install applet links at runtime"
|
||||||
default y
|
default y
|
||||||
|
depends on BUSYBOX
|
||||||
help
|
help
|
||||||
Enable 'busybox --install [-s]' support. This will allow you to use
|
Enable 'busybox --install [-s]' support. This will allow you to use
|
||||||
busybox at runtime to create hard links or symlinks for all the
|
busybox at runtime to create hard links or symlinks for all the
|
||||||
|
|
|
@ -701,7 +701,7 @@ static void install_links(const char *busybox, int use_symbolic_links,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# else
|
# elif ENABLE_BUSYBOX
|
||||||
static void install_links(const char *busybox UNUSED_PARAM,
|
static void install_links(const char *busybox UNUSED_PARAM,
|
||||||
int use_symbolic_links UNUSED_PARAM,
|
int use_symbolic_links UNUSED_PARAM,
|
||||||
char *custom_install_dir UNUSED_PARAM)
|
char *custom_install_dir UNUSED_PARAM)
|
||||||
|
@ -709,6 +709,7 @@ static void install_links(const char *busybox UNUSED_PARAM,
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# if ENABLE_BUSYBOX
|
||||||
/* If we were called as "busybox..." */
|
/* If we were called as "busybox..." */
|
||||||
static int busybox_main(char **argv)
|
static int busybox_main(char **argv)
|
||||||
{
|
{
|
||||||
|
@ -843,6 +844,7 @@ static int busybox_main(char **argv)
|
||||||
/* POSIX: "If a command is not found, the exit status shall be 127" */
|
/* POSIX: "If a command is not found, the exit status shall be 127" */
|
||||||
exit(127);
|
exit(127);
|
||||||
}
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
void FAST_FUNC run_applet_no_and_exit(int applet_no, char **argv)
|
void FAST_FUNC run_applet_no_and_exit(int applet_no, char **argv)
|
||||||
{
|
{
|
||||||
|
@ -886,8 +888,10 @@ void FAST_FUNC run_applet_and_exit(const char *name, char **argv)
|
||||||
{
|
{
|
||||||
int applet;
|
int applet;
|
||||||
|
|
||||||
|
# if ENABLE_BUSYBOX
|
||||||
if (is_prefixed_with(name, "busybox"))
|
if (is_prefixed_with(name, "busybox"))
|
||||||
exit(busybox_main(argv));
|
exit(busybox_main(argv));
|
||||||
|
# endif
|
||||||
/* find_applet_by_name() search is more expensive, so goes second */
|
/* find_applet_by_name() search is more expensive, so goes second */
|
||||||
applet = find_applet_by_name(name);
|
applet = find_applet_by_name(name);
|
||||||
if (applet >= 0)
|
if (applet >= 0)
|
||||||
|
|
Loading…
Reference in New Issue