首页 > 代码库 > init_machine 在Kernel中被调用的过程

init_machine 在Kernel中被调用的过程

以tiny4412为例:

arch/arm/mach-exynos/mach-tiny4412.c

MACHINE_START(TINY4412, "TINY4412")    /* Maintainer: FriendlyARM (www.arm9.net) */    .boot_params    = S5P_PA_SDRAM + 0x100,    .init_irq    = exynos4_init_irq,    .map_io        = smdk4x12_map_io,    .init_machine    = smdk4x12_machine_init,    .timer        = &exynos4_timer,    .reserve    = &exynos4_reserve,MACHINE_END

其中:

#define MACHINE_START(_type,_name)            static const struct machine_desc __mach_desc_##_type     __used                             __attribute__((__section__(".arch.info.init"))) = {        .nr        = MACH_TYPE_##_type,            .name        = _name,#define MACHINE_END                \};

 

启动时:

start_kernel  ----- init/main.c

      ---->  setup_arch ---- arch/arm/kernel/setup.c

                      ---->  mdesc = setup_machine_tags(machine_arch_type);   到这里,根据machine_arch_type就找到上面这个结构体了。

                      ---->  machine_desc = mdesc;

                      ---->  paging_init(mdesc)   (arch/arm/mm/mmu.c)

                                      ----> devicemaps_init(mdesc)

                                                        ----> mdesc->map_io()   调用了函数 smdk4x12_map_io
       

 

 

init_machine 在Kernel中被调用的过程