reviving libbusybox, adding CONFIG_INDIVIDUAL part 3

This commit is contained in:
Denis Vlasenko 2007-10-07 17:06:01 +00:00
parent 76a6b236a9
commit def8898596
5 changed files with 76 additions and 61 deletions

View File

@ -292,31 +292,30 @@ config BUILD_LIBBUSYBOX
binary serves no purpose (and increases the size). You should binary serves no purpose (and increases the size). You should
almost certainly say "no" to this right now. almost certainly say "no" to this right now.
config FEATURE_FULL_LIBBUSYBOX ### config FEATURE_FULL_LIBBUSYBOX
bool "Feature-complete libbusybox" ### bool "Feature-complete libbusybox"
default n if !FEATURE_SHARED_BUSYBOX ### default n if !FEATURE_SHARED_BUSYBOX
depends on BUILD_LIBBUSYBOX ### depends on BUILD_LIBBUSYBOX
help ### help
Build a libbusybox with the complete feature-set, disregarding ### Build a libbusybox with the complete feature-set, disregarding
the actually selected config. ### the actually selected config.
###
Normally, libbusybox will only contain the features which are ### Normally, libbusybox will only contain the features which are
used by busybox itself. If you plan to write a separate ### used by busybox itself. If you plan to write a separate
standalone application which uses libbusybox say 'Y'. ### standalone application which uses libbusybox say 'Y'.
###
Note: libbusybox is GPL, not LGPL, and exports no stable API that ### Note: libbusybox is GPL, not LGPL, and exports no stable API that
might act as a copyright barrier. We can and will modify the ### might act as a copyright barrier. We can and will modify the
exported function set between releases (even minor version number ### exported function set between releases (even minor version number
changes), and happily break out-of-tree features. ### changes), and happily break out-of-tree features.
###
Say 'N' if in doubt. ### Say 'N' if in doubt.
config FEATURE_SHARED_BUSYBOX config FEATURE_SHARED_BUSYBOX
bool "Use shared libbusybox for busybox" bool "Produce additional busybox binary linked against libbusybox"
default y if BUILD_LIBBUSYBOX default y if BUILD_LIBBUSYBOX
depends on !STATIC && BUILD_LIBBUSYBOX depends on !STATIC && BUILD_LIBBUSYBOX
help help
Use libbusybox.so also for busybox itself.
You need to have a working dynamic linker to use this variant. You need to have a working dynamic linker to use this variant.
config LFS config LFS
@ -331,24 +330,24 @@ config LFS
cp, mount, tar, and many others. If you want to access files larger cp, mount, tar, and many others. If you want to access files larger
than 2 Gigabytes, enable this option. Otherwise, leave it set to 'N'. than 2 Gigabytes, enable this option. Otherwise, leave it set to 'N'.
config BUILD_AT_ONCE ### config BUILD_AT_ONCE
bool "Compile all sources at once" ### bool "Compile all sources at once"
default n ### default n
help ### help
Normally each source-file is compiled with one invocation of ### Normally each source-file is compiled with one invocation of
the compiler. ### the compiler.
If you set this option, all sources are compiled at once. ### If you set this option, all sources are compiled at once.
This gives the compiler more opportunities to optimize which can ### This gives the compiler more opportunities to optimize which can
result in smaller and/or faster binaries. ### result in smaller and/or faster binaries.
###
Setting this option will consume alot of memory, e.g. if you ### Setting this option will consume alot of memory, e.g. if you
enable all applets with all features, gcc uses more than 300MB ### enable all applets with all features, gcc uses more than 300MB
RAM during compilation of busybox. ### RAM during compilation of busybox.
###
This option is most likely only beneficial for newer compilers ### This option is most likely only beneficial for newer compilers
such as gcc-4.1 and above. ### such as gcc-4.1 and above.
###
Say 'N' unless you know what you are doing. ### Say 'N' unless you know what you are doing.
endmenu endmenu

View File

@ -3,6 +3,7 @@
# ========================================================================== # ==========================================================================
BB_VER = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) BB_VER = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
export BB_VER
SKIP_STRIP = n SKIP_STRIP = n
# -std=gnu99 needed for [U]LLONG_MAX on some systems # -std=gnu99 needed for [U]LLONG_MAX on some systems
@ -59,7 +60,7 @@ ifeq ($(CONFIG_STATIC),y)
LDFLAGS += -static LDFLAGS += -static
endif endif
LDLIBS = m crypt LDLIBS += m crypt
ifeq ($(CONFIG_PAM),y) ifeq ($(CONFIG_PAM),y)
LDLIBS += pam pam_misc LDLIBS += pam pam_misc

View File

