From: Waldemar Brodkorb <wbx@openadk.org>
To: Romain Naour <romain.naour@smile.fr>
Cc: Mark Corbin <mark@dibsco.co.uk>,
Jesse Taube <mr.bossman075@gmail.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
buildroot@buildroot.org, Romain Naour <romain.naour@gmail.com>,
Charles Lohr <lohr85@gmail.com>, Yimin Gu <ustcymgu@gmail.com>,
Giulio Benetti <giulio.benetti@benettiengineering.com>
Subject: Re: [Buildroot] [PATCH v2 4/4] configs/qemu_riscv32_nommu_virt_defconfig: New defconfig
Date: Sun, 1 Oct 2023 16:09:14 +0200 [thread overview]
Message-ID: <ZRl9ikAM2+k82PiI@waldemar-brodkorb.de> (raw)
In-Reply-To: <3f01b947-21f8-d573-a8fe-b7ca6d044170@smile.fr>
[-- Attachment #1: Type: text/plain, Size: 1601 bytes --]
Hi Romain,
Romain Naour wrote,
> Hi Waldemar,
>
> Le 01/10/2023 à 13:39, Waldemar Brodkorb a écrit :
> > Hi Romain,
> >
> > Romain Naour wrote,
> >
> >> Hello,
> >>
> >> Le 17/12/2022 à 06:13, Jesse Taube a écrit :
> >>> Add RISC-V 32-bit nommu defconfig for QEMU virt machine with MMU
> >>> disabled.
> >>>
> >>> Unlike qemu_riscv32_virt, qemu_riscv32_nommu_virt does not use OpenSBI,
> >>> since the kernel is running in machine mode (M-mode).
> >>>
> >>> Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com>
> >>> Cc: Yimin Gu <ustcymgu@gmail.com>
> >>
> >> I rebased the elf2flt patch for risc32 [1] on top of elf2flt 2023.09 release,
> >> then I enabled the risc32 uclibc-ng support [2] without patching it since we use
> >> the latest release (v1.0.44) containing this commit [3].
> >>
> >> But the system doesn't boot due to a reloc issue:
> >>
> >> binfmt_flat: reloc outside program 0xfff7b6dc (0 - 0x9cec0/0x8a180), killing sh!
> >> Starting init: /bin/sh exists but couldn't execute it (error -8)
> >>
> >> This issue may be related to the toolchain used to build this defconfig (gcc
> >> 12.3.0 and binutils 2.40) that is newer than the toolchain used at the time this
> >> series was tested.
> >
> > Can you share your elf2flt patch, please.
>
> Sure, It the initial patch from Jesse Taube but without the relocation part that
> was part of riscv64 commit:
>
> https://github.com/uclinux-dev/elf2flt/commit/c5c8043c4d79a1cdd9bd359a542e6fdf3b04d5a1
>
> I hope this can help.
See attached patch I am using, there is one change missing in your
patch.
best regards
Waldemar
[-- Attachment #2: 0001-riscv32.patch --]
[-- Type: text/x-diff, Size: 1555 bytes --]
diff -Nur elf2flt-v2023.04.orig/elf2flt.c elf2flt-v2023.04/elf2flt.c
--- elf2flt-v2023.04.orig/elf2flt.c 2023-09-04 11:29:05.952417209 +0200
+++ elf2flt-v2023.04/elf2flt.c 2023-09-04 11:30:05.371065966 +0200
@@ -81,7 +81,7 @@
#include <elf/v850.h>
#elif defined(TARGET_xtensa)
#include <elf/xtensa.h>
-#elif defined(TARGET_riscv64)
+#elif defined(TARGET_riscv64) || defined(TARGET_riscv32)
#include <elf/riscv.h>
#endif
@@ -127,6 +127,8 @@
#define ARCH "xtensa"
#elif defined(TARGET_riscv64)
#define ARCH "riscv64"
+#elif defined(TARGET_riscv32)
+#define ARCH "riscv32"
#else
#error "Don't know how to support your CPU architecture??"
#endif
@@ -822,7 +824,7 @@
goto good_32bit_resolved_reloc_update_text;
default:
goto bad_resolved_reloc;
-#elif defined(TARGET_riscv64)
+#elif defined(TARGET_riscv64) || defined(TARGET_riscv32)
case R_RISCV_NONE:
case R_RISCV_32_PCREL:
case R_RISCV_ADD8:
diff -Nur elf2flt-v2023.04.orig/ld-elf2flt.c elf2flt-v2023.04/ld-elf2flt.c
--- elf2flt-v2023.04.orig/ld-elf2flt.c 2023-09-04 11:28:59.072573514 +0200
+++ elf2flt-v2023.04/ld-elf2flt.c 2023-09-04 11:29:32.507813592 +0200
@@ -327,7 +327,7 @@
/* riscv adds a global pointer symbol to the linker file with the
"RISCV_GP:" prefix. Remove the prefix for riscv64 architecture and
the entire line for other architectures. */
- if (streq(TARGET_CPU, "riscv64"))
+ if (streq(TARGET_CPU, "riscv64") || streq(TARGET_CPU, "riscv32"))
append_sed(&sed, "^RISCV_GP:", "");
else
append_sed(&sed, "^RISCV_GP:", NULL);
[-- Attachment #3: Type: text/plain, Size: 150 bytes --]
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2023-10-01 14:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-17 5:13 [Buildroot] [PATCH v2 0/4] Add RISC-V 32 NOMMU support Jesse Taube
2022-12-17 5:13 ` [Buildroot] [PATCH v2 1/4] package/elf2flt: add RISC-V 32-bits support Jesse Taube
2022-12-17 5:13 ` [Buildroot] [PATCH v2 2/4] package/uclibc: Add RISC-V 32-bit support Jesse Taube
2023-09-30 21:31 ` Romain Naour
2022-12-17 5:13 ` [Buildroot] [PATCH v2 3/4] arch: Enable support for RISC-V 32-bit NOMMU Jesse Taube
2022-12-17 5:13 ` [Buildroot] [PATCH v2 4/4] configs/qemu_riscv32_nommu_virt_defconfig: New defconfig Jesse Taube
2023-10-01 7:15 ` Romain Naour
2023-10-01 11:39 ` Waldemar Brodkorb
2023-10-01 12:02 ` Romain Naour
2023-10-01 14:09 ` Waldemar Brodkorb [this message]
2023-01-08 19:40 ` [Buildroot] [PATCH v2 0/4] Add RISC-V 32 NOMMU support Jesse Taube
2023-02-12 20:59 ` Jesse Taube
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZRl9ikAM2+k82PiI@waldemar-brodkorb.de \
--to=wbx@openadk.org \
--cc=buildroot@buildroot.org \
--cc=giulio.benetti@benettiengineering.com \
--cc=lohr85@gmail.com \
--cc=mark@dibsco.co.uk \
--cc=mr.bossman075@gmail.com \
--cc=romain.naour@gmail.com \
--cc=romain.naour@smile.fr \
--cc=thomas.petazzoni@bootlin.com \
--cc=ustcymgu@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox