Uncompressing Linux... done, booting the kernel

今天用主線Linux內核移植到MINI6410,主線內核2.6.37.1基本已經支持了MINI6410的板子,因此移植到可以啓動起來的階段很簡單,可是在移植的時候仍是出現了一個比較常見的問題:css

  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. 停住不動了~~~~
這種問題比較常見,因爲輸出的信息有限,不是很好找緣由,若是去代碼中追蹤的話也比較麻煩。在查找緣由解決這個問題的時候,我找到了一些可能出現的緣由,在這裏總結一下:
 
一、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
只要這兩個數對上就能夠了。
 
二、串口驅動沒有編譯入內核

在弄MINI6410的時候我就犯了這個錯誤,由於尚未MINI6410的默認配置文件,全部這個要本身選上的。位置在Device Drivers->Character devices->Serial drivers中linux

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

三、內核啓動參數設置錯誤   web

內核的啓動參數的錯誤也能夠形成一樣的錯誤。函數

好比有一個配置是:ui

 

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

關鍵是在 console=ttySAC0,115200上,若是 ttySAC0弄錯了,或者波特率不對就會出問題。.net

不一樣的CPU的 console有可能不同,好比有的多是 ttyS0。code

ref: http://blog.csdn.net/challen537/article/details/6544878orm

相關文章
相關標籤/搜索