Kernel panic not syncing: Attempted to kill init!

问题:

使用ELDK4.1版本编译的内核加载ELDK4.2编译的根文件系统root422以NFS方式启动遇到错误信息:

IP-Config: Complete:
     device=eth0, addr=192.168.1.244, mask=255.255.255.0, gw=255.255.255.255,
     host=192.168.1.244, domain=, nis-domain=(none),
     bootserver=255.255.255.255, rootserver=192.168.1.200, rootpath=
Looking up port of RPC 100003/2 on 192.168.1.200
eth0: link up (10/Half)
eth0: link down
eth0: link up (10/Half)
Looking up port of RPC 100005/1 on 192.168.1.200
VFS: Mounted root (nfs filesystem) on device 0:12.
Freeing init memory: 124K
Kernel panic - not syncing: Attempted to kill init!

解决:

而这个问题在用ELDK4.1作为交叉编译工具链编译得到根文件系统root400时没有出现,

从网上查到这篇文章http://blog.chinaunix.net/uid-12461657-id-2975953.html

说这是内核编译时EABI的选项没有选中所导致的。


想起来,用ELDK4.1编译时,当将内核中的EABI选项选中,编译时会提示错误;

查了下ELDK4.1和ELDK4.2的区别,从ftp://ftp-stud.hs-esslingen.de/pub/Mirrors/eldk/4.2/arm-linux-x86/distribution/README.html

中知道从ELDK4.2版本起开始支持EABI。

所以,ELDK4.1编译内核选中EABI时,自然会出现编译错误。


在menuconfig中选中EABI选项:

Kernel Features  --->
            [*] Use the ARM EABI to compile the kernel                  
            [*]   Allow old ABI binaries to run with this kernel (EXPERIMENTA)

使用ELDK4.2版本重新编译,将编译完的uImage烧写到NAND Flash中,重启目标板,能够进入shell界面了。


补充:

在U-Boot命令行模式,将根文件系统换成使用ELDK4.1版本编译生成的root400,照样可以通过NFS成功加载根文件系统,正常进入shell界面。

这应该是内核编译选项Allow old ABI binaries to run with this kernel (EXPERIMENTA)的作用。


为了验证是否确实是内核编译选项Allow old ABI binaries to run with this kernel (EXPERIMENTA)的作用,重新运行make menuconfig,将EABI的选项更改为:

Kernel Features  --->
            [*] Use the ARM EABI to compile the kernel                  
            [ ]   Allow old ABI binaries to run with this kernel (EXPERIMENTA)

编译,将编译完的uImage烧写到Flash中,重启目标板,发现内核在成功挂载根文件系统并释放初始化内存后,始终不能进入shell界面,虽然,console口还能响应键盘输入的回车键。

Looking up port of RPC 100005/1 on 192.168.1.200
VFS: Mounted root (nfs filesystem) on device 0:12.
Freeing init memory: 120K

停在此处始终不能进入shell界面。

也就是,不兼容OABI(Old Application Binary Interface)所造成的后果。


所以,安全期间,不管是多少版本的内核,为了兼容旧的版本的编译器编译出的根文件系统,一定要将
            [*] Use the ARM EABI to compile the kernel                  
            [*]   Allow old ABI binaries to run with this kernel (EXPERIMENTA)

同时选中。


原文地址:https://www.cnblogs.com/java20130726/p/3218568.html