diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-10-07 17:06:26 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-10-07 17:06:26 +0000 |
commit | f545be083d3e9758b70edf16aa532528cd7ce108 (patch) | |
tree | 136f8792a5217e6558a29aee33eef199e338f652 | |
parent | def88985966a9351911844d42e06b735977bcb72 (diff) | |
download | busybox-w32-f545be083d3e9758b70edf16aa532528cd7ce108.tar.gz busybox-w32-f545be083d3e9758b70edf16aa532528cd7ce108.tar.bz2 busybox-w32-f545be083d3e9758b70edf16aa532528cd7ce108.zip |
reviving libbusybox, adding CONFIG_INDIVIDUAL part 4
-rw-r--r-- | Config.in | 46 | ||||
-rw-r--r-- | include/applets.h | 9 | ||||
-rwxr-xr-x | scripts/trylink | 69 |
3 files changed, 109 insertions, 15 deletions
@@ -311,24 +311,32 @@ config BUILD_LIBBUSYBOX | |||
311 | ### | 311 | ### |
312 | ### Say 'N' if in doubt. | 312 | ### Say 'N' if in doubt. |
313 | 313 | ||
314 | config FEATURE_INDIVIDUAL | ||
315 | bool "Produce a binary for each applet, linked against libbusybox" | ||
316 | default y | ||
317 | depends on !STATIC && BUILD_LIBBUSYBOX | ||
318 | help | ||
319 | If your CPU architecture doesn't allow for sharing text/rodata | ||
320 | sections of running binaries, but allows for runtime dynamic | ||
321 | libraries, this option will allow you to reduce memory footprint | ||
322 | when you have many different applets running at once. | ||
323 | |||
324 | If your CPU architecture allows for sharing text/rodata, | ||
325 | having single binary is more optimal. | ||
326 | |||
327 | Each applet will be a tiny program, dynamically linked | ||
328 | against libbusybox.so.N.N.N. | ||
329 | |||
330 | You need to have a working dynamic linker. | ||
331 | |||
314 | config FEATURE_SHARED_BUSYBOX | 332 | config FEATURE_SHARED_BUSYBOX |
315 | bool "Produce additional busybox binary linked against libbusybox" | 333 | bool "Produce additional busybox binary linked against libbusybox" |
316 | default y if BUILD_LIBBUSYBOX | 334 | default y |
317 | depends on !STATIC && BUILD_LIBBUSYBOX | 335 | depends on !STATIC && BUILD_LIBBUSYBOX |
318 | help | 336 | help |
319 | You need to have a working dynamic linker to use this variant. | 337 | Build busybox, dynamically linked against libbusybox.so.N.N.N. |
320 | 338 | ||
321 | config LFS | 339 | You need to have a working dynamic linker. |
322 | bool "Build with Large File Support (for accessing files > 2 GB)" | ||
323 | default n | ||
324 | select FDISK_SUPPORT_LARGE_DISKS | ||
325 | help | ||
326 | If you want to build BusyBox with large file support, then enable | ||
327 | this option. This will have no effect if your kernel or your C | ||
328 | library lacks large file support for large files. Some of the | ||
329 | programs that can benefit from large file support include dd, gzip, | ||
330 | cp, mount, tar, and many others. If you want to access files larger | ||
331 | than 2 Gigabytes, enable this option. Otherwise, leave it set to 'N'. | ||
332 | 340 | ||
333 | ### config BUILD_AT_ONCE | 341 | ### config BUILD_AT_ONCE |
334 | ### bool "Compile all sources at once" | 342 | ### bool "Compile all sources at once" |
@@ -349,6 +357,18 @@ config LFS | |||
349 | ### | 357 | ### |
350 | ### Say 'N' unless you know what you are doing. | 358 | ### Say 'N' unless you know what you are doing. |
351 | 359 | ||
360 | config LFS | ||
361 | bool "Build with Large File Support (for accessing files > 2 GB)" | ||
362 | default n | ||
363 | select FDISK_SUPPORT_LARGE_DISKS | ||
364 | help | ||
365 | If you want to build BusyBox with large file support, then enable | ||
366 | this option. This will have no effect if your kernel or your C | ||
367 | library lacks large file support for large files. Some of the | ||
368 | programs that can benefit from large file support include dd, gzip, | ||
369 | cp, mount, tar, and many others. If you want to access files larger | ||
370 | than 2 Gigabytes, enable this option. Otherwise, leave it set to 'N'. | ||
371 | |||
352 | endmenu | 372 | endmenu |
353 | 373 | ||
354 | menu 'Debugging Options' | 374 | menu 'Debugging Options' |
diff --git a/include/applets.h b/include/applets.h index e88192d24..ac3f65f6d 100644 --- a/include/applets.h +++ b/include/applets.h | |||
@@ -30,6 +30,13 @@ s - suid type: | |||
30 | # define APPLET_NOEXEC(name,main,l,s,name2) int main##_main(int argc, char **argv); | 30 | # define APPLET_NOEXEC(name,main,l,s,name2) int main##_main(int argc, char **argv); |
31 | # define APPLET_NOFORK(name,main,l,s,name2) int main##_main(int argc, char **argv); | 31 | # define APPLET_NOFORK(name,main,l,s,name2) int main##_main(int argc, char **argv); |
32 | 32 | ||
33 | #elif defined(NAME_MAIN_CNAME) | ||
34 | # define APPLET(name,l,s) name name##_main name | ||
35 | # define APPLET_NOUSAGE(name,main,l,s) name main##_main name | ||
36 | # define APPLET_ODDNAME(name,main,l,s,name2) name main##_main name2 | ||
37 | # define APPLET_NOEXEC(name,main,l,s,name2) name main##_main name2 | ||
38 | # define APPLET_NOFORK(name,main,l,s,name2) name main##_main name2 | ||
39 | |||
33 | #elif defined(MAKE_USAGE) && ENABLE_FEATURE_VERBOSE_USAGE | 40 | #elif defined(MAKE_USAGE) && ENABLE_FEATURE_VERBOSE_USAGE |
34 | # define APPLET(name,l,s) name##_trivial_usage "\n\n" name##_full_usage "\0" | 41 | # define APPLET(name,l,s) name##_trivial_usage "\n\n" name##_full_usage "\0" |
35 | # define APPLET_NOUSAGE(name,main,l,s) "\b\0" | 42 | # define APPLET_NOUSAGE(name,main,l,s) "\b\0" |
@@ -373,7 +380,7 @@ USE_YES(APPLET_NOFORK(yes, yes, _BB_DIR_USR_BIN, _BB_SUID_NEVER, yes)) | |||
373 | USE_GUNZIP(APPLET_ODDNAME(zcat, gunzip, _BB_DIR_BIN, _BB_SUID_NEVER, zcat)) | 380 | USE_GUNZIP(APPLET_ODDNAME(zcat, gunzip, _BB_DIR_BIN, _BB_SUID_NEVER, zcat)) |
374 | USE_ZCIP(APPLET(zcip, _BB_DIR_SBIN, _BB_SUID_NEVER)) | 381 | USE_ZCIP(APPLET(zcip, _BB_DIR_SBIN, _BB_SUID_NEVER)) |
375 | 382 | ||
376 | #if !defined(PROTOTYPES) && !defined(MAKE_USAGE) | 383 | #if !defined(PROTOTYPES) && !defined(NAME_MAIN_CNAME) && !defined(MAKE_USAGE) |
377 | { NULL } | 384 | { NULL } |
378 | }; | 385 | }; |
379 | #endif | 386 | #endif |
diff --git a/scripts/trylink b/scripts/trylink index de60a2cf7..a87d67225 100755 --- a/scripts/trylink +++ b/scripts/trylink | |||
@@ -137,7 +137,7 @@ if test "$CONFIG_FEATURE_SHARED_BUSYBOX" = y; then | |||
137 | -o $EXE -Wl,-Map -Wl,$EXE.map \ | 137 | -o $EXE -Wl,-Map -Wl,$EXE.map \ |
138 | -Wl,--warn-common -Wl,--sort-common -Wl,--gc-sections \ | 138 | -Wl,--warn-common -Wl,--sort-common -Wl,--gc-sections \ |
139 | -Wl,--start-group $O_FILES -Wl,--end-group \ | 139 | -Wl,--start-group $O_FILES -Wl,--end-group \ |
140 | $l_list -Wl,--verbose \ | 140 | -Wl,--verbose \ |
141 | -L"$sharedlib_dir" -lbusybox \ | 141 | -L"$sharedlib_dir" -lbusybox \ |
142 | >/dev/null \ | 142 | >/dev/null \ |
143 | || { | 143 | || { |
@@ -148,3 +148,70 @@ if test "$CONFIG_FEATURE_SHARED_BUSYBOX" = y; then | |||
148 | strip -s --remove-section=.note --remove-section=.comment $EXE -o "$sharedlib_dir/busybox" | 148 | strip -s --remove-section=.note --remove-section=.comment $EXE -o "$sharedlib_dir/busybox" |
149 | echo "busybox linked against libbusybox: $sharedlib_dir/busybox" | 149 | echo "busybox linked against libbusybox: $sharedlib_dir/busybox" |
150 | fi | 150 | fi |
151 | |||
152 | if test "$CONFIG_FEATURE_INDIVIDUAL" = y; then | ||
153 | gcc -DNAME_MAIN_CNAME -E -include include/autoconf.h include/applets.h \ | ||
154 | | grep -v "^#" \ | ||
155 | | grep -v "^$" \ | ||
156 | > applet.lst | ||
157 | while read name main cname; do | ||
158 | |||
159 | test x"$cname" = "x[" && cname=test | ||
160 | test x"$cname" = "x[[" && cname=test | ||
161 | |||
162 | echo "\ | ||
163 | #include <errno.h> | ||
164 | #include <unistd.h> | ||
165 | #include <stdlib.h> | ||
166 | #include <stdio.h> | ||
167 | #include \"../include/autoconf.h\" | ||
168 | #include \"../include/usage.h\" | ||
169 | |||
170 | #ifdef __GLIBC__ | ||
171 | /* Make it reside in R/W memory: */ | ||
172 | int *const bb_errno __attribute__ ((section (\".data\"))); | ||
173 | #endif | ||
174 | |||
175 | const char *applet_name = \"$name\"; | ||
176 | |||
177 | void bb_show_usage(void) | ||
178 | { | ||
179 | fprintf(stderr, \"Usage: $name \" | ||
180 | #ifdef ${cname}_trivial_usage | ||
181 | ${cname}_trivial_usage | ||
182 | #endif | ||
183 | #ifdef ${cname}_full_usage | ||
184 | \"\\n\\n\" ${cname}_full_usage | ||
185 | #endif | ||
186 | \"\\n\\n\"); | ||
187 | exit(1); | ||
188 | } | ||
189 | |||
190 | int $main(int argc, char **argv); | ||
191 | |||
192 | int main(int argc, char **argv) | ||
193 | { | ||
194 | #ifdef __GLIBC__ | ||
195 | (*(int **)&bb_errno) = __errno_location(); | ||
196 | #endif | ||
197 | return $main(argc, argv); | ||
198 | } | ||
199 | " >"$sharedlib_dir/applet.c" | ||
200 | |||
201 | EXE="$sharedlib_dir/$name" | ||
202 | try $CC $LDFLAGS "$sharedlib_dir/applet.c" \ | ||
203 | -o $EXE \ | ||
204 | -Wl,--warn-common -Wl,--sort-common -Wl,--gc-sections \ | ||
205 | -L"$sharedlib_dir" -lbusybox \ | ||
206 | >/dev/null \ | ||
207 | || { | ||
208 | echo "Linking $EXE failed" | ||
209 | cat -- $EXE.out | ||
210 | exit 1 | ||
211 | } | ||
212 | rm -- "$sharedlib_dir/applet.c" $EXE.out | ||
213 | strip -s --remove-section=.note --remove-section=.comment $EXE | ||
214 | echo "applet linked against libbusybox: $EXE" | ||
215 | |||
216 | done <applet.lst | ||
217 | fi | ||