On Wed, Jun 4, 2008 at 12:28 AM, Isaac Dupree <[EMAIL PROTECTED]> wrote: > Bean wrote: >> >> Hi, >> >> The problem with initrd is that it can't allocate enough memory. >> Please try the following patch, it will show some info that could be >> be useful in debugging. > > linux (hd0,4)/vmlinuz > [Linux-EFI, setup=0x2a00, size=0x1d2798] > initrd (hd0,4)/initrd.img > 679000 1ffeffff 832
Hi, I figure it out now, there is some problem with the initrd allocation algorithm, the following patch should fix it: diff --git a/loader/i386/efi/linux.c b/loader/i386/efi/linux.c index ee3fb99..8d0e0c2 100644 --- a/loader/i386/efi/linux.c +++ b/loader/i386/efi/linux.c @@ -601,7 +604,7 @@ grub_rescue_cmd_initrd (int argc, char *argv[]) lh = (struct linux_kernel_header *) real_mode_mem; - addr_max = grub_cpu_to_le32 (lh->initrd_addr_max); + addr_max = (grub_cpu_to_le32 (lh->initrd_addr_max) << 10); if (linux_mem_size != 0 && linux_mem_size < addr_max) addr_max = linux_mem_size; @@ -612,7 +615,8 @@ grub_rescue_cmd_initrd (int argc, char *argv[]) addr_max -= 0x10000; /* Usually, the compression ratio is about 50%. */ - addr_min = (grub_addr_t) prot_mode_mem + ((prot_mode_pages * 3) << 12); + addr_min = (grub_addr_t) prot_mode_mem + ((prot_mode_pages * 3) << 12) + + page_align (size); /* Find the highest address to put the initrd. */ mmap_size = find_mmap_size (); @@ -625,8 +629,6 @@ grub_rescue_cmd_initrd (int argc, char *argv[]) desc = NEXT_MEMORY_DESCRIPTOR (desc, desc_size)) { if (desc->type == GRUB_EFI_CONVENTIONAL_MEMORY - && desc->physical_start >= addr_min - && desc->physical_start + size < addr_max && desc->num_pages >= initrd_pages) { grub_efi_physical_address_t physical_end; @@ -635,6 +637,9 @@ grub_rescue_cmd_initrd (int argc, char *argv[]) if (physical_end > addr_max) physical_end = addr_max; + if (physical_end < addr_min) + continue; + if (physical_end > addr) addr = physical_end - page_align (size); } -- Bean _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel