微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > ARM MACHINE_TYPE_XXXX问题

ARM MACHINE_TYPE_XXXX问题

时间:11-10 来源:互联网 点击:
1. Machines ID分配表

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

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开发板(1)---bootm手动引导>>一文中,执行完第6步的操作后,启动u-boot后,用bootm 命令来引导内核(执行bootm 0x30008000),但是执行后,卡住了,无法启动内核,现象如下:

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开发板(1)---bootm手动引导>>一文中的第8步后,就可以手动成功引导内核了。

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top