From 50ef8eb544e7604c78942916458dcabd91d268d0 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 6 Sep 2024 10:41:23 +0000 Subject: [PATCH] grub: Fix build on riscv64 https://savannah.gnu.org/bugs/?65909 Signed-off-by: Michael Tremer --- lfs/grub | 1 + ...any-instead-of-large-model-for-RISCV.patch | 36 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 src/patches/grub-2.12-Use-medany-instead-of-large-model-for-RISCV.patch diff --git a/lfs/grub b/lfs/grub index bcc6ac4ab..91dda242c 100644 --- a/lfs/grub +++ b/lfs/grub @@ -94,6 +94,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @rm -rf $(DIR_APP) $(DIR_APP_EFI) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE) cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/grub/grub-2.06-remove_os_prober_disabled_warning.patch cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/grub/grub-2.02_disable_vga_fallback.patch + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/grub-2.12-Use-medany-instead-of-large-model-for-RISCV.patch cd $(DIR_APP) && [ ! -e grub-core/extra_deps.lst ] && echo 'depends bli part_gpt' > grub-core/extra_deps.lst cd $(DIR_APP) && autoreconf -vfi diff --git a/src/patches/grub-2.12-Use-medany-instead-of-large-model-for-RISCV.patch b/src/patches/grub-2.12-Use-medany-instead-of-large-model-for-RISCV.patch new file mode 100644 index 000000000..4bfd46856 --- /dev/null +++ b/src/patches/grub-2.12-Use-medany-instead-of-large-model-for-RISCV.patch @@ -0,0 +1,36 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jason Montleon +Date: Fri, 3 May 2024 13:18:37 -0400 +Subject: [PATCH] Use medany instead of large model for RISCV + +Signed-off-by: Jason Montleon +--- + configure.ac | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index d223fe3ef6e..6a6688e362a 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1313,7 +1313,7 @@ AC_SUBST(TARGET_LDFLAGS_OLDMAGIC) + + LDFLAGS="$TARGET_LDFLAGS" + +-if test "$target_cpu" = x86_64 || test "$target_cpu" = sparc64 || test "$target_cpu" = riscv64 ; then ++if test "$target_cpu" = x86_64 || test "$target_cpu" = sparc64 ; then + # Use large model to support 4G memory + AC_CACHE_CHECK([whether option -mcmodel=large works], grub_cv_cc_mcmodel, [ + CFLAGS="$TARGET_CFLAGS -mcmodel=large" +@@ -1323,9 +1323,11 @@ if test "$target_cpu" = x86_64 || test "$target_cpu" = sparc64 || test "$target_ + ]) + if test "x$grub_cv_cc_mcmodel" = xyes; then + TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=large" +- elif test "$target_cpu" = sparc64 || test "$target_cpu" = riscv64; then ++ elif test "$target_cpu" = sparc64; then + TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=medany" + fi ++elif test "$target_cpu" = riscv64 ; then ++ TARGET_CFLAGS="$TARGET_CFLAGS -mcmodel=medany" + fi + + if test "$target_cpu"-"$platform" = x86_64-efi; then -- 2.39.5