buildroot + external-kernel挂载rootfs失败的几种情况

一、Attempted to kill init!

没有其他信息,直接报 kill init。

可能的原因 1:
Linux Kernel 和 Buildroot Rootfs 的 ABI 接口不一致。

Linux Kernel:
  -> Kernel Features
	  -> Use the ARM EABI to compile the kernel

Buildroot Rootfs:
  -> Target options
	  -> Target ABI

Embedded application binary interface (EABI), 嵌入式应用二进制接口。

查看编译器属性:

$ buildroot/output/host/usr/bin/arm-buildroot-linux-gnueabi-gcc -v
Using built-in specs.
COLLECT_GCC=/home/wu/opensource/buildroot/output/host/bin/arm-buildroot-linux-gnueabi-gcc.br_real
COLLECT_LTO_WRAPPER=/home/wu/opensource/buildroot/output/host/libexec/gcc/arm-buildroot-linux-gnueabi/9.2.0/lto-wrapper
Target: arm-buildroot-linux-gnueabi
Configured with:
省略...

解决办法:
重新配置内核支持 EABI

$ make menuconfig
Kernel Features  --->
     [*] Use the ARM EABI to compile the kernel

根本原因:
Linux 和 Rootfs 的编译器不一致。

二、can't open /r/dev/console: no such file

解决办法:

$ mknod /dev/console c 5 1
$ mknod dev/null c 1 3 mknod

三、bad init /linuxrc: Exec format error

可能的原因 1:
CONFIG_BINFMT_ELF=n

可能的原因 2:
拷贝 rootfs 到目标板时数据损坏。

检查方法:

$ readelf /rootfs/bin/busybox
$ du -sh /rootfs/bin/busybox

避免问题的方法:

$ sync

四、FATAL: kernel too old

可能的原因 1:
交叉编译器在制作时限制了使用的最低内核版本。

确认文件系统要求的最低内核:

$ file buildroot/output/target/lib/libc-2.30.so
buildroot/output/target/lib/libc-2.30.so: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux 4.14.0, stripped

或者

$ cd buildroot/output/build/glibc-2.30-20-xxx
$ grep "enable-kernel" ./* -nR

暂时只遇到这些情况,后面有机会在补充。

成功挂载的效果:

你和我各有一个苹果,如果我们交换苹果的话,我们还是只有一个苹果。但当你和我各有一个想法,我们交换想法的话,我们就都有两个想法了。如果你也对嵌入式系统开发有兴趣,并且想和更多人互相交流学习的话,请关注我的公众号:ESexpert,一起来学习吧,欢迎各种收藏/转发/批评,小小的转发一下对我来说是极大的恩惠,十分感谢!

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值