UEFI / EDK2 on the Rock 5B

Откатил этот PR, и заодно убрал комент в Dsdt.asl с usb2. загрузка пошла , но виснет в процессе запуска системы.

Если ты запускаешься в режиме FDT - тебе нужен правильный DTB файл, если в режиме ACPI,
я сильно сомневаюсь. Я на всякий случая откатываю и коммит который удаляет DTB.
Я запускаю FreeBSD с USB в режиме ACPI, так как у меня ещё нет полной поддержки RK3588

Это в настройках ?
кстати, откуда берётся сам dtb (из каких исходников собран или взят из ядра ? ), который лежит уже готовым бинарником

нашёл, оно ?

Its great to see progress on this front, but would you mind staying with english please (;

Yes this. You can take any DTB that your operating system kernel likes.
I just take from the Debian build, from Radxa.
In the uefi source codes, there is a binary DTB.

Rolled back all the changes for the rk3588-evb variant. Starting from USB worked fine. so there is something that is not working correctly in subsequent changes. Now I will look for the “culprit” of the problems (compare rock 5b configs. and rk3588-evb)

Did I understand correctly that DTB is not needed for EDK2 itself? Is it needed already for the running kernel ? I.e. can I use DTB from my working core directly in EDK2? I have a kernel startup and DTB registered in the grub config and the kernel uses it.

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