系统:Ubuntu 16.04
busubox:1.29.3(busybox版本差异不大,因此新旧版本无所谓)
下载地址:www.busybox.net
1. 修改Makefile
ARCH ?= arm
CROSS_COMPILE ?= /home/linuxwei/toolchain/arm-2009q3/bin/arm-none-linux-gnueabi-
2. make menuconfig配置
Settings --->
--- Build Options
[*] Build static binary (no shared libs)
Settings --->
--- Library Tuning
[*] vi-style line editing commands
[*] Fancy shell prompts (NEW)
Linux Module Utilities --->
[ ] Simplified modutils
[*] depmod (26 kb) (NEW)
[*] insmod (22 kb) (NEW)
[*] lsmod (4.3 kb) (NEW)
[*] Pretty output (NEW)
[*] modinfo (25 kb) (NEW)
[*] modprobe (29 kb) (NEW)
[*] Blacklist support (NEW)
[*] rmmod (3.6 kb) (NEW)
Linux System Utilities --->
[*] mdev (16 kb) (NEW)
[*] Support /etc/mdev.conf (NEW)
[*] Support subdirs/symlinks (NEW)
[*] Support regular expressions substitutions when renaming device (NEW)
[*] Support command execution at device addition/removal (NEW)
[*] Support loading of firmware (NEW)
3. make
错误:
util-linux/lib.a(nsenter.o): In function `nsenter_main':
nsenter.c:(.text.nsenter_main+0x180): undefined reference to `setns'
coreutils/lib.a(sync.o): In function `sync_main':
sync.c:(.text.sync_main+0x6c): undefined reference to `syncfs'
解决方案:
第1步:在make menuconfig中去掉nsenter
Linux System Utilities --->
[ ] nsenter (8.6 kb)
第2步:在make menuconfig去掉sync
Coreutils --->
[ ] sync (769 bytes)
4. make install
在busybox顶层目录下会生成一个_install目录,其中包含了busybox及每个命令的软链接,只要将这个目录拷贝到目标平台上就可以了。