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

OK let me backup and absorb your work. I have a list of questions to ask.

So as I understand it your forked UEFI EDK2 firmware replaces u-boot on platforms you build it for.
You have compiled your firmware to support both ACPI or FDT mode. Selectable via loader.conf.

Questions:
1.) Can this firmware be flashed to a SPI storage device as well? Does it take a special version like u-boot-SPL?

2.) Does the DTB used for EDK2 firmware+FDT need anything special or is u-boot generated version of DTB's OK?
 
So as I understand it your forked UEFI EDK2 firmware replaces u-boot on platforms you build it for.
You have compiled your firmware to support both ACPI or FDT mode. Selectable via loader.conf.

I haven't updated my github yet, it will be later.

Yes, I prefer to make UEFI binary images in which ACPI + FDT are enabled at the same time but by default.
But starting from version v1.1,
this can be changed in the UEFI settings and these changes will be saved the next time you turn it on.

Next, we need to tell FreeBSD kernel which mode (ACPI or FDT) to use.
If the kernel detects FDT, then it will be selected, if we want to test ACPI,
we must explicitly specify this in loader.conf.

The my latest test images have modified lua scripts that allow you to
choose between ACPI or FDT kernel startup mode.

It works simply, abort loader.efi (press space), select option 7 from the menu,
enable or disable ACPI, continue to start the kernel.
In my opinion, this should work.

1.) Can this firmware be flashed to a SPI storage device as well? Does it take a special version like u-boot-SPL?
At the moment there is no support for SPI flash from Jared UEFI,
but it is already in this project edk2-porting/edk2-rk35xx
This is the UEFI implementation for Rockchip RK3588.
Perhaps the source code you need can be found there.

2.) Does the DTB used for EDK2 firmware+FDT need anything special or is u-boot generated version of DTB's OK?
The DTB itself is not used in UEFI, so we need the most complete DTB for the FreeBSD kernel.

At the same time, if we do not have any driver in the system kernel,
it is better not to include this device in DTB and do not include this DTB in UEFI.
We can always give the kernel a new (test) DTB by specifying the path to it in loader.conf,
and after our new driver works and we have a new DTB, we can include it in the UEFI image.
 
The DTB itself is not used in UEFI, so we need the most complete DTB for the FreeBSD kernel.
Ok that makes sense now. So a standard FDT that FreeBSD understands is all that is needed.
Just like a u-boot build generates.

I have been investigating EDK2 and specifically the Minnowboard package.
I would like to join the fun and compile my own.

What do you recommend? I see a FreeBSD EDK2 fork:
Beaglebone package might be an intresting first build.

I noticed our forked library seems sparse compared to master.
Advantages or disadvantages of building on FreeBSD?
What do you use? Linux or BSD?
 
Beaglebone package might be an intresting first build.

I noticed our forked library seems sparse compared to master.
Advantages or disadvantages of building on FreeBSD?
What do you use? Linux or BSD?

There are already several ports of EDK2 in FreeBSD at present.

root@honeycomb:~ # pkg search ^edk
edk2-fvp-g202202_10 EDK2 Firmware for fvp
edk2-macchiatobin-g202202_10 EDK2 Firmware for macchiatobin
edk2-rpi3-g202202_10 EDK2 Firmware for rpi3
edk2-rpi4-g202202_10 EDK2 Firmware for rpi4
root@honeycomb:~ #

BagleBone TianoCore WIKi

In my opinion it is possible to create FreeBSD port to build UEFI for BagleBone.

For RockChip this can also be done but to create an SD card image we need the Rockchip utilities and I have seen them in binary form only for Linux, so I use Linux.

