由于交叉编译博芯官方提供的busybox 1.10,出现了不少问题,刚好找到一篇出现问题一样的文章
我的平台是fedora8,
交叉编译器:/usr/local/arm/3.3.2/bin/arm-linux-
Busybox版本:busybox-1.10.1.tar.bz2
解压,进入目录,
make menuconfig
Busybox Settings-->Build Options--> Build BusyBox as a static binary (no shared libs) 选上。静态编译,为了以后方便。
在Busybox Settings-->Build Options-->Cross Compiler Prefix
填入交叉编译器路径。这里用3.3.2的版本。
/usr/local/arm/3.3.2/bin/arm-linux-
(注意最后是arm-linux-不多不少)
由于编译器版本,glibc的版本匹配问题,编译过程中可能会出错。有些错误是莫名其妙的。
编译过程中出现了
In file included from miscutils/watchdog.c:13:
/usr/local/arm/3.3.2/arm-linux/sys-include/linux/watchdog.h:17: error: parse error before "__u32"
/usr/local/arm/3.3.2/arm-linux/sys-include/linux/watchdog.h:19: error: parse error before "identity"
/usr/local/arm/3.3.2/arm-linux/sys-include/linux/watchdog.h:20: error: parse error before ''}'' token
make[1]: *** [miscutils/watchdog.o] 错误 1
make: *** [miscutils] 错误 2
可是/usr/local/arm/3.3.2/arm-linux/sys-include/linux/watchdog.h相关行
struct watchdog_info {
__u32 options; /* Options the card/driver supports */
__u32 firmware_version; /* Firmware version of the card */
__u8 identity[32]; /* Identity of the board */
};
并没有语法错误,解决办法为,去掉相应选项,
make menuconfig
去掉Miscellaneous Utilities --->里的最后一个watchdog(实际上它是指pc机上的,和我们板子的看门狗没有关系)
继续make
networking/brctl.c: In function `brctl_main'':
networking/brctl.c:186: error: `SIOCBRADDBR'' undeclared (first use in this function)
networking/brctl.c:186: error: (Each undeclared identifier is reported on
networking/brctl.c:186: error: for each function it appears in.)
networking/brctl.c:186: error: `SIOCBRDELBR'' undeclared (first use in this function)
networking/brctl.c:202: error: `SIOCBRADDIF'' undeclared (first use in this function)
networking/brctl.c:202: error: `SIOCBRDELIF'' undeclared (first use in this function)
make[1]: *** [networking/brctl.o] 错误 1
make: *** [networking] 错误 2
在3.3.2的编译器/usr/local/arm/3.3.2/arm-linux/sys-include/linux/sockios.h里没有找到
SIOCBRDELBR等相关定义,解决办法:在自己电脑的内核头文件里找到相关定义,并加入。
稍微新一点的内核都应该增加了以下定义,
#define SIOCBRADDBR 0x89a0 /* create new bridge device */
#define SIOCBRDELBR 0x89a1 /* remove bridge device */
#define SIOCBRADDIF 0x89a2 /* add interface to bridge */
#define SIOCBRDELIF 0x89a3 /* remove interface from bridge */
把他们加入到busybox的networking/brctl.c或交叉编译器的/usr/local/arm/3.3.2/arm-linux/sys-include/linux/sockios.h文件加上
继续,make
=======================================================================
[root@localhost busybox-1.13.1]# make
CC networking/brctl.o
CC networking/dnsd.o
CC networking/ether-wake.o
CC networking/ftpgetput.o
CC networking/hostname.o
CC networking/httpd.o
CC networking/ifconfig.o
CC networking/ifenslave.o
In file included from networking/ifenslave.c:105:
/usr/local/arm/3.3.2/arm-linux/sys-include/linux/if_bonding.h:65: error: `IFNAMSIZ
'' undeclared here (not in a function)
networking/ifenslave.c:120: error: field `mtu'' has incomplete type
networking/ifenslave.c:120: error: field `flags'' has incomplete type
networking/ifenslave.c:120: error: field `hwaddr'' has incomplete type
networking/ifenslave.c: In function `set_ifrname_and_do_ioctl'':
networking/ifenslave.c:155: error: dereferencing pointer to incomplete type
networking/ifenslave.c: In function `set_hwaddr'':
networking/ifenslave.c:177: error: storage size of `ifr'' isn''t known
networking/ifenslave.c:177: warning: unused variable `ifr''
networking/ifenslave.c: In function `set_mtu'':
networking/ifenslave.c:185: error: storage size of `ifr'' isn''t known
networking/ifenslave.c:185: warning: unused variable `ifr''
networking/ifenslave.c: In function `set_if_flags'':
networking/ifenslave.c:193: error: storage size of `ifr'' isn''t known
networking/ifenslave.c:193: warning: unused variable `ifr''
networking/ifenslave.c: In function `set_if_up'':
networking/ifenslave.c:201: error: `IFF_UP'' undeclared (first use in this function
)
networking/ifenslave.c:201: error: (Each undeclared identifier is reported only on
ce
networking/ifenslave.c:201: error: for each function it appears in.)
networking/ifenslave.c: In function `set_if_down'':
networking/ifenslave.c:209: error: `IFF_UP'' undeclared (first use in this function
)
networking/ifenslave.c: In function `clear_if_addr'':
networking/ifenslave.c:217: error: storage size of `ifr'' isn''t known
networking/ifenslave.c:217: warning: unused variable `ifr''
networking/ifenslave.c: In function `set_if_addr'':
networking/ifenslave.c:244: error: storage size of `ifr'' isn''t known
networking/ifenslave.c:244: warning: unused variable `ifr''
networking/ifenslave.c: In function `change_active'':
networking/ifenslave.c:266: error: storage size of `ifr'' isn''t known
networking/ifenslave.c:268: error: `IFF_SLAVE'' undeclared (first use in this funct
ion)
networking/ifenslave.c:266: warning: unused variable `ifr''
networking/ifenslave.c: In function `enslave'':
networking/ifenslave.c:285: error: storage size of `ifr'' isn''t known
networking/ifenslave.c:288: error: `IFF_SLAVE'' undeclared (first use in this funct
ion)
networking/ifenslave.c:285: warning: unused variable `ifr''
networking/ifenslave.c: In function `release'':
networking/ifenslave.c:404: error: storage size of `ifr'' isn''t known
networking/ifenslave.c:407: error: `IFF_SLAVE'' undeclared (first use in this funct
ion)
networking/ifenslave.c:404: warning: unused variable `ifr''
networking/ifenslave.c: In function `get_drv_info'':
networking/ifenslave.c:433: error: storage size of `ifr'' isn''t known
networking/ifenslave.c:441: error: `BOND_ABI_VERSION'' undeclared (first use in thi
s function)
networking/ifenslave.c:433: warning: unused variable `ifr''
networking/ifenslave.c: In function `ifenslave_main'':
networking/ifenslave.c:519: error: `IFF_MASTER'' undeclared (first use in this func
tion)
networking/ifenslave.c:523: error: `IFF_UP'' undeclared (first use in this function
)
make[1]: *** [networking/ifenslave.o] Error 1
make: *** [networking] Error 2
======================================================================
networking/ifenslave.c出错,vi networking/ifenslave.c,然后
在适当的地方添加#include “/usr/include/net/if.h”
[root@localhost busybox-1.13.1]# make
CC networking/ifenslave.o
In file included from networking/ifenslave.c:105:
/usr/local/arm/3.3.2/arm-linux/sys-include/linux/if_bonding.h:65: error: `IFNAMSIZ'' undeclared here (not in a function)
networking/ifenslave.c: In function `get_drv_info'':
networking/ifenslave.c:443: error: `BOND_ABI_VERSION'' undeclared (first use in this function)
networking/ifenslave.c:443: error: (Each undeclared identifier is reported only once
networking/ifenslave.c:443: error: for each function it appears in.)
在交叉编译器的if_bonding.h文件上,适当的地方添加
#define BOND_ABI_VERSION 1
[root@localhost busybox-1.13.1]# make
CC networking/ifenslave.o
In file included from networking/ifenslave.c:105:
/usr/local/arm/3.3.2/arm-linux/sys-include/linux/if_bonding.h:67: error: `IFNAMSIZ'' undeclared here (not in a function)
make[1]: *** [networking/ifenslave.o] Error 1
make: *** [networking] Error 2
vi /usr/local/arm/3.3.2/arm-linux/sys-include/linux/if_bonding.h,在适当地方(67行前面)添加
#ifndef IFNAMSIZ
#define IFNAMSIZ 16
#endif
[root@localhost busybox-1.13.1]# make
CC networking/ifenslave.o
In file included from networking/ifenslave.c:105:
/usr/local/arm/3.3.2/arm-linux/sys-include/linux/if_bonding.h:67: error: `IFNAMSIZ'' undeclared here (not in a function)make[1]: *** [networking/ifenslave.o] Error 1
make: *** [networking] Error 1
vi networking/ifenslave.c
////
#define ARPHRD_INFINIBAND 32
////
然后make install
在 _install目录下得到所有二进制文件。
2562




被折叠的 条评论
为什么被折叠?



