2008年10月31日星期五

Busybox移植

今天做了一个Busybox的移植实验。
我使用的是Busybox 1.7.0
编译器使用的是arm-linux-gcc 3.4.1。
编译Busybox有很多选项,但是以下的几步是必须要做的,剩下的选项自己看着进行勾选。
首先修改Makefile在175行和176行,本来是
ARCH ?= $(SUBARCH)
CROSS_COMPILE ?=
修改成
ARCH ?= arm
CROSS_COMPILE ?= arm-linux-
然后执行make menuconfig 进入Busybox Settings,然后进入Installation Options,然后勾选
[*] Don't use /usr
然后在Linux Module Utilities配置项中,因为我使用linux2.6内核,所以我取消
[*] Support version 2.2.x to 2.4.x Linux kernels选项,让这个选项变成这样
[ ] Support version 2.2.x to 2.4.x Linux kernels
在Miscellaneous Utilities配置项中,取消[*] taskset 的选中状态,让它变成这样
[ ] taskset

因为我使用glibc库,如果想编译成静态的,那么需要在Busybox Settings选项中的Build Options子选项中选择使用静态链接,然后
把applet目录下applet.c文件中如下的一堆注释掉就可以开始编译了
#if ENABLE_STATIC && defined(__GLIBC__) && !defined(__UCLIBC__)
#warning Static linking against glibc produces buggy executables
#warning (glibc does not cope well with ld --gc-sections).
#warning See sources.redhat.com/bugzilla/show_bug.cgi?id=3400
#warning Note that glibc is unsuitable for static linking anyway.
#warning If you still want to do it, remove -Wl,--gc-sections
#warning from top-level Makefile and remove this warning.
#error Aborting compilation.
#endif

然后进行其他的配置,保存配置后,执行make和make install两条命令就可以在_install目录下得到需要的东西了。

没有评论:

发表评论