新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > ARM MACHINE_TYPE_XXXX問題

ARM MACHINE_TYPE_XXXX問題

作者: 時間:2016-11-10 來源:網絡 收藏
1. Machines ID分配表

參考:http://www.arm.linux.org.uk/developer/machines/

本文引用地址:http://2s4d.com/article/201611/317206.htm

193(0xC1) smdk2410

362(0x16A) S3C2440

2928 WM8505

3472WonderMedia WM8650 Reference Board

-------------------------------------------------------------------------------------------------------

The ArcNumber parameter references a particular mach-type/machine from the kernelsArm machine table, telling the kernel which specific piece of hardware its on.

Its presumed that the bundled kernel is hardcoded and doesnt need this parameter, but if you are building your own kernel, you need to set this parameter in uBoot , so the kernel knows what to boot. Leaving it set appears to be perfectly OK for botting the bundled kernels.

========================================================================================

The machine type number is obtained via the ARM Linux websiteMachine Registry. A machine type should be obtained as early in a

projects life as possible, it has a number of ramifications for the kernel port itself (machine definitions etc.) and changing definitions

afterwards may lead to a number of undesirable issues. These values are represented by a list of defines within the kernel source

(linux/arch/arm/tools/mach-types).

2. 作者遇到的問題

在<<移植linux 2.6.31到OK2440V3開發(fā)板(1)---bootm手動引導>>一文中,執(zhí)行完第6步的操作后,啟動u-boot后,用bootm 命令來引導內核(執(zhí)行bootm 0x30008000),但是執(zhí)行后,卡住了,無法啟動內核,現(xiàn)象如下:

Starting kernel ...

Uncompressing Linux.............................................................

Error: unrecognized/unsupported machine ID (r1 = 0x000000c1).

Available machine support:

ID (hex) NAME
000000a8 SMDK2440

從這里的提示信息可知,是u-boot的Machine Type和linux的不相同造成的,u-boot是0x000000c1(193),內核是 0x0000016A(362)。

網上大多數都是修改linux內核的機器碼,在arch/arm/tools/mach-types.h中,讓它們一致,具體修改哪一方,我覺得要看情況而定。

我們先看u-boot的機器碼和linux的機器碼是在什么地方決定的。

u-boot的機器碼是在u-boot的board/samsung/ok2440v3/ok2440v3.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
#define MACH_TYPE_S3C2440 362
這就是我們上面看到r1 = 0x000000c1(193)的原因。

linux的機器碼是由arch/arm/mach-s3c2440/mach-smdk2440.c下面的MACHINE_START(S3C2440, "SMDK2440")中的第一個參數S3C2440(關鍵字)決定的:

MACHINE_START(S3C2440, "SMDK2440")
/* Maintainer: Ben Dooks */
.phys_io = S3C2410_PA_UART,
.io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
.boot_params = S3C2410_SDRAM_PA + 0x100,

.init_irq = s3c24xx_init_irq,
.map_io = smdk2440_map_io,
.init_machine = smdk2440_machine_init,
.timer = &s3c24xx_timer,
MACHINE_END

查看內核目錄下的arch/arm/tools/mach-types.h文件,有:
smdk2410 ARCH_SMDK2410 SMDK2410 193
s3c2440 ARCH_S3C2440 S3C2440 362
smdk2440 MACH_SMDK2440 SMDK2440 1008

關鍵字是s3c2440,所以我們上面看到的是0x000000a8(362)。

所以,我們這里不去修改內核,而是直接修改u-boot 的 board/samsung/ok2440v3/ok2440v3.c文件,如下:
/* arch number of SMDK2410-Board */
gd->bd->bi_arch_number = MACH_TYPE_S3C2440;

重新編譯u-boot后,下載到nand中,完成<<移植linux 2.6.31到OK2440V3開發(fā)板(1)---bootm手動引導>>一文中的第8步后,就可以手動成功引導內核了。



關鍵詞: ARMMACHINE_TYPE_XXX

評論


技術專區(qū)

關閉