Skip to content

Commit 81e45a6

Browse files
committed
grub-efi: add .bbappend for visionfive2
Builds with newer gcc versions fail for the visionfive2 MACHINE target with the following error: |grub-mkimage: error: relocation 0x2b is not implemented yet. Add a patch to use medany instead of the large model for the target. This could apply to all builds, but only visionfive2 has thus far been tested. See: https://savannah.gnu.org/bugs/?65909 Signed-off-by: Trevor Gamblin <[email protected]>
1 parent ca90c47 commit 81e45a6

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed
Binary file not shown.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: Jason Montleon <[email protected]>
3+
Date: Fri, 3 May 2024 13:18:37 -0400
4+
Subject: [PATCH] Use medany instead of large model for RISCV
5+
6+
Upstream-Status: Submitted [https://savannah.gnu.org/bugs/?65909]
7+
8+
Signed-off-by: Jason Montleon <[email protected]>
9+
Signed-off-by: Trevor Gamblin <[email protected]>
10+
---
11+
configure.ac | 6 ++++--
12+
1 file changed, 4 insertions(+), 2 deletions(-)
13+
14+
diff --git a/configure.ac b/configure.ac
15+
index d223fe3ef6e..6a6688e362a 100644
16+
--- a/configure.ac
17+
+++ b/configure.ac
18+
@@ -1313,7 +1313,7 @@ AC_SUBST(TARGET_LDFLAGS_OLDMAGIC)
19+
20+
LDFLAGS="$TARGET_LDFLAGS"
21+
22+
-if test "$target_cpu" = x86_64 || test "$target_cpu" = sparc64 || test "$target_cpu" = riscv64 ; then
23+
+if test "$target_cpu" = x86_64 || test "$target_cpu" = sparc64 ; then
24+
# Use large model to support 4G memory
25+
AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [
26+
CFLAGS="$TARGET_CFLAGS -mcmodel=large"
27+
@@ -1323,9 +1323,11 @@ if test "$target_cpu" = x86_64 || test "$target_cpu" = sparc64 || test "$target_
28+
])
29+
if test "x$grub_cv_cc_mcmodel" = xyes; then
30+
TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large"
31+
- elif test "$target_cpu" = sparc64 || test "$target_cpu" = riscv64; then
32+
+ elif test "$target_cpu" = sparc64; then
33+
TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=medany"
34+
fi
35+
+elif test "$target_cpu" = riscv64 ; then
36+
+ TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=medany"
37+
fi
38+
39+
if test "$target_cpu"-"$platform" = x86_64-efi; then
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
2+
3+
SRC_URI:append:visionfive2 = " file://0263-Use-medany-instead-of-large-model-for-RISCV.patch"

0 commit comments

Comments
 (0)