[PATCH v2 3/6] kexec, x86: put ramdisk high for 64bit bzImage
Eric W. Biederman
ebiederm at xmission.com
Mon Nov 19 12:20:00 EST 2012
Yinghai Lu <yinghai at kernel.org> writes:
> only do that for 64bit bzImage, and will fall back to low if fail to
> get high.
The way you have modified the code is silly.
You should be able to do this with one add_buffer call. Making
the breaking of all of the add_buffer callers unnecessary.
You just need to supply a larger range to add_buffer.
You can get a wider range to add_buffer by modifying the initialization
of initrd_addr_max to account for boot protocol 0x020c.
> Signed-off-by: Yinghai Lu <yinghai at kernel.org>
> ---
> kexec/arch/i386/x86-linux-setup.c | 30 ++++++++++++++++++++++--------
> 1 files changed, 22 insertions(+), 8 deletions(-)
>
> diff --git a/kexec/arch/i386/x86-linux-setup.c b/kexec/arch/i386/x86-linux-setup.c
> index 53d9df9..b0e6119 100644
> --- a/kexec/arch/i386/x86-linux-setup.c
> +++ b/kexec/arch/i386/x86-linux-setup.c
> @@ -69,20 +69,34 @@ void setup_linux_bootloader_parameters(
> }
>
> /* Load the initrd if we have one */
> + initrd_base = 0;
> if (initrd_buf) {
> - initrd_base = add_buffer(info,
> - initrd_buf, initrd_size, initrd_size,
> - 4096, INITRD_BASE, initrd_addr_max, -1);
> + if (real_mode->protocol_version >= 0x020c &&
> + real_mode->code64_start_offset) {
> + initrd_base = add_buffer(info,
> + initrd_buf, initrd_size, initrd_size,
> + 4096, 1UL<<32, ULONG_MAX, -1);
> + if (!initrd_base)
> + initrd_base = add_buffer(info,
> + initrd_buf, initrd_size, initrd_size,
> + 4096, 1UL<<30, 1UL<<32, -1);
> + }
> + if (!initrd_base)
> + initrd_base = add_buffer(info,
> + initrd_buf, initrd_size, initrd_size,
> + 4096, INITRD_BASE, initrd_addr_max, -1);
> dbgprintf("Loaded initrd at 0x%lx size 0x%lx\n", initrd_base,
> initrd_size);
> - } else {
> - initrd_base = 0;
> + } else
> initrd_size = 0;
> - }
>
> /* Ramdisk address and size */
> - real_mode->initrd_start = initrd_base;
> - real_mode->initrd_size = initrd_size;
> + real_mode->initrd_start = initrd_base & 0xffffffff;
> + real_mode->initrd_size = initrd_size & 0xffffffff;
> + if ((initrd_base + initrd_size) > (1ULL<<32)) {
> + real_mode->ext_ramdisk_image = initrd_base >> 32;
> + real_mode->ext_ramdisk_size = initrd_size >> 32;
> + }
And this needs to compile 32bit which where 1ULL<<32 doesn't work. So I
suggest you make the code look like:
+ if (real_mode->protocol_version >= 0x020c &&
+ (initrd_base & 0xffffffffUL) != initrd_base)
+ real_mode->ext_ramdisk_image = initrd_base >> 32;
+
+ if (real_mode->protocol_version >= 0x020c &&
+ (initrd_size & 0xffffffffUL) != initrd_size)
+ real_mode->ext_ramdisk_size = initrd_size >> 32;
Eric
> /* The location of the command line */
> /* if (real_mode_base == 0x90000) { */
More information about the kexec
mailing list