標準的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