Commit 1a5417f39[1] introduced a grub installation error on i386 target:

  grub-mkimage: error: `/usr/lib/grub/i386-pc/kernel.img' is
  miscompiled: its start address is 0x9074 instead of 0x9000: ld.gold
  bug?.

A series of patches are under review in grub mailing list[2]. Once these
patches are merged, we will backport them to the current version.

Currently, referring to Gentoo[3] and Libreboot[4], revert the following
commits as a workaround:
1a5417f39 configure: Check linker for --image-base support
ac042f3f5 configure: Print a more helpful error if autoconf-archive is
          not installed

[1] 
https://cgit.git.savannah.gnu.org/cgit/grub.git/commit/?id=1a5417f39a0ccefcdd5440f2a67f84d2d2e26960
[2] https://lists.gnu.org/archive/html/grub-devel/2026-02/msg00039.html
[3] 
https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f5a995ac689a7132651ef6b2b87295c392899427
[4] 
https://codeberg.org/libreboot/lbmk/src/branch/master/config/grub/nvme/patches/0010-Revert-configure-Check-linker-for-image-base-support.patch

Signed-off-by: Yi Zhao <[email protected]>
---
 ...-Check-linker-for-image-base-support.patch | 73 +++++++++++++++++++
 ...-Print-a-more-helpful-error-if-autoc.patch | 34 +++++++++
 meta/recipes-bsp/grub/grub2.inc               |  4 +-
 3 files changed, 110 insertions(+), 1 deletion(-)
 create mode 100644 
meta/recipes-bsp/grub/files/0001-Revert-configure-Check-linker-for-image-base-support.patch
 create mode 100644 
meta/recipes-bsp/grub/files/0002-Revert-configure-Print-a-more-helpful-error-if-autoc.patch

diff --git 
a/meta/recipes-bsp/grub/files/0001-Revert-configure-Check-linker-for-image-base-support.patch
 
b/meta/recipes-bsp/grub/files/0001-Revert-configure-Check-linker-for-image-base-support.patch
new file mode 100644
index 0000000000..123909cdf8
--- /dev/null
+++ 
b/meta/recipes-bsp/grub/files/0001-Revert-configure-Check-linker-for-image-base-support.patch
@@ -0,0 +1,73 @@
+From 3a9d2dd2f5fb07b75a74c307d61b9b9fc5d20a62 Mon Sep 17 00:00:00 2001
+From: Yi Zhao <[email protected]>
+Date: Fri, 27 Feb 2026 11:46:54 +0800
+Subject: [PATCH] Revert "configure: Check linker for --image-base support"
+
+This reverts commit 1a5417f39a0ccefcdd5440f2a67f84d2d2e26960.
+
+Upstream-Status: Inappropriate [oe specific]
+
+Signed-off-by: Yi Zhao <[email protected]>
+---
+ acinclude.m4 |  5 -----
+ configure.ac | 14 ++------------
+ 2 files changed, 2 insertions(+), 17 deletions(-)
+
+diff --git a/acinclude.m4 b/acinclude.m4
+index 70c1912f8..fa7840f09 100644
+--- a/acinclude.m4
++++ b/acinclude.m4
+@@ -79,11 +79,6 @@ AC_DEFUN([grub_PROG_OBJCOPY_ABSOLUTE],
+ [AC_MSG_CHECKING([whether ${TARGET_OBJCOPY} works for absolute addresses])
+ AC_CACHE_VAL(grub_cv_prog_objcopy_absolute,
+ [cat > conftest.c <<\EOF
+-asm (
+-    ".globl start, _start, __start\n"
+-    ".ifdef cmain; .set start = _start = __start = cmain\n.endif\n"
+-    ".ifdef _cmain; .set start = _start = __start = _cmain\n.endif\n"
+-);
+ void cmain (void);
+ void
+ cmain (void)
+diff --git a/configure.ac b/configure.ac
+index d8ca1b7c1..041cfbab4 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1461,6 +1461,7 @@ elif test x$grub_cv_target_cc_link_format = x-mi386pe || 
test x$grub_cv_target_c
+   TARGET_IMG_LDSCRIPT='$(top_srcdir)'"/conf/i386-cygwin-img-ld.sc"
+   TARGET_IMG_LDFLAGS="-Wl,-T${TARGET_IMG_LDSCRIPT}"
+   TARGET_IMG_LDFLAGS_AC="-Wl,-T${srcdir}/conf/i386-cygwin-img-ld.sc"
++  TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
+   TARGET_IMG_CFLAGS=
+ else
+   TARGET_APPLE_LINKER=0
+@@ -1468,6 +1469,7 @@ else
+   TARGET_IMG_LDSCRIPT=
+   TARGET_IMG_LDFLAGS='-Wl,-N'
+   TARGET_IMG_LDFLAGS_AC='-Wl,-N'
++  TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"
+   TARGET_IMG_CFLAGS=
+ fi
+ 
+@@ -1798,18 +1800,6 @@ grub_PROG_TARGET_CC
+ m4_ifndef([AX_CHECK_LINK_FLAG], [m4_fatal([autoconf-archive is missing. You 
must install it to generate the configure script.])])
+ 
+ if test "x$TARGET_APPLE_LINKER" != x1 ; then
+-AX_CHECK_LINK_FLAG([-Wl,--image-base,0x400000],
+-    [TARGET_IMG_BASE_LDOPT="-Wl,--image-base"],
+-    [TARGET_IMG_BASE_LDOPT="-Wl,-Ttext"],
+-    [],
+-    [AC_LANG_SOURCE([
+-asm (".globl start; start:");
+-asm (".globl _start; _start:");
+-asm (".globl __start; __start:");
+-void __main (void);
+-void __main (void) {}
+-int main (void);
+-    ])])
+ grub_PROG_OBJCOPY_ABSOLUTE
+ fi
+ grub_PROG_LD_BUILD_ID_NONE
+-- 
+2.43.0
+
diff --git 
a/meta/recipes-bsp/grub/files/0002-Revert-configure-Print-a-more-helpful-error-if-autoc.patch
 
b/meta/recipes-bsp/grub/files/0002-Revert-configure-Print-a-more-helpful-error-if-autoc.patch
new file mode 100644
index 0000000000..bf6375246e
--- /dev/null
+++ 
b/meta/recipes-bsp/grub/files/0002-Revert-configure-Print-a-more-helpful-error-if-autoc.patch
@@ -0,0 +1,34 @@
+From d0f516385dc73e8dd92b78ce08c1df100434fe67 Mon Sep 17 00:00:00 2001
+From: Yi Zhao <[email protected]>
+Date: Fri, 27 Feb 2026 13:58:44 +0800
+Subject: [PATCH] Revert "configure: Print a more helpful error if
+ autoconf-archive is not installed"
+
+This reverts commit ac042f3f58d33ce9cd5ff61750f06da1a1d7b0eb.
+
+Upstream-Status: Inappropriate [oe specific]
+
+Signed-off-by: Yi Zhao <[email protected]>
+---
+ configure.ac | 5 -----
+ 1 file changed, 5 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 041cfbab4..209c0fb11 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1794,11 +1794,6 @@ LIBS=""
+ # Defined in acinclude.m4.
+ grub_ASM_USCORE
+ grub_PROG_TARGET_CC
+-
+-# The error message produced by autoconf if autoconf-archive is not installed 
is
+-# quite misleading and not very helpful. So, try point people in the right 
direction.
+-m4_ifndef([AX_CHECK_LINK_FLAG], [m4_fatal([autoconf-archive is missing. You 
must install it to generate the configure script.])])
+-
+ if test "x$TARGET_APPLE_LINKER" != x1 ; then
+ grub_PROG_OBJCOPY_ABSOLUTE
+ fi
+-- 
+2.43.0
+
diff --git a/meta/recipes-bsp/grub/grub2.inc b/meta/recipes-bsp/grub/grub2.inc
index 434f977667..8c62315e69 100644
--- a/meta/recipes-bsp/grub/grub2.inc
+++ b/meta/recipes-bsp/grub/grub2.inc
@@ -17,6 +17,8 @@ SRC_URI = "${GNU_MIRROR}/grub/grub-${PV}.tar.gz \
            file://0001-autogen.sh-exclude-.pc-from-po-POTFILES.in.patch \
            
file://0002-grub-module-explicitly-keeps-symbole-.module_license.patch \
            file://0003-grub.d-10_linux.in-add-oe-s-kernel-name.patch \
+           
file://0001-Revert-configure-Check-linker-for-image-base-support.patch \
+           
file://0002-Revert-configure-Print-a-more-helpful-error-if-autoc.patch \
 "
 
 SRC_URI[sha256sum] = 
"d0415fbb3e739237064e173743a6e5f60c33a81ec02a069cc9152d80efff4967"
@@ -26,7 +28,7 @@ CVE_STATUS[CVE-2023-4001]  = "not-applicable-platform: 
Applies only to RHEL/Fedo
 CVE_STATUS[CVE-2024-1048]  = "not-applicable-platform: Applies only to 
RHEL/Fedora"
 CVE_STATUS[CVE-2024-2312]  = "not-applicable-platform: Applies only to Ubuntu"
 
-DEPENDS = "flex-native bison-native gettext-native gawk-replacement-native 
autoconf-archive-native"
+DEPENDS = "flex-native bison-native gettext-native gawk-replacement-native"
 
 GRUB_COMPATIBLE_HOST = 
'(x86_64.*|i.86.*|arm.*|aarch64.*|loongarch64.*|riscv.*)-(linux.*|freebsd.*)'
 COMPATIBLE_HOST = "${GRUB_COMPATIBLE_HOST}"
-- 
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#232233): 
https://lists.openembedded.org/g/openembedded-core/message/232233
Mute This Topic: https://lists.openembedded.org/mt/118107266/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to