UEFI / EDK2 on the Rock 5B

Yes, DTB is absolutely not needed for UEFI, it is transmitted via efi to the kernel, for example, the FreeBSD kernel understands it perfectly. Linux probably can too, I don’t know. But if you want to see kernel boot debugging, you need to have a proper console description in DTB.

does now linux work on the rock 5b with uefi perfectley

In the long run, what you want is proper console description in ACPI instead, assuming SystemReady is what you’re after.

Using a fixed DTB from u-boot\EDK2 for the kernel is a bad approach. DTB kernels can vary greatly (and change rapidly from version to version) from the one available in EDK2 or even from another version of the kernel. Therefore, EDK2 should pass EFI\grub only the specific name of the dtb that they should use from the kernel. According to this principle, running with extlinux.conf in u-boot works. This allows to have one universal system image for all devices.

All this is there and works well (displaying the entire startup process in the UART console). Also in the Armbain version with EDK2 support, the grub menu works on the rk3588 to control the system startup, as on a regular PC. It remains to wait for HDMI support for rk3588. On the rk356x, this already fully works (selecting the system\kernel on the HDMI screen from the USB keyboard, including when starting the system from an SD card).

By the way, on rk3588, for some reason, the entire system does not work from the SD card yet, grub is installed in the console (grubrescue) and cannot read data from the SD card (writes that it does not see the file system). May need to change the settings to support SD card, similar to USB).

It’s not clear what you mean. The latest version of Armbian with support for EDK2-EFI\grub runs perfectly and all kernel functions work, similarly starting the system using u-boot\extlinux.conf. You can check everything yourself, an SD card and a USB flash drive are enough, for details on how to launch Armbian with EDK2, see the corresponding topic. The only limitation for today is that only 8GB of RAM is defined.

In fact, EDK2 only needs to properly initialize the basic part of the hardware, run efi\grub and pass them the correct DTB name to use. I have not yet found a way to pass to efi\grub the name of the DTB that they should use when starting the kernel (I have not found an analogue to the description of “fdt /boot/dtb/rockchip/name.dtb” of the DTB that is used in extlinucx.conf)

what does work on armbian with edk2 uefi (i meant just booting)

What prevents you from checking for yourself ? The process is very simple. Download the latest image with Armbian-EDK2 support, unpack, burn simultaneously to two media (SD card and USB flash drive), connect both media (SD card and USB flash drive) and turn on the power. If you have a UART console , you will get the GRUB menu with all the standard functions , as on a regular PC.

maybe lazyness? ok i will try myself

is hdmi allready working?

How did you manage to get FreeBSD to work? I got the Armbian EFI image to work but can’t get any FreeBSD image to work. Did you build one with crochet or just use one of the Pre-made default downloads. Currently getting this error complaining about a missing DTB:

This is because this PR removes DTB from UEFI.

You need to roll it back or substitute your custom DTB file into the kernel.
This can be done in FreeBSD’s efi loader configuration.
To do this, you need to modify the default FreeBSD image.
You need to put the DTB file in it in the /boot/dtb directory and create a configuration file for loader.efi - /boot/loader.conf

#
# Hack to get loader to find dtb.
#
dtbfile_load="YES"
dtbfile_type="dtb"
dtbfile_name="rk3588-rock-5b.dtb"

I use crochet for quick builds.

I rolled back the changes by uncommenting. However FreeBSD still hangs during the boot process. (I’m using USB for FreeBSD)
I’ll try the second option next by adding a custom DTB into the kernel instead. Are you using the one provided by the official Debian build?

I modified the original dtb by adding in the chosen section

stdout-path=

     --- rk3588-orig.dts 2022-12-27 20:26:52.358052771 +0000
     +++ rk3588.dts 2022-11-24 20:42:59.137942955 +0000
     @@ -8661.6 +8661.7 @@
     };

     chosen {
             + stdout-path = "/serial@feb50000";
             bootargs = "earlycon=uart8250,mmio32,0xfeb50000 console=ttyFIQ0 irqchip.gicv3_pseudo_nmi=0 root=PARTUUID=614e0000-0000 rw rootwait";
     };

You can try my UEFI binary, it should work.

https://personalbsd.org/download/Business/RK3588_NOR_FLASH.img

I have not tried the standard FreeBSD image,
I’m not sure if the console will work correctly there.

I used my test image for RK3568 which I ran in ACPI mode on a Rock-5B.

This image will definitely work.

https://personalbsd.org/download/Business/FreeBSD-aarch64-14.0-CURRENT-GENERIC-RK356X-20221227.img.xz

3 Likes

Hello SleepWalker,
could you please re-upload both files ? I want to test and play around with UEFI and FreeBSD.
How to handle with that RK3588_NOR_FLASH.img ?
Thanks
Andreas

1 Like

You just have to write it to the SD card.
You can just use the dd command
and FreeBSD on USB flash.

Hi All.
Has anyone managed to get PCIe to work correctly?

Thank you SleepWalker,
FreeBSD is working (only via serial console) but it’s okay for a first test.
Next test was with Fedora. GRUB console is working but afterwards only dump errors are visible. Nothing with I can handle.
Not good news.

Andreas

try it with other distros maybe arch or debian also the hated and loved ubuntu and why not armbian generic

Do you mean starting the system with M2\SSD using EDK2 (EDK2-EFI is placed on the SD card)?

Oh sure.

UEFI can be written to both eMMC and SPI FLASH I think.

The current PCIe driver in UEFI does not work correctly at all.

For example, I draw four NVMe from me, although I actually have one. All this is very strange.
If you add PCIe2 support then UEFI can add support for 2.5GbE Ethernet via the driver provided by REALTEK UEFI UNDI Driver for RTL8125

https://www.realtek.com/en/component/zoo/category/network-interface-controllers-10-100-1000m-gigabit-ethernet-pci-express-software

This may look very good on Rock 5B.