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.