Add patch from https://github.com/rhboot/grub2/pull/30 to fix uefi booting

Resolves: rhbz#1624532
This commit is contained in:
Kevin Fenzi 2018-09-07 10:17:38 -07:00
parent 66fa5861ee
commit 1b51084aaa
3 changed files with 69 additions and 1 deletions

View File

@ -0,0 +1,63 @@
From d2332fd171c4ed22aa4f226bdbc5aec24589144f Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 3 Sep 2018 10:44:40 +0200
Subject: [PATCH] Fix "Try to pick better locations for kernel and initrd"
causing boot to fail on some UEFI x86_64 systems
The "Try to pick better locations for kernel and initrd" commit causes boot
to fail on some UEFI x86_64 systems (Sandy Bridge) with these errors:
grub-core/loader/i386/efi/linux.c:217:cannot allocate kernel parameters.
grub-core/loader/i386/efi/linux.c:94:you need to load the kernel first.
This commit fixes this by retrying the memory allocations changed by
the "Try to pick better locations for kernel and initrd" commit with
the old memory limit of 0x3fffffff.
BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1624525
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
grub-core/loader/i386/efi/linux.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c
index fddf547..15f6b40 100644
--- a/grub-core/loader/i386/efi/linux.c
+++ b/grub-core/loader/i386/efi/linux.c
@@ -110,6 +110,10 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
}
initrd_mem = grub_efi_allocate_pages_max (GRUB_EFI_MAX_USABLE_ADDRESS, BYTES_TO_PAGES(size));
+
+ if (!initrd_mem)
+ initrd_mem = grub_efi_allocate_pages_max (0x3fffffff, BYTES_TO_PAGES(size));
+
if (!initrd_mem)
{
grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate initrd"));
@@ -212,6 +216,11 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
params = grub_efi_allocate_pages_max (GRUB_EFI_MAX_USABLE_ADDRESS,
BYTES_TO_PAGES(sizeof(*params)));
+
+ if (! params)
+ params = grub_efi_allocate_pages_max (0x3fffffff,
+ BYTES_TO_PAGES(sizeof(*params)));
+
if (! params)
{
grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot allocate kernel parameters");
@@ -313,6 +322,10 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
kernel_mem = grub_efi_allocate_pages_max(GRUB_EFI_MAX_USABLE_ADDRESS,
BYTES_TO_PAGES(lh->init_size));
+ if (!kernel_mem)
+ kernel_mem = grub_efi_allocate_pages_max(0x3fffffff,
+ BYTES_TO_PAGES(lh->init_size));
+
if (!kernel_mem)
{
grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate kernel"));
--
2.19.0.rc1

View File

@ -234,3 +234,4 @@ Patch0233: 0233-Make-grub_error-more-verbose.patch
Patch0234: 0234-arm-arm64-loader-Better-memory-allocation-and-error-.patch
Patch0235: 0235-Fix-GRUB_EFI_MAX_USABLE_ADDRESS-to-be-64-bit-on-x86_.patch
Patch0236: 0236-Try-to-pick-better-locations-for-kernel-and-initrd.patch
Patch0237: 0237-Fix-Try-to-pick-better-locations-for-kernel-and-init.patch

View File

@ -7,7 +7,7 @@
Name: grub2
Epoch: 1
Version: 2.02
Release: 53%{?dist}
Release: 54%{?dist}
Summary: Bootloader with support for Linux, Multiboot and more
Group: System Environment/Base
License: GPLv3+
@ -498,6 +498,10 @@ fi
%endif
%changelog
* Fri Sep 07 2018 Kevin Fenzi <kevin@scrye.com> - 2.02-54
- Add patch from https://github.com/rhboot/grub2/pull/30 to fix uefi booting
- Resolves: rhbz#1624532
* Thu Aug 30 2018 Peter Jones <pjones@redhat.com> - 2.02-53
- Fix AArch64 machines with no RAM latched lower than 1GB
Resolves: rhbz#1615969