:(
 
Hi,

I have a NanoPI R5S 4GB here and been talking to SleepWalker for about a month now. I am not a developer, so my progress was way too slow here.

Yesterday I got to have a custom build for it, using both resources from him and Soren.

FreeBSD NanopiR5S-nvme 14.0-CURRENT FreeBSD 14.0-CURRENT #0: Fri Jun 2 19:28:14 -03 2023 root@NanopiR5S-nvme:/usr/obj/usr/src/arm64.aarch64/sys/GENERIC.pf arm64

and also got to test it as a router using iperf3:

last pid: 2002; load averages: 1.36, 1.27, 0.72 up 0+00:24:03 23:25:31
16 processes: 1 running, 15 sleeping
CPU: 0.0% user, 0.0% nice, 20.0% system, 17.2% interrupt, 62.8% idle
Mem: 16M Active, 19M Inact, 218M Wired, 56K Buf, 3429M Free
ARC: 33M Total, 6192K MFU, 25M MRU, 431K Header, 1833K Other
17M Compressed, 54M Uncompressed, 3.26:1 Ratio
Swap: 2048M Total, 2048M Free

PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMAND
2000 root 1 20 0 14M 3720K CPU2 2 0:00 0.15% top
1497 root 1 20 0 13M 2940K select 2 0:00 0.00% syslogd
1616 root 1 20 0 13M 3280K wait 1 0:00 0.00% sh
1976 root 1 28 0 21M 9280K select 0 0:00 0.00% sshd
1980 matheus 1 32 0 14M 4264K pause 2 0:00 0.00% csh
1615 root 1 21 0 13M 3140K wait 3 0:00 0.00% login
1985 root 1 20 0 13M 3456K ttyin 3 0:00 0.00% sh
1574 root 1 20 0 13M 2644K nanslp 1 0:00 0.00% cron
1979 matheus 1 20 0 21M 9588K select 1 0:00 0.00% sshd
1286 root 1 20 0 14M 4216K select 2 0:00 0.00% devd
1599 root 1 20 0 21M 8768K select 1 0:00 0.00% sshd
1984 matheus 1 21 0 13M 3068K wait 0 0:00 0.00% su
1737 root 1 4 0 13M 2860K select 2 0:00 0.00% dhclient
1814 _dhcp 1 20 0 13M 3008K select 0 0:00 0.00% dhclient
1734 root 1 20 0 13M 2768K select 2 0:00 0.00% dhclient

iperf3 -s -i 60
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 10.1.1.59, port 59411
[ 5] local 10.1.1.112 port 5201 connected to 10.1.1.59 port 56210
[ ID] Interval Transfer Bitrate
[ 5] 0.00-60.00 sec 1.73 GBytes 247 Mbits/sec
[ 5] 60.00-120.00 sec 1.73 GBytes 247 Mbits/sec
[ 5] 120.00-180.00 sec 1.73 GBytes 247 Mbits/sec
[ 5] 180.00-240.00 sec 1.73 GBytes 247 Mbits/sec
[ 5] 240.00-300.00 sec 1.73 GBytes 247 Mbits/sec
[ 5] 300.00-360.00 sec 1.73 GBytes 247 Mbits/sec
[ 5] 360.00-420.00 sec 1.72 GBytes 246 Mbits/sec

this is using a simple pf.conf to make nat working:

ext_if=re1
int_if=re0
nat on $ext_if from $int_if:network to any -> ($ext_if)
pass all

Despite the pf.conf using both re nics, at this time I was using eqos0 and re0.

Later I switched to both re nics:

Accepted connection from 10.1.1.66, port 55292
[ 5] local 10.1.1.112 port 5201 connected to 10.1.1.66 port 63022
[ ID] Interval Transfer Bitrate
[ 5] 0.00-60.00 sec 1.94 GBytes 278 Mbits/sec
[ 5] 60.00-120.00 sec 1.94 GBytes 278 Mbits/sec
[ 5] 120.00-180.00 sec 1.94 GBytes 278 Mbits/sec
[ 5] 180.00-240.00 sec 1.94 GBytes 277 Mbits/sec
[ 5] 240.00-300.00 sec 1.94 GBytes 278 Mbits/sec

and then I disabled nat on pf, still both re nics:

Accepted connection from 10.1.9.121, port 44720
[ 5] local 10.1.1.112 port 5201 connected to 10.1.9.121 port 44732
[ ID] Interval Transfer Bitrate
[ 5] 0.00-60.00 sec 3.10 GBytes 444 Mbits/sec
[ 5] 60.00-120.00 sec 3.11 GBytes 446 Mbits/sec

have anyone else seen these numbers? Are they the same as others testing it?

I used a patch from Soren and another from SleepWalker for realtek mod. If I can help testing it, I can sure help.

thanks for the work from you all,

none
 
Are you using ACPI or FDT method?
30-40 Megabytes a second with pf enabled is not terrible.

I hope to enjoy the ROCK 3A work SleepWalker provided this weekend.
Might be time to build a dtb for it and experiment.
 
Starting 20230531 UEFI for Rock-3A already has PCe30 support
and contains DTB with PCIe30 support, so NVMe will work in both ACPI mode and FDT mode.
The test image from 20230531 is already available.
 
Are you using ACPI or FDT method?
30-40 Megabytes a second with pf enabled is not terrible.

I hope to enjoy the ROCK 3A work SleepWalker provided this weekend.
Might be time to build a dtb for it and experiment.
As fas as I know, FTD method. I use the uefi images available from SleepWalker.

About the numbers, I had hopes it would reach to 1Gbps numbers, or close, as the benchmarks pointed to (Linux, need to say). My network link for it is 500Mbps, so yet a bit far from what it will handle, hence my search for new methods for speed here :)

