NanoPi R6C

Hello,

I've currently got Armbian booting on a NanoPi R6C but ultimately I'd like to boot OPNsense.

I've been following the instructions here but the author has used a Raspberry Pi to boot FreeBSD for which there exists a dedicated FreeBSD image whereas the only Arm machine I have access to is my NanoPi. I tried the armv7-GENERICSD image but it wouldn't boot. As the DTB exists in Armbian, is it possible for me to copy the appropriate files across to the FreeBSD image and somehow configure it to load the correct DTB in order for it to boot?
 
I tried the armv7-GENERICSD image but it wouldn't boot.
This is for Arm v7 you have arm64 also called aarch64.
So for this RockChip platform the RK3588 you would generally start with the ROCKPRO64 image.
I have to recommend CURRENT BUILD here because it is so new.

The process is similar among RK boards on FreeBSD and that is put your dtb file in ESP/EFI partition in
/dtb/rockchip/ directory (which you may have to create).

You might want to stall u-boot and checkout the environmental variables. It will show you where (directory structure) it is expecting to find the dtb. Usually it will be /rockchip/${BOARD_NAME.dtb} apparently the /dtb/ directory is a given.
I think it is printenv you want at u-boot prompt. You might need your scroll lock to see it all.

So take your Armbiam image and burn to SD Card then use gpart delete -F to destroy the partition table.
This should leave only u-boot on card. Take that and test boot up the board.
Does it still boot? But stalls at u-boot trying to network boot?

That is what you want. u-boot only on microSD card booting on device.

Then you introduce a FreeBSD USB memstick prepared with the ROCKPRO64 CURRENT IMAGE flashed to it.
Copy the dtb to the EFI partition in proper directory. Finding the proper dtb can be challenging. You have to try some.

At this point you should boot up your board with the microSD card with u-boot and have your FreeBSD Memstick inserted.
Now at boot up to u-boot you need to probe the usb ports.
usb start
Now hope you find one Removable Storage option found.
Some times you might want to do a usb restart if you insert USB disk late in u-boot.

The problem here is some Armbians don't seem to like USB booting but you have to try it out. This is the least work possible.
Use the blue USB ports first. Eyeball your drive to see if flashing LED on during usb restart.
If unsuccessful try other USB ports and observe LED. Obviously a USB stick with LED is really helpful here.

That is Part One. Let me know where it goes. You hope to see --(1)Mass Storage Device found--- from u-boot

Look at usb dev If you are lucky and a drive shows and you can set it active.
usb dev 0
and let it rip
boot
 
I think the most easy route is to flash UEFI firmware on the board.
There is efi firmware for the R6C.
This project is really interesting:
edk2-rk3588 efi
I use this firmware to run FreeBSD, Opnsense, and Win11 on Orange Pi 5 Plus.
Next download this opnsense image.
opnsense for arm or amd64
Mount the image on another machine and add the correct nic drivers for the R6C. Then put the image on sd card and boot off that image.
I am impressed by FreeBSD on the Orange Pi 5 Plus.
 
I build images for the R5S, that uses the same Realtek 2.5Gbps but a different CPU. There are images for R6S from https://yrzr.github.io/running-opnsense-on-r6s/, I don't know how many devices they share, but if you have dtb and boot stuff you can manage to have the image you want, just use the right boot files dd'ed to the beginning of the image and that should do.

I have repository files for R5S that uses all opnsense files but the realtek kmod. For R5S must use realtek-kmod198 port instead. On https://github.com/matheusber/opnsense/ these files are available to build for R5S.

Once you have it running on R6C, you can use repository to keep it updated and able to install packages and plugins.

none
 
I think the most easy route is to flash UEFI firmware on the board.
There is efi firmware for the R6C.
This project is really interesting:
edk2-rk3588 efi
I use this firmware to run FreeBSD, Opnsense, and Win11 on Orange Pi 5 Plus.
Next download this opnsense image.
opnsense for arm or amd64
Mount the image on another machine and add the correct nic drivers for the R6C. Then put the image on sd card and boot off that image.
I am impressed by FreeBSD on the Orange Pi 5 Plus.
Thanks for this. I've just bought an R6C thinking I could easily find an opnsense aarch64 image (didn't really do much research before buying). i've managed to get the efi firmware running on my device and managed to boot into a freebsd image running on a usb, however when trying to bootstrap opnsense from freebsd, it says it's only possible on amd64.

My assumption is i'll have to build my own opnsense image unless i can find one online somewhere but my knowledge of this process is limited. Do you know of an easier way to find an opnsense aarch64 efi image to use or bootstrap opnsense on a freebsd installation through this efi method? Or do you know if there is there a simpler way altogether to avoid all of this, utilizing the EFI firmware to boot an efi image?
 
The Opnsense images are here: https://github.com/maurice-w/opnsense-vm-images
You can download a release or use the instructions and build your own.
Okay great thanks. I have seen these but I wasn't sure if I could use them since they were VM images. I imagine i'll have to convert them into something that I will be able to put on a USB which I can boot from the UEFI firmware? Sorry for the noob questions. It's literally my first few days googling the hell out of this problem haha. For context, my plan was to initially just boot it from a USB to make sure it was working and then flash the image onto the eMMC using the RKDevTool which i've figured out how to use now
 
And then you probably need the drivers for the nic. I do not have a NanoPi R6C, so have no idea about those files.
A VM image is just what you need for Opnsense. You will modify the VM image a little then copy the image to sdcard, nvme, eMMC.
There is no simple guide to do this.
You start with the download of the Opnsense image:
https://github.com/maurice-w/opnsense-vm-images/releases
grab the ufs | efi | vm | aarch64
Some people may want zfs
For example: OPNsense-25.7-ufs-efi-vm-aarch64.qcow2.bz2
use bunzip2 to unzip
Code:
bunzip2 OPNsense-25.7-ufs-efi-vm-aarch64.qcow2.bz2
Next step requires qemu-image--> you may need to install that package on your image builder system
Code:
qemu-img convert OPNsense-25.7-ufs-efi-vm-aarch64.qcow2  opnsense.raw
become root for rest of operations
make sure you are in correct directory
Code:
mdconfig -a -t vnode -u 10 -f opnsense.raw
  
   ls /dev/md*
   /dev/md10       /dev/md10p1     /dev/md10p2     /dev/mdctl

    gpart show /dev/md10
=>     34  8921149  md10  GPT  (4.3G)
       34   532480     1  efi  (260M)
   532514  8388608     2  freebsd-ufs  (4.0G)
  8921122       61        - free -  (31K)
So... it is index 2 to mount and manipulate
Code:
mount -t ufs /dev/md10p2 /mnt
** check that it really is mounted
Code:
 ls /mnt
.cshrc                  COPYRIGHT               media                   sys
.probe.for.growfs       dev                     mnt                     tmp
.profile                entropy                 net                     usr
.snap                   etc                     proc                    var
bin                     home                    rescue
boot                    lib                     root
conf                    libexec                 sbin
add nic driver to--> /mnt/boot/modules
I do not know what your nano Pi uses for nics
For this example I will use Realtek 1.98 driver
Code:
cp ../opnsense/if_re.ko /mnt/boot/modules/
** need to make FreeBSD load this nic driver at boot time

opnsense wants to use-- /boot/loader.conf.local
In order to deploy a custom change to this installation, #
# please use /boot/loader.conf.local as it is not rewritten
Code:
 vi /mnt/boot/loader.conf.local
--------------------------
if_re_load="YES"
if_re_name="/boot/modules/if_re.ko"
hw.re.max_rx_mbuf_sz="2048"
kern.cfg.order="acpi"
console="efi"
Now unmount the efi slice and detach the memory disk
Code:
umount /mnt
mdconfig -d -u 10
Figure out what you will use as your Opnsense disk (sdcard, nvme, whatever)
Plug that device into your Opnsense builder system
insert the sdcard into system
find the device name for the device (for example here is a usb sdcard)
Code:
tail /var/log/messages
kernel: da0: 400.000MB/s transfers
Now you can write your image to that device
Code:
dd if=opnsense.raw of=/dev/da0 bs=1M status=progress
Clean up that device after the dd write
Code:
gpart recover da0
da0 recovered
Check your work (for example using da0)
Code:
# gpart show -l da0
=>      34  62333878  da0  GPT  (30G)
        34    532480    1  efifs  (260M)
    532514   6291456    2  rootfs  (3.0G)
   6823970  55509942       - free -  (26G)
These are the basic steps.
I do some extra steps to control the actual sizes of the slices.
If you need to make some changes to your new disk use these commands
Code:
for efi slice --> mount -t msdosfs /dev/da0p1 /mnt
for ufs slice --> mount -t ufs /dev/da0p2 /mnt

