[Work In Progress] OPNsense Ported into ARM Devices

Started by nekoprog, March 25, 2019, 11:55:58 AM

Previous topic - Next topic
it is feasible to port OPNsense to an ARM Cortex-A72 (Marvell® ARMADA® 7040)?
There is a OpenWrt SNAPSHOT available for the Globalscale MOCHAbin (I do have dev board).
Moreover I have Debian and Ubuntu image.

What would be the way to go to port it?


thank you
stefan

Quote from: PackElend on December 29, 2021, 10:11:43 PM
it is feasible to port OPNsense to an ARM Cortex-A72 (Marvell® ARMADA® 7040)?
There is a OpenWrt SNAPSHOT available for the Globalscale MOCHAbin (I do have dev board).
Moreover I have Debian and Ubuntu image.

What would be the way to go to port it?


thank you
stefan

Afaik the Armada 7k SoC is already supported by FreeBSD (see https://www.freebsd.org/status/report-2021-01-2021-03/marvell/)
The report is from early 2021 so can't tell whether they mean HEAD as in FreeBSD 14 or 13. Nevertheless, you are probably one of the few people who own a MOCHAbin dev board. Aren't the latter supposed to get shipped around Q2 2022?

If you have access to the datasheet, and maybe also the kernel source code (besides the image, so that you have an idea about how the drivers etc. work) you can start porting to FreeBSD. Don't know if OPNsense is the right place for it, but I guess you can get more help in the FreeBSD forums / mailing lists.

Sergey from Personalbsd.org project is waiting for his device to arrive.

Once he have it then he will start working on Opnsense port for that device.

Please subscribe fro regular donation to his project so he can afford to buy devices to support at opnsense community arm project called personalbsd.

February 02, 2022, 09:45:53 AM #288 Last Edit: February 02, 2022, 09:56:52 AM by HappyOpnSense
Hi,

struggling for some days now to create a working x-build for a AMD64 host to a NanoPI R4S. Has someone this really working as I continue to run into error messages with the package build (base and kernel build seem to run fine).

I guess it's related to the cc target not being right because when I do a chroot in the build directory (make chroot DEVICE=R4S) and check the cc output I get the following

>>> chroot'ing into /usr/obj/usr/tools/config/22.1/OpenSSL:aarch64/...
root@freebsd-13-0-1:/ # cc --version
FreeBSD clang version 13.0.0 (git@github.com:llvm/llvm-project.git llvmorg-13.0.0-0-gd7b669b3a303)
Target: x86_64-unknown-freebsd13.0
Thread model: posix
InstalledDir: /usr/bin

Where I would expect an aarch64 target. Not sure where this is going wrong.

Thnx for your support
OPNSense on Elite Edition Intel N100 - Crucial 16G DDR - Lexar NM620 512GB



Hi,

Which image did you use?

Would you mind sharing?



Quote from: mestafin on February 20, 2022, 11:02:26 AM
Hi,

Which image did you use?

Would you mind sharing?

Are you referring to the ROCKPro64 image? You can simply get the R4S image from https://ftp.yrzr.tk/opnsense/FreeBSD%3A13%3Aaarch64/22.1/images/

All you gotta do is write the bootloader files and you're set

I really wanted to like OPNSense.

However, after installing it on my R4S (what an amazing tiny device!), I found that my best throughput on a hardwire to my GB fiber was about 500Mbps (usually less!).

When I installed OpenWRT, I can get 940+ (that is to say, wire speed, for a Gigabit ethernet line).

Same hardware, same connections.  Even the same plugin (AdGuardHome) running.

Open to suggestions for improving speed, but otherwise, I really can't justify sticking with OPNSense.

R2S using rtl usb to lan chip which does not have good drive support on freebsd hence it's broken. 
That chip is only used in few devices so developers are not putting effort to fix it..

Best is to use R4S. 

Quote from: HappyOpnSense on February 02, 2022, 09:45:53 AM
Hi,

struggling for some days now to create a working x-build for a AMD64 host to a NanoPI R4S. Has someone this really working as I continue to run into error messages with the package build (base and kernel build seem to run fine).

I guess it's related to the cc target not being right because when I do a chroot in the build directory (make chroot DEVICE=R4S) and check the cc output I get the following

>>> chroot'ing into /usr/obj/usr/tools/config/22.1/OpenSSL:aarch64/...
root@freebsd-13-0-1:/ # cc --version
FreeBSD clang version 13.0.0 (git@github.com:llvm/llvm-project.git llvmorg-13.0.0-0-gd7b669b3a303)
Target: x86_64-unknown-freebsd13.0
Thread model: posix
InstalledDir: /usr/bin

Where I would expect an aarch64 target. Not sure where this is going wrong.

Thnx for your support

I'm having this same problem. Did you ever find a solution?

::EDIT::
I was able to build using a FreeBSD VM on my M1 MacBook. The image boots up just fine on my RockPro64 but the PCI slot doesn't seem to work while it does on FreeBSD 13.

Ok, tried a few different things, and still no luck with getting the PCI slot recognized in OPNsense with my RockPro64. Would anyone more familiar with what the differences are between FreeBSD 13 and OPNsense 22.1 be able to chime in with some thoughts?

With the 4 port NIC on OPNsense 22.1, dmesg shows:
pcib0: <Rockchip PCIe controller> mem 0xf8000000-0xf9ffffff,0xfd000000-0xfdffffff irq 6,7,8 on ofwbus0
pcib0: Cannot get 'pcie-phy-0' phy
device_attach: pcib0 attach returned 6


With the 4 port PCI NIC on FreeBSD 13 shows:
pcib0: <Rockchip PCIe controller> mem 0xf8000000-0xf9ffffff,0xfd000000-0xfdffffff irq 6,7,8 on ofwbus0
pci0: <PCI bus> on pcib0
pcib1: <PCI-PCI bridge> at device 0.0 on pci0
pcib0: failed to reserve resource for pcib1
pcib1: failed to allocate initial memory window: 0-0xfffff
pci1: <PCI bus> on pcib1
pcib0: route pin 1 for device 0.0 to 78
pcib0: route pin 2 for device 0.0 to 79
pcib0: route pin 3 for device 0.0 to 80
pcib0: route pin 4 for device 0.0 to 81


Running "pciconf -lv" returns nothing on OPNsense while FreeBSD 13 shows my pci devices...  :-\


::EDIT::
So I switched the kernel to one downloaded straight from FreeBSD but still had the same problem...this is about as far as my troubleshooting goes I think...Not sure where the problem lies.

Quote
Are you referring to the ROCKPro64 image? You can simply get the R4S image from https://ftp.yrzr.tk/opnsense/FreeBSD%3A13%3Aaarch64/22.1/images/

All you gotta do is write the bootloader files and you're set

Hi! Could you please explain what do you mean with "All you gotta do is write the bootloader files and you're set"? I tried to install a lot of images for RockPro64 without any problems but I'm no able to run any OPNsense image. All files hangs during booting. Is there something special to update in OPNsense image? Thanks in advance.

1) On a FreeBSD machine, pkg install u-boot-rockpro64
2) Then from /usr/local/share/u-boot/u-boot-rockpro64 pick up idbloader.img and u-boot.itb
3) Overwrite the boot loader on the OPNsense-22.1-OpenSSL-arm-aarch64-R4S.img (which is for Nanopi-R4S) with the boot loader for ROCKPro64
dd if=u-boot-rockpro64/idbloader.img of=OPNsense-22.1-OpenSSL-arm-aarch64-R4S.img seek=64 bs=512  conv=notrunc
dd if=u-boot-rockpro64/u-boot.itb of=OPNsense-22.1-OpenSSL-arm-aarch64-R4S.img seek=16384 bs=512 conv=notrunc
Note: conv=notrunk prevents the output file from being truncated after the end of the respective boot images.

Figured out the problem with the RockPro64 PCI slot!

With FreeBSD, there are a bunch of .dtb files (device tree blobs) on the MSDOSBOOT partition that are not present when making OPNsense for ARM. Sure enough, there is one for the RockPro64.

Copying that dtb folder over resolved the problem. The PCI slot and the 4 port NIC are both detected immediately upon boot.

I can't do anymore testing today, but I'll definitely be doing more testing in the days to come. Exciting!