Just as a means to compare, using the FriendlyWrt it cames with, I get this (I don't know the WebUI well, but I have strong feelings nat is enabled):


Accepted connection from 10.1.1.67, port 53150
[ 5] local 10.1.1.112 port 5201 connected to 10.1.1.67 port 53164
[ ID] Interval Transfer Bitrate
[ 5] 0.00-60.00 sec 5.76 GBytes 825 Mbits/sec
[ 5] 60.00-120.00 sec 5.63 GBytes 806 Mbits/sec
[ 5] 120.00-180.00 sec 5.58 GBytes 798 Mbits/sec
[ 5] 180.00-240.00 sec 5.75 GBytes 823 Mbits/sec
[ 5] 240.00-300.00 sec 5.80 GBytes 830 Mbits/sec
[ 5] 300.00-360.00 sec 5.56 GBytes 796 Mbits/sec
[ 5] 360.00-420.00 sec 5.62 GBytes 805 Mbits/sec
[ 5] 420.00-480.00 sec 5.81 GBytes 832 Mbits/sec
[ 5] 480.00-540.00 sec 5.32 GBytes 761 Mbits/sec
[ 5] 540.00-600.00 sec 5.67 GBytes 811 Mbits/sec
[ 5] 600.00-660.00 sec 5.74 GBytes 822 Mbits/sec
[ 5] 660.00-720.00 sec 5.84 GBytes 835 Mbits/sec
[ 5] 720.00-780.00 sec 5.75 GBytes 824 Mbits/sec
[ 5] 780.00-840.00 sec 5.89 GBytes 843 Mbits/sec
[ 5] 840.00-900.00 sec 5.84 GBytes 837 Mbits/sec
[ 5] 900.00-960.00 sec 5.59 GBytes 800 Mbits/sec
[ 5] 960.00-1020.00 sec 5.80 GBytes 831 Mbits/sec
[ 5] 1020.00-1080.00 sec 5.72 GBytes 819 Mbits/sec

Thanks for all the work from you all.

none
 
The test image from 20230531 is already available.
I just found that yesterday. I seem to have a problem with NVMe/PCIe not showing up in firmware.
The prior firmware dated 2023-05-27 the devices are found correctly.
Both mini-PCIe/M.2 and the NVMe are detected. I have an Atheros M.2 card installed and it is found.
NVMe PCIe 4.0 cards and PCIe 3.0 cards in both 2230 and 2280.

The problem I have is disk corruption on the NVMe install. 3 different drives.
I used bsdinstall from regular 14-CURRENT memstick and it fails at creating an UFS partition.
I run fsck and it has much repairing to do.

I need to run bsdinstall from your rk356x image to see if that has been addressed.
I almost feel its a symptom of the firmware?

I also found a weird problem in that your Rock-3A CURRENT image seemed to fail booting (hung at bios screen) when flashed to 16GB microSD card but when I flashed it to 4GB card it worked fine.
These are all Apacer Industrial cards.
 
I want to add that it could just be a bug in bsdinstall while partitioning an aarch64 device.
I tried an already formatted NVMe drive and it worked fine and fsck had no issues.
I could swear I used bsdinstall off aarch64 memstick to format drives though...

Networking showed up to as eq0. That was fantastic to see.
I need to disable serial console or I miss console messages.
I did notice that your firmware has options for Graphical or Serial console.
I have yet to mess with that. HDMI is working ok.

Thanks so much SleepWalker

I see you have a patch in RockPi-E port for u-boot and MMC.
I need to try that patch on Rock64 which is failing on MMC as of 13.1-RELEASE.
 
Can I ask a question. Why are you using 3 Linux Data partitions on the ROCK3A EDK2 firmware?
It has me somewhat confused.
I did not see this directly answered so I will give my best guess.
I have tried mounting these "linux-data" partitions to see whats going on behind the scenes.
No luck with anything. But GpartedLive gave me the clue bat. The partitions are named.
p1=
p2=u-boot
p3=env

From this I have to guess that these are not readable file partitions but storage for the firmware.
is that correct? The EDK2 build on Linux doesn't support FFS so you use linux-data ?

Would EDK2 built on FreeBSD use UFS for these bios storage partitions?
 
I just found that yesterday. I seem to have a problem with NVMe/PCIe not showing up in firmware.
The prior firmware dated 2023-05-27 the devices are found correctly.
Both mini-PCIe/M.2 and the NVMe are detected. I have an Atheros M.2 card installed and it is found.
NVMe PCIe 4.0 cards and PCIe 3.0 cards in both 2230 and 2280.

The problem I have is disk corruption on the NVMe install. 3 different drives.
I used bsdinstall from regular 14-CURRENT memstick and it fails at creating an UFS partition.
I run fsck and it has much repairing to do.

I need to run bsdinstall from your rk356x image to see if that has been addressed.
I almost feel its a symptom of the firmware?

I also found a weird problem in that your Rock-3A CURRENT image seemed to fail booting (hung at bios screen) when flashed to 16GB microSD card but when I flashed it to 4GB card it worked fine.
These are all Apacer Industrial cards.
Hi,

I told SleepWalker something close to this nvme error. It may be something about the image date. Later let me install freebsd on nvme using zfs (as SleepWalker told me, no ufs so far). This week I had issues using WD Blue 1TB nvme, using bsdinstall from the image created. I changed for Intel 660p 512GB and worked fine. The error was issues with zroot pool on the boot. Tried to install many times and same error.

none
 
I want to add that it could just be a bug in bsdinstall while partitioning an aarch64 device.
I tried an already formatted NVMe drive and it worked fine and fsck had no issues.
I could swear I used bsdinstall off aarch64 memstick to format drives though...

Networking showed up to as eq0. That was fantastic to see.
I need to disable serial console or I miss console messages.
I did notice that your firmware has options for Graphical or Serial console.
I have yet to mess with that. HDMI is working ok.

Thanks so much SleepWalker

I see you have a patch in RockPi-E port for u-boot and MMC.
I need to try that patch on Rock64 which is failing on MMC as of 13.1-RELEASE.

I got some success on really early images that hdmi would work here. Serial failed to work and I could see early messages from it telling resolution of the hdmi monitor and failing. So I removed hdmi for good and I have serial working. Sometimes its 115200, other 1500000, sometimes are mixed and I can see just part of the boot, but in general works.

none
 
I am very happy running the Rock3A image on microSD card. It really seems stable over here.
I started poking at the GPIO pins. Anybody decode them to FreeBSD pins yet? It looks like the standard 40-Pi layout.

I have a usb stick for flashing NVMe now. So that will be my next test. Rock3A running off NVMe...
 
Hi
Both mini-PCIe/M.2 and the NVMe are detected. I have an Atheros M.2 card installed and it is found
I can't seem to find a suitable WiFi card.
What kind of work do you have? Send as much information about it as possible.

The problem I have is disk corruption on the NVMe install. 3 different drives.
I used bsdinstall from regular 14-CURRENT memstick and it fails at creating an UFS partition.
I run fsck and it has much repairing to do

Yes, it is not possible to create a new file system, this is a clear error.
I'm using ZFS on NVMe, everything works fine
 
I can't seem to find a suitable WiFi card.
What kind of work do you have? Send as much information about it as possible.
Atheros QCNFA222 with AR9462
This is the only Atheros card we support in M.2 factor. QCNFA222
There are lots of cheap used OEM versions available.
Make sure you get M.2 as they also have MiniPCIe same model. Look for the -222 model number.
Also seen as wb222 and Azurewave AW-NB234NF

Note the 'keying' or gold fingers on this OEM version. It will not physically work.


You can also test with Intel 7260NGW, 7265NGW M.2 modules. Newer Intel modules should work too,
 
I did some quick benchmarking the NVMe slot on Rock3A with your uEFI firmware.

diskinfo -t found speeds ranging from 1GB/sec on Toshiba XG3 to 1.3GB/sec on Micron 2450

Not bad at all..

On Rockpro64 all i could manage was PCIe1.0 links. I have PCIe2.0 now.
 
Atheros QCNFA222 with AR9462
This is the only Atheros card we support in M.2 factor. QCNFA222
There are lots of cheap used OEM versions available.
Make sure you get M.2 as they also have MiniPCIe same model. Look for the -222 model number.
Also seen as wb222 and Azurewave AW-NB234NF

Note the 'keying' or gold fingers on this OEM version. It will not physically work.


You can also test with Intel 7260NGW, 7265NGW M.2 modules. Newer Intel modules should work too,
I understand that WiFi and NVMe can only work in FDT mode at the same time. Can you post the DTS or DTB file?
 
I am using the image and dtb you generated for Rock3A on May 17th. FreeBSD-13.2-RC3
FreeBSD-aarch64-13.2-RC3-Rock-3A-20230317.img.xz

Using various UEFI firmware you provided. I am trying to stay on -RELEASE if possible.

I am also testing with your UEFI-356x -CURRENT image.

I have not tested simultaneous NVMe and PCIe usage yet.
 
Mainline U-Boot recently added the Rock-3a
How does the dts look to you? I am going to test its dtb tonight.


My U-Boot off-tree build stalled again but I noticed I ran gmake dtbs and it spat one out for me to test.
/usr/ports/sysutils/u-boot-rock3/u-boot/arch/arm/dts/rk3568-rock-3a.dtb
 
So until I get u-boot working I am scraping.
These pre-compiled binaries from Raxda work. (Serial Console)
rock-3a-idbloader-gef9f6b1caad.img
rock-3a-u-boot-gef9f6b1caad.itb

I am really tempted to try their SPI Flash image.

Armbian u-boot for rock 3a does not support PCI that I can tell. (All versions)
It does support HDMI but you can't get into u-boot via HDMI. Must use serial console.
 
Well I have found some major differences booting on Rock 3A.
I have Raxda Rock 3A from Toybrick and I have a Raxda Rock 3A from Okdo.

The one from Toybrick boots UEFI EDK2 fine. Not so much for u-boot.
The Rock 3A from Okdo boots from both EDK2 and u-boot and the Rock3C u-boot posted on here as well.
Bizarre that I can't find a single chip that looks different on the two boards.
Maybe some value for the sd-card card reader is different.
 
Well I have found some major differences booting on Rock 3A.
I have Raxda Rock 3A from Toybrick and I have a Raxda Rock 3A from Okdo.

The one from Toybrick boots UEFI EDK2 fine. Not so much for u-boot.
The Rock 3A from Okdo boots from both EDK2 and u-boot and the Rock3C u-boot posted on here as well.
Bizarre that I can't find a single chip that looks different on the two boards.
Maybe some value for the sd-card card reader is different.
Probably there are several hardware revisions of Rock-3A.
Radxa has published several different circuits on their website.
v1.1
And two versions
v1.3
https://dl.radxa.com/rock3/docs/hw/3a/rock3a_v1.3_sch.pdf

Publication dates vary.

Can you post pictures of the boards?
It would be helpful.
 
Back
Top