UEFI / EDK2 on the Rock 5B

Hello,

I’ve started to implement an SBBR-compatible bootloader on the Rock 5B, to replace the default u-boot.

I have found a few repositories online of what appears to be EDK2 sources from various RK3588 BSP versions (e.g. https://gitlab.com/rk3588_linux/rk/uefi-monorepo/-/tree/linux-5.10/edk2-platforms, https://github.com/chainsx/edk2-rk3588), and successfully compiled and booted one of them (chainsx’s one). However, one very important feature that’s missing is HDMI out support.

Now, I did find an HDMI driver for the RK3568, but unfortunately the HDMI IP is quite different between the two SoCs.

Before I start adding RK3588 support to that driver, I would like to make sure I’m not duplicating effort with Rockchip’s or Radxa’s engineers. Unfortunately while Radxa’s GitHub has most parts of the BSP uploaded, EDK2 / UEFI is not there (probably because work on customizing it for the Rock 5B hasn’t started yet), and the other 2 repositories are either not up to date, or they don’t have commit history.

I would therefore like to ask to have the EDK2 BSP sources uploaded to Radxa’s GitHub (assuming Radxa has received such code, and is allowed to publish it), just like u-boot sources currently are. I could then submit my changes on top of that as pull requests.

EDIT: I have uploaded my work so far to https://github.com/Googulator/edk2-rk3588

8 Likes

https://gitlab.com/rk3588_linux/ is uploaded by me since the rockchip sdk uses manifest whose folder structure cannot be reproduced on GitHub. The version I uploaded there is also a bit outdated. I’ll update uefi-monorepo to the latest release for you.

Edit: https://gitlab.com/rk3588_linux/rk/uefi-monorepo/-/tree/linux-5.10-gen-rkr3.4 is the latest Rockchip release.

@SleepWalker maybe you two can have some discussion about it.

1 Like

I’d love to see the latest version of uefi.
I think you’ve already seen it


Yes, we can discuss it.

I just got some new info from Rockchip. They are working on HDMI right now, and will add serial number support in SMBIOS. They will also release a new version this month (unknown if above features will be included or not).

3 Likes

Maybe RockChip will look at Jared’s code and it will make it easier for them. I really like Jared’s code, it’s so clear and simple

1 Like

I was able to get FreeBSD running on Rock 5B using the uefi bootloader.
I used the master branch and I had to completely block the pci code otherwise the system hung on the pci initialization.

This code is for Rockchip development board and needs to be modified for Rock 5B

is HDMI allready working? or was it through the serial console and what boot device did you use and would it be possible to boot linux via grub

I used console.
As mentioned earlier, the HDMI initialization code is not in uefi yet.
I tested booting efi loader from efi partition and running FreeBSD OSes. It works. Only blue USB ports work and for some reason in USB 2.0 mode. All this requires study, the uefi code is very raw this is the Alfa version.

and did you try it with linux? if yes did it work and where is your code?

I think Linux can be tried to run, but this is not a great specialist.
This patch - disable pci

diff --git a/edk2-platforms/Platform/Rockchip/RK3588/AcpiTables/Dsdt.asl b/edk2-platforms/Platform/Rockchip/RK3588/AcpiTables/Dsdt.asl
index c7d03babd5..db7c865a25 100755
--- a/edk2-platforms/Platform/Rockchip/RK3588/AcpiTables/Dsdt.asl
+++ b/edk2-platforms/Platform/Rockchip/RK3588/AcpiTables/Dsdt.asl
@@ -10,6 +10,11 @@
  *  SPDX-License-Identifier: BSD-2-Clause-Patent
  *
  **/
+/** ^M
+ *   include ("Pcie.aslc")^M
+ *   include ("Sata.asl")^M
+ *   include ("Gmac.asl")^M
+ **/^M
 
 #include "AcpiTables.h"
 
@@ -65,10 +70,7 @@ DefinitionBlock ("Dsdt.aml", "DSDT", 2, "RPIFDN", "RPI", 2)
       }
     }
 
