diff -u --recursive ../../clean/linux-4.14.62/arch/x86/boot/compressed/eboot.c linux-4.14.62/arch/x86/boot/compressed/eboot.c --- ../../clean/linux-4.14.62/arch/x86/boot/compressed/eboot.c 2018-08-09 06:16:40.000000000 -0400 +++ linux-4.14.62/arch/x86/boot/compressed/eboot.c 2018-08-09 10:13:11.801000000 -0400 @@ -630,8 +630,8 @@ u16 *s2; u8 *s1; int i; - unsigned long ramdisk_addr; - unsigned long ramdisk_size; + unsigned long ramdisk_addr = 0; + unsigned long ramdisk_size = 0; efi_early = c; sys_table = (efi_system_table_t *)(unsigned long)efi_early->table; @@ -686,9 +686,6 @@ /* Fill in upper bits of command line address, NOP on 32 bit */ boot_params->ext_cmd_line_ptr = (u64)(unsigned long)cmdline_ptr >> 32; - hdr->ramdisk_image = 0; - hdr->ramdisk_size = 0; - /* Clear APM BIOS info */ memset(bi, 0, sizeof(*bi)); @@ -712,10 +709,16 @@ if (status != EFI_SUCCESS) goto fail2; - hdr->ramdisk_image = ramdisk_addr & 0xffffffff; - hdr->ramdisk_size = ramdisk_size & 0xffffffff; - boot_params->ext_ramdisk_image = (u64)ramdisk_addr >> 32; - boot_params->ext_ramdisk_size = (u64)ramdisk_size >> 32; + + // don't overwrite the bzImage or loader provided ramdisk pointer + // unless the kernel command line specified a different one. + if (ramdisk_addr != 0) + { + hdr->ramdisk_image = ramdisk_addr & 0xffffffff; + hdr->ramdisk_size = ramdisk_size & 0xffffffff; + boot_params->ext_ramdisk_image = (u64)ramdisk_addr >> 32; + boot_params->ext_ramdisk_size = (u64)ramdisk_size >> 32; + } return boot_params; fail2: