先看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
#define MACH_TYPE_SMDK2410 193
而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
* 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
smdk2410 ARCH_SMDK2410 SMDK2410 193
只要保持两个文件(u-boot的board/fs2410/fs2410.c与linux内核的arch/arm/mach-s3c2410/mach-smdk2410.c)参照对象的码值一样就可以了!