From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arne Fitzenreiter To: development@lists.ipfire.org Subject: [PATCH 2/3] grub: fix mkimage on riscv64 and fix cdrom Date: Sun, 08 Oct 2023 09:27:21 +0200 Message-ID: <20231008072722.3900296-2-arne_f@ipfire.org> In-Reply-To: <20231008072722.3900296-1-arne_f@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6159265203740579990==" List-Id: --===============6159265203740579990== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable the riscv64 image needs more than 1.44MB Signed-off-by: Arne Fitzenreiter --- lfs/cdrom | 2 +- lfs/grub | 1 + .../grub-Handle-R_RISCV_CALL_PLT-reloc.patch | 48 +++++++++++++++++++ 3 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 src/patches/grub/grub-Handle-R_RISCV_CALL_PLT-reloc.patch diff --git a/lfs/cdrom b/lfs/cdrom index 261df2663..fed69f171 100644 --- a/lfs/cdrom +++ b/lfs/cdrom @@ -220,7 +220,7 @@ ifeq "$(EFI)" "1" < $(DIR_SRC)/config/cdrom/grub.cfg > $(DIR_TMP)/cdrom/EFI/BOOT/grub.cfg =20 # Create the EFI Eltorito image - dd if=3D/dev/zero of=3D$(DIR_TMP)/cdrom/boot/isolinux/efiboot.img bs=3D1k c= ount=3D1440 + dd if=3D/dev/zero of=3D$(DIR_TMP)/cdrom/boot/isolinux/efiboot.img bs=3D1k c= ount=3D2880 mkdosfs -F 12 -n "IPFIRE_EFI" $(DIR_TMP)/cdrom/boot/isolinux/efiboot.img =20 # Mount the EFI image diff --git a/lfs/grub b/lfs/grub index c32edb2ef..e4cd35d78 100644 --- a/lfs/grub +++ b/lfs/grub @@ -96,6 +96,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) 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/grub-Use-zifencei= -on-riscv.patch + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/grub/grub-Handle-R_RIS= CV_CALL_PLT-reloc.patch cd $(DIR_APP) && autoreconf -vfi =20 # Install unifont diff --git a/src/patches/grub/grub-Handle-R_RISCV_CALL_PLT-reloc.patch b/src/= patches/grub/grub-Handle-R_RISCV_CALL_PLT-reloc.patch new file mode 100644 index 000000000..f3f12b6f0 --- /dev/null +++ b/src/patches/grub/grub-Handle-R_RISCV_CALL_PLT-reloc.patch @@ -0,0 +1,48 @@ +From 64be669638e198bc0c7c1a344547265dfacd2470 Mon Sep 17 00:00:00 2001 +From: Khem Raj +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/20= 23-02/msg00143.html] + +[1] https://sourceware.org/git/?p=3Dbinutils-gdb.git;a=3Dcommit;h=3D70f35d72= ef04cd23771875c1661c9975044a749c +[2] https://reviews.llvm.org/D132530 + +Upstream-Status: Pending +Signed-off-by: Khem Raj +--- + 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; +=20 + case R_RISCV_CALL: ++ case R_RISCV_CALL_PLT: + { + grub_uint32_t *abs_place =3D place; + grub_ssize_t off =3D 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; +=20 +@@ -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: --=20 2.39.2 --===============6159265203740579990==--