arm-linux-gcc4.4.3编译busybox-1.25.0
2023-05-10 来源:elecfans
系统环境:
1、操作系统:Ubuntu16.04
2、交叉编译工具链:arm-linux-gcc4.4.3
3、busybox源码包:busybox-1.25.0
一、修改Makefile配置
首先解压源码包:
tar -jxvf busybox-1.25.0.tar.bz2
进入busybox-1.25.0目录,修改Makefile文件如下:
ARCH ?= arm
CROSS_COMPILE ?= arm-linux-
二、修改配置文件
make menuconfig
选择Busybox Settings--->Build Options--->,选择[*] Build Busybox as a static binary(no shared libs)
三、编译
make
出现如下错误:
miscutils/nandwrite.c: In function 'nandwrite_main':
miscutils/nandwrite.c:151: error: 'MTD_FILE_MODE_RAW' undeclared (first use in this function)
miscutils/nandwrite.c:151: error: (Each undeclared identifier is reported only once
miscutils/nandwrite.c:151: error: for each function it appears in.)
scripts/Makefile.build:197: recipe for target 'miscutils/nandwrite.o' failed
make[1]: *** [miscutils/nandwrite.o] Error 1
Makefile:742: recipe for target 'miscutils' failed
make: *** [miscutils] Error 2
解决办法:
MTD_FILE_MODE_RAW在/usr/include/mtd/mtd-abi.h中定义,直接在nandwrite.c中包含 #include 'libbb.h' 编译可以通过。 继续make,出现如下错误: util-linux/blkdiscard.c: In function 'blkdiscard_main': 解决办法: BLKSECDISCARD在/usr/include/linux/fs.h中定义,方法如上所述,将/usr/include/linux/fs.h拷贝到busybox的include文件中,然后修改blkdiscard.c中头文件包含: 修改:#include #include 'fs.h' 继续make,编译通过,但是在链接的时候出现问题: networking/lib.a(nslookup.o): In function `print_host': 解决办法: make menuconfig Linux System Utilities--->nsenter,去掉该选项,重新编译make,又出现如下错误: networking/lib.a(nslookup.o): In function `print_host': 解决办法: make menuconfig Coreutils--->sync选项去掉,重新make编译通过,生成了busybox可执行文件。 具体选项是什么意思还不太清楚,需要进一步理解。
#include 'mtd-abi.h'
#include
util-linux/blkdiscard.c:72: error: 'BLKSECDISCARD' undeclared (first use in this function)
util-linux/blkdiscard.c:72: error: (Each undeclared identifier is reported only once
util-linux/blkdiscard.c:72: error: for each function it appears in.)
scripts/Makefile.build:197: recipe for target 'util-linux/blkdiscard.o' failed
make[1]: *** [util-linux/blkdiscard.o] Error 1
Makefile:742: recipe for target 'util-linux' failed
make: *** [util-linux] Error 2
nslookup.c:(.text.print_host+0x44): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
debianutils/lib.a(mktemp.o): In function `mktemp_main':
mktemp.c:(.text.mktemp_main+0x98): warning: the use of `mktemp' is dangerous, better use `mkstemp'
networking/lib.a(ipcalc.o): In function `ipcalc_main':
ipcalc.c:(.text.ipcalc_main+0x25c): warning: Using 'gethostbyaddr' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
libbb/lib.a(inet_common.o): In function `INET_resolve':
inet_common.c:(.text.INET_resolve+0x60): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
networking/lib.a(inetd.o): In function `reread_config_file':
inetd.c:(.text.reread_config_file+0x230): warning: Using 'getservbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
networking/lib.a(netstat.o): In function `ip_port_str':
netstat.c:(.text.ip_port_str+0x50): warning: Using 'getservbyport' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
util-linux/lib.a(nsenter.o): In function `nsenter_main':
nsenter.c:(.text.nsenter_main+0x1b0): undefined reference to `setns'
collect2: ld returned 1 exit status
Note: if build needs additional libraries, put them in CONFIG_EXTRA_LDLIBS.
Example: CONFIG_EXTRA_LDLIBS='pthread dl tirpc audit pam'
Makefile:717: recipe for target 'busybox_unstripped' failed
make: *** [busybox_unstripped] Error 1
nslookup.c:(.text.print_host+0x44): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
debianutils/lib.a(mktemp.o): In function `mktemp_main':
mktemp.c:(.text.mktemp_main+0x98): warning: the use of `mktemp' is dangerous, better use `mkstemp'
networking/lib.a(ipcalc.o): In function `ipcalc_main':
ipcalc.c:(.text.ipcalc_main+0x25c): warning: Using 'gethostbyaddr' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
libbb/lib.a(inet_common.o): In function `INET_resolve':
inet_common.c:(.text.INET_resolve+0x60): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
networking/lib.a(inetd.o): In function `reread_config_file':
inetd.c:(.text.reread_config_file+0x230): warning: Using 'getservbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
networking/lib.a(netstat.o): In function `ip_port_str':
netstat.c:(.text.ip_port_str+0x50): warning: Using 'getservbyport' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
coreutils/lib.a(sync.o): In function `sync_main':
sync.c:(.text.sync_main+0x7c): undefined reference to `syncfs'
collect2: ld returned 1 exit status
Note: if build needs additional libraries, put them in CONFIG_EXTRA_LDLIBS.
Example: CONFIG_EXTRA_LDLIBS='pthread dl tirpc audit pam'
Makefile:717: recipe for target 'busybox_unstripped' failed
make: *** [busybox_unstripped] Error 1
- arm-linux-gcc4.4.3编译s3c2410平台linux内核
- 关于arm-linux-gcc4.4.3在ubuntu11.10下的安装
- 5G网速比4G快但感知差!邬贺铨:6G标准制定应重视用户需求
- AMD将裁员4%,以在人工智能芯片领域争取更强的市场地位
- 消息称内存原厂考虑 HBM4 采用无助焊剂键合,进一步降低层间间隙
- 随时随地享受大屏幕游戏:让便携式 4K 超高清 240Hz 游戏投影仪成为现实
- 学习ARM开发(4)
- 英飞凌与马瑞利合作 利用AURIX™ TC4x MCU系列推动区域控制单元创新
- 英飞凌推出新型高性能微控制器AURIX™ TC4Dx
- Rambus宣布推出业界首款HBM4控制器IP,加速下一代AI工作负载