移植内核过程中出现界面卡在"Uncompressing Linux... done, booting the kernel."

来源:互联网 发布:网络教室软件 破解版 编辑:程序博客网 时间:2024/05/16 23:38

转载:http://blog.csdn.net/comwise/article/details/16995451

移植平台:Linux 3.4.2 Mini2440  U-Boot 2012.04.01

1.移植内核过程中出现界面卡在"Uncompressing Linux... done, booting the kernel."

在Linux内核中搜素"Uncompressing Linux... ", 找到如下

[plain] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. Misc.c (arch\arm\boot\compressed):    putstr("Uncompressing Linux...");  
  2. Serial.txt (documentation\ia64):    No kernel output after elilo prints "Uncompressing Linux... done":  
  3. Serial.txt (documentation\ia64):    Long pause (60+ seconds) between "Uncompressing Linux... done" and  
先看代码出错处
[cpp] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. putstr("Uncompressing Linux...");  
  2. ret = do_decompress(input_data, input_data_end - input_data,  
  3.             output_data, error);  
  4. if (ret)  
  5.     error("decompressor returned an error");  
  6. else  
  7.     putstr(" done, booting the kernel.\n");  

这里可以看到解压缩是正确的,那为什么不能正常启动呢?再看搜索到的文档

[plain] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. No kernel output after elilo prints "Uncompressing Linux... done":  
  2. - You specified "console=ttyS0" but Linux changed the device to which ttyS0 refers.  Configure exactly one EFI console  
  3.   device[3] and remove the "console=" option.  
  4. - The EFI console path contains both a VGA device and a UART. EFI and elilo use both, but Linux defaults to VGA.  Remove  
  5.   the VGA device from the EFI console path[3].  
  6. - Multiple UARTs selected as EFI console devices.  EFI and elilo use all selected devices, but Linux uses only one.  
  7.   Make sure only one UART is selected in the EFI console  
  8.   path[3].  
  9. - You're connected to an HP MP port[2] but have a non-MP UART selected as EFI console device.  EFI uses the MP as a  
  10.   console device even when it isn't explicitly selected.  
  11.   Either move the console cable to the non-MP UART, or change  
  12.   the EFI console path[3] to the MP UART.  
我扫了一眼,意思就是如果启用EFI就不需要设备,如果没有需要设置参数,我就想先设置了启动参数

set bootargs 'console=ttySAC0' 

注意:也会有其他情况,以下几种为网上的方法:

1)u-boot中的参数(console)没有传到内核。
2)u-boot的时钟设置不在405MHz,与Kernel的不一致。
3)u-boot中的Machine ID设置的与Kernel不一致。

具体可参考文章:http://blog.csdn.net/delphityro/article/details/7520629

2. 设置之后启动乱码

网上有提供说加入波特率,那就试试 set bootargs 'console=ttySAC0,115200' 

注意:这里ttySAC0,115200之间一定要有,否则还是会出错的.

3. 再试启动成功了,但是后面出现了崩溃,代码如下:

VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
Please append a correct "root=" boot option; here are the available partitions:

意思是我启动参数里面没有加入root选项,加入里面再看看

set bootargs 'noinitrd root=/dev/mtdblock3 console=ttySAC0,115200'

具体参数说明:http://blog.csdn.net/comwise/article/details/15804875

4. 启动之后发现又出现了新问题,如下

No filesystem could mount root, tried:  ext3 cramfs vfat msdos romfs
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,3)

意思就是根文件系统不支持,所以下一步需要增加根文件系统的支持:

这里需要下载网上提供的busybox1.20(这里先制作jffs2格式的根文件系统)

具体怎么移植可参考网上步骤,这里一定要参考busybox下面的README和INSTALL还有docs文件下的文件,这里要注意几点:

1)一定要有脚本inittab,在里面会进行网络的配置和根文件的挂接,

2)在上面脚本中不要忘记串口的设备,否则界面会卡在串口无初始化或者不能打开串口/dev/console之类的

3)如果使用动态链接库,需要将编译的库文件拷进去

4)就是mdev的创建,mdev是通过init进程启动的,至少需要设备文件console和null,null是在没有串口输出的后备,一定需要

以下为制作好jffs2文件后,会出现的问题

1)uboot bootargs参数设置要正确

bootargs=console=ttySAC0,115200 root=/dev/mtdblock3 rootfstype=jffs2

这里默认的启动init=/linuxrc已经在脚本中写入,所以需要;文件系统、波特率一定也要加上

2)如果这里设置了如下的bootcmd,会出现如下类似启动信息

[cpp] view plaincopyprint?在CODE上查看代码片派生到我的代码片
  1. jffs2: Empty flash at 0x00438fd8 ends at 0x00439000  
  2. jffs2: Empty flash at 0x096e8474 ends at 0x096e8800  
  3. VFS: Mounted root (jffs2 filesystem) on device 31:3.  
  4. Freeing init memory: 148K  
  5. BUG: scheduling while atomic: init/1/0x00000100  
  6. Modules linked in:  
  7. [<c000dc1c>] (unwind_backtrace+0x0/0xf8) from [<c03423c8>] (__schedule+0x2ac/0x318)  
  8. [<c03423c8>] (__schedule+0x2ac/0x318) from [<c0341588>] (__mutex_lock_slowpath+0x68/0x98)  
  9. [<c0341588>] (__mutex_lock_slowpath+0x68/0x98) from [<c019b530>] (gpio_unexport+0x18/0xb4)  

由于0x30000000地址处,存有系统放置的代码,导致数据损坏,所以一定要将启动的地址设备大一些,比如32000000

注意:后期我再次烧写使用0x30000000,发现并没有出现崩溃,其实这个根本没有多大关系。
0 0