-    include ("Pcie.aslc")
-    include ("Sata.asl")
     include ("Emmc.asl")
-    include ("Gmac.asl")
     include ("Gpio.asl")
     include ("I2c.asl")
     include ("Uart.asl")

Hi @SleepWalker

Could you please point to a HOWTO about building EDK2?
I got an errors during build attempt.
Thanks.

UPD: successfully built it under Debian… but had a errors under Gentoo.

UPD2: not such successfully as i thought

cd u-boot and re-packet uboot.img: ./scripts/fit-repack.sh -f uboot.img -d unpack/
./make.sh: line 35: cd: ../u-boot: No such file or directory
cp: cannot stat 'uboot.img': No such file or directory
cp: cannot create regular file 'unpack/uboot': No such file or directory
mv: cannot stat 'uboot_uefi.img': No such file or directory
****Build NOR FLASH IMAGE****

The u-boot directory is missing and i’m not sure where to find it, any clues? thx.

UPD3: Successfully built it after downloading u-boot and build-tools.

might be useful :slight_smile:

i hope windows wont boot on the rock 5b

Hello!
Thanks to the help of @strongtz , UEFI for Rock 5B now almost works PCIe30.

root@Rock-5B:~ # pciconf -lv
none0@pci0:0:2:0:       class=0x010802 rev=0x03 hdr=0x00 vendor=0x126f device=0x2263 subvendor=0x126f subdevice=0x2263
    vendor     = 'Silicon Motion, Inc.'
    device     = 'SM2263EN/SM2263XT SSD Controller'
    class      = mass storage
    subclass   = NVM
none1@pci0:0:3:0:       class=0x010802 rev=0x03 hdr=0x00 vendor=0x126f device=0x2263 subvendor=0x126f subdevice=0x2263
    vendor     = 'Silicon Motion, Inc.'
    device     = 'SM2263EN/SM2263XT SSD Controller'
    class      = mass storage
    subclass   = NVM
none2@pci0:0:18:0:      class=0x010802 rev=0x03 hdr=0x00 vendor=0x126f device=0x2263 subvendor=0x126f subdevice=0x2263
    vendor     = 'Silicon Motion, Inc.'
    device     = 'SM2263EN/SM2263XT SSD Controller'
    class      = mass storage
    subclass   = NVM
none3@pci0:0:19:0:      class=0x010802 rev=0x03 hdr=0x00 vendor=0x126f device=0x2263 subvendor=0x126f subdevice=0x2263
    vendor     = 'Silicon Motion, Inc.'
    device     = 'SM2263EN/SM2263XT SSD Controller'
    class      = mass storage
    subclass   = NVM
root@Rock-5B:~ #

Hopefully, with the help of Radxa Team and Rockchip, we should have more HDMI. :sunglasses:

Latest update here

3 Likes

Any update for the HDMI support now? And really thanks for sharing the uefi repo. :slight_smile:

No news so far. We will ask about that (and PCIe support) in our next meeting.

2 Likes

I am currently checking the work of EDK2 to run Armbian. And I found some interesting nuances.

  1. The settings indicate a waiting time of 3 seconds, but in reality 10 seconds are used. a cursory analysis showed a line in which 10 seconds are indicated and if it is changed, the time changes. It is possible that the processing of variables from the general settings file is triggered before the reconfiguration is performed.

  2. The RAM size is limited to 8 GB. Even if you change the settings in the general settings file, it doesn’t change anything.

1 Like

@balbes-150
Yes, indeed the maximum memory size is 8Gbyte.
And a change in the configuration files does not affect this, it is not clear how to fix it.

I looked at the EDK2 code for rk356x, the RAM size is automatically determined there (I’m studying the commit that does it there), maybe there’s a chance to try using these algorithms for rk3588 as well?

I figured out the USB, found the reason.

p.s. By the way, I took your screensaver designs for Station and used them in my builds, I hope you don’t mind? :slight_smile:

In my opinion, this commit ruined the work of USB.

As the classic said.
“Хотели как лучше, получилось - как всегда”
"Никогда такого не было, и вот ОПЯТЬ.
:joy: