BUSYBOX编译备忘录

BUSYBOX编译备忘录

编译busybox的组合:
busybox-1.0.0   arm-linux-gcc-2.95.3 (AT91rm9200开发板)
 
经典参考:
http://busybox.net/downloads/   下载busybox
http://husaberg.toby-churchill.com/balloon/releases/v0.7/roots/   文件系统制作
 
移植基本过程:
1. 到http://busybox.net/downloads/busybox-1.7.3.tar.bz2下载busybox;
2. 解压busybox1.7.3
    tar jxvf busybox-1.7.3.tar.bz2
3. make defconfig
4. make menuconfig
   在[build options]中选择[Build busybox as a static binary]
    主要是C库的连接方式,安装目录等。
5. make
6. 创建rootfs目录
7. make install 
  
编译过程可能出现以下错误,解决方法如下:
  
 
可能会出现的错误:


1. 出现如下错误


   CC miscutils/taskset.o
  miscutils/taskset.c:17: error: parse error before '*' token
  miscutils/taskset.c:18: warning: function declaration isn't a prototype
  miscutils/taskset.c: In function `__from_cpuset':
  miscutils/taskset.c:22: error: `CPU_SETSIZE' undeclared (first use in this function)
  miscutils/taskset.c:22: error: (Each undeclared identifier is reported only once
  miscutils/taskset.c:22: error: for each function it appears in.)
  miscutils/taskset.c:26: warning: implicit declaration of function `CPU_ISSET'
  miscutils/taskset.c:26: error: `mask' undeclared (first use in this function)
  miscutils/taskset.c: In function `taskset_main':
  miscutils/taskset.c:47: error: `cpu_set_t' undeclared (first use in this function)
  miscutils/taskset.c:47: error: parse error before "mask"
  miscutils/taskset.c:68: warning: implicit declaration of function `CPU_ZERO'
  miscutils/taskset.c:68: error: `new_mask' undeclared (first use in this function)
  miscutils/taskset.c:69: error: `CPU_SETSIZE' undeclared (first use in this function)
  miscutils/taskset.c:71: warning: implicit declaration of function `CPU_SET'
  miscutils/taskset.c:78: error: `mask' undeclared (first use in this function)
  make[1]: *** [miscutils/taskset.o] Error 1
  make: *** [miscutils] Error 2
  
make menuconfig 
   找到[Miscellaneous Utilities],去掉[task set]


2. 如下错误:

time.c
libbb/time.c:20: error: "CLOCK_MONOTONIC" undeclared (first use in this function)
make menuconfig


  去掉Busybox Settings->Busybox Library Tuning->[]Use clock_gettie(CLOCK_MONOTONIC) syscall

3.出现如下错误:

In file included from /usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/sys-include/linux/fs.h:12,
                from /usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/sys-include/linux/capability.h:17,
                from /usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/sys-include/linux/binfmts.h:5,
                from /usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/sys-include/linux/sched.h:9,
                from /usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/sys-include/net/inetpeer.h:14,
                from /usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/sys-include/net/route.h:28,
                from /busybox-1.01/networking/route.c:42:
/usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/sys-include/linux/wait.h:4: warning: `WNOHANG' redefined
/usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/include/bits/waitflags.h:26: warning:
this is the location of the previous definition
/usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/sys-include/linux/wait.h:5: warning: `WUNTRACED' redefined
/usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/include/bits/waitflags.h:27: warning:
this is the location of the previous definition
In file included from /usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/sys-include/linux/sched.h:77,
                from /usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/sys-include/net/inetpeer.h:14,
                from /usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/sys-include/net/route.h:28,
                from /busybox-1.01/networking/route.c:42:
/usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/sys-include/linux/time.h:108: warning: `FD_SET' redefined
/usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/include/sys/select.h:83: warning: this is the location of the previous definition
/usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/sys-include/linux/time.h:109: warning: `FD_CLR' redefined
/usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/include/sys/select.h:84: warning: this is the location of the previous definition
/usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/sys-include/linux/time.h:110: warning: `FD_ISSET' redefined
/usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/include/sys/select.h:85: warning: this is the location of the previous definition
/usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/sys-include/linux/time.h:111: warning: `FD_ZERO' redefined
/usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/include/sys/select.h:86: warning: this is the location of the previous definition
In file included from /busybox-1.01/networking/route.c:42:
/usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/sys-include/net/route.h:34: warning: #warning This file is not supposed to be used outside of kernel.
……
……
In file included from /usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/include/netdb.h:38,
                from /busybox-1.01/include/libbb.h:36,
                from /busybox-1.01/include/busybox.h:54,
                from /busybox-1.01/networking/route.c:44:
/usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/include/bits/siginfo.h:34: redefinition of `union sigval'
/usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/include/bits/siginfo.h:37: warning: redefinition of `sigval_t'
/usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/sys-include/asm/siginfo.h:11: warning: `sigval_t' previously declared here
/usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/include/bits/siginfo.h:274: redefinition of `struct sigevent'
/usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/include/bits/siginfo.h:289: warning: redefinition of `sigevent_t'
/usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/sys-include/asm/siginfo.h:211: warning: `sigevent_t' previously declared here
/usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/../../../../arm-linux/include/bits/siginfo.h:298: parse error before `0'
In file included from /busybox-1.01/include/busybox.h:54,
                from /busybox-1.01/networking/route.c:44:
