配置 编译 busybox,在根目录下INSTALL文件里有说明,
make menuconfig # This creates a file called ".config"
make # This creates the "busybox" executable
make install # or make CONFIG_PREFIX=/path/from/root install
- 解压
tar xjf busybox-1.7.0.tar.bz2
make menuconfig
,
选择补全命令
修改交叉编译工具:新版busybox可以在交互界面直接选择,1.7.0版本只能在顶层Makefile中修改,Busybox Settings ---> Busybox Library Tuning ---> [*] Tab completion
CROSS_COMPILE ?= arm-linux-
。
可能出错:Makefile:405: *** mixed implicit and normal rules: deprecated syntax
Makefile:1242: *** mixed implicit and normal rules: deprecated syntax
原因:新版Makefile不支持这样的组合目标:config %config(一个有通配符,另一个没有通配符)
办法 :要么把config %config拆成2个规则,要么把其中一个目标去掉。
具体措施:
a.顶层Makefile 405行 改为:%config:scripts_basic outputmakefile FORCE
b.顶层Makefile 1242行 改为:%/:prepare scripts FORCE
make
可能出错1:/include/linux/netfilter.h:57:17: error: field ‘in’ has incomplete type
make[1]: *** [ipsvd/tcpudp.o] Error 1
Makefile:701: recipe for target ‘ipsvd’ failed
根据提示的路径找到netfilter.h,添加头文件#include <netinet/in.h>
可能出错2:recipe for target ‘loginutils/passwd.o’ failed
make[1]: *** [loginutils/passwd.o] Error 1
Makefile:701: recipe for target ‘loginutils’ failed
办法:BusyBox源码的include目录下/libbb.h 文件添加头文件#include <sys/resource.h>
最终出现以下说明编译成功:
- install
不能make install,这将安装到PC系统可能导致系统出错,
创建一个目录,mkdir -p fs_root
然后安装到该目录下,make CONFIG_PREFIX=/fs_root install
出现如下应该安装成功:
ls -l
:可以看到所有工具都指向了busybox,