ubuntu 在 R40e 上 還有 Debian 在 Sempron 2600 上

2010年11月8日 星期一

arch/arm/mach-xx 的 board.c 宣告
MACHINE_START(BOARD_NAME,"bord name")
.fixup = fixup_board,
.map_io = board_map_io,
.init_irq = board_init_irq,
.init_machine = mxc_board_init,
.timer = &mxc_timer,
MACHINE_END
這個 MACRO 定義在 arch/arm/include/asm/mach/arch.h
##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                             \
};

arch/arm/kernel/setup.c -- void _init setup_arch(char *cmdline_p) init/main.c: -- asmlinkage void _init start_kernel(void)
asmlinkage void __init start_kernel(void)
{
        char * command_line;
        extern struct kernel_param __start___param[], __stop___param[];

        smp_setup_processor_id();

        lockdep_init();
        debug_objects_early_init();

        boot_init_stack_canary();

        cgroup_init_early();

        local_irq_disable();
        early_boot_irqs_off();
        early_init_irq_lock_class();

        lock_kernel();
        tick_init();
        boot_cpu_init();
        page_address_init();
        printk(KERN_NOTICE "%s", linux_banner);
        setup_arch(&command_line);

在 init/main.c 的 do_early_param(char *param,char *val):
{
        struct obs_kernel_param *p;

        for (p = __setup_start; p < __setup_end; p++) {
                if ((p->early && strcmp(param, p->str) == 0) ||
                    (strcmp(param, "console") == 0 &&
                     strcmp(p->str, "earlycon") == 0)
                ) {
                        if (p->setup_func(val) != 0)
                                printk(KERN_WARNING
                                       "Malformed early option '%s'\n", param);
                }
        }
        /* We accept everything at this stage. */
        return 0;
}
參考 __setup_start, __setup_end, 這宣告/tag 在 lds 中。 配合 include/asm-generic/vmlinux.lds.h :
#define INIT_SETUP(initsetup_align)                                     \
                . = ALIGN(initsetup_align);                             \
                VMLINUX_SYMBOL(__setup_start) = .;                      \
                *(.init.setup)                                          \
                VMLINUX_SYMBOL(__setup_end) = .;

還有在 arch/arm/kernel/vmlinux.lds 中
  __setup_start = .;
   *(.init.setup)
  __setup_end = .;
 
所以

沒有留言:

標籤

網誌存檔