How to run FreeBSD on new boards built on Rockchip 35XX..

I would like to discuss this issue.
What do you think about it?
Recently there have been many new AARCH64 boards based on Rockchip RK3566/68/88.
They are widely sold and quite cheap compared to RPI.

Although the FreeBSD team has received demos,
we still don't have full support for them and can't actively use them.

In my opinion, there is a fairly simple way to get FreeBSD running on a new board quickly,
and that is to create a Tianocore EDK2 UEFI BIOS (bootloader) for it.

And run FreeBSD in ACPI mode.
Your opinion?
 
Your work on the Tiano EDK2 BIOS for Rock3A is incredible.

I never thought I would see the day of a Intel Open Source BIOS on an Arm Board.

You have done the impossible. Good Job SleepWalker I need to put an OS on the card now.
 
I am having problem with keyboard input on my Hdmi terminal. Can't access this nice looking BIOS.

This BIOS looks exactly like Minnowboard, which also uses TianoEDK2.
The ability to set GPIO pin states in TianoEDK2 BIOS is a major plus.
 
Your work on the Tiano EDK2 BIOS for Rock3A is incredible.
I never thought I would see the day of a Intel Open Source BIOS on an Arm Board.

It wasn't me who did it, it was Jared McNeill from the NetBSD and VMware team.
I just messed around adding a new board to his project, that's all.
I don't consider myself a developer, any engineer can do it.

Original repo https://github.com/jaredmcneill/quartz64_uefi
My repo for Rock 3A https://github.com/S199pWa1k9r/rk356x-uefi.git
 
I am having problem with keyboard input on my Hdmi terminal. Can't access this nice looking BIOS.

This BIOS looks exactly like Minnowboard, which also uses TianoEDK2.
The ability to set GPIO pin states in TianoEDK2 BIOS is a major plus.
I haven't made the latest OHCI changes yet.
You can connect a keyboard to the blue USB and use the USB HUB. Until the bug is fixed.
UART console also works, speed 115200..

Suggestions for changing the source code are welcome.
 
UART console also works, speed 115200..
Thanks for that tip. I was expecting 1500000 baud. Maybe I need to fiddle with this some.

I have yet to see a UART console off the GPIO Pins or off the OTG USB port. (tried switch in both directions)
Thank goodness HDMI works.

I am still trying to figure out this board.


You can connect a keyboard to the blue USB and use the USB HUB. Until the bug is fixed.
I was using the USB2 ports. I will try again.
 
Running the quartz64 board is much easier when using acpi tables + the custom patch from soren for the network adapter.
The only major missing bit is support for panfrost driver, since the quartz64 does not expose it in an acpi table.
For use as a kdc server it is ideal (overpowered for this task) .
 
Running the quartz64 board is much easier when using acpi tables + the custom patch from soren for the network adapter.
The only major missing bit is support for panfrost driver, since the quartz64 does not expose it in an acpi table.
For use as a kdc server it is ideal (overpowered for this task) .
Where is the custom patch from soren? I have tried web searching for it and cannot find it.

I do not have the skills currently to configure FreeBSD as needed, however I'd like to but do not know where to start. I have booted a custom Balbes150 image and have used it as a SAMBA server. It would be nice to get it running from eMMC instead of an SD card and USB.
 
Recently there have been many new AARCH64 boards based on Rockchip RK3566/68/88.
Another of the same. Bought the Seeed LinkStar H68K, RK3568 bizarre nice hardware for routing
Zero luck trying hard to have FreeBSD installed on it.
 
Where is the custom patch from soren? I have tried web searching for it and cannot find it.

I do not have the skills currently to configure FreeBSD as needed, however I'd like to but do not know where to start. I have booted a custom Balbes150 image and have used it as a SAMBA server. It would be nice to get it running from eMMC instead of an SD card and USB.
Here the patches from soren relative to the ethernet chipset


This patch works (ethernet works, but sometimes the quartz64 board just reboot during some more intensive network operation I guess) on 13.1-RELEASE.
For 13.2-RELEASE there is some conflict, so they may be some works to be done.

The patches where here


But it has been a while since this pages does not exist.

