u-boot和linux的機器碼

來源:互聯網
上載者:User

啟動u-boot後,用bootm命令來引導核心(執行bootm 0x30008000),但是執行後,卡住了,無法啟動核心,現象如下:
 
Starting kernel ...                      
Uncompressing Linux.............................................................
Error: unrecognized/unsupported machine ID (r1 = 0x000000c1).
                 
Available machine support:                         
ID (hex)        NAME                                                           
000000**        ****
 
從這裡的提示資訊可知,是u-boot的機器碼和linux的不相同造成的,u-boot是0x000000c1(193),核心是0x000000**。大多數都是修改的linux核心的機器碼,讓它們一致即可。
  
先看u-boot的機器碼和linux的機器碼是在什麼地方決定的。
1、 u-boot的機器碼是在u-boot的board/fs2410/fs2410.c檔案裡決定的:

    /* arch number of SMDK2410-Board */
    gd->bd->bi_arch_number = MACH_TYPE_SMDK2410;
 
參照查看u-boot的include/asm-arm/mach-types.h檔案,有:
   #define MACH_TYPE_SMDK2410          193
這就是我們上面看到r1 = 0x000000c1(193)的原因。
 
2、 而linux核心的機器碼是由arch/arm/mach-s3c2410/mach-smdk2410.c下面的MACHINE_START(SMDK2410, "SMDK2440")中的第一個參數SMDK2410(關鍵字)決定的:
  
MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switch
                                    * to SMDK2410 */
        /* Maintainer: Jonas Dietsche */
        .phys_io        = S3C2410_PA_UART,
        .io_pg_offst    = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
        .boot_params    = S3C2410_SDRAM_PA + 0x100,
        .map_io         = smdk2410_map_io,
        .init_irq       = s3c24xx_init_irq,
        .init_machine   = smdk2410_init,
        .timer          = &s3c24xx_timer,
MACHINE_END

 
參照查看核心目錄下的arch/arm/tools/mach-types.h檔案,有:
    smdk2410        ARCH_SMDK2410       SMDK2410        193

 
 
只要保持兩個檔案(u-boot的board/fs2410/fs2410.c與linux核心的arch/arm/mach-s3c2410/mach-smdk2410.c)參照對象的碼值一樣就可以了!

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.