Installing Gentoo on the Unmatched

Hi All,

My first goal with the Unmatched is to install Gentoo on it. Is anyone else here interested in that?
I made a writeup in the Gentoo forums with my progress so far. Unfortunately i can’t link directly to my post, but this is the right topic and the right page, you just have to scroll down a bit :slight_smile: :


I found your post from Google. This is the direct link to it: Gentoo Forums :: View topic - Risc-v It was very helpful. Thanks a lot!

Are you able to reboot though? I’m exactly the same strategy and the patches seem to have been applied and I’m using nearly the default config (besides from a few options that some packages complained about when emerging).

I’m getting a rcu: INFO: rcu_sched self-detected stall on CPU. This is what I found about it, but both are about Unleashed, not Unmatched (apparently I can’t put more than 2 links because I’m a new user):

  • forums dot sifive dot com/t/rebooting-fails-with-rcu-sched-self-detected-stall-on-cpu/3285
  • github dot com/sifive/meta-sifive/issues/3

And this isn’t a known issue on meta-sifive’s README. Maybe I’m missing a patch or config?

software reboot isn’t supported. This is documented in the freedom-u-sdk release notes.


Thanks for your feedback on my post @jansegre, and no, i can’t reboot (as @jimw already pointed out), although the effect of running “reboot” is different with Gentoo/OpenRC than with FU-SDK. In Gentoo i get a clean shutdown, and after that it simply stops. When I accidentally typed reboot in FU-SDK the system kept running and I had to do an unclean shutdown to get out of the situation it was in.
I’m thinking about patching the sys-apps/sysvinit package to make reboot do the same as halt just in case i type the wrong command :slight_smile:

Now i got my basic Gentoo setup going i’d like to see if i can build the bootloader(s) from source and make Gentoo packages (ebuilds) for them.

It seems that partition 1 on the SD Card is U-Boot, and partition 2 is U-Boot/OpenSBI. Is that correct? I’m unsure because the actual configuration file loaded from partition 3 (/boot in the SDK) is called extlinux.conf.

I’m also thinking of a save way to experiment with this, assuming i’ll make some mistakes which makes it unbootable. As far a as I can see, if I dd partition 1 and 2 of the SD Card into a file and can always restore by dd’ing the files back to the partitions, right? In case i really made a mess i can aways download an image of the SDK and re-image the whole SD-Card :slight_smile:

I started by using the latest SDK image and never used the SD card that was shipped. So that surely works and you can’t ruin your bootability (is this a word?) that way.

I suggest this as a guide for building your own sdcard image

Thanks @jimw, that link contained all information i needed. I now have ebuilds voor u-boot and opensbi and just successfully booted with my self-compiled u-boot/opensbl in partition 1 and 2 of the SD card.
There seems to be a little mistake on that page though, in the section “Creating an SDCard Image file” is says:

# Write the bootloader partitions. Adjust "loop0" to your loop device created in previous command if needed.
sudo dd if=u-boot/spl/u-boot-spl.bin of=/dev/loop0p1 bs=8k iflag=fullblock oflag=direct conv=fsync status=progress
sudo dd if=opensbi/build/platform/generic/firmware/fw_payload.bin of=/dev/loop0p2 bs=8k iflag=fullblock oflag=direct conv=fsync status=progress

There i think the fw_payload.bin is wrong. In a later section “Installing/Updating new Kernel and Bootloader packages” the right commands are listed:

# Write the new U-boot and SPL to the SDcard
sudo dd if=u-boot.itb of=/dev/mmcblk0p2 bs=4k oflag=direct
sudo dd if=u-boot-spl.bin of=/dev/mmcblk0p1 bs=4k oflag=direct

I also made an gentoo overlay containing a few packages:

  • sys-boot/opensbi-0.9 (opensbi with sifive patches applied)
  • sys-boot/u-boot-2021.01_rc5 (u-boot with sifive patches applied)
  • sys-kernel/sifive-sources-5.12.11 (gentoo-sources with sifive patches applied, and places defconfig in arch/riscv/configs/unmatched_defconfig)
  • sys-apps/sysvinit-2.99 (sysvinit with halt patched to halt if you call reboot and installs an inittab with the serial console at ttySIF0 enabled)
  • media-video/mplayer-1.4-r1 (mplayer with a small patch for the configure script to accept the RISC-V architecture)

If anyone is interested i’ll be happy to share, just let me know.


You can file an issue against the github repo to report bugs. I went ahead and did that adding a link back to here. This looks like an editing error converting the unleashed info to the unmatched info as the unleased used an older scheme, and fw_payload.bin was correct for the unleashed.

Thanks for registering the issue for the documentation. I don’t have a github account and actually don’t want to have one :slight_smile:

1 Like

In case someone is interested: I’ve published my overlay here:
The name of the overlay is of course a play on the name of the board :slight_smile:

Any feedback is welcome.