@ -260,7 +260,7 @@ int udhcpc_main(int argc, char **argv)
if (opt & OPT_t) if (opt & OPT_t)
client_config.retries = xatoi_u(str_t); client_config.retries = xatoi_u(str_t);
if (opt & OPT_v) { if (opt & OPT_v) {
printf("version %s\n", BB_VER); puts("version "BB_VER);
return 0; return 0;
} }
@ -283,7 +283,7 @@ int udhcpc_main(int argc, char **argv)
/* if (!..) bb_perror_msg("cannot create pidfile %s", pidfile); */ /* if (!..) bb_perror_msg("cannot create pidfile %s", pidfile); */
/* Goes to stdout and possibly syslog */ /* Goes to stdout and possibly syslog */
bb_info_msg("%s (v%s) started", applet_name, BB_VER); bb_info_msg("%s (v"BB_VER") started", applet_name);
/* if not set, and not suppressed, setup the default client ID */ /* if not set, and not suppressed, setup the default client ID */
if (!client_config.clientid && !(opt & OPT_C)) { if (!client_config.clientid && !(opt & OPT_C)) {

View File

@ -62,7 +62,7 @@ int udhcpd_main(int argc, char **argv)
write_pidfile(server_config.pidfile); write_pidfile(server_config.pidfile);
/* if (!..) bb_perror_msg("cannot create pidfile %s", pidfile); */ /* if (!..) bb_perror_msg("cannot create pidfile %s", pidfile); */
bb_info_msg("%s (v%s) started", applet_name, BB_VER); bb_info_msg("%s (v"BB_VER") started", applet_name);
option = find_option(server_config.options, DHCP_LEASE_TIME); option = find_option(server_config.options, DHCP_LEASE_TIME);
server_config.lease = LEASE_TIME; server_config.lease = LEASE_TIME;

View File

@ -101,35 +101,50 @@ else
>/dev/null >/dev/null
fi fi
mkdir 0lib 2>/dev/null . .config
test -d 0lib || exit 1
ln -s libbusybox.so.1.8.0 0lib/libbusybox.so 2>/dev/null
EXE="0lib/libbusybox.so.1.8.0" sharedlib_dir="0_lib"
try $CC $LDFLAGS \
if test "$CONFIG_BUILD_LIBBUSYBOX" = y; then
mkdir "$sharedlib_dir" 2>/dev/null
test -d "$sharedlib_dir" || {
echo "Cannot make directory $sharedlib_dir"
exit 1
}
ln -s "libbusybox.so.$BB_VER" "$sharedlib_dir"/libbusybox.so 2>/dev/null
EXE="$sharedlib_dir/libbusybox.so.${BB_VER}_unstripped"
try $CC $LDFLAGS \
-o $EXE -Wl,-Map -Wl,$EXE.map \ -o $EXE -Wl,-Map -Wl,$EXE.map \
-shared -fPIC -Wl,--enable-new-dtags \ -shared -fPIC -Wl,--enable-new-dtags \
-Wl,--start-group -Wl,--whole-archive $A_FILES -Wl,--no-whole-archive -Wl,--end-group \ -Wl,--start-group -Wl,--whole-archive $A_FILES -Wl,--no-whole-archive -Wl,--end-group \
$l_list -Wl,--verbose \ $l_list -Wl,--verbose \
-Wl,-soname="libbusybox.so.1.8.0" \ -Wl,-soname="libbusybox.so.$BB_VER" \
-Wl,-z,combreloc \ -Wl,-z,combreloc \
>/dev/null \ >/dev/null \
|| { || {
echo "Linking $EXE failed" echo "Linking $EXE failed"
exit 1 cat $EXE.out
} exit 1
strip -s --remove-section=.note --remove-section=.comment $EXE }
strip -s --remove-section=.note --remove-section=.comment $EXE -o "$sharedlib_dir/libbusybox.so.$BB_VER"
echo "libbusybox: $sharedlib_dir/libbusybox.so.$BB_VER"
fi
EXE="0lib/busybox" if test "$CONFIG_FEATURE_SHARED_BUSYBOX" = y; then
try $CC $LDFLAGS \ EXE="$sharedlib_dir/busybox_unstripped"
try $CC $LDFLAGS \
-o $EXE -Wl,-Map -Wl,$EXE.map \ -o $EXE -Wl,-Map -Wl,$EXE.map \
-Wl,--warn-common -Wl,--sort-common -Wl,--gc-sections \ -Wl,--warn-common -Wl,--sort-common -Wl,--gc-sections \
-Wl,--start-group $O_FILES -Wl,--end-group \ -Wl,--start-group $O_FILES -Wl,--end-group \
$l_list -Wl,--verbose \ $l_list -Wl,--verbose \
-L"0lib" -lbusybox \ -L"$sharedlib_dir" -lbusybox \
>/dev/null \ >/dev/null \
|| { || {
echo "Linking $EXE failed" echo "Linking $EXE failed"
exit 1 cat $EXE.out
} exit 1
strip -s --remove-section=.note --remove-section=.comment $EXE }
strip -s --remove-section=.note --remove-section=.comment $EXE -o "$sharedlib_dir/busybox"
echo "busybox linked against libbusybox: $sharedlib_dir/busybox"
fi