forked from pool/grub2
8ee92f5194
- Implement NV index mode for TPM 2.0 key protector 0001-protectors-Implement-NV-index.patch - Fall back to passphrase mode when the key protector fails to unlock the disk 0002-cryptodisk-Fallback-to-passphrase.patch - Wipe out the cached key cleanly 0003-cryptodisk-wipe-out-the-cached-keys-from-protectors.patch - Make diskfiler to look up cryptodisk devices first 0004-diskfilter-look-up-cryptodisk-devices-first.patch - Version bump to 2.12~rc1 * Added: - grub-2.12~rc1.tar.xz * Removed: - grub-2.06.tar.xz * Patch dropped merged by new version: - grub2-GRUB_CMDLINE_LINUX_RECOVERY-for-recovery-mode.patch - grub2-s390x-02-kexec-module-added-to-emu.patch - grub2-efi-chainloader-root.patch - grub2-Fix-incorrect-netmask-on-ppc64.patch - 0001-osdep-Introduce-include-grub-osdep-major.h-and-use-i.patch - 0002-osdep-linux-hostdisk-Use-stat-instead-of-udevadm-for.patch - 0002-net-read-bracketed-ipv6-addrs-and-port-numbers.patch - grub2-s390x-10-keep-network-at-kexec.patch - 0001-Fix-build-error-in-binutils-2.36.patch - 0001-emu-fix-executable-stack-marking.patch - 0046-squash-verifiers-Move-verifiers-API-to-kernel-image.patch - 0001-30_uefi-firmware-fix-printf-format-with-null-byte.patch - 0001-tpm-Pass-unknown-error-as-non-fatal-but-debug-print-.patch - 0001-Filter-out-POSIX-locale-for-translation.patch OBS-URL: https://build.opensuse.org/request/show/1105405 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=458
84 lines
3.2 KiB
Diff
84 lines
3.2 KiB
Diff
From 6c06378c1bf6ae21788427e62ab0011b7f1bc2f0 Mon Sep 17 00:00:00 2001
|
|
From: Michael Chang <mchang@suse.com>
|
|
Date: Fri, 25 Nov 2022 16:11:24 +0800
|
|
Subject: [PATCH] xen_boot: add missing grub_arch_efi_linux_load_image_header
|
|
|
|
The new xen_boot module has used grub_arch_efi_linux_load_image_header
|
|
exported by grub-core/loader/arm64/linux.c. It is not a problem for
|
|
upstream but many downstream projects may not use it and take
|
|
grub-core/loader/arm64/efi/linux.c as a replacement as PE entry is the
|
|
preferred way in combination with shim loader.
|
|
|
|
This patch did a trivial workaround just adding back the dropped
|
|
defintion to the xen_boot itself.
|
|
|
|
Signed-off-by: Michael Chang <mchang@suse.com>
|
|
---
|
|
grub-core/loader/arm64/xen_boot.c | 50 +++++++++++++++++++++++++++++++
|
|
1 file changed, 50 insertions(+)
|
|
|
|
diff --git a/grub-core/loader/arm64/xen_boot.c b/grub-core/loader/arm64/xen_boot.c
|
|
index 26e1472c9..b82a2db89 100644
|
|
--- a/grub-core/loader/arm64/xen_boot.c
|
|
+++ b/grub-core/loader/arm64/xen_boot.c
|
|
@@ -84,6 +84,56 @@ static int loaded;
|
|
static struct xen_boot_binary *xen_hypervisor;
|
|
static struct xen_boot_binary *module_head;
|
|
|
|
+/* The function is exported by grub-core/loader/arm64/linux.c that is not built
|
|
+ * because we use PE entry provided by grub-core/loader/arm64/efi/linux.c
|
|
+ */
|
|
+static bool initrd_use_loadfile2 = false;
|
|
+
|
|
+grub_err_t
|
|
+grub_arch_efi_linux_load_image_header (grub_file_t file,
|
|
+ struct linux_arch_kernel_header * lh)
|
|
+{
|
|
+ grub_file_seek (file, 0);
|
|
+ if (grub_file_read (file, lh, sizeof (*lh)) < (grub_ssize_t) sizeof (*lh))
|
|
+ return grub_error(GRUB_ERR_FILE_READ_ERROR, "failed to read Linux image header");
|
|
+
|
|
+ if ((lh->code0 & 0xffff) != GRUB_PE32_MAGIC)
|
|
+ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
|
+ N_("plain image kernel not supported - rebuild with CONFIG_(U)EFI_STUB enabled"));
|
|
+
|
|
+ grub_dprintf ("linux", "UEFI stub kernel:\n");
|
|
+ grub_dprintf ("linux", "PE/COFF header @ %08x\n", lh->hdr_offset);
|
|
+
|
|
+ /*
|
|
+ * The PE/COFF spec permits the COFF header to appear anywhere in the file, so
|
|
+ * we need to double check whether it was where we expected it, and if not, we
|
|
+ * must load it from the correct offset into the pe_image_header field of
|
|
+ * struct linux_arch_kernel_header.
|
|
+ */
|
|
+ if ((grub_uint8_t *) lh + lh->hdr_offset != (grub_uint8_t *) &lh->pe_image_header)
|
|
+ {
|
|
+ if (grub_file_seek (file, lh->hdr_offset) == (grub_off_t) -1
|
|
+ || grub_file_read (file, &lh->pe_image_header,
|
|
+ sizeof (struct grub_pe_image_header))
|
|
+ != sizeof (struct grub_pe_image_header))
|
|
+ return grub_error (GRUB_ERR_FILE_READ_ERROR, "failed to read COFF image header");
|
|
+ }
|
|
+
|
|
+ /*
|
|
+ * Linux kernels built for any architecture are guaranteed to support the
|
|
+ * LoadFile2 based initrd loading protocol if the image version is >= 1.
|
|
+ */
|
|
+ if (lh->pe_image_header.optional_header.major_image_version >= 1)
|
|
+ initrd_use_loadfile2 = true;
|
|
+ else
|
|
+ initrd_use_loadfile2 = false;
|
|
+
|
|
+ grub_dprintf ("linux", "LoadFile2 initrd loading %sabled\n",
|
|
+ initrd_use_loadfile2 ? "en" : "dis");
|
|
+
|
|
+ return GRUB_ERR_NONE;
|
|
+}
|
|
+
|
|
static __inline grub_addr_t
|
|
xen_boot_address_align (grub_addr_t start, grub_size_t align)
|
|
{
|
|
--
|
|
2.41.0
|
|
|