When using the EFI to boot make sure and set the firmware to ACPI.
Firmware: ACPI | Device Tree ==> ACPI
Also, set EFI system to correct boot device
 
And then you probably need the drivers for the nic. I do not have a NanoPi R6C, so have no idea about those files.
A VM image is just what you need for Opnsense. You will modify the VM image a little then copy the image to sdcard, nvme, eMMC.
There is no simple guide to do this.
You start with the download of the Opnsense image:
https://github.com/maurice-w/opnsense-vm-images/releases
grab the ufs | efi | vm | aarch64
Some people may want zfs
For example: OPNsense-25.7-ufs-efi-vm-aarch64.qcow2.bz2
use bunzip2 to unzip
Code:
bunzip2 OPNsense-25.7-ufs-efi-vm-aarch64.qcow2.bz2
Next step requires qemu-image--> you may need to install that package on your image builder system
Code:
qemu-img convert OPNsense-25.7-ufs-efi-vm-aarch64.qcow2  opnsense.raw
become root for rest of operations
make sure you are in correct directory
Code:
mdconfig -a -t vnode -u 10 -f opnsense.raw
 
   ls /dev/md*
   /dev/md10       /dev/md10p1     /dev/md10p2     /dev/mdctl

    gpart show /dev/md10
=>     34  8921149  md10  GPT  (4.3G)
       34   532480     1  efi  (260M)
   532514  8388608     2  freebsd-ufs  (4.0G)
  8921122       61        - free -  (31K)
So... it is index 2 to mount and manipulate
Code:
mount -t ufs /dev/md10p2 /mnt
** check that it really is mounted
Code:
 ls /mnt
.cshrc                  COPYRIGHT               media                   sys
.probe.for.growfs       dev                     mnt                     tmp
.profile                entropy                 net                     usr
.snap                   etc                     proc                    var
bin                     home                    rescue
boot                    lib                     root
conf                    libexec                 sbin
add nic driver to--> /mnt/boot/modules
I do not know what your nano Pi uses for nics
For this example I will use Realtek 1.98 driver
Code:
cp ../opnsense/if_re.ko /mnt/boot/modules/
** need to make FreeBSD load this nic driver at boot time

opnsense wants to use-- /boot/loader.conf.local
In order to deploy a custom change to this installation, #
# please use /boot/loader.conf.local as it is not rewritten
Code:
 vi /mnt/boot/loader.conf.local
--------------------------
if_re_load="YES"
if_re_name="/boot/modules/if_re.ko"
hw.re.max_rx_mbuf_sz="2048"
kern.cfg.order="acpi"
console="efi"
Now unmount the efi slice and detach the memory disk
Code:
umount /mnt
mdconfig -d -u 10
Figure out what you will use as your Opnsense disk (sdcard, nvme, whatever)
Plug that device into your Opnsense builder system
insert the sdcard into system
find the device name for the device (for example here is a usb sdcard)
Code:
tail /var/log/messages
kernel: da0: 400.000MB/s transfers
Now you can write your image to that device
Code:
dd if=opnsense.raw of=/dev/da0 bs=1M status=progress
Clean up that device after the dd write
Code:
gpart recover da0
da0 recovered
Check your work (for example using da0)
Code:
# gpart show -l da0
=>      34  62333878  da0  GPT  (30G)
        34    532480    1  efifs  (260M)
    532514   6291456    2  rootfs  (3.0G)
   6823970  55509942       - free -  (26G)
These are the basic steps.
I do some extra steps to control the actual sizes of the slices.
If you need to make some changes to your new disk use these commands
Code:
for efi slice --> mount -t msdosfs /dev/da0p1 /mnt
for ufs slice --> mount -t ufs /dev/da0p2 /mnt

When using the EFI to boot make sure and set the firmware to ACPI.
Firmware: ACPI | Device Tree ==> ACPI
Also, set EFI system to correct boot device
Thanks so much! Yeah you're right there's very little in the way of guides out there since I guess this is probably a bit of a niche setup/there's too many arm devices out there which all need different drivers etc. From what I've been reading so far from reading some other forum posts online it looks like there's a bit of traction on people trying to get OPNsense running on arm devices since I guess they're a cheaper alternative/lower power than their x86 counterparts. Just a bit of a pain in the *ss to get working. This is great though and I'll have a go at it when I've got some time.

If I can actually get this working maybe I'll write the first noobs guide to running OPNsense on this device.
 
Back
Top