Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1463392 > unrolled thread
| Started by | Matt Mullins <mmullins@mmlx.us> |
|---|---|
| First post | 2016-08-16 06:20 +0200 |
| Last post | 2016-08-17 04:30 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH 2/6] x86/boot: Move compressed kernel to end of decompression buffer Matt Mullins <mmullins@mmlx.us> - 2016-08-16 06:20 +0200
Re: [PATCH 2/6] x86/boot: Move compressed kernel to end of decompression buffer Yinghai Lu <yinghai@kernel.org> - 2016-08-16 21:20 +0200
Re: [PATCH 2/6] x86/boot: Move compressed kernel to end of decompression buffer Matt Mullins <mmullins@mmlx.us> - 2016-08-17 04:30 +0200
| From | Matt Mullins <mmullins@mmlx.us> |
|---|---|
| Date | 2016-08-16 06:20 +0200 |
| Subject | Re: [PATCH 2/6] x86/boot: Move compressed kernel to end of decompression buffer |
| Message-ID | <s6E13-6G7-1@gated-at.bofh.it> |
[added Simon Glass to CC in case there's some input from u-boot] On Thu, Apr 28, 2016 at 05:09:04PM -0700, Kees Cook wrote: > From: Yinghai Lu <yinghai@kernel.org> > > This patch adds BP_init_size (which is the INIT_SIZE as passed in from > the boot_params) into asm-offsets.c to make it visible to the assembly > code. Then when moving the ZO, it calculates the starting position of > the copied ZO (via BP_init_size and the ZO run size) so that the VO__end > will be at the end of the decompression buffer. To make the position > calculation safe, the end of ZO is page aligned (and a comment is added > to the existing VO alignment for good measure). > diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S > index d43c30ed89ed..09cdc0c3ee7e 100644 > --- a/arch/x86/boot/compressed/head_64.S > +++ b/arch/x86/boot/compressed/head_64.S > @@ -338,7 +340,9 @@ preferred_addr: > 1: > > /* Target address to relocate to for decompression */ > - leaq z_extract_offset(%rbp), %rbx > + movl BP_init_size(%rsi), %ebx > + subl $_end, %ebx > + addq %rbp, %rbx > > /* Set up the stack */ > leaq boot_stack_end(%rbx), %rsp This appears to have a negative effect on booting the Intel Edison platform, as it uses u-boot as its bootloader. u-boot does not copy the init_size parameter when booting a bzImage: it copies a fixed-size setup_header [1], and its definition of setup_header doesn't include the parameters beyond setup_data [2]. With a zero value for init_size, this calculates a %rsp value of 0x101ff9600. This causes the boot process to hard-stop at the immediately-following pushq, as this platform has no usable physical addresses above 4G. What are the options for getting this type of platform to function again? For now, kexec from a working Linux system does seem to be a work-around, but there appears to be other x86 hardware using u-boot: the chromium.org folks seem to be maintaining the u-boot x86 tree. [1] http://git.denx.de/?p=u-boot.git;a=blob;f=arch/x86/lib/zimage.c;h=1b33c771391f49ffe82864ff1582bdfd07e5e97d;hb=HEAD#l156 [2] http://git.denx.de/?p=u-boot.git;a=blob;f=arch/x86/include/asm/bootparam.h;h=140095117e5a2daef0a097c55f0ed10e08acc781;hb=HEAD#l24
[toc] | [next] | [standalone]
| From | Yinghai Lu <yinghai@kernel.org> |
|---|---|
| Date | 2016-08-16 21:20 +0200 |
| Message-ID | <s6S42-73X-1@gated-at.bofh.it> |
| In reply to | #1463392 |
On Mon, Aug 15, 2016 at 9:01 PM, Matt Mullins <mmullins@mmlx.us> wrote:
>
> This appears to have a negative effect on booting the Intel Edison platform, as
> it uses u-boot as its bootloader. u-boot does not copy the init_size parameter
> when booting a bzImage: it copies a fixed-size setup_header [1], and its
> definition of setup_header doesn't include the parameters beyond setup_data [2].
>
> With a zero value for init_size, this calculates a %rsp value of 0x101ff9600.
> This causes the boot process to hard-stop at the immediately-following pushq, as
> this platform has no usable physical addresses above 4G.
>
> What are the options for getting this type of platform to function again? For
> now, kexec from a working Linux system does seem to be a work-around, but there
> appears to be other x86 hardware using u-boot: the chromium.org folks seem to be
> maintaining the u-boot x86 tree.
>
> [1] http://git.denx.de/?p=u-boot.git;a=blob;f=arch/x86/lib/zimage.c;h=1b33c771391f49ffe82864ff1582bdfd07e5e97d;hb=HEAD#l156
> [2] http://git.denx.de/?p=u-boot.git;a=blob;f=arch/x86/include/asm/bootparam.h;h=140095117e5a2daef0a097c55f0ed10e08acc781;hb=HEAD#l24
Then should fix the u-boot about header_size assumption.
correct way should be like kexec one:
/* only copy setup_header */
setup_header_size = kernel[0x201] + 0x202 - 0x1f1;
if (setup_header_size > 0x7f)
setup_header_size = 0x7f;
memcpy((unsigned char *)real_mode + 0x1f1, kernel + 0x1f1,
setup_header_size);
need get setup_header_size at first before copying.
setup_base->hdr = params->hdr;
===>
unsigned long setup_header_size;
setup_header_size = image[0x201] + 0x202 - 0x1f1;
if (setup_header_size > 0x7f)
setup_header_size = 0x7f;
memcpy((unsigned char *)&setup_base->hdr, ¶ms->hdr,
setup_header_size);
Thanks
Yinghai
[toc] | [prev] | [next] | [standalone]
| From | Matt Mullins <mmullins@mmlx.us> |
|---|---|
| Date | 2016-08-17 04:30 +0200 |
| Message-ID | <s6YM9-38J-3@gated-at.bofh.it> |
| In reply to | #1464018 |
On Tue, Aug 16, 2016 at 12:19:42PM -0700, Yinghai Lu wrote: > On Mon, Aug 15, 2016 at 9:01 PM, Matt Mullins <mmullins@mmlx.us> wrote: > > > > This appears to have a negative effect on booting the Intel Edison platform, as > > it uses u-boot as its bootloader. u-boot does not copy the init_size parameter > > when booting a bzImage: it copies a fixed-size setup_header [1], and its > > definition of setup_header doesn't include the parameters beyond setup_data [2]. > > > > With a zero value for init_size, this calculates a %rsp value of 0x101ff9600. > > This causes the boot process to hard-stop at the immediately-following pushq, as > > this platform has no usable physical addresses above 4G. > > > > What are the options for getting this type of platform to function again? For > > now, kexec from a working Linux system does seem to be a work-around, but there > > appears to be other x86 hardware using u-boot: the chromium.org folks seem to be > > maintaining the u-boot x86 tree. > > > > [1] http://git.denx.de/?p=u-boot.git;a=blob;f=arch/x86/lib/zimage.c;h=1b33c771391f49ffe82864ff1582bdfd07e5e97d;hb=HEAD#l156 > > [2] http://git.denx.de/?p=u-boot.git;a=blob;f=arch/x86/include/asm/bootparam.h;h=140095117e5a2daef0a097c55f0ed10e08acc781;hb=HEAD#l24 > > Then should fix the u-boot about header_size assumption. I was hoping to avoid that, since the Edison's u-boot is 10,000-line patch atop the upstream -- I don't trust myself to build and flash one quite yet. If this turned out to affect Chromebooks, I'd spend more effort pushing for a kernel fix, but it seems that ChromeOS has a different kernel load procedure and doesn't use "zboot". For now, I'll probably just keep a local patch that hard-codes a value large enough to decompress and launch the kernel. I may turn that local patch into something gated by a Kconfig eventually, in hopes that users of the other x86 u-boot platforms will see it in a "make oldconfig" run.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web