creator sz111@126.com
机器ID是bootloader传给r1的。
每个开发板有个ID。在mach-types中定义,如:我的开发板上2440。
对应s3c2440 ARCH_S3C2440 S3C2440 362
当编译后,会生成一个头文件mach-types.h
里面会有:
#ifdef CONFIG_ARCH_S3C2440
# ifdef machine_arch_type
# undef machine_arch_type
# define machine_arch_type __machine_arch_type
# else
# define machine_arch_type MACH_TYPE_S3C2440
# endif
# define machine_is_s3c2440() (machine_arch_type == MACH_TYPE_S3C2440)
#else
# define machine_is_s3c2440() (0)
#endif
而如果我们配置的时候,选择了SMDK2440,
config ARCH_S3C2440
bool "SMDK2440"
select CPU_S3C2440
help
Say Y here if you are using the SMDK2440.
就会编译mach-smdk2440.c
MACHINE_START(S3C2440, "SMDK2440")
/* Maintainer: Ben Dooks */
.phys_ram = S3C2410_SDRAM_PA,
.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
#define MACHINE_START(_type,_name) \
const struct machine_desc __mach_desc_##_type \
__attribute__((__section__(".arch.info"))) = { \
.nr = MACH_TYPE_##_type, \
.name = _name,
#define MACHINE_END \
};
而传给R1的值就是MACH_TYPE_S3C2440,然后程序会搜寻,发现定义
了就会采用MACHINE_START(S3C2440, "SMDK2440")的配置。
阅读(3613) | 评论(0) | 转发(0) |