Atsushi Nemoto wrote: > On Mon, 16 Oct 2006 10:03:13 +0200, Franck Bui-Huu <vagabon.xyz@xxxxxxxxx> wrote: >>> end = (unsigned long)&_end; >>> tmp = PAGE_ALIGN(end) - sizeof(u32) * 2; >>> if (tmp < end) >>> tmp += PAGE_SIZE; >>> >> Any idea on what is this code for ? >> It seems that a minimum gap is needed betweend the end of kernel >> code and initrd but I don't see why... > > Perhaps because current tools put initrd image at that place. > > For example: > > arch/mips/boot/addinitrd.c:92: > loadaddr = ((SWAB(esecs[2].s_vaddr) + SWAB(esecs[2].s_size) > + MIPS_PAGE_SIZE-1) & ~MIPS_PAGE_MASK) - 8; > if (loadaddr < (SWAB(esecs[2].s_vaddr) + SWAB(esecs[2].s_size))) > loadaddr += MIPS_PAGE_SIZE; > initrd_header[0] = SWAB(0x494E5244); > initrd_header[1] = SWAB(st.st_size); > thanks but it doesn't explain anything either...Anyways what about this patch on top of the previous one ? -- >8 -- diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index 811a8fd..0e61e18 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -177,15 +177,13 @@ static unsigned long __init init_initrd( if (initrd_end > initrd_start) goto sanitize; - end = (unsigned long)&_end; - tmp = PAGE_ALIGN(end) - sizeof(u32) * 2; - if (tmp < end) - tmp += PAGE_SIZE; - + /* + * FIXME: a good comment would be nice here... + */ + initrd_header = __va(PAGE_ALIGN(__pa_symbol(&_end) + sizeof(u32) * 2 + 1)); initrd_start = 0; initrd_end = 0; end = 0; - initrd_header = (u32 *)tmp; if (initrd_header[0] == 0x494E5244) { initrd_start = (unsigned long)&initrd_header[2]; initrd_end = initrd_start + initrd_header[1];