lkml.org 
[lkml]   [2011]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH v5 10/10] x86, efi: EFI boot stub support
Hey Matt,

On 11/23/2011 08:27 PM, Matt Fleming wrote:

> On Wed, 2011-11-23 at 01:44 +0100, Maarten Lankhorst wrote:
>> When I tested this with v3.2-rc2 it didn't boot, it hung before it
>> initialized the kernel.
>> Without initrd it works fine, though.
> Bah, so this change actually makes booting worse? You said before that
> you almost made it to userspace but this seems to hang much earlier now.
> Is that correct?
>
> ... back to the drawing board.
I was looking at why grub2 could boot, seems to be it reads in chunks of
256 kilobytes. I seem to be able to get it to boot with chunks of 4 mb
as well, but didn't test beyond that.

So the fix is to simply read the file in parts, otherwise efi hangs..
As a nice side effect, short reads are also handled, but the efi
firmware seems to choke over huge reads and dies.

diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index 8627a56..9b076f0 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -695,14 +695,16 @@ grow:
u64 size;

size = initrds[j].size;
- status = efi_call_phys3(fh->read, initrds[j].handle,
- &size, addr);
- if (status != EFI_SUCCESS)
- goto free_initrd_total;
-
+ while (size) {
+ u64 toread = size > 1024 * 1024 ? 1024 * 1024 : size;
+ status = efi_call_phys3(fh->read, initrds[j].handle,
+ &toread, addr);
+ if (status != EFI_SUCCESS)
+ goto free_initrd_total;
+ size -= toread;
+ addr += toread;
+ }
efi_call_phys1(fh->close, initrds[j].handle);
-
- addr += size;
}

}



\
 
 \ /
  Last update: 2011-11-24 15:45    [W:0.163 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site