From: Isaac Dupree <id@isaac.cedarswampstudios.org>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: macbook EFI experiences
Date: Wed, 04 Jun 2008 07:01:20 -0400 [thread overview]
Message-ID: <48467600.9090203@isaac.cedarswampstudios.org> (raw)
In-Reply-To: <ca0f59980806031128q3753f536s72bf3cb3d90ac1a5@mail.gmail.com>
how do you apply this patch? With `patch -p1` I'm getting:
2 out of 4 hunks FAILED -- saving rejects to file
loader/i386/efi/linux.c.rej
any more infos needed?
-Isaac
Bean wrote:
> 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);
> }
>
next prev parent reply other threads:[~2008-06-04 11:01 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-30 14:42 macbook EFI experiences Isaac Dupree
2008-05-30 15:18 ` Robert Millan
2008-05-30 16:06 ` Isaac Dupree
2008-05-30 16:17 ` Bean
2008-05-30 16:29 ` Isaac Dupree
2008-05-30 19:26 ` Robert Millan
2008-05-30 21:01 ` Isaac Dupree
2008-05-31 9:35 ` Robert Millan
2008-05-31 9:41 ` rename partmap/pc.c? (Re: macbook EFI experiences) Robert Millan
2008-05-31 17:13 ` Pavel Roskin
2008-06-01 10:23 ` Robert Millan
2008-06-01 17:44 ` Pavel Roskin
2008-05-31 18:57 ` macbook EFI experiences Isaac Dupree
2008-05-31 19:26 ` Robert Millan
2008-05-31 19:52 ` Bean
2008-05-31 21:10 ` Robert Millan
2008-05-31 21:46 ` Isaac Dupree
2008-06-03 6:06 ` Bean
2008-06-03 16:28 ` Isaac Dupree
2008-06-03 18:28 ` Bean
2008-06-04 11:01 ` Isaac Dupree [this message]
2008-06-04 11:08 ` Bean
2008-06-04 11:27 ` Isaac Dupree
2008-06-04 11:35 ` Bean
2008-06-04 13:03 ` Isaac Dupree
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48467600.9090203@isaac.cedarswampstudios.org \
--to=id@isaac.cedarswampstudios.org \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.