There are some patch on phabricator too (I don't have the reference sadly).
 
The patches where here


But it has been a while since this pages does not exist.
I purchased my Quartz64 sometime last summer and there were links and references to Soren or sos, but everything was broken then. Some of his contributions were published within months of his FreeBSD disappearance.

It is unfortunate with the Quartz64 because I've found it to perform better as a SAMBA server than the RockPro64, despite needing to use a USB to Ethernet dongle. It hasn't mattered what operating system I've had on the RockPro64, it does not index and serve files as quickly as the Quartz64.
 
It is currently feasible to run FreeBSD 14.0-CURRENT on the following boards RK356x

1. Pine64 - Quartz64
2. Firefly - Station-M2
3. Firefly - Station-P2
4. Radxa - Rock-3A
5. Radxa - E25/E23
6. FriendlyElec - NanoPi-R5S
7. FriendlyElec - NanoPi-R5C.

This can be done using Tianocore EDK2 UEFI.
What is not working now.
1. Recording on EMMc.
2. Ethernet only works at 1 Gbps
Ethernet port speed 10/100Mbps is not supported.
 
Thanks so much for your efforts. I only got to the loader on Rock3A but I need to revist it.

I am wondering about the Quartz64B ???

I see a pair used on ebay for $50ea. and nearly pounced.
 
I hate to crash your rk35xx thread but I am digging Rockchip offerings.

This really stood out to me.
Rockchip 3.5" SBC

Drawbacks: MiniPCIe slot is USB signaling only and no M.2 slots whatsoever.

I do like the serial port.
Seller made me $60 offer.
Meh with no good expansion slots.
 
I hate to crash your rk35xx thread but I am digging Rockchip offerings.

This really stood out to me.
Rockchip 3.5" SBC

Drawbacks: MiniPCIe slot is USB signaling only and no M.2 slots whatsoever.

I do like the serial port.
Seller made me $60 offer.
Meh with no good expansion slots.
If you like to have easy and convenient access to the console, you should pay attention
for two devices - Firefly Station-P2 and Radxa E25
Both have console access and lovely passively cooled boxes
On E25 - console via USB-C
 

Attachments

  • B049E0CA-8825-4EB2-B5ED-541EF868201C.jpeg
    B049E0CA-8825-4EB2-B5ED-541EF868201C.jpeg
    224.5 KB · Views: 103
  • FBFA46D1-746F-4F07-8D2D-FB485F3CC937.jpeg
    FBFA46D1-746F-4F07-8D2D-FB485F3CC937.jpeg
    44.7 KB · Views: 101
OK I have your EDK2 ACPI BIOS running on ROCK3A with microSD card.
I have FreeBSD booting up from aarch 13.2 memstick installer but no NVMe is showing up.

But when using your recent 14-CURRENT BUILD for RK35xx it has the Station-PC Logo on boot screen.(Nice touch)
The kicker is NVMe works on ROCK3A too. It seems to boil down to the EDK2 firmware build.
The P2 firmware has working PCIe but ROCK3A firmware does not.
HDMI is working. Serial Console is giving me trouble. Network adapter is not showing up.

Any chance that PCIe can be fixed so I can install to NVMe on ROCK3A?
I am going to install to another USB stick from to test an installation.

What about GPIO? It seems absent in /dev . Is that because of the ACPI Firmware not including it?
 
Hi Phishfry,

A lot depends on UEFI.
Using it opens up two ways to run FreeBSD on a new SoC.
1. The old, classical for aarch64 way of describing the hardware configuration via FDT.
2. And the use of ACPI tables.

Therefore, if you are testing images based on 13.2 (there is no support for RK356X in the kernel), you need to use ACPI mode and we will see the hardware that UEFI supports.

If you are testing images based on 14.0, then you can already use FDT mode,
but you need the correct DTB file.

It can be included in the UEFI image, or loaded using loader.efi,
for this you need to specify its name in /boot/loader.conf and put the DTB file
itself in the /boot/dtb directory.
# Hack to get loader to find dtb. dtbfile_load="YES" dtbfile_type="dtb" dtbfile_name="rk3568-rock-3a.dtb" # ACPI or FDT kern.cfg.order="acpi" # Kernel params hw.usb.usbhid.enable="1" hw.regulator.disable_unused="0" kern.geom.label.gptid.enable="0" kern.geom.label.disk_ident.enable="0" # ZFS settings #vfs.zfs.prefetch_disable="0" #cryptodev_load="YES" #zfs_load="YES" # Delay in seconds before autobooting, autoboot_delay="3" # EFI BOOT options #boot_verbose="NO" #loader_color="YES" #beastie_disable="NO" # Enable EFI GOP console boot_serial="NO" console="efi" # Multiple console (serial+efi gop) enabled. #boot_serial="YES" #boot_multicons="YES" #console="comconsole"
 
I really admire your work here. I would feel more comfortable with fdt this point. I know how to work with it.
Modify it and make it work in most cases.

Can I ask a question. Why are you using 3 Linux Data partitions on the ROCK3A EDK2 firmware?
It has me somewhat confused.
I am guessing these directories are related to the EDK2 build which I read from you that Linux was easier to build EDK2 with. Is that the case? These partitions contain the BIOS or associated files?

I noticed that your -CURRENT build for RK356x has a different structure without these partitions.
But on this firmware I cannot access the bios with keyboard. It still boots fine. NVMe shows up.
With earlier firmware from you (With Raxda logo) I can access the bios with keyboard but no NVMe.

So yes it has been amazing to test, but I think I want to use FDT.

dtbfile_name="rk3568-rock-3a.dtb"
I noticed that with your -CURRENT build there are several DTB's in the EFI partition.
rk3568-rock-3a.dtb
rk3568-rock-3-a.dtb
What is the difference here between the two dtb's?
 
Can I ask a question. Why are you using 3 Linux Data partitions on the ROCK3A EDK2 firmware?
It has me somewhat confused.
I am guessing these directories are related to the EDK2 build which I read from you that Linux was easier to build EDK2 with. Is that the case? These partitions contain the BIOS or associated files?
An image for Rock-3A based on 13.2 was created a long time ago
when a bug in the implementation of pcie in 14.0-current hasn't been fixed yet.
Using 14.0 and FDT mode was then not possible on the Rock-3A.

The CURRENT 14.0 images are recent and PCIe works correctly in them.
But I do not yet have a DTB file that I would be sure of for Rock-3A.
Most likely both files are wrong.
You need to take DTS files from Linux as a basis
dts/rockchip/rk3568-rock-3a.dts

1. The difficulty is that this device-tree version is not yet included in the 14.0 source code,
and it is an interesting task to create a DTB for Rock-3A for FreeBSD.

2. We can do otherwise, create a new version of UEFI for Rock-3A, now pcie30 can already work in it, which means direct launch of loader.efi(bootaa64.efi) from the EFI partition on NVMe will work.

After that, UEFI can be written to EMMc, and completely abandon the SD card.
I built a new version of UEFI for Rock-3A but haven't tested it yet.

We need to do both the first and second,
because so far UEFI has not implemented the simultaneous operation of pcie20 and pcie30.

And if we want both an NVMe and a WiFi card on the pcie20 bus to work on FreeBSD,
we need the correct DTB and 14.0 CURRENT in FDT mode.

Of course, when creating an SD card image or an image for EMMc, we need to take into account the features of the SoC RockChip. And the EFI partition must have a certain offset.
Writing UEFI to an SD card is done similarly to writing U-Boot, these are two separate files and two dd commands, and it is not necessary to arrange them as separate partitions on the SD card.

Bash:
#!/bin/sh
DISK_MD="da0"
EFI=ROCK-3A_EFI

URL="https://personalbsd.org/download/UEFI-RK356x"

UBOOT_BIN="idblock.bin"
UBOOT_PATH="/tmp"

fetch ${URL}/${UBOOT_BIN} -o ${UBOOT_PATH}/${UBOOT_BIN}
fetch ${URL}/${EFI}.itb   -o ${UBOOT_PATH}/${EFI}.itb

rk356x_uefi_write () {
        echo "Installing EDK2 on ${DISK_MD}"
        if [ -f ${UBOOT_PATH}/${UBOOT_BIN} ]; then
                dd if=${UBOOT_PATH}/idblock.bin of=/dev/${DISK_MD} bs=512 seek=64 conv=notrunc
                dd if=${UBOOT_PATH}/${EFI}.itb  of=/dev/${DISK_MD} bs=512 seek=20480 conv=notrunc
        fi
}

# Insert SD card reader in to USB,
# uncomment next line an run
# rk356x_uefi_write
 
Back
Top