分享

Uncompressing Linux... done, booting the kernel (问题集锦)

 guitarhua 2012-05-03

Uncompressing Linux... done, booting the kernel (问题集锦)

391人阅读 评论(0) 收藏 举报

今天用主线Linux内核移植到MINI6410,主线内核2.6.37.1基本已经支持了MINI6410的板子,所以移植到能够启动起来的阶段很简单,但是在移植的时候还是出现了一个比较常见的问题:

  1. MINI6410 # bootm 0x50008000
  2. ## Booting kernel from Legacy Image at 50008000 ...
  3. Image Name: Linux-2.6.37.1
  4. Image Type: ARM Linux Kernel Image (uncompressed)
  5. Data Size: 3800644 Bytes = 3.6 MiB
  6. Load Address: 50008000
  7. Entry Point: 50008040
  8. Verifying Checksum ... OK
  9. XIP Kernel Image ... OK
  10. OK
  11. Starting kernel ...
  12. Uncompressing Linux... done, booting the kernel.
  13. 停住不动了~~~~
这种问题比较常见,由于输出的信息有限,不是很好找原因,如果去代码中追踪的话也比较麻烦。在查找原因解决这个问题的时候,我找到了一些可能出现的原因,在这里总结一下:

1、machine type 不匹配
在 内核自解压完成以后内核会首先会进入 bl      __lookup_machine_type函数(在arch/arm/kernel/head.S中),检查machine_type是否匹配,如果不 匹配会跳入__error_a函数(在arch/arm/kernel/head-common.S中),导致启动失败。
例如arch/arm/mach-s3c64xx/mach-mini6410.c 查看下面这个结构体:
  1. MACHINE_START( MINI6410 , "MINI6410" )
  2.     /* Maintainer: Darius Augulis <augulis.darius@gmail.com> */
  3.     . boot_params    = S3C64XX_PA_SDRAM + 0x100,
  4.     . init_irq    = s3c6410_init_irq,
  5.     . map_io        = mini6410_map_io,
  6.     . init_machine    = mini6410_machine_init,
  7.     . timer        = & s3c24xx_timer,
  8. MACHINE_END
这个宏的定义在arch/arm/include/asm/mach/arch.h
  1. /*
  2.  * Set of macros to define architecture features. This is built into
  3.  * a table by the linker.
  4.  */
  5. # define MACHINE_START( _type , _name)             /
  6. static const struct machine_desc __mach_desc_# # _type    /
  7.  __used                            /
  8.  __attribute__( ( __section__( ".arch.info.init" ) ) ) = {     /
  9.     
  10. .nr        = MACH_TYPE_##_type,         /
  11.     
  12. . name        = _name,

  13. # define MACHINE_END                /
  14. } ;
这个宏定义扩展之后的machine type 就成了 MACHINE_TYPE_MIN6410。
MACHINE_TYPE_MIN6410这个宏定义在include/generated/mach-types.h
  1.  
    1. # define MACH_TYPE_MINI6410 2520
machine type在u-boot
的配置 在board/samsung/mini6410/mini6410.c
  1.  
    1. /*
    2.  * Miscellaneous platform dependent initialisations
    3.  */

    4. int board_init( void )
    5. {
    6.     s3c64xx_gpio * const gpio = s3c64xx_get_base_gpio( ) ;

    7. . . . . .

    8.     gd- > bd- > bi_arch_number = MACH_TYPE ;
    9.     gd- > bd- > bi_boot_params = PHYS_SDRAM_1 + 0x100;

    10.     return 0;
    11. }
这个宏的定义在:include/configs/mini6410.h
  1.  
    1. /*
    2.  * Architecture magic and machine type
    3.  */
    4. # define MACH_TYPE        2520
只要这两个数对上就可以了。

2、串口驱动没有编译入内核

在弄MINI6410的时候我就犯了这个错误,因为还没有MINI6410的默认配置文件,所有这个要自己选上的。位置在Device Drivers->Character devices->Serial drivers中

  1. <*> Samsung SoC serial support 
  2. [*] Support for console on Samsung SoC serial port  
  3. <*> Samsung S3C6400/S3C6410/S5P6440/S5P6450/S5PC100 Serial port support

3、内核启动参数设置错误   

内核的启动参数的错误也可以造成同样的错误。

比如有一个配置是:

 

  1. noinitrd root=/dev/mtdblock4 rootfstype=jffs2 rw console=ttySAC0,115200 init=/linuxrc mem=64M

关键是在 console=ttySAC0,115200上,如果 ttySAC0弄错了,或者波特率不对就会出问题。

不同的CPU的 console有可能不一样,比如有的可能是 ttyS0。

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多