sys-boot/grub: Sync with Gentoo

It's from Gentoo commit a822ebdd34d0270dc3adad287abee2c6fd7f86cf.

Signed-off-by: Flatcar Buildbot <buildbot@flatcar-linux.org>
This commit is contained in:
Flatcar Buildbot 2026-05-11 08:18:58 +00:00
parent 97bb6719e1
commit 1202ff5223
5 changed files with 105 additions and 9 deletions

View File

@ -1,3 +1,7 @@
https://bugs.gentoo.org/528826
http://lists.gnu.org/archive/html/grub-devel/2014-10/msg00031.html
https://gitlab.freedesktop.org/gnu-grub/grub/-/merge_requests/98
From e2d5bf1bc6aaaabeba538c1ca94ea8601e4e1474 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Thu, 16 Oct 2014 23:43:51 -0400

View File

@ -0,0 +1,41 @@
https://gitlab.freedesktop.org/gnu-grub/grub/-/merge_requests/10
From 129588e498647842c6f13f7809ef9ac583e2351b Mon Sep 17 00:00:00 2001
From: Egor Ignatov <egori@altlinux.org>
Date: Thu, 19 Mar 2026 17:22:11 +0500
Subject: [PATCH] util/grub.d/00_header.in: Load efi_uga only on x86 EFI
platforms
The efi_uga module is only built for i386-efi and x86_64-efi firmware), but
commit ea0b76dc4a ("Disable loading all_video for EFI") loads it unconditionally
on all EFI platforms. This causes a "file not found" error on aarch64-efi and
other non-x86 EFI targets.
Guard the insmod with a $grub_cpu check so the module is only
loaded where it is actually available.
Fixes: ea0b76dc4 ("util/grub.d/00_header.in: Disable loading all_video for EFI")
Signed-off-by: Egor Ignatov <egori@altlinux.org>
---
util/grub.d/00_header.in | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/util/grub.d/00_header.in b/util/grub.d/00_header.in
index 77834cfaf..1afe41e67 100644
--- a/util/grub.d/00_header.in
+++ b/util/grub.d/00_header.in
@@ -135,7 +135,9 @@ else # GRUB_FORCE_EFI_ALL_VIDEO is not set true
cat <<EOF
if [ x\$grub_platform = xefi ]; then
insmod efi_gop
- insmod efi_uga
+ if [ x\$grub_cpu = xi386 -o x\$grub_cpu = xx86_64 ]; then
+ insmod efi_uga
+ fi
elif [ x\$feature_all_video_module = xy ]; then
EOF
fi # end GRUB_FORCE_EFI_ALL_VIDEO
--
GitLab

View File

@ -0,0 +1,39 @@
https://bugs.gentoo.org/528826
http://lists.gnu.org/archive/html/grub-devel/2014-10/msg00031.html
https://gitlab.freedesktop.org/gnu-grub/grub/-/merge_requests/98
From bcc760dc5de65fe2ae6ed37f68c01fc6a9793484 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Thu, 16 Oct 2014 23:43:51 -0400
Subject: [PATCH] 10_linux: default gfxpayload=keep only when booting using EFI
A given kernel may be compiled with CONFIG_FB_EFI, but may be booted in
legacy PC-BIOS mode. It is not safe to set gfxmode=keep under these
conditions, and this may result in a black screen once the kernel
starts.
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Reviewed-by: Neal Gompa <neal@gompa.dev>
Reviewed-by: Leo Sandoval <lsandova@redhat.com>
---
util/grub.d/10_linux.in | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 1233b112b..737e1c30c 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -118,7 +118,9 @@ linux_entry ()
echo " load_video" | sed "s/^/$submenu_indentation/"
if grep -qx "CONFIG_FB_EFI=y" "${config}" 2> /dev/null \
&& grep -qx "CONFIG_VT_HW_CONSOLE_BINDING=y" "${config}" 2> /dev/null; then
- echo " set gfxpayload=keep" | sed "s/^/$submenu_indentation/"
+ echo ' if [ "x$grub_platform" = xefi ]; then' | sed "s/^/$submenu_indentation/"
+ echo " set gfxpayload=keep" | sed "s/^/$submenu_indentation/"
+ echo ' fi' | sed "s/^/$submenu_indentation/"
fi
else
if [ "x$GRUB_GFXPAYLOAD_LINUX" != xtext ]; then
--
GitLab

View File

@ -26,7 +26,7 @@ if [[ -n ${GRUB_AUTORECONF} ]]; then
inherit autotools
fi
inherit bash-completion-r1 eapi9-ver flag-o-matic multibuild optfeature
inherit bash-completion-r1 eapi9-pipestatus eapi9-ver flag-o-matic multibuild optfeature
inherit python-any-r1 secureboot toolchain-funcs verify-sig
DESCRIPTION="GNU GRUB boot loader"
@ -56,7 +56,7 @@ if [[ ${PV} != 9999 ]]; then
sec-keys/openpgp-keys-unifont
)
"
KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86"
KEYWORDS="amd64 arm arm64 ~loong ppc ppc64 ~riscv ~sparc x86"
else
inherit git-r3
EGIT_REPO_URI="https://git.savannah.gnu.org/git/grub.git"
@ -175,8 +175,14 @@ src_unpack() {
}
src_prepare() {
# Bug 971544
find grub-core/lib/gnulib -name '*.in.h' | sed 's/.in.h$/.h/' | xargs rm -fv
pipestatus || die
local PATCHES=(
"${WORKDIR}/${P}-patches"
"${FILESDIR}/${P}-efi_uga.patch"
"${FILESDIR}/${P}-gfxpayload.patch"
)
default
@ -302,7 +308,10 @@ src_configure() {
src_compile() {
# Sandbox bug 404013.
use libzfs && { addpredict /etc/dfs; addpredict /dev/zfs; }
if use libzfs; then
addpredict /etc/dfs
addpredict /dev/zfs
fi
grub_do emake
use doc && grub_do_once emake -C docs html

View File

@ -32,10 +32,13 @@ inherit bash-completion-r1 eapi9-ver flag-o-matic multibuild optfeature
inherit python-any-r1 secureboot toolchain-funcs verify-sig
DESCRIPTION="GNU GRUB boot loader"
HOMEPAGE="https://www.gnu.org/software/grub/"
HOMEPAGE="https://gnu-grub.freedesktop.org/"
MY_P=${P}
if [[ ${PV} != 9999 ]]; then
if [[ ${PV} == 9999 ]]; then
inherit git-r3
EGIT_REPO_URI="https://gitlab.freedesktop.org/gnu-grub/grub.git"
else
if [[ ${PV} == *_alpha* || ${PV} == *_beta* || ${PV} == *_rc* ]]; then
# The quote style is to work with <=bash-4.2 and >=bash-4.3 #503860
MY_P=${P/_/'~'}
@ -58,9 +61,6 @@ if [[ ${PV} != 9999 ]]; then
)
"
KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86"
else
inherit git-r3
EGIT_REPO_URI="https://git.savannah.gnu.org/git/grub.git"
fi
DEJAVU_VER=2.37
@ -299,7 +299,10 @@ src_configure() {
src_compile() {
# Sandbox bug 404013.
use libzfs && { addpredict /etc/dfs; addpredict /dev/zfs; }
if use libzfs; then
addpredict /etc/dfs
addpredict /dev/zfs
fi
grub_do emake
use doc && grub_do_once emake -C docs html