Failure of riscv-linux

Tried to build RISCV Linux 4.6.2, but it could not be loaded by spike.

I followed the instructions from the following two links and built spike, Linux 4.6.2 and BusyBox


https://www.ocf.berkeley.edu/~qmn/linux/install.html

But when I tried to start it by “spike +disk=root.bin vmlinux”, I got an error message,

terminate called after throwing an instance of ‘trap_store_access_fault’

Does anyone have any clue?

Thanks

Tried “spike +disk=root.bin bbl”, it works partially. It seems the VFS cannot be mounted. Will check inittab.

The second guide is very much outdated now. More precisely, what has changed since 2014:

  • spike no longer supports external disk images following the deprecation of the Host-Target Interface (HTIF). This is the reason for the mount error - an embedded initramfs is now required if using spike.
  • vmlinux is no longer loaded directly but rather embedded in bbl.

An easier way to build a Linux image that works with the current spike simulator is through the Freedom U SDK, which automates the entire process.

$ git clone https://github.com/sifive/freedom-u-sdk.git
$ cd freedom-u-sdk
$ git submodule update --init --recursive
$ make
$ spike work/riscv-pk/bbl

Yep. I saw there was a payload definition in bbl.

Not sure about how to give root img file yet. Will try freedom-u-sdk later.

Thanks

The CONFIG_INITRAMFS_SOURCE Kconfig option specifies which initramfs image to embed. This can be a cpio archive, sysroot directory, or a configuration file. See Documentation/early-userspace/README.

After compiling freedom-u-sdk (with some tweaks), spike + bbl can start Linux now.

But I am stuck with the login

Welcome to Buildroot
buildroot login:

what are the login name and password? I tried a few, but nono of them worked.

Thanks

The default login credentials are

  • username: root
  • password: sifive

It works. Thanks.

I saw bbl included Linux core, so it becomes independent now.

The network interface eth0 does not work now.

Another question is how to mount external FS blocks to this Linux. I think I have to change etc/fstab under sysroot to make it happen, but I am not sure how to do it in this setup.

Since spike doesn’t implement a virtual Ethernet device, eth0 being absent is expected. Keep in mind that the SDK is originally intended for use with the VC707 development board to which a physical NIC can be connected via PCIe. It should be possible to modify the buildroot to exclude the networking initscript.

At this time, spike doesn’t support external block devices, so there is no way to mount additional filesystems. You will have to add whatever files you need to the buildroot initramfs using a filesystem overlay. Unfortunately, this means that file modifications aren’t persistent.

Hello All

First i followed the steps in
https://github.com/riscv/riscv-linux
and in the process i was able to complile spike, gcc, linux etc.
How ever i was not successful in booting linux using spike.

Meanwhile i hit up on the instructions using freedom-u-sdk
and I have been able to compile the freedom-u-sdk by following the steps
$ git clone https://github.com/sifive/freedom-u-sdk.git
$ cd freedom-u-sdk
$ git submodule update --init --recursive
$ make

The following (few executable + linux kernel) are shown…

-rwxrwxr-x 1 gvsk gvsk 7986392 Oct 28 19:13 work/bbl.bin
-rw-rw-r-- 1 gvsk gvsk 23959176 Oct 28 19:13 work/bbl.hex
-rwxrwxr-x 1 gvsk gvsk 8718576 Oct 28 19:12 work/linux/vmlinux
-rwxrwxr-x 1 gvsk gvsk 80248 Oct 28 19:13 work/riscv-pk/pk
-rwxrwxr-x 1 gvsk gvsk 8000120 Oct 28 19:13 work/riscv-pk/bbl

However i dont find the spike (sources/executable) in the freedom-u-sdk.

So i used the spike from the riscv-tools to boot up linux
$ …/…/riscv/bin/spike work/riscv-pk/bbl

but it does not boot vmlinux.

Not sure where i am going wrong. Any pointers/suggestions are welcome.

thanks in advance
best regards
santhosh

The spike invoked from riscv won’t work on the freedom-u-sdk.Instead type “make sim” in the freedom-u-sdk top level dir. It will build everything you need and then boot the kernel in spike.