../linux_2.6.29/arch/arm/kernel/setup.c 查找函数parse_tag_cmdline();bootloader的命令行就是通过这个函数传递给kernel的。可以直接屏蔽掉这个函数中的命令行传递,在kernel的config下直接写入你想要的命令行参数。位置: .config文件中:# # Boot options # CONFIG_ZBOOT_ROM_TEXT=0 CONFIG_ZBOOT_ROM_BSS=0 CONFIG_CMDLINE="" <----写入 noinitrd root=/dev/mt....效果是一样的。不过在这里做命令行传递调试更方便,试好了可以去做bootloader的代码变更。
../linux_2.6.29/arch/arm/kernel/setup.c 需要分析这个函数来了解参数传递的过程!!! 看到上面的说明,我们是不是可以作一个假设,就是去掉vivi中的传送参数的这一部分,而直接在内核的.config文件中加入本应当在vivi中传递给kernel的参数 这个我还没有具体实现。理论上应该是行得通! 具体的函数 |
void __init setup_arch(char **cmdline_p)
{
struct tag *tags = (struct tag *)&init_tags;
struct machine_desc *mdesc;
char *from = default_command_line;
ROOT_DEV = MKDEV(0, 255);
setup_processor();
mdesc = setup_machine(machine_arch_type);
machine_name = mdesc->name;
if (mdesc->soft_reboot)
reboot_setup("s");
if (mdesc->param_offset)
tags = phys_to_virt(mdesc->param_offset);
/*
* Do the machine-specific fixups before we parse the
* parameters or tags.
*/
if (mdesc->fixup)
mdesc->fixup(mdesc, (struct param_struct *)tags,
&from, &meminfo);
/*
* 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) {
if (meminfo.nr_banks != 0)
squash_mem_tags(tags);
parse_tags(tags);
}
if (meminfo.nr_banks == 0) {
meminfo.nr_banks = 1;
meminfo.bank[0].start = PHYS_OFFSET;
meminfo.bank[0].size = MEM_SIZE;
}
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;
memcpy(saved_command_line, from, COMMAND_LINE_SIZE);
saved_command_line[COMMAND_LINE_SIZE-1] = '\0';
parse_cmdline(&meminfo, cmdline_p, from);
bootmem_init(&meminfo);
paging_init(&meminfo, mdesc);
request_standard_resources(&meminfo, mdesc);
/*
* Set up various architecture-specific pointers
*/
init_arch_irq = mdesc->init_irq;
#ifdef CONFIG_VT
#if defined(CONFIG_VGA_CONSOLE)
conswitchp = &vga_con;
#elif defined(CONFIG_DUMMY_CONSOLE)
conswitchp = &dummy_con;
#endif
#endif
}
|
这是linux里面接受从bootloader里面传过来参数的解析函数,具体我没去分析
需要注意的是,vivi传递参数的数据结构比较古老,需要转化为linux现在的参数结构struct tag
阅读(641) | 评论(0) | 转发(0) |