编译busybox

busybox编译

  • busybox是一个源码包,可以编译生成一些列linux下常用的工具.

这里下载的busybox-1.26.2.tar.bz2


1/配置

make menuconfig
Busybox Settings  --->
	[ ] Build BusyBox as a static binary (no shared libs)
	//上面这个选项是一定要选择的,这样才能把busybox编译成静态链接的可执行文件,运行时才独立于其他函数库.否则必需要其他库文件才能运行,在单一个linux内核不能使它正常工作.
	//好像动态连接也可以,再移植一些库就可以了,这个库对应编译器的库
	
Applets下面的东西都是你要生成的bash中的命令.

//编译器也可以再make menuconfig 中配置
//还可以在 make menuconfig 中配置安装目录

2/编译

make CROSS_COMPILE=arm-hisiv300-linux-
//这个东西可以直接通过make install就可以了,不用 install 目标 依赖于 编译

3/安装

make CROSS_COMPILE=arm-hisiv300-linux- install
在源码目录下生成了一个_install文件夹,文件夹下有bin	 linuxrc sbin usr目录


编译时出现的错误处理

util-linux/lib.a(nsenter.o): In function `nsenter_main':
nsenter.c:(.text.nsenter_main+0x188): undefined reference to `setns'
coreutils/lib.a(sync.o): In function `sync_main':
sync.c:(.text.sync_main+0x98): undefined reference to `syncfs'
collect2: error: 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"
make: *** [busybox_unstripped] Error 1
root@ubuntu:/home/linux/src/busybox-1.26.2# file util-linux/volume_id/xfs.o
util-linux/volume_id/xfs.o: ELF 32-bit LSB relocatable, ARM, version 1 (SYSV), not stripped

如上,会出现上述错误
只需要再去
make menuconfig 中把 nsenter 和 sync 去掉即可

参考资料

关于根文件系统中命令行提示符的显示

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值