标准的Linux发行版本具有功能种类比较多的应用程序,这些应用程序占用的空间也很大,这对存储容量空间有限的开发板来说就不是理想的选择,在嵌入式开发过程中,经常用BusyBox来定制应用程序。BusyBox具有shell的功能,它能提供系统所需要的大部分工具,包括编辑工具、网络工具、模块加载工具、压缩解压缩工具、查找工具、帐号密码管理工具和进程相关工具等。
目前BusyBox的最新版本是BusyBox-1.9.2版本,下载解压,切换到BusyBox的
根目录下,修改Makefile,找到ARCH和CROSS COMPILE修改如下:
ARCH ?= arm
CROSS_COMPILE ?=/usr/local/arm/3.4.1/bin/arm-linux-
5 修改编译配置选项。
#make defconfig
#make menuconfig
出现错误后解决方法,出了问题后很郁闷,在网上搜了许久找到了两种方法
一种是如果您用的是Ubuntu系统 就安装这个包 sudo aptitab instab libncurses5-dev
装完就好了;
第二种 如果您用的是rhel系列 就安装这个包 ncurses-devel这个包 就可以了
在默认的选项前提之下,选项设置如下:
BusyBox Settings --->
Build Options ---> (采用静态编译)
[*] Build BusyBox as a static binary (no shared libs)
Install optin-->
[*] Don't use /usr //可以不选,选了则没有/usr文件夹
Busybox Library Tuning --->
(2) MD5: Trade Bytes for Speed
[*] Faster /proc scanning code (+100 bytes)
[*] Support for /etc/networks
[*] Support for /etc/networks
[*] Additional editing keys
[*] vi-style line editing commands
[*] History saving
[*] Tab completion
[*] Username completion
[*] Fancy shell prompts
Linux Module Utilities --->
[ ] Support version 2.2.x to 2.4.x Linux kernels //不能选
[*] Support version 2.6.x Linux kernels
Linux System Utilities --->
[*] Support for the old /etc/mtab file //不确定
Miscellaneous Utilities --->
[*] devfs(obsolete) //不确定
[*] Use devfs names for all device(obsolete) //不确定
Shell --->
Choose your default shell(ash)-->
---ash //下面的选项全部选择
6 编译busybox
applets/applets.c:15:2: warning: #warning Static linking against glibc produces buggy executables
applets/applets.c:16:2: warning: #warning (glibc does not cope well with ld --gc-sections).
applets/applets.c:17:2: warning: #warning See sources.redhat.com/bugzilla/show_bug.cgi?id=3400
applets/applets.c:18:2: warning: #warning Note that glibc is unsuitable for static linking anyway.
applets/applets.c:19:2: warning: #warning If you still want to do it, remove -Wl,--gc-sections
applets/applets.c:20:2: warning: #warning from scripts/trylink and remove this warning.
applets/applets.c:21:2: error: #error Aborting compilation.
make[1]: *** [applets/applets.o] Error 1
按照提示,修改文件 applets/applets.c 第 21 行, 将
#error Aborting compilation.
注释掉:
make install