Buildroot RV32 Linux.

386 views
Skip to first unread message

David H. Lynch Jr.

unread,
Jun 1, 2018, 6:04:19 PM6/1/18
to RISC-V SW Dev
I have been trying to get riscv-32 linux booting under qemu for some
time. With help from here I have made substantial progress.

I appear to have a working toolchain/linux/qemu for riscv-32

but when I "boot" I get the error below.
I have checked and for reasons I do not understand Buildroot is
creating an x86 image and obviously an x86 /sbin/init is not going to
run on a riscv-32.

I compared the build root process of riscv-32 and riscv-64 buildroot
trying to figure out where and why buildroot is creating an x86 image
but only when building for 32 bits.
But I have not been able to sort that out yet.





0.513525] This architecture does not have kernel memory protection.
[    0.516684] Failed to execute /init (error -8)
[    0.517177] Starting init: /sbin/init exists but couldn't execute it
(error -8)
[    0.517739] Starting init: /bin/sh exists but couldn't execute it
(error -8)
[    0.517958] Kernel panic - not syncing: No working init found.  Try
passing init= option to kernel. See Linux Documentation/admin-
guide/init.rst for guidance.
[    0.518316] CPU: 0 PID: 1 Comm: swapper Not tainted 4.15.0-00047-
g2751b6aad368 #2
[    0.518530] Call Trace:
[    0.518659] [<(ptrval)>] walk_stackframe+0x0/0xa2
[    0.518811] [<(ptrval)>] show_stack+0x24/0x32
[    0.518936] [<(ptrval)>] dump_stack+0x20/0x2c
[    0.519060] [<(ptrval)>] panic+0xc4/0x1d6
[    0.519179] [<(ptrval)>] kernel_init+0xe4/0xe8
[    0.519305] [<(ptrval)>] ret_from_syscall+0xa/0xe
[    0.519591] ---[ end Kernel panic - not syncing: No working init
found.  Try passing init= option to kernel. See Linux
Documentation/admin-guide/init.rst for guidance.

Tommy Murphy

unread,
Jun 1, 2018, 6:39:23 PM6/1/18
to RISC-V SW Dev, dh...@dlasys.net

David H. Lynch Jr.

unread,
Jun 2, 2018, 2:11:19 AM6/2/18
to Tommy Murphy, RISC-V SW Dev
Yes, It is the LAST problem in the chain, and I beleive I have found it and fixed it.
It was an error running SED on the config file for buildroot



On Fri, 2018-06-01 at 15:39 -0700, Tommy Murphy wrote:
--
You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+un...@groups.riscv.org.
To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/sw-dev/45a1e653-ce38-4252-a3dd-16535f6c5095%40groups.riscv.org.

Michael Clark

unread,
Jun 2, 2018, 4:19:42 PM6/2/18
to dh...@dlasys.net, RISC-V SW Dev
Hi David,

I managed to get buildroot to build a riscv32 image but I can’t remember how. I remember that I got ENOEXEC from the kernel. I used a simpler root image build script (requires minor modification to build for riscv32) to build a riscv32 busybox:


I remember my first buildroot builds came out as x86 but I may have added or modified a platform default config file with help from Palmer. Search for platform configuration files i.e. find buildroot -name ‘*riscv32*’ -o -name ‘*riscv64*’

Your Makefile was really helpful btw.

In any case I am pretty certain I got ENOEXEC with a riscv32 binary and I began looking at the kernel code to see where the issue might be.

It might be worth trying busybear (busybox plus dropbear) as it’s a lot simpler to modify compared to buildroot. It’s just two scripts, a conf directory and a skeleton etc directory. It’s dynamically linked by default. I changed it to static linking by editing conf/busybox.conf to eliminate ld-linux.so while trying to debug the ENOEXEC.

Michael
--
You received this message because you are subscribed to the Google Groups "RISC-V SW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sw-dev+un...@groups.riscv.org.
To post to this group, send email to sw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/sw-dev/.

David H. Lynch Jr.

unread,
Jun 9, 2018, 6:28:26 PM6/9/18
to Michael Clark, RISC-V SW Dev
I have successfully built and executed RV32 Linux from the freedom-u-sdk

I thank you and others for their help.

I am going to try to put together a patchfile that allows either 32 or 64 bit builds.
I beleive the changes are entirely to the "root" Makefile.

I assume I post that to pat...@groups.riscv.org ?

Jim Wilson

unread,
Jun 9, 2018, 6:56:31 PM6/9/18
to Dave Lynch, Michael Clark, RISC-V SW Dev
On Sat, Jun 9, 2018 at 3:28 PM, David H. Lynch Jr. <dhly...@gmail.com> wrote:
> I have successfully built and executed RV32 Linux from the freedom-u-sdk
>
> I assume I post that to pat...@groups.riscv.org ?

pat...@groups.riscv.org is for cc'ing patches that go elsewhere. It
is not a primary place to send patches.

Since you are using freedom-u-sdk, you should send the patches to that
github tree, either as a pull request or in an issue.

Jim
Reply all
Reply to author
Forward
0 new messages