1)下载,解压busybox1.6.1(地址:www.busybox.net/downloads )
2)make defconfig
3)make menuconfig
在[build options]中选择[Build busybox as a static binary]
4)make
出现如下错误
CC applets/applets.o
applets/applets.c:20:2: warning: #warning Static linking against glibc produces buggy executables
applets/applets.c:21:2: warning: #warning (glibc does not cope well with ld --gc-sections).
applets/applets.c:22:2: warning: #warning See sources.redhat.com/bugzilla/show_bug.cgi?id=3400
applets/applets.c:23:2: warning: #warning Note that glibc is unsuitable for static linking anyway.
applets/applets.c:24:2: warning: #warning If you still want to do it, remove -Wl,--gc-sections
applets/applets.c:25:2: warning: #warning from top-level Makefile and remove this warning.
applets/applets.c:26:2: #error Aborting compilation.
make[1]: *** [applets/applets.o] Error 1
make: *** [applets] Error 2
看来是做为static时不建议用glibc,图省事,不考虑生成文件会大的问题,不打算换uclibc,将applts/applets.c的第19到27行注消
5)make
出现如下错误
CC miscutils/taskset.o
miscutils/taskset.c:17: error: parse error before '*' token
miscutils/taskset.c:18: warning: function declaration isn't a prototype
miscutils/taskset.c: In function `__from_cpuset':
miscutils/taskset.c:22: error: `CPU_SETSIZE' undeclared (first use in this function)
miscutils/taskset.c:22: error: (Each undeclared identifier is reported only once
miscutils/taskset.c:22: error: for each function it appears in.)
miscutils/taskset.c:26: warning: implicit declaration of function `CPU_ISSET'
miscutils/taskset.c:26: error: `mask' undeclared (first use in this function)
miscutils/taskset.c: In function `taskset_main':
miscutils/taskset.c:47: error: `cpu_set_t' undeclared (first use in this function)
miscutils/taskset.c:47: error: parse error before "mask"
miscutils/taskset.c:68: warning: implicit declaration of function `CPU_ZERO'
miscutils/taskset.c:68: error: `new_mask' undeclared (first use in this function)
miscutils/taskset.c:69: error: `CPU_SETSIZE' undeclared (first use in this function)
miscutils/taskset.c:71: warning: implicit declaration of function `CPU_SET'
miscutils/taskset.c:78: error: `mask' undeclared (first use in this function)
make[1]: *** [miscutils/taskset.o] Error 1
make: *** [miscutils] Error 2
make menuconfig 找到[Miscellaneous Utilities],去掉[task set]
5)make
6)make install
搞定,生成的busybox是1.1M,如果不编译成static的话是500多K,但要带gclib用运行.生成的bin和sbin里的程序,还有linuxrc都是指向bin/busybox的符号链接. |