/busybox-1.01/include/libbb.h:112: warning: declaration of `flags' shadows global declaration
/busybox-1.01/include/libbb.h:113: warning: declaration of `flags' shadows global declaration
/busybox-1.01/include/libbb.h:135: warning: declaration of `flags' shadows global declaration
/busybox-1.01/include/libbb.h:251: warning: declaration of `flags' shadows global declaration
/busybox-1.01/include/libbb.h:256: redefinition of `struct sysinfo'
/busybox-1.01/include/libbb.h:272: warning: declaration of `info' shadows global declaration
/busybox-1.01/include/libbb.h:309: warning: declaration of `flags' shadows global declaration
/busybox-1.01/include/libbb.h:440: warning: declaration of `flags' shadows global declaration
/busybox-1.01/networking/route.c:475: warning: declaration of `flags' shadows global declaration
/busybox-1.01/networking/route.c: In function `set_flags':
/busybox-1.01/networking/route.c:476: warning: declaration of `flags' shadows global declaration
/busybox-1.01/networking/route.c: In function `displayroutes':
/busybox-1.01/networking/route.c:490: warning: declaration of `flags' shadows global declaration
make: *** [/busybox-1.01/networking/route.o] Error 1

去掉Busybox Settings->NetWork device-->[]route

4.如下错误:

usr/src/armlinux/busybox-1.0.0/libbb/loop.c:32:linux/version.h:No such file or directory
/usr/src/armlinux/busybox-1.0.0/libbb/loop.c:35 arse error
/usr/src/armlinux/busybox-1.0.0/libbb/loop.c:37 arse error

将内核源码下的include/linux目录下的versition.h文件

放到 busybox-1.0.0/include/linux下

.....

(以上错误并不全是自己遇到的,仅收集以备忘)



相关问题可参考
交叉编译busybox
http://www.sudu.cn/info/html/edu/linux/20080101/282711.html
Busybox 的编译过程
http://blog.tianya.cn/blogger/post_show.asp?BlogID=1351475&PostID=12381125  

对于busybox的交叉编译,您可以按照以下步骤进行操作: 1. 获取交叉编译工具链:您需要首先获取与目标平台相匹配的交叉编译工具链,以便在本机上进行编译。您可以从目标平台的供应商或社区获取这个工具链。 2. 下载busybox源代码:您可以从busybox的官方网站(https://busybox.net/downloads/)上下载最新的稳定版本的源代码。 3. 设置环境变量:将交叉编译工具链添加到您的环境变量中,以便系统能够找到它们。例如,您可以将工具链的路径添加到`PATH`变量中。 4. 配置busybox:在命令行中进入busybox源代码目录,并运行`make menuconfig`命令来配置busybox。这将打开一个文本菜单界面,您可以在其中选择要包含在busybox中的功能。 5. 设置目标平台:在配置菜单中设置目标平台的体系结构和编译选项。这些选项将取决于您的目标平台和交叉编译工具链。 6. 编译busybox:运行`make`命令来开始编译busybox。这将使用交叉编译工具链在本机上生成目标平台的可执行文件。 7. 安装busybox:运行`make install`命令来安装busybox。这将把生成的可执行文件复制到指定的安装目录中。 完成上述步骤后,您将得到一个交叉编译后的busybox可执行文件,可以将其部署到目标平台上使用。请注意,具体的步骤可能会因您使用的交叉编译工具链和目标平台而有所不同。因此,在进行交叉编译之前,请确保您已经阅读并理解了相应工具链和平台的文档和指南。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值