void
__init setup_arch(char **cmdline_p)
{
struct tag *tags = (struct tag
*)&init_tags;
struct machine_desc *mdesc;
char *from = default_command_line;编译内核时配置的Boot Options
unwind_init();
setup_processor();
mdesc =
setup_machine(machine_arch_type);
machine_name = mdesc->name;
if (mdesc->soft_reboot)
reboot_setup("s");
if (__atags_pointer)检查BootLoader是否传入参数
tags =
phys_to_virt(__atags_pointer);
else if (mdesc->boot_params)
tags =
phys_to_virt(mdesc->boot_params);machine descriptor中传入的启动参数地址(arch/arm/mach-s3c2440/mach-mini2440.c)
/*
* If we have the old style parameters, convert
them to
* a tag list.
*/
if (tags->hdr.tag != ATAG_CORE)
convert_to_tag_list(tags);
if (tags->hdr.tag != ATAG_CORE)
tags = (struct tag
*)&init_tags;使用default
init_tags,其中内存的定义是:起始地址:0x30000000,大小是16M
if (mdesc->fixup)
mdesc->fixup(mdesc, tags,
&from, &meminfo);
if (tags->hdr.tag == ATAG_CORE) {
if (meminfo.nr_banks != 0)如果内存已经初始化,则忽略mem TAG
squash_mem_tags(tags);
save_atags(tags);
parse_tags(tags);解析TAGS,其中如果U-boot传入ATAG_CMDLINE,则使用U-boot传入的bootargs覆盖default_command_line
}
init_mm.start_code = (unsigned long)
_text;
init_mm.end_code= (unsigned long) _etext;
init_mm.end_data= (unsigned long) _edata;
init_mm.brk= (unsigned long) _end;
/* parse_early_param needs a
boot_command_line */
strlcpy(boot_command_line, from,
COMMAND_LINE_SIZE);将defualt_command_line拷入boot_command_line
/* populate cmd_line too for later use,
preserving boot_command_line */
strlcpy(cmd_line, boot_command_line,
COMMAND_LINE_SIZE);
*cmdline_p = cmd_line;
parse_early_param();大部分参数的early属性为0,即大部分参数在早期不处理,如noinitrd,console等
paging_init(mdesc);
request_standard_resources(&meminfo,
mdesc);
***************
}