一、移植:busybox-1.20.0并且使用strace解决问题
1、到官网下载:http://www.busybox.net/downloads/
2、解压:tarxvf busybox-1.20.0.tar.bz2
3、配置:cd busybox-1.20.0
make menuconfig
4、配置选项添加交叉编译工具:arm-linux-
Busybox Settings --->
Build Options --->
添加交叉编译工具前缀:arm-linux-
5、编译:make
6、解决错误:
错误1:
miscutils/ionice.c:23: error:`SYS_ioprio_set' undeclared (first use in this function)
解决方法:将ionice选项去掉
(1)make menuconfig
(2)输入"/",进入到搜索框
(3)在搜索框里面输入:ionice,回车
(4)会列出ionice选项的位置
(5)找到ionice选项并去除选中
(6)保存退出,并且执行:make
错误2:
miscutils/nandwrite.c:64: error:dereferencing pointer to incomplete type
解决方法:将nandwrite,nanddump选项去掉
方法同上
错误3:
miscutils/ubi_tools.c:67:26:mtd/ubi-user.h: No such file or directory
解决方法:将ubi开头的选项都去掉
错误4:
networking/interface.c:806: error:`ARPHRD_INFINIBAND' undeclared here (not in a function)
networking/interface.c:806: error: initializerelement is not constant
networking/interface.c:806: error: (nearinitialization for `ib_hwtype.type')
在文件interface.c中加入如下语句
#define ARPHRD_INFINIBAND 32 /* InfiniBand */
这个是从文件include/linux/if_arp.h中得到
错误5:法一、networking/udhcp/dhcpc.c: In function`udhcp_raw_socket':
networking/udhcp/dhcpc.c:821: error:elements of array `filter_instr' have incomplete type
把network下面不要的一堆东西干掉吧
法二、
我根据提示,改了一下,将/FL2440/usr/local/arm/3.4.1/arm-linux/sys-include/llinux/filter.h中的sock_filter类型的定义改成了
struct sock_filter /* Filter block */
{
unsigned short code; /* Actual filter code */ 原来为__u16
unsigned char jt; /* Jump true */
unsigned char jf; /* Jump false */
unsigned int k; /* Generic multiuse field */
};
或者直接添加头文件 #include <linux/types.h>
错误6:
/opt/arm/3.4.1/bin/../lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/percpu.h:45:error: `GFP_KERNEL' undeclared (first use in this function)
/opt/arm/3.4.1/bin/../lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/percpu.h:45:error: (Each undeclared identifier is reported only once
/opt/arm/3.4.1/bin/../lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/percpu.h:45:error: for each function it appears in.)
In file included from/opt/arm/3.4.1/bin/../lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/ext2_fs.h:20,
去掉
Linux System Utilities --->
[ ] mkfs_ext2
[ ] mkfs_vfat
错误7:
usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/fd.h:342: error: variable or field `__user'' declared void
/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/fd.h:342: error: parse error before ''*'' token
/usr/local/arm/3.4.1/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/sys-include/linux/fd.h:360: error: parse error before ''}'' token
解决方法:
在/usr/local/arm/3.4.1/arm-linux/sys-include/linux/fd.h文件中添加#include <linux/compiler.h>