grub: update to 2.12-rc1

this is the first version that support booting linux kernel on
riscv. The release of the final version was delayed again and again
so i have bootstrapped the rc1 from the git and fixed the path in 25_bli.

Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
Reviewed-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Arne Fitzenreiter
2023-11-22 17:52:45 +01:00
committed by Peter Müller
parent 5868715e47
commit 3273f4796a
8 changed files with 136 additions and 313 deletions

View File

@@ -0,0 +1,9 @@
diff -Naur grub-2.12-rc1.org/util/grub.d/25_bli.in grub-2.12-rc1/util/grub.d/25_bli.in
--- grub-2.12-rc1.org/util/grub.d/25_bli.in 2023-07-10 17:43:48.000000000 +0200
+++ grub-2.12-rc1/util/grub.d/25_bli.in 2023-11-17 07:07:30.743519612 +0100
@@ -1,4 +1,4 @@
-#!/usr/bin/sh
+#!/bin/sh
set -e
# grub-mkconfig helper script.

View File

@@ -1,48 +0,0 @@
From 64be669638e198bc0c7c1a344547265dfacd2470 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 23 Jan 2023 15:29:02 -0800
Subject: [PATCH] risc-v: Handle R_RISCV_CALL_PLT reloc
GNU assembler starting 2.40 release always generates R_RISCV_CALL_PLT
reloc for call in assembler [1], similarly llvm does not make
distinction between R_RISCV_CALL_PLT and R_RISCV_CALL [2]
Upstream-Status: Submitted [https://lists.gnu.org/archive/html/grub-devel/2023-02/msg00143.html]
[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=70f35d72ef04cd23771875c1661c9975044a749c
[2] https://reviews.llvm.org/D132530
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
grub-core/kern/riscv/dl.c | 1 +
1 file changed, 1 insertion(+)
--- a/grub-core/kern/riscv/dl.c
+++ b/grub-core/kern/riscv/dl.c
@@ -188,6 +188,7 @@ grub_arch_dl_relocate_symbols (grub_dl_t
break;
case R_RISCV_CALL:
+ case R_RISCV_CALL_PLT:
{
grub_uint32_t *abs_place = place;
grub_ssize_t off = sym_addr - (grub_addr_t) place;
--- a/util/grub-mkimagexx.c
+++ b/util/grub-mkimagexx.c
@@ -1294,6 +1294,7 @@ SUFFIX (relocate_addrs) (Elf_Ehdr *e, st
}
break;
case R_RISCV_CALL:
+ case R_RISCV_CALL_PLT:
{
grub_uint32_t hi20, lo12;
@@ -1725,6 +1726,7 @@ translate_relocation_pe (struct translat
case R_RISCV_BRANCH:
case R_RISCV_JAL:
case R_RISCV_CALL:
+ case R_RISCV_CALL_PLT:
case R_RISCV_PCREL_HI20:
case R_RISCV_PCREL_LO12_I:
case R_RISCV_PCREL_LO12_S:

View File

@@ -1,47 +0,0 @@
From f1217c803cec90813eb834dde7829f4961b2a2e4 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Thu, 17 Feb 2022 15:07:02 -0800
Subject: [PATCH] configure.ac: Use _zicsr_zifencei extentions on riscv
From version 2.38, binutils defaults to ISA spec version 20191213. This
means that the csr read/write (csrr*/csrw*) instructions and fence.i
instruction has separated from the `I` extension, become two standalone
extensions: Zicsr and Zifencei.
The fix is to specify those extensions explicitely in -march. Since we
are now using binutils 2.38+ in OE this is ok, a more upstreamable fix for
grub will be to detect these extentions, however thats not easy to
implement
Upstream-Status: Inappropriate [OE specific]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
configure.ac | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index c7fc55a..072f2c9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -849,14 +849,14 @@ if test x"$platform" != xemu ; then
[grub_cv_target_cc_soft_float="-mgeneral-regs-only"], [])
fi
if test "x$target_cpu" = xriscv32; then
- CFLAGS="$TARGET_CFLAGS -march=rv32imac -mabi=ilp32 -Werror"
+ CFLAGS="$TARGET_CFLAGS -march=rv32imac_zicsr_zifencei -mabi=ilp32 -Werror"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
- [grub_cv_target_cc_soft_float="-march=rv32imac -mabi=ilp32"], [])
+ [grub_cv_target_cc_soft_float="-march=rv32imac_zicsr_zifencei -mabi=ilp32"], [])
fi
if test "x$target_cpu" = xriscv64; then
- CFLAGS="$TARGET_CFLAGS -march=rv64imac -mabi=lp64 -Werror"
+ CFLAGS="$TARGET_CFLAGS -march=rv64imac_zicsr_zifencei -mabi=lp64 -Werror"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
- [grub_cv_target_cc_soft_float="-march=rv64imac -mabi=lp64"], [])
+ [grub_cv_target_cc_soft_float="-march=rv64imac_zicsr_zifencei -mabi=lp64"], [])
fi
if test "x$target_cpu" = xia64; then
CFLAGS="$TARGET_CFLAGS -mno-inline-float-divide -mno-inline-sqrt -Werror"
--
2.35.1