From 31d3c4f444751c8dd4bbcd4f76276b08e6cceb5b0fd2eb7cf62a43ddc077b50b Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Sat, 30 Jan 2021 05:56:02 +0000 Subject: [PATCH] Accepting request 867843 from home:michael-chang:branches:Base:System * 0009-squash-Add-support-for-linuxefi.patch OBS-URL: https://build.opensuse.org/request/show/867843 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=370 --- ...or-Linux-EFI-stub-loading-on-aarch64.patch | 2 +- ...fdt-has-address-cells-and-size-cells.patch | 2 +- 0003-Make-grub_error-more-verbose.patch | 2 +- ...-Better-memory-allocation-and-error-.patch | 2 +- ...ernel_header.hdr_offset-be-at-the-ri.patch | 2 +- ...se-address-before-jumping-to-the-PE-.patch | 2 +- ...rnel-validation-without-shim-protoco.patch | 2 +- ...rt-for-Linux-EFI-stub-loading-on-aar.patch | 2 +- 0009-squash-Add-support-for-linuxefi.patch | 39 +++++++++++++++++++ grub2.changes | 1 + grub2.spec | 2 + 11 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 0009-squash-Add-support-for-linuxefi.patch diff --git a/0001-Add-support-for-Linux-EFI-stub-loading-on-aarch64.patch b/0001-Add-support-for-Linux-EFI-stub-loading-on-aarch64.patch index e22685b..54caf31 100644 --- a/0001-Add-support-for-Linux-EFI-stub-loading-on-aarch64.patch +++ b/0001-Add-support-for-Linux-EFI-stub-loading-on-aarch64.patch @@ -1,7 +1,7 @@ From db4da8095b5ba722d22502c8d090e66816a5577d Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Fri, 6 Nov 2020 08:36:36 +0000 -Subject: [PATCH 1/8] Add support for Linux EFI stub loading on aarch64. +Subject: [PATCH 1/9] Add support for Linux EFI stub loading on aarch64. Add support for Linux EFI stub loading on aarch64. --- diff --git a/0002-arm64-make-sure-fdt-has-address-cells-and-size-cells.patch b/0002-arm64-make-sure-fdt-has-address-cells-and-size-cells.patch index 56a68d4..6938346 100644 --- a/0002-arm64-make-sure-fdt-has-address-cells-and-size-cells.patch +++ b/0002-arm64-make-sure-fdt-has-address-cells-and-size-cells.patch @@ -1,7 +1,7 @@ From e27acddebd30175587155613042abffd2e9a5de8 Mon Sep 17 00:00:00 2001 From: Mark Salter Date: Mon, 17 Apr 2017 08:44:29 -0400 -Subject: [PATCH 2/8] arm64: make sure fdt has #address-cells and #size-cells +Subject: [PATCH 2/9] arm64: make sure fdt has #address-cells and #size-cells properties Recent upstream changes to kexec-tools relies on #address-cells diff --git a/0003-Make-grub_error-more-verbose.patch b/0003-Make-grub_error-more-verbose.patch index 3bd149f..1e5b580 100644 --- a/0003-Make-grub_error-more-verbose.patch +++ b/0003-Make-grub_error-more-verbose.patch @@ -1,7 +1,7 @@ From 3526c4e467ee01a3cfd2f4d627433d078a1ab780 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 27 Aug 2018 13:14:06 -0400 -Subject: [PATCH 3/8] Make grub_error() more verbose +Subject: [PATCH 3/9] Make grub_error() more verbose Signed-off-by: Peter Jones --- diff --git a/0004-arm-arm64-loader-Better-memory-allocation-and-error-.patch b/0004-arm-arm64-loader-Better-memory-allocation-and-error-.patch index 7ade7fb..1a83e9d 100644 --- a/0004-arm-arm64-loader-Better-memory-allocation-and-error-.patch +++ b/0004-arm-arm64-loader-Better-memory-allocation-and-error-.patch @@ -1,7 +1,7 @@ From 5d417346956bc3108183020a8a9f20ddda034b48 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 11 Jul 2019 14:38:57 +0200 -Subject: [PATCH 4/8] arm/arm64 loader: Better memory allocation and error +Subject: [PATCH 4/9] arm/arm64 loader: Better memory allocation and error messages. On mustang, our memory map looks like: diff --git a/0005-Make-linux_arm_kernel_header.hdr_offset-be-at-the-ri.patch b/0005-Make-linux_arm_kernel_header.hdr_offset-be-at-the-ri.patch index 79b4489..dd22c30 100644 --- a/0005-Make-linux_arm_kernel_header.hdr_offset-be-at-the-ri.patch +++ b/0005-Make-linux_arm_kernel_header.hdr_offset-be-at-the-ri.patch @@ -1,7 +1,7 @@ From 669aa440ca34f6d8982c92b79fa2ee84c20618c6 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 16 Aug 2018 11:08:11 -0400 -Subject: [PATCH 5/8] Make linux_arm_kernel_header.hdr_offset be at the right +Subject: [PATCH 5/9] Make linux_arm_kernel_header.hdr_offset be at the right place The kernel in front of me (slightly edited to make objdump work) looks like: diff --git a/0006-efi-Set-image-base-address-before-jumping-to-the-PE-.patch b/0006-efi-Set-image-base-address-before-jumping-to-the-PE-.patch index 8aa209b..f645df5 100644 --- a/0006-efi-Set-image-base-address-before-jumping-to-the-PE-.patch +++ b/0006-efi-Set-image-base-address-before-jumping-to-the-PE-.patch @@ -1,7 +1,7 @@ From 3741c6807923ae97b0d87e61c59c8de8af544484 Mon Sep 17 00:00:00 2001 From: Javier Martinez Canillas Date: Thu, 23 Apr 2020 15:06:46 +0200 -Subject: [PATCH 6/8] efi: Set image base address before jumping to the PE/COFF +Subject: [PATCH 6/9] efi: Set image base address before jumping to the PE/COFF entry point Upstream GRUB uses the EFI LoadImage() and StartImage() to boot the Linux diff --git a/0007-linuxefi-fail-kernel-validation-without-shim-protoco.patch b/0007-linuxefi-fail-kernel-validation-without-shim-protoco.patch index 97d3c37..26f193a 100644 --- a/0007-linuxefi-fail-kernel-validation-without-shim-protoco.patch +++ b/0007-linuxefi-fail-kernel-validation-without-shim-protoco.patch @@ -1,7 +1,7 @@ From 496890ebd2605eb1ff15f8d96c30b5d617f1bb85 Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Fri, 6 Nov 2020 11:19:06 +0000 -Subject: [PATCH 7/8] linuxefi: fail kernel validation without shim protocol. +Subject: [PATCH 7/9] linuxefi: fail kernel validation without shim protocol. If certificates that signed grub are installed into db, grub can be booted directly. It will then boot any kernel without signature diff --git a/0008-squash-Add-support-for-Linux-EFI-stub-loading-on-aar.patch b/0008-squash-Add-support-for-Linux-EFI-stub-loading-on-aar.patch index e357efd..100a6b9 100644 --- a/0008-squash-Add-support-for-Linux-EFI-stub-loading-on-aar.patch +++ b/0008-squash-Add-support-for-Linux-EFI-stub-loading-on-aar.patch @@ -1,7 +1,7 @@ From 5f98e139f74a1280dee4f1579eeab05e08541e8c Mon Sep 17 00:00:00 2001 From: Michael Chang Date: Tue, 10 Nov 2020 04:33:21 +0000 -Subject: [PATCH 8/8] squash! Add support for Linux EFI stub loading on +Subject: [PATCH 8/9] squash! Add support for Linux EFI stub loading on aarch64. Make efi handoff the default loader for arm64 platform. diff --git a/0009-squash-Add-support-for-linuxefi.patch b/0009-squash-Add-support-for-linuxefi.patch new file mode 100644 index 0000000..f57a7db --- /dev/null +++ b/0009-squash-Add-support-for-linuxefi.patch @@ -0,0 +1,39 @@ +From 5d72f1ccbedcfc883e5f4cda60ea456cdc2b5dcd Mon Sep 17 00:00:00 2001 +From: Michael Chang +Date: Sat, 30 Jan 2021 12:34:17 +0800 +Subject: [PATCH 9/9] squash! Add support for linuxefi + +The upstream commit + +df84d6e94 efi: Print error messages to grub_efi_allocate_pages_real() + +adds grub_error() to set error message and return grub_errno. We have to +unset the grub_errno if we want to ignore the error and proceed, or +the inadvertently provoked error handler would lead to unspecified +consequence. + +Signed-off-by: Michael Chang +--- + grub-core/loader/i386/efi/linux.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c +index 3f6d51519..742b215a3 100644 +--- a/grub-core/loader/i386/efi/linux.c ++++ b/grub-core/loader/i386/efi/linux.c +@@ -283,8 +283,11 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), + BYTES_TO_PAGES(lh.init_size)); + + if (!kernel_mem) +- kernel_mem = grub_efi_allocate_pages_max(0x3fffffff, ++ { ++ grub_errno = GRUB_ERR_NONE; ++ kernel_mem = grub_efi_allocate_pages_max(0x3fffffff, + BYTES_TO_PAGES(lh.init_size)); ++ } + + if (!kernel_mem) + { +-- +2.26.2 + diff --git a/grub2.changes b/grub2.changes index f48745f..c3e6f7f 100644 --- a/grub2.changes +++ b/grub2.changes @@ -10,6 +10,7 @@ Wed Jan 27 04:13:32 UTC 2021 - Michael Chang * 0006-efi-Set-image-base-address-before-jumping-to-the-PE-.patch * 0007-linuxefi-fail-kernel-validation-without-shim-protoco.patch * 0008-squash-Add-support-for-Linux-EFI-stub-loading-on-aar.patch + * 0009-squash-Add-support-for-linuxefi.patch ------------------------------------------------------------------- Thu Jan 21 07:59:39 UTC 2021 - Michael Chang diff --git a/grub2.spec b/grub2.spec index c477d5e..bbc9597 100644 --- a/grub2.spec +++ b/grub2.spec @@ -345,6 +345,7 @@ Patch734: 0005-Make-linux_arm_kernel_header.hdr_offset-be-at-the-ri.patch Patch735: 0006-efi-Set-image-base-address-before-jumping-to-the-PE-.patch Patch736: 0007-linuxefi-fail-kernel-validation-without-shim-protoco.patch Patch737: 0008-squash-Add-support-for-Linux-EFI-stub-loading-on-aar.patch +Patch738: 0009-squash-Add-support-for-linuxefi.patch Requires: gettext-runtime %if 0%{?suse_version} >= 1140 @@ -683,6 +684,7 @@ swap partition while in resuming %patch735 -p1 %patch736 -p1 %patch737 -p1 +%patch738 -p1 %build # collect evidence to debug spurious build failure on SLE15