During my experiments with u-boot i noticed that it is able to boot an EFI binary, which made me wonder if i could actually use u-boot to start grub. I usually like grub because it allows me to choose between different kernel versions and configurations.
I started my experiment with plain grub 2.06. It compiles fine for RISC-V. Actual installation in /boot with grub-install requires the use for the --force parameter because it can’t find the efibootmgr, which is ok because it’s not an actual UEFI platform.
I interrupted u-boot in it’s boot sequence and was able to start grub with these commands (nvme 0:3 is my /boot):
pci enum nvme scan load nvme 0:3 $kernel_addr_r /EFI/gentoo/grubriscv64.efi bootefi $kernel_addr_r
After that grub showed it’s usual prompt. It is even able to access my SD card and my SSD. Now here’s the catch: This version doesn’t support the “linux” command (required to load the linux kernel) on RISC-V
Then i found this thread on the grub-devel maillinglist:
These patches implement just the linux command for RISC-V. I added the patches to my grub and it’s partially succesful.
If i just type the regular linux command including all the parameters listed in extlinux.conf the kernel actually boots. Unfortunately a lot of hardware doesn’t work (including the SSD, the SD card does work), i think because of a missing devicetree. Grub has support for devicetrees, but if i load a devicetree i only get this message:
EFI stub: ERROR: /chosen/boot-hartid missing or invalid!
It seems that u-boot adds this to the devicetree and grub doesn’t. As far as i know the boot hart is selected at random during boot, is it possible to set it to a fixed value so i can add it as a fixed entry in the devicetree?