summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--user/grub/0001-unmerged-usr.patch36
-rw-r--r--user/grub/0002-revert-gawk.patch19
-rw-r--r--user/grub/0003-spcr-revision.patch42
-rw-r--r--user/grub/0004-videoinfo-no-reinit.patch49
-rw-r--r--user/grub/0005-vsnprintf.patch35
-rw-r--r--user/grub/0006-cryptodisk-retval.patch37
-rw-r--r--user/grub/0007-efi_gop-shadow.patch37
-rw-r--r--user/grub/0008-efi-pure64.patch110
-rw-r--r--user/grub/0009-linux-mixed-mode.patch79
-rw-r--r--user/grub/0010-fix-gcc-no-pie-specs.patch (renamed from user/grub/fix-gcc-no-pie-specs.patch)7
-rw-r--r--user/grub/APKBUILD77
-rw-r--r--user/grub/fix-deprecated-fgrep-usage.patch75
12 files changed, 491 insertions, 112 deletions
diff --git a/user/grub/0001-unmerged-usr.patch b/user/grub/0001-unmerged-usr.patch
new file mode 100644
index 000000000..93dd838c3
--- /dev/null
+++ b/user/grub/0001-unmerged-usr.patch
@@ -0,0 +1,36 @@
+From e641b4ab32f1724005ec8bf58214df86de7e81d9 Mon Sep 17 00:00:00 2001
+From: Oskari Pirhonen <xxc3ncoredxx@gmail.com>
+Date: Mon, 10 Jul 2023 23:55:43 -0500
+Subject: util/grub.d/25_bli.in: Fix shebang on unmerged-usr
+
+On an unmerged-usr system, grub-mkconfig errors out with the following
+error due to /usr/bin/sh not existing:
+
+ /usr/sbin/grub-mkconfig: /etc/grub.d/25_bli: /usr/bin/sh: bad interpreter: No such file or directory
+
+Use a /bin/sh shebang to fix the error as well as match the other
+existing files.
+
+Fixes: 158a6583e (util/grub.d/25_bli.in: Activate bli module on EFI)
+
+Signed-off-by: Oskari Pirhonen <xxc3ncoredxx@gmail.com>
+Reviewed-by: Glenn Washburn <development@efficientek.com>
+Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
+Reviewed-by: Oliver Steffen <osteffen@redhat.com>
+---
+ util/grub.d/25_bli.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/util/grub.d/25_bli.in b/util/grub.d/25_bli.in
+index 6e45387..26e27a0 100644
+--- a/util/grub.d/25_bli.in
++++ b/util/grub.d/25_bli.in
+@@ -1,4 +1,4 @@
+-#!/usr/bin/sh
++#! /bin/sh
+ set -e
+
+ # grub-mkconfig helper script.
+--
+cgit v1.1
+
diff --git a/user/grub/0002-revert-gawk.patch b/user/grub/0002-revert-gawk.patch
new file mode 100644
index 000000000..565e22d6a
--- /dev/null
+++ b/user/grub/0002-revert-gawk.patch
@@ -0,0 +1,19 @@
+Revert "grub-core/genmoddep.awk: Ensure output is deterministic"
+
+This reverts commit 87648e9c12a32bddb005b899edc44c2c9c63df82.
+
+We don't ship gawk, so we can't use asorti. The old way worked fine enough.
+
+--- grub-2.12-rc1/grub-core/genmoddep.awk.old 2023-07-10 15:43:48.000000000 +0000
++++ grub-2.12-rc1/grub-core/genmoddep.awk 2023-10-01 07:52:03.407286373 +0000
+@@ -59,9 +59,7 @@
+ }
+ modlist = ""
+ depcount[mod] = 0
+- n = asorti(uniqmods, w)
+- for (i = 1; i <= n; i++) {
+- depmod = w[i]
++ for (depmod in uniqmods) {
+ modlist = modlist " " depmod;
+ inverse_dependencies[depmod] = inverse_dependencies[depmod] " " mod
+ depcount[mod]++
diff --git a/user/grub/0003-spcr-revision.patch b/user/grub/0003-spcr-revision.patch
new file mode 100644
index 000000000..48b5e2f48
--- /dev/null
+++ b/user/grub/0003-spcr-revision.patch
@@ -0,0 +1,42 @@
+From b0890d371ca1e49877c45d696deb9102f1b605c3 Mon Sep 17 00:00:00 2001
+From: Glenn Washburn <development@efficientek.com>
+Date: Wed, 26 Jul 2023 16:02:36 -0500
+Subject: term/ns8250-spcr: Continue processing SPCR table even if revision is
+ < 2
+
+According to commit 0231d00082 (ACPI: SPCR: Make SPCR available to x86)
+to the Linux kernel, "On x86, many systems have a valid SPCR table but the
+table version is not 2 so the table version check must be a warning."
+
+Signed-off-by: Glenn Washburn <development@efficientek.com>
+Reviewed-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
+---
+ grub-core/term/ns8250-spcr.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/grub-core/term/ns8250-spcr.c b/grub-core/term/ns8250-spcr.c
+index d101bff..d52b52c 100644
+--- a/grub-core/term/ns8250-spcr.c
++++ b/grub-core/term/ns8250-spcr.c
+@@ -18,6 +18,7 @@
+
+ #if !defined(GRUB_MACHINE_IEEE1275) && !defined(GRUB_MACHINE_QEMU)
+
++#include <grub/misc.h>
+ #include <grub/serial.h>
+ #include <grub/ns8250.h>
+ #include <grub/types.h>
+@@ -34,7 +35,8 @@ grub_ns8250_spcr_init (void)
+ if (spcr == NULL)
+ return NULL;
+ if (spcr->hdr.revision < 2)
+- return NULL;
++ grub_dprintf ("serial", "SPCR table revision %d < 2, continuing anyway\n",
++ (int) spcr->hdr.revision);
+ if (spcr->intf_type != GRUB_ACPI_SPCR_INTF_TYPE_16550 &&
+ spcr->intf_type != GRUB_ACPI_SPCR_INTF_TYPE_16550X)
+ return NULL;
+--
+cgit v1.1
+
diff --git a/user/grub/0004-videoinfo-no-reinit.patch b/user/grub/0004-videoinfo-no-reinit.patch
new file mode 100644
index 000000000..c3877bf07
--- /dev/null
+++ b/user/grub/0004-videoinfo-no-reinit.patch
@@ -0,0 +1,49 @@
+From 1de58326994b0045ccfb28017d05fc1ddecdb92d Mon Sep 17 00:00:00 2001
+From: Glenn Washburn <development@efficientek.com>
+Date: Fri, 11 Aug 2023 16:30:04 -0500
+Subject: commands/videoinfo: Prevent crash when run while video driver already
+ active
+
+The videoinfo command will initialize all non-active video adapters. Video
+drivers tend to zero out the global framebuffer object on initialization.
+This is not a problem when there is no active video adapter. However, when
+there is, then outputting to the video adapter will cause a crash because
+methods in the framebuffer object are reinitialized. For example, this
+command sequence will cause a crash.
+
+ terminal_output --append gfxterm; videoinfo
+
+When running in a QEMU headless with GRUB built for the x86_64-efi target,
+the first command initializes the Bochs video adapter, which, among
+other things, sets the set_page() member function. Then when videoinfo is
+run, all non-Bochs video adapters will be initialized, each one wiping
+the framebuffer and thus setting set_page to NULL. Soon after the videoinfo
+command finishes there will be a call to grub_refresh(), which will
+ultimately call the framebuffer's set_page which will be NULL and cause
+a crash when called.
+
+Signed-off-by: Glenn Washburn <development@efficientek.com>
+Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
+---
+ grub-core/commands/videoinfo.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/grub-core/commands/videoinfo.c b/grub-core/commands/videoinfo.c
+index 5eb9697..205ba78 100644
+--- a/grub-core/commands/videoinfo.c
++++ b/grub-core/commands/videoinfo.c
+@@ -191,6 +191,11 @@ grub_cmd_videoinfo (grub_command_t cmd __attribute__ ((unused)),
+ /* Don't worry about errors. */
+ grub_errno = GRUB_ERR_NONE;
+ }
++ else if (id != GRUB_VIDEO_DRIVER_NONE)
++ {
++ grub_puts_ (N_(" A video driver is active, cannot initialize this driver until it is deactivated\n"));
++ continue;
++ }
+ else
+ {
+ if (adapter->init ())
+--
+cgit v1.1
+
diff --git a/user/grub/0005-vsnprintf.patch b/user/grub/0005-vsnprintf.patch
new file mode 100644
index 000000000..88c3e0f09
--- /dev/null
+++ b/user/grub/0005-vsnprintf.patch
@@ -0,0 +1,35 @@
+From 14c95e57fddb6c826bee7755232de62efc8eb45b Mon Sep 17 00:00:00 2001
+From: Glenn Washburn <development@efficientek.com>
+Date: Fri, 18 Aug 2023 12:15:27 -0500
+Subject: kern/misc: Make grub_vsnprintf() C99/POSIX conformant
+
+To comply with C99 and POSIX standards, snprintf() should return the
+number of bytes that would be written to the string (excluding the
+terminating NUL byte) if the buffer size was big enough. Before this
+change, the return value was the minimum of the standard return and the
+length of the buffer. Rarely is the return value of grub_snprintf() or
+grub_vsnprintf() used with current code, and the few places where it is
+used do not need to be changed.
+
+Signed-off-by: Glenn Washburn <development@efficientek.com>
+Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
+---
+ grub-core/kern/misc.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/grub-core/kern/misc.c b/grub-core/kern/misc.c
+index 2890aad..b57249a 100644
+--- a/grub-core/kern/misc.c
++++ b/grub-core/kern/misc.c
+@@ -1201,7 +1201,7 @@ grub_vsnprintf (char *str, grub_size_t n, const char *fmt, va_list ap)
+
+ free_printf_args (&args);
+
+- return ret < n ? ret : n;
++ return ret;
+ }
+
+ int
+--
+cgit v1.1
+
diff --git a/user/grub/0006-cryptodisk-retval.patch b/user/grub/0006-cryptodisk-retval.patch
new file mode 100644
index 000000000..9db7f8434
--- /dev/null
+++ b/user/grub/0006-cryptodisk-retval.patch
@@ -0,0 +1,37 @@
+From 296d3ec835ed6e3b90d740e497bb534f14fe4b79 Mon Sep 17 00:00:00 2001
+From: Glenn Washburn <development@efficientek.com>
+Date: Fri, 18 Aug 2023 12:27:22 -0500
+Subject: disk/cryptodisk: Fix missing change when updating to use
+ grub_uuidcasecmp()
+
+This was causing the cryptomount command to return failure even though
+the crypto device was successfully added. Of course, this meant that any
+script using the return code would behave unexpectedly.
+
+Fixes: 3cf2e848bc03 (disk/cryptodisk: Allows UUIDs to be compared in a dash-insensitive manner)
+
+Suggested-by: Olaf Hering <olaf@aepfle.de>
+Signed-off-by: Glenn Washburn <development@efficientek.com>
+Reviewed-by: Patrich Steinhardt <ps@pks.im>
+Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
+---
+ grub-core/disk/cryptodisk.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/grub-core/disk/cryptodisk.c b/grub-core/disk/cryptodisk.c
+index 34b67a7..fb807e2 100644
+--- a/grub-core/disk/cryptodisk.c
++++ b/grub-core/disk/cryptodisk.c
+@@ -1236,7 +1236,8 @@ grub_cryptodisk_scan_device (const char *name,
+ dev = grub_cryptodisk_scan_device_real (name, source, cargs);
+ if (dev)
+ {
+- ret = (cargs->search_uuid != NULL && grub_strcasecmp (cargs->search_uuid, dev->uuid) == 0);
++ ret = (cargs->search_uuid != NULL
++ && grub_uuidcasecmp (cargs->search_uuid, dev->uuid, sizeof (dev->uuid)) == 0);
+ goto cleanup;
+ }
+
+--
+cgit v1.1
+
diff --git a/user/grub/0007-efi_gop-shadow.patch b/user/grub/0007-efi_gop-shadow.patch
new file mode 100644
index 000000000..7709641cd
--- /dev/null
+++ b/user/grub/0007-efi_gop-shadow.patch
@@ -0,0 +1,37 @@
+From 34a3adff822a6d136430e631d0a93448b27fac4e Mon Sep 17 00:00:00 2001
+From: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
+Date: Mon, 28 Aug 2023 23:50:09 +0200
+Subject: video/efi_gop: Require shadow if PixelBltOnly
+
+If the EFI graphics pixel format is PixelBltOnly, we cannot write directly
+to the frame buffer. We need the shadow frame buffer which we copy via
+the BitBlt operation to the hardware.
+
+If the pixel format is PixelBltOnly and allocation of the shadow frame
+buffer fails, we must raise an error to signal that the EFI GOP protocol
+is not usable.
+
+Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
+Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
+---
+ grub-core/video/efi_gop.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/grub-core/video/efi_gop.c b/grub-core/video/efi_gop.c
+index 7247aee..9452f5e 100644
+--- a/grub-core/video/efi_gop.c
++++ b/grub-core/video/efi_gop.c
+@@ -480,6 +480,10 @@ grub_video_gop_setup (unsigned int width, unsigned int height,
+ if (!buffer)
+ {
+ grub_dprintf ("video", "GOP: couldn't allocate shadow\n");
++
++ if (info->pixel_format == GRUB_EFI_GOT_BLT_ONLY)
++ return grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
++
+ grub_errno = 0;
+ grub_video_gop_fill_mode_info (gop->mode->mode, info,
+ &framebuffer.mode_info);
+--
+cgit v1.1
+
diff --git a/user/grub/0008-efi-pure64.patch b/user/grub/0008-efi-pure64.patch
new file mode 100644
index 000000000..e07323c63
--- /dev/null
+++ b/user/grub/0008-efi-pure64.patch
@@ -0,0 +1,110 @@
+From 67ae3981dc5113e5af3a0539174bcd7eab8f7722 Mon Sep 17 00:00:00 2001
+From: Ard Biesheuvel <ardb@kernel.org>
+Date: Thu, 3 Aug 2023 15:24:09 +0200
+Subject: loader/i386/linux: Prefer entry in long mode when booting via EFI
+
+The x86_64 Linux kernel can be booted in 32-bit mode, in which case the
+startup code creates a set of preliminary page tables that map the first
+4 GiB of physical memory 1:1 and enables paging. This is a prerequisite
+for 64-bit execution and can therefore only be implemented in 32-bit code.
+
+The x86_64 Linux kernel can also be booted in 64-bit mode directly: this
+implies that paging is already enabled and it is the responsibility of
+the bootloader to ensure that the active page tables cover the entire
+loaded image, including its BSS space, the size of which is described in
+the image's setup header.
+
+Given that the EFI spec mandates execution in long mode for x86_64 and
+stipulates that all system memory is mapped 1:1, the Linux/x86
+requirements for 64-bit entry can be met trivially when booting on
+x86_64 via EFI. So, enter via the 64-bit entry point in this case.
+
+This involves inspecting the xloadflags field in the setup header to
+check whether the 64-bit entry point is supported. This field was
+introduced in Linux version v3.8 (early 2013).
+
+This change ensures that all EFI firmware tables and other assets passed
+by the firmware or bootloader in memory remain mapped and accessible
+throughout the early startup code.
+
+Avoiding the drop out of long mode will also be needed to support
+upcoming CPU designs that no longer implement 32-bit mode at all
+(as recently announced by Intel [0]).
+
+[0] https://www.intel.com/content/www/us/en/developer/articles/technical/envisioning-future-simplified-architecture.html
+
+Cc: Daniel Kiper <daniel.kiper@oracle.com>
+Cc: Julian Andres Klode <julian.klode@canonical.com>
+Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
+Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
+---
+ grub-core/loader/i386/linux.c | 12 ++++++++++++
+ include/grub/i386/linux.h | 15 +++++++++++++--
+ 2 files changed, 25 insertions(+), 2 deletions(-)
+
+diff --git a/grub-core/loader/i386/linux.c b/grub-core/loader/i386/linux.c
+index 997647a..977757f 100644
+--- a/grub-core/loader/i386/linux.c
++++ b/grub-core/loader/i386/linux.c
+@@ -624,6 +624,18 @@ grub_linux_boot (void)
+ }
+ #endif
+
++#if defined (__x86_64__) && defined (GRUB_MACHINE_EFI)
++ if (grub_le_to_cpu16 (ctx.params->version) >= 0x020c &&
++ (linux_params.xloadflags & LINUX_X86_XLF_KERNEL_64) != 0)
++ {
++ struct grub_relocator64_efi_state state64;
++
++ state64.rsi = ctx.real_mode_target;
++ state64.rip = ctx.params->code32_start + LINUX_X86_STARTUP64_OFFSET;
++ return grub_relocator64_efi_boot (relocator, state64);
++ }
++#endif
++
+ /* FIXME. */
+ /* asm volatile ("lidt %0" : : "m" (idt_desc)); */
+ state.ebp = state.edi = state.ebx = 0;
+diff --git a/include/grub/i386/linux.h b/include/grub/i386/linux.h
+index 0fd6e12..d4b5508 100644
+--- a/include/grub/i386/linux.h
++++ b/include/grub/i386/linux.h
+@@ -69,6 +69,16 @@
+ #define GRUB_LINUX_OFW_SIGNATURE \
+ (' ' << 24 | 'W' << 16 | 'F' << 8 | 'O')
+
++#define LINUX_X86_XLF_KERNEL_64 (1<<0)
++#define LINUX_X86_XLF_CAN_BE_LOADED_ABOVE_4G (1<<1)
++#define LINUX_X86_XLF_EFI_HANDOVER_32 (1<<2)
++#define LINUX_X86_XLF_EFI_HANDOVER_64 (1<<3)
++#define LINUX_X86_XLF_EFI_KEXEC (1<<4)
++#define LINUX_X86_XLF_5LEVEL (1<<5)
++#define LINUX_X86_XLF_5LEVEL_ENABLED (1<<6)
++
++#define LINUX_X86_STARTUP64_OFFSET 0x200
++
+ #ifndef ASM_FILE
+
+ #define GRUB_E820_RAM 1
+@@ -138,7 +148,7 @@ struct linux_i386_kernel_header
+ grub_uint32_t kernel_alignment;
+ grub_uint8_t relocatable;
+ grub_uint8_t min_alignment;
+- grub_uint8_t pad[2];
++ grub_uint16_t xloadflags;
+ grub_uint32_t cmdline_size;
+ grub_uint32_t hardware_subarch;
+ grub_uint64_t hardware_subarch_data;
+@@ -315,7 +325,8 @@ struct linux_kernel_params
+ grub_uint32_t initrd_addr_max; /* Maximum initrd address */
+ grub_uint32_t kernel_alignment; /* Alignment of the kernel */
+ grub_uint8_t relocatable_kernel; /* Is the kernel relocatable */
+- grub_uint8_t pad1[3];
++ grub_uint8_t min_alignment;
++ grub_uint16_t xloadflags;
+ grub_uint32_t cmdline_size; /* Size of the kernel command line */
+ grub_uint32_t hardware_subarch;
+ grub_uint64_t hardware_subarch_data;
+--
+cgit v1.1
+
diff --git a/user/grub/0009-linux-mixed-mode.patch b/user/grub/0009-linux-mixed-mode.patch
new file mode 100644
index 000000000..d3b2135f2
--- /dev/null
+++ b/user/grub/0009-linux-mixed-mode.patch
@@ -0,0 +1,79 @@
+From 1f5b180742ff2706bc3a696d115ddbc677ec75b9 Mon Sep 17 00:00:00 2001
+From: Ard Biesheuvel <ardb@kernel.org>
+Date: Mon, 7 Aug 2023 14:21:51 +0200
+Subject: loader/efi/linux: Implement x86 mixed mode using legacy boot
+
+Recent mixed-mode Linux kernels, i.e., v4.0 or newer, can access EFI
+runtime services at OS runtime even when the OS was not entered via the
+EFI stub. This is because, instead of reverting back to the firmware's
+segment selectors, GDTs and IDTs, the 64-bit kernel simply calls 32-bit
+runtime services using compatibility mode, i.e., the same mode used for
+32-bit user space, without taking down all interrupt handling, exception
+handling, etc.
+
+This means that GRUB's legacy x86 boot mode is sufficient to make use of
+this: 32-bit i686 builds of GRUB can already boot 64-bit kernels in EFI
+enlightened mode, but without going via the EFI stub, and provide all
+the metadata that the OS needs to map the EFI runtime regions and call
+EFI runtime services successfully.
+
+It does mean that GRUB should not attempt to invoke the firmware's
+LoadImage()/StartImage() methods on kernel builds that it knows cannot
+be started natively. So, add a check for this in the native EFI boot
+path and fall back to legacy x86 mode in such cases.
+
+Note that in the general case, booting non-native images of the same
+native word size, e.g., x64 EFI apps on arm64 firmware, might be
+supported by means of emulation. So, let's only disallow images that use
+a non-native word size. This will also permit booting i686 kernels on
+x86_64 builds, although without access to runtime services, as this is
+not supported by Linux.
+
+This change on top of 2.12-rc1 is sufficient to boot ordinary Linux
+mixed mode builds and get full access to the EFI runtime services.
+
+Cc: Daniel Kiper <daniel.kiper@oracle.com>
+Cc: Steve McIntyre <steve@einval.com>
+Cc: Julian Andres Klode <julian.klode@canonical.com>
+Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
+Acked-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
+Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
+---
+ grub-core/loader/efi/linux.c | 3 +++
+ include/grub/efi/pe32.h | 6 ++++++
+ 2 files changed, 9 insertions(+)
+
+diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c
+index ab8fb35..bfbd95a 100644
+--- a/grub-core/loader/efi/linux.c
++++ b/grub-core/loader/efi/linux.c
+@@ -117,6 +117,9 @@ grub_arch_efi_linux_load_image_header (grub_file_t file,
+ return grub_error (GRUB_ERR_FILE_READ_ERROR, "failed to read COFF image header");
+ }
+
++ if (lh->pe_image_header.optional_header.magic != GRUB_PE32_NATIVE_MAGIC)
++ return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "non-native image not supported");
++
+ /*
+ * Linux kernels built for any architecture are guaranteed to support the
+ * LoadFile2 based initrd loading protocol if the image version is >= 1.
+diff --git a/include/grub/efi/pe32.h b/include/grub/efi/pe32.h
+index 101859a..4e6e9d2 100644
+--- a/include/grub/efi/pe32.h
++++ b/include/grub/efi/pe32.h
+@@ -267,6 +267,12 @@ struct grub_pe32_section_table
+
+ #define GRUB_PE32_SIGNATURE_SIZE 4
+
++#if GRUB_TARGET_SIZEOF_VOID_P == 8
++#define GRUB_PE32_NATIVE_MAGIC GRUB_PE32_PE64_MAGIC
++#else
++#define GRUB_PE32_NATIVE_MAGIC GRUB_PE32_PE32_MAGIC
++#endif
++
+ struct grub_pe_image_header
+ {
+ /* This is always PE\0\0. */
+--
+cgit v1.1
+
diff --git a/user/grub/fix-gcc-no-pie-specs.patch b/user/grub/0010-fix-gcc-no-pie-specs.patch
index 273c9dbe3..ecd59d24d 100644
--- a/user/grub/fix-gcc-no-pie-specs.patch
+++ b/user/grub/0010-fix-gcc-no-pie-specs.patch
@@ -1,6 +1,7 @@
---- ./configure.ac.orig
-+++ ./configure.ac
-@@ -1100,7 +1100,7 @@
+diff -ur a/configure b/configure
+--- a/configure 2023-10-03 12:10:39.434444137 -0500
++++ b/configure 2023-10-03 12:10:58.731025605 -0500
+@@ -37616,7 +37616,7 @@
if test x"$grub_cv_target_cc_efiemu64_link_format" = xunknown; then
efiemu_excuse="no suitable link format for efiemu64 found"
else
diff --git a/user/grub/APKBUILD b/user/grub/APKBUILD
index 187dc3524..8b365fc0b 100644
--- a/user/grub/APKBUILD
+++ b/user/grub/APKBUILD
@@ -1,30 +1,32 @@
# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=grub
-pkgver=2.04
-pkgrel=5
-pkgdesc="Bootloader with support for Linux, Multiboot and more"
+pkgver=2.12_rc1
+_pkgver=$(printf '%s' "$pkgver" | tr _ \~)
+pkgrel=0
+pkgdesc="Boot loader with support for Linux, Multiboot and more"
url="https://www.gnu.org/software/grub/"
-arch="all !s390x"
+arch="all"
# strip handled by grub Makefiles, abuild strip breaks xen pv-grub
options="!check !strip" # Cannot test boot loader.
license="GPL-3.0+"
depends=""
makedepends="bison flex freetype-dev fuse-dev linux-headers lvm2-dev python3
- unifont xz
- automake autoconf libtool"
+ unifont xz"
# [22:02] <@awilfox> [[sroracle]]: grub breaks without its locale files present
# [22:02] <@awilfox> it cannot be split
subpackages="$pkgname-dev $pkgname-doc $pkgname-mount"
-# currently grub only builds on x86*, aarch64 and ppc* systems
flavors=""
case "$CARCH" in
-x86 | pmmx) flavors="efi bios";;
+x86|pmmx) flavors="efi bios";;
x86_64) flavors="efi bios xenhost";;
-aarch64|arm*) flavors="efi";;
+aarch64) flavors="efi";;
+arm*) flavors="efi uboot";;
ppc*) flavors="ieee1275"; makedepends="$makedepends powerpc-utils" ;;
-s390x) flavors="emu" ;;
+sparc*) flavors="ieee1275";;
+mips*) flavors="arc";;
+riscv*) flavors="efi";;
esac
for f in $flavors; do
subpackages="$subpackages $pkgname-$f"
@@ -32,28 +34,32 @@ done
install="$pkgname.post-upgrade"
-source="https://ftp.gnu.org/gnu/grub/grub-$pkgver.tar.xz
+source="https://alpha.gnu.org/gnu/$pkgname/$pkgname-$_pkgver.tar.xz
adelie-branding.patch
- fix-gcc-no-pie-specs.patch
grub2-accept-empty-module.patch
- fix-deprecated-fgrep-usage.patch
+ 0001-unmerged-usr.patch
+ 0002-revert-gawk.patch
+ 0003-spcr-revision.patch
+ 0004-videoinfo-no-reinit.patch
+ 0005-vsnprintf.patch
+ 0006-cryptodisk-retval.patch
+ 0007-efi_gop-shadow.patch
+ 0008-efi-pure64.patch
+ 0009-linux-mixed-mode.patch
+ 0010-fix-gcc-no-pie-specs.patch
grub-xen-host_grub.cfg
default-grub
update-grub
quirk-01_radeon_agpmode
"
-
-prepare() {
- default_prepare
- autoreconf -vif
-}
+builddir="$srcdir/$pkgname-$_pkgver"
_build_flavor() {
- local flavor="$1"
+ flavor="$1"
shift
- local _configure="$@"
+ _configure="$@"
case $CTARGET_ARCH in
- ppc64) export CFLAGS="-O2 -ggdb -mcpu=970 -mno-altivec";; # Workaround for http://savannah.gnu.org/bugs/?52629
+ ppc64) export CFLAGS="${CFLAGS} -mno-altivec";; # Workaround for http://savannah.gnu.org/bugs/?52629
esac
msg "Building grub for platform $flavor"
@@ -74,7 +80,7 @@ _build_flavor() {
}
build() {
- local f
+ f=""
for f in $flavors; do
case "$f" in
bios) _build_flavor $f --with-platform=pc;;
@@ -109,7 +115,7 @@ _install_xen() {
}
_install_flavor() {
- local flavor="$1"
+ flavor="$1"
cd "$srcdir"/build-$flavor
case $flavor in
xenhost) _install_xen;;
@@ -162,18 +168,13 @@ xenhost() {
ieee1275() {
pkgdesc="$pkgdesc (IEEE-1275 OpenFirmware version)"
- depends="$pkgname powerpc-utils"
+ case $CTARGETARCH in
+ ppc*) depends="$pkgname powerpc-utils"
+ esac
mkdir -p "$subpkgdir"/usr/lib/grub
mv "$pkgdir"/usr/lib/grub/*-ieee1275 "$subpkgdir"/usr/lib/grub/
}
-emu() {
- pkgdesc="$pkgdesc (EMU version)"
- depends="$pkgname"
- mkdir -p "$subpkgdir"/usr/lib/grub
- mv "$pkgdir"/usr/lib/grub/*-emu "$subpkgdir"/usr/lib/grub/
-}
-
mount() {
pkgdesc="Utility to mount filesystems using GRUB modules"
depends="$pkgname"
@@ -181,11 +182,19 @@ mount() {
mv "$pkgdir"/usr/bin/grub-mount "$subpkgdir"/usr/bin/
}
-sha512sums="9c15c42d0cf5d61446b752194e3b628bb04be0fe6ea0240ab62b3d753784712744846e1f7c3651d8e0968d22012e6d713c38c44936d4004ded3ca4d4007babbb grub-2.04.tar.xz
+sha512sums="6f1fbce004b6dccf58e203bf6a6eeb771bac5ecc54b503265e56a97e9adce0221677bb3e64328144ec921f327a099f0345e7a9952be41cd8808f7635cded52cb grub-2.12~rc1.tar.xz
4a6c909a1150b057fb0563f7a0646db33e16f84d6a8c443ef7db4003efd56c211a52f87699c5c95a6ccde65f6db46a8711a5b784f38479db804938dfe3115439 adelie-branding.patch
-f2a7d9ab6c445f4e402e790db56378cecd6631b5c367451aa6ce5c01cd95b95c83c3dd24d6d4b857f8f42601eba82c855607513eb6ce5b2af6bd6c71f046e288 fix-gcc-no-pie-specs.patch
6e001762f7f562f2fafed56118079122e7602c731c70723241276f523e0882a3930d720fd847143d379ffd85626d2d7d3fa914590c0de1f0903a293695e71c41 grub2-accept-empty-module.patch
-bca0f23e73bfa09108bbf7b8ee12635051122e0a1f0db7d8a7d53727ba7d8f45b76a70a04c070e900109cd2baf97fcaf01a07208d45597ed1c390d5cf63ba9cd fix-deprecated-fgrep-usage.patch
+de798c8907ab5c3f00b42bf10a63a5666af2076932a46ec6e484c67303bef0509e7787910392f75b3e4ccb9aa17d67f2ef5f5fc1eed3dcdf96f598dc2400ade4 0001-unmerged-usr.patch
+60e299ef0677dbd4e1e60623353be3dd8fbb1a795cbf24a9e1a2511f6a7322033254daf71116e95e93335d5e76a7a85488d66f357779a9f589f04119df8f0aea 0002-revert-gawk.patch
+d7f22e5f02dfbebad5e9122a01a9d6e5fffd0bb4731790c97e5184c148a5e1e8f4d5d3d49b09b26a7768648b147b134c3b316649608d2ac8390ab63b7f278a07 0003-spcr-revision.patch
+1daba1b4857c45f4e729d24cd800eb6f6b659ea5c8399394487f75817b4f7092e5972676fc8c28b6289e04f0fe41d4ca54dc4523db1393cdb65751d377a06d8a 0004-videoinfo-no-reinit.patch
+0a69b2f9cb178b8ae4a7b96f1cb801ef6d6d7942a842346de5017b6fdb5a8bd6db1ad55fdd9cc41a6c4660be9985621008d1da1dc45510d6ffed425f0f4997d1 0005-vsnprintf.patch
+9b444c596c3c7387c18f3d6747ce4000d8e1ac89a07d919f3c648b07a3492911a6b7a84764c7f953a8a7873f26dedf10549a46008bc23e38d1da3eeb6d1850e3 0006-cryptodisk-retval.patch
+a16569a037b29a669d5bd68f6130b1c59870f8bb660bf98b318f0dac39bb9a0026d76e2d47298e2b22a91f75aa34c234785149b61e699dfdde27020210023e84 0007-efi_gop-shadow.patch
+13a819813b82ed13752dff2bf2ddaf47e1c369f10148a988a2517d51f33c11ee187f3c6909c08a1b922440aebebe1f3178fe8f63f85055129b74893885e0db1f 0008-efi-pure64.patch
+911a28fa28f966369039e14062deaf90c81818c06fb3f44add27c395a3074b8c1b858a47c1a97909e07b813a87633bf244e5ee4db23f9d429edd9a05f5b5d72a 0009-linux-mixed-mode.patch
+1552f56c17c55aabae26c64beeb9ed507623331794d4b590721fa0f22b658831bbef3475dfb8c125ab05e8ec62939d5928416c32d2c968a4a2a98bee0744c1fd 0010-fix-gcc-no-pie-specs.patch
4e7394e0fff6772c89683039ccf81099ebbfe4f498e6df408977a1488fd59389b6e19afdbf0860ec271e2b2aea0df7216243dcc8235d1ca3af0e7f4d0a9d60a4 grub-xen-host_grub.cfg
1cb675fa0af9a1fd8d1a868e3e9de3bfef7eada66c5df0cfef23eca33e93e676eed6e1f67c679690f3e581565b350a9f3ba01aa9b89de66c970ea61ca21bcd65 default-grub
8e5f1cf91da9fd956695438509bb26e45f38170ca90d99a996e859053d72c82b7e4b02cb8979f047fc53498036f47b5400bf54687c390793995a05ded4216d55 update-grub
diff --git a/user/grub/fix-deprecated-fgrep-usage.patch b/user/grub/fix-deprecated-fgrep-usage.patch
deleted file mode 100644
index a37ce9912..000000000
--- a/user/grub/fix-deprecated-fgrep-usage.patch
+++ /dev/null
@@ -1,75 +0,0 @@
-diff -ur a/grub-core/lib/libgcrypt/src/libgcrypt-config.in b/grub-core/lib/libgcrypt/src/libgcrypt-config.in
---- a/grub-core/lib/libgcrypt/src/libgcrypt-config.in 2023-05-10 17:44:15.293941096 +0000
-+++ b/grub-core/lib/libgcrypt/src/libgcrypt-config.in 2023-05-10 17:44:42.164950456 +0000
-@@ -142,7 +142,7 @@
-
- tmp=""
- for i in $includes $cflags_final; do
-- if echo "$tmp" | fgrep -v -- "$i" >/dev/null; then
-+ if echo "$tmp" | grep -F -v -- "$i" >/dev/null; then
- tmp="$tmp $i"
- fi
- done
-@@ -163,7 +163,7 @@
-
- tmp=""
- for i in $libdirs $libs_final; do
-- if echo "$tmp" | fgrep -v -- "$i" >/dev/null; then
-+ if echo "$tmp" | grep -F -v -- "$i" >/dev/null; then
- tmp="$tmp $i"
- fi
- done
-diff -ur a/util/grub.d/10_hurd.in b/util/grub.d/10_hurd.in
---- a/util/grub.d/10_hurd.in 2023-05-10 17:44:15.453935199 +0000
-+++ b/util/grub.d/10_hurd.in 2023-05-10 17:44:42.088953259 +0000
-@@ -168,7 +168,7 @@
- hurd_entry "$kernel" advanced
- hurd_entry "$kernel" recovery
-
-- kernels=`echo $kernels | tr ' ' '\n' | fgrep -vx "$kernel" | tr '\n' ' '`
-+ kernels=`echo $kernels | tr ' ' '\n' | grep -F -vx "$kernel" | tr '\n' ' '`
- done
-
- # If at least one kernel was found, then we need to
-diff -ur a/util/grub.d/10_kfreebsd.in b/util/grub.d/10_kfreebsd.in
---- a/util/grub.d/10_kfreebsd.in 2023-05-10 17:44:15.453935199 +0000
-+++ b/util/grub.d/10_kfreebsd.in 2023-05-10 17:44:42.164950456 +0000
-@@ -231,7 +231,7 @@
- kfreebsd_entry "${OS}" "${version}" recovery "-s"
- fi
-
-- list=`echo $list | tr ' ' '\n' | fgrep -vx "$kfreebsd" | tr '\n' ' '`
-+ list=`echo $list | tr ' ' '\n' | grep -F -vx "$kfreebsd" | tr '\n' ' '`
- done
-
- # If at least one kernel was found, then we need to
-diff -ur a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
---- a/util/grub.d/10_linux.in 2023-05-10 17:44:15.453935199 +0000
-+++ b/util/grub.d/10_linux.in 2023-05-10 17:44:42.160950604 +0000
-@@ -282,7 +282,7 @@
- "single ${GRUB_CMDLINE_LINUX}"
- fi
-
-- list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '`
-+ list=`echo $list | tr ' ' '\n' | grep -F -vx "$linux" | tr '\n' ' '`
- done
-
- # If at least one kernel was found, then we need to
-diff -ur a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
---- a/util/grub.d/20_linux_xen.in 2023-05-10 17:44:15.453935199 +0000
-+++ b/util/grub.d/20_linux_xen.in 2023-05-10 17:44:42.156950751 +0000
-@@ -310,12 +310,12 @@
- "single ${GRUB_CMDLINE_LINUX}" "${GRUB_CMDLINE_XEN}"
- fi
-
-- list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '`
-+ list=`echo $list | tr ' ' '\n' | grep -F -vx "$linux" | tr '\n' ' '`
- done
- if [ x"$is_top_level" != xtrue ]; then
- echo ' }'
- fi
-- xen_list=`echo $xen_list | tr ' ' '\n' | fgrep -vx "$current_xen" | tr '\n' ' '`
-+ xen_list=`echo $xen_list | tr ' ' '\n' | grep -F -vx "$current_xen" | tr '\n' ' '`
- done
-
- # If at least one kernel was found, then we need to