--- zzzz-none-000/linux-2.6.13.1/arch/arm/kernel/setup.c 2005-09-10 02:42:58.000000000 +0000 +++ ohio-7170-487/linux-2.6.13.1/arch/arm/kernel/setup.c 2006-12-20 12:37:57.000000000 +0000 @@ -38,6 +38,8 @@ #include #include +#include + #ifndef MEM_SIZE #define MEM_SIZE (16*1024*1024) #endif @@ -115,6 +117,8 @@ static union { char c[4]; unsigned long l; } endian_test __initdata = { { 'l', '?', '?', 'b' } }; #define ENDIANNESS ((char)endian_test.l) +int *pEnvironment; + DEFINE_PER_CPU(struct cpuinfo_arm, cpu_data); /* @@ -402,8 +406,11 @@ * Ensure that start/size are aligned to a page boundary. * Size is appropriately rounded down, start is rounded up. */ + size -= start & ~PAGE_MASK; + printk("[add_memory] size 0x%lx meminfo.nr_banks %d\n", size, meminfo.nr_banks); + meminfo.bank[meminfo.nr_banks].start = PAGE_ALIGN(start); meminfo.bank[meminfo.nr_banks].size = size & PAGE_MASK; meminfo.bank[meminfo.nr_banks].node = PHYS_TO_NID(start); @@ -526,11 +533,13 @@ if (kernel_data.start >= res->start && kernel_data.end <= res->end) request_resource(res, &kernel_data); + printk("[request_standard_resources] bank %x: start=%lx end=%lx\n", i, res->start, res->end); } if (mdesc->video_start) { video_ram.start = mdesc->video_start; video_ram.end = mdesc->video_end; + printk("[request_standard_resources] video: start=%x end=%x\n", mdesc->video_start, mdesc->video_end); request_resource(&iomem_resource, &video_ram); } @@ -576,7 +585,9 @@ tag->u.mem.start, tag->u.mem.size / 1024); return -EINVAL; } + printk("[parse_tag_mem32] start 0x%x size 0x%x\n", tag->u.mem.start, tag->u.mem.size); add_memory(tag->u.mem.start, tag->u.mem.size); + return 0; } @@ -658,12 +669,24 @@ static int __init parse_tag_cmdline(const struct tag *tag) { - strlcpy(default_command_line, tag->u.cmdline.cmdline, COMMAND_LINE_SIZE); + int len = strlen(default_command_line); + + if (len) + strncat(default_command_line, " ", COMMAND_LINE_SIZE - len); + strncat(default_command_line, tag->u.cmdline.cmdline, COMMAND_LINE_SIZE-len-1); return 0; } __tagtable(ATAG_CMDLINE, parse_tag_cmdline); +static int __init parse_tag_envp(const struct tag *tag) +{ + pEnvironment = (int *)tag->u.envp.envp; + return 0; +} + +__tagtable(ATAG_ENVP, parse_tag_envp); + /* * Scan the tag table for this tag, and call its parse function. * The tag table is built by the linker from all the __tagtable @@ -674,6 +697,7 @@ extern struct tagtable __tagtable_begin, __tagtable_end; struct tagtable *t; + printk("[parse_tag] tag 0x%x\n", tag->hdr.tag); for (t = &__tagtable_begin; t < &__tagtable_end; t++) if (tag->hdr.tag == t->tag) { t->parse(tag); @@ -724,6 +748,8 @@ } arch_initcall(customize_machine); +/*------------------------------------------------------------------------------------------*\ +\*------------------------------------------------------------------------------------------*/ void __init setup_arch(char **cmdline_p) { struct tag *tags = (struct tag *)&init_tags; @@ -734,20 +760,28 @@ mdesc = setup_machine(machine_arch_type); machine_name = mdesc->name; + printk("[setup_arch] mdesc 0x%p\n", mdesc); + if (mdesc->soft_reboot) reboot_setup("s"); - if (mdesc->boot_params) + if (mdesc->boot_params) { + printk("[setup_arch] tags from boot_params\n"); tags = phys_to_virt(mdesc->boot_params); + } /* * If we have the old style parameters, convert them to * a tag list. */ + printk("[setup_arch] search tags 0x%p\n", tags); if (tags->hdr.tag != ATAG_CORE) convert_to_tag_list(tags); - if (tags->hdr.tag != ATAG_CORE) + + if (tags->hdr.tag != ATAG_CORE) { + printk ("[setup_arch] invalid tags in boot_params\n"); tags = (struct tag *)&init_tags; + } if (mdesc->fixup) mdesc->fixup(mdesc, tags, &from, &meminfo); @@ -765,7 +799,9 @@ memcpy(saved_command_line, from, COMMAND_LINE_SIZE); saved_command_line[COMMAND_LINE_SIZE-1] = '\0'; + printk("[setup_arch] saved_command_line %s\n", saved_command_line); parse_cmdline(cmdline_p, from); + paging_init(&meminfo, mdesc); request_standard_resources(&meminfo, mdesc); @@ -785,6 +821,15 @@ conswitchp = &dummy_con; #endif #endif + + /*--- das Environment kann erst initialisiert werden, wenn das Memorymapping eingerichtet ist ---*/ + env_init(phys_to_virt((unsigned long)pEnvironment)); +} + +/*------------------------------------------------------------------------------------------*\ +\*------------------------------------------------------------------------------------------*/ +char *getcmdline(void) { + return default_command_line; }