FreeBSD 13-CURRENT on Rock Pi4

Hi!

Unfortunately the current FreBSD kernel does not support HDMI video
via EFI FB in 4K(3840x2160) mode.
Maximum FULLHD supported.
This issue is fixed by forcing u-boot to 1920x1080 mode. If you try to load my image from an SD card or eMMC, I think it will work for you on a 4K monitor but in FULLHD mode.
So far, this is the only solution I’ve found. Use mask rom mode.

Hi Sleepwalker

Unfortunately not. I tried booting your FreeBSD image off uSD, eMMC and NVME but all three failed.

Hi @Dan_MacDonald!

This may be because you have uboot on SPI FLASH and it starts first.
If you don’t see the FreeBSD orbit logo on the screen, that means it’s not my uboot that is starting.

Everything is very simple.

Booting from an SD card in mask rom mode has always helped me.
In any case, you can always get reliable startup if you turn on a FULL HD monitor.

1 Like

Yes I do have u-boot on SPI. I will try again in mask rom mode.

Is it possible to it install to and boot off the nvme disk using ZFS?

Hi @Dan_MacDonald.

Yes of course it is possible.

You need to use the bsdinstall utility after logging in as root from the console.
Or via ssh like
Username: admin
Password: admin
admin@rock-pi:~ % su -
root@rock-pi:~ # bsdinstall

In this case, bsdinstall should write the correct uboot to the eMMC,
this will happen automatically.

Don’t forget to clear the contents of the SPI FLASH after bsdinstall is complete.
Use command
dd if=/dev/zero of=/dev/flash/spi0 bs=4k status=progress
I hope everything will work for you.
If uboot is on eMMC and NVMe contains ZFS root FS, you will get successful OS boot from NVMe.

I haven’t tested this for a long time,
but I think I’m not mistaken and everything should be exactly like this.

Good luck.

2 Likes

I have got it to boot now, off uSD. I had to enable maskrom mode and remove my nvme disk. I get a (full HD) HDMI display but unfortunately its cropped and doesn’t quite fit so I cannot see the whole of the bottom row of text ie the command line itself and so I can only really use its terminal via ssh or UART unless I type blind.

I’ve not tried installing it yet - I’m mainly interested to see if FreeBSD can utilise the full speed of the NVME interface ie PCIe 2.0 speeds. If the FreeBSD devs can get 4K output and the wifi working then I might consider switching from Manjaro.

Cool to see a BSD booting on the RockPi4!

1 Like

So far no one uses aarch64 on 4k FreeBSD displays :slight_smile:
But we hope that the drm for aarch4 project will be completed soon.

1 Like

I have successfully installed FreeBSD to NVME on my rockpi4.

FreeBSD manages over 300 MB/s read speeds using ZFS according to diskinfo so it looks like it does support PCIe-gen2.

I have armbian uboot on SPI and I was able to boot the freebsd image from nvme, but I didn’t know how to install. In this case, with bsdintall do I should boot a desktop simply?

Hi @aguapi,

The standard scenario for installing a system on EMMc, USB, SATA or NVMe looks like this

  1. Starting the system with my u-boot (it correctly generates smbios variables for bsdinatall to work).
  2. Login with superuser rights
  3. Run bsdinstall and install
  4. Tuning - if needed, and reboot.

I want to warn you that in the process, badinstall updates u-boot on EMMc even if you chose to install on EMMc, unfortunately this is the case
.
But at the same time, it will write spi u-boot to the efi section of emmc as a separate file and you can rewrite it yourself to spi.
instructions will be in /usr/local/share/u-boot/u-boot-rock-pi-4/README

To install this bootloader on an SPI flash just do:
=> load mmc 0 ${kernel_addr_r} u-boot-spi.bin
=> sf probe
=> sf update ${kernel_addr_r} 0 ${filesize}

To run my u-boot from an SD card, you should use mask rom mode.

Hello. Thanks for answering. Why put another bootloader if the Armbian one worked fine so far?

It is a standard process and there are multiple uboot maintain by every distro.

So it make everything work out of the box it is preferable to follow a standard process.

I just don’t know how bsdinstall will behave if it’s an Armbian u-boot.
My u-boot generates special kernel variables that can be viewed with the kenv command,
they are parsed by bsdinstall and this allows us to understand that we are dealing with Radxa-Pi-4
and do the right thing, since RK3399 needs a special breakdown of EMMc in order for the system to boot.
You can just try. If you install the system on NVMe, then most likely it will be fine.
I only recommend the path I’m 99.99% sure of :wink:

So having this perfectly running on a Rock Pi4, how to upgrade to FreeBSD 13.1? Has this been done already ?

freebsd-update -r 13.1-RELEASE upgrade

Read man freebsd-update

Hi there I’m trying this out on a Rockpi 4b, and wondering if USB OTG is supported?

I see on the bootlog of the announcement that it probably is. Is there some clues somewhere about how to enable the board to boot to that mode?

gpio0: mem 0x2000a000-0x2000a0ff irq 86 on simplebus0
gpioc0: on gpio0
gpiobus0: on gpio0
gpio1: mem 0x2003c000-0x2003c0ff irq 87 on simplebus0
device_attach: gpio1 attach returned 6
gpio1: mem 0x2003e000-0x2003e0ff irq 88 on simplebus0
device_attach: gpio1 attach returned 6
gpio1: mem 0x20080000-0x200800ff irq 89 on simplebus0
device_attach: gpio1 attach returned 6
dwcotg0: <DWC OTG 2.0 integrated USB controller> mem 0x10180000-0x101bffff irq 48 on simplebus0
usbus0 on dwcotg0
dwcotg1: <DWC OTG 2.0 integrated USB controller> mem 0x101c0000-0x101fffff irq 49 on simplebus0
usbus1 on dwcotg1
uart0: <16650 or compatible> mem 0x20064000-0x200643ff irq 68 on simplebus0
uart0: console (115200,n,8,1)
Timecounters tick every 10.000 msec
usbus0: 480Mbps High Speed USB v2.0
usbus1: 480Mbps High Speed USB v2.0
ugen1.1: at usbus1
uhub0: <DWCOTG OTG Root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus1
ugen0.1: at usbus0
uhub1: <DWCOTG OTG Root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus0
random: unblocking device.
Release APs

I have tried also using the dwc3 usb driver, with no better results. It seems to be in host mode, not device mode no matter what position the physical switch is in.

I’m using this documentation to try to make an iSCSI target accessible as a USB mass storage device to whatever host I plug it in to.

Hi @Curtman.

Hi there I’m trying this out on a Rockpi 4b, and wondering if USB OTG is supported?

This is a very interesting question.
And the answer to that is No, it can’t without changes to the FreeBSD source code.
The fact is that now FreeBSD has a dwc_otg driver, but it will be activated only if the DTS file of the board contains “snps,dwc2” and we have “snps,dwc3” on RockPi 4.
You can try changing the source code.

I have tried many ways to install FreeBSD-13.0 and FreeBSD-13.1 images but without any luck. My board is the rock-pi-4-se version. Should I be able to use a modification of this (change the Makefile) mentioned by Ashley_Mills?
When the system boots into u-boot it shows
; MODEL: Radxa ROCK PI 4B
I have no issues when installing debian or ubuntu.

SleepWalker’s FreeBSD-aarch64-13.0-RELEASE-p8-Rock-Pi-4-20220316.img image (from personalbsd.org) worked for me on my Rock 4 SE but I had to get on the serial console and set the ‘media’ and ‘mediaopt’ using ‘ifconfig dwc0’ (see https://forums.freebsd.org/threads/rockpro64-network-adapter.83789/) before the ethernet would work. Hope that helps.

1 Like

Very little information about Rock 4 SE.
And I don’t have Rock 4 SE in my hands, it’s hard to advise.
But in theory, all problems can be solved with the help of building a custom u-boot that will have the correct DTB.