We Turned an arm64 Router into a FreeBSD Hypervisor

Rainy Mathew
Hayzam Sherif

Rainy Mathew and Hayzam Sherif

07 Dec, 2026

The Hunt for an arm64 Box

Our FOSS team has spent the last year and a half quietly building Sylve, a Swiss Army knife for FreeBSD sponsored largely by the FreeBSD Foundation, and we’re planning a big launch for the next release, with goodies like Podman and OCI containers, but we digress. arm64 is a Tier 1 platform for FreeBSD, and Sylve is mostly Go, so shipping an arm64 binary was cake. Testing it was not: nearly all of our development and dogfooding happens on amd64, and arm64 cloud instances like Oracle Cloud’s don’t support nested virtualization, so no bhyve there.

An Ampere server would cost 5 to 10 thousand USD before Indian import taxes: way more machine than our tests need, and way too much for our tiny budget. A lot of people in the community did give us access to Ampere machines to play on, Michael Dexter of Call for Testing among them. But we also work on bhyve’s arm64 kernel side (vmm) in parallel, and that gets messy: you swap kernel modules all day and crash the machine more often than you would like. Asking for IPMI access so we could keep rebooting someone else’s server felt icky.

Even the latest Raspberry Pi weirdly lacks the GICv3 interrupt controller bhyve needs, and the other candidates were hard to find or cost a pretty penny to import. Then it hit us: we already had a bunch of Banana Pi BPI-R3 boards left over from building Difuse, one of our projects, which uses OpenWrt to build its base system and runs on MediaTek chips. The BPI-R3 is a deveopment board for MediaTek’s MT7986, with four arm64 cores, 2 GB of RAM and, as it turned out, everything we wanted.

There Was Just One Catch

On Difuse we rarely had to think about drivers: OpenWrt already supports these MediaTek chips, so we reused most of its drivers and our own work was mostly optimizations and bug fixes. On FreeBSD we were starting from scratch, since nobody had brought it to this chip yet, which is fair enough for a router chip. So before Bhyve could even think about running on this thing, we had to write drivers for pretty much everything on the board ourselves: clocks and the serial console, the SD card and eMMC, Ethernet and the switch, USB, GPIO and the watchdog. We would have done the M.2 slot too, but we didn’t have a spare NVMe drive on hand, and thanks to all the LLM-fueled price hikes it’s impossible to get a decent disk at a decent price right now, so that one is deferred. We also wanted all of it to go upstream into FreeBSD proper, so none of it could be a quick hack that only works on our desk.

Honestly, the code wasn’t the hardest part, figuring out how the hardware actually behaves was. MediaTek’s documentation for this chip is hard to get hold of, so a lot of what we know came from asking our MediaTek vendor or digging through Linux, U-Boot and random git repos scattered across the internet. LLMs helped us dig through all that scarce documentation, but every line of code and every note was written, reviewed and tested by us, so if you find slop, it’s human slop. When our sources disagreed with each other, which happened a lot, we poked the board until it told us who was right.

Things the Board Taught Us

The first SD card image we made just wouldn’t boot, the board printed “System halt!” and sat there. We had copied OpenWrt’s partition layout, and the data on our card matched an OpenWrt card that did boot, byte for byte. It took a while to notice that OpenWrt’s card also had a couple of flags set in its partition table that ours didn’t, and the boot ROM won’t boot without them. We also managed to freeze the serial console early on by poking the wrong register from U-Boot, which meant pulling the power and plugging it back in, and later found out the console was actually running at about 115273 baud instead of the 115200 everyone assumed. FreeBSD even says so at boot: uart0: console (115273,n,8,1).

The manual says the chip has “100 I/O pins”, while its own register tables, five pages later, count them from GPIO0 all the way up to GPIO100, which makes 101:

Pages 599 and 604 of the MT7986 Reference Manual: "There are 100 I/O pins", and a register table that goes up to GPIO100

USB keyboards showed up fine and then never sent a single keypress, until a small fix taught FreeBSD a MediaTek quirk and the Caps Lock light finally started toggling.

Those tiny quirks aside, the board itself is incredible and seriously robust. It has put up with us flashing it, crashing it and yanking its power more times than we can count, and it just keeps going.

FreeBSD Was a Pleasure

Once we knew how the hardware behaved, FreeBSD itself was honestly a pleasure to work with. The kernel, the userland and the build system all live in one tree, and most of our drivers are one or two source files plus a few lines of build config. Cross-building an arm64 kernel on an amd64 machine takes a couple of make commands, and FreeBSD’s build even runs on Linux, which is how our CI builds the kernel, since GitHub Actions sadly has no native FreeBSD runners. Compare that with the Linux side of this board, where the drivers are spread across mainline, OpenWrt’s patch stacks on top of it and MediaTek’s own SDK, and figuring out which of the three you are actually looking at is half the job. Given how streamlined FreeBSD is, we are genuinely surprised more vendors don’t ship FreeBSD support instead of Linux.

The ports tree helps a lot with packaging too. The board’s boot firmware (TF-A and U-Boot) is now built from FreeBSD ports instead of being copied off an OpenWrt image. Those ports are in the tree already, so pkg install u-boot-bananapi-r3 is all it takes to get it.

And Then Sylve Ran on It

All of this was so that we could do one thing: run Sylve on a cheap arm64 box, with real virtual machines. And it does:

Sylve's summary page for the BPI-R3 node
Sylve managing a BPI-R3: four Cortex-A53 cores and 2 GB of RAM.

It also gave us exactly what we wanted from a test box: a few edge cases you would never hit on a typical amd64 server, like a couple of pages that didn’t expect a machine with no PCI devices at all, and a VM whose virtual USB tablet got in the way of its network card, which looks like an arm64 bhyve quirk we are still digging into. Small stuff, and exactly the kind we would rather find on our desk than on a customer’s machine.

Try It Yourself

If you have a BPI-R3 lying around, you can try FreeBSD on it today. We build ready-to-flash SD card images, plus an installer for the board’s onboard storage, and the instructions, the images and our engineering notes are all on GitHub. Write the image to an SD card, flip four switches, and boot. Running from the SD card does not touch anything else on the board, so going back is a matter of flipping the switches back.

What’s Next

Wi-Fi, the M.2 slot, the SFP cages and hardware NAT are still on the to-do list. The first batch of changes (SoC support, clocks, resets and the serial console) is already in FreeBSD’s own tree. The SD card and eMMC driver has been accepted and lands next, Ethernet is being prepared for review, and the rest is tested and waiting its turn. Landing all of it got a lot easier on 16 November, when one of us, Hayzam, got a FreeBSD src commit bit. The images and branches on GitHub are only a stopgap until the patches land, and we hope to retire them soon. We fully intend to shepherd the rest of the patches, with whatever fixes review asks for, until they are all merged into FreeBSD’s src tree.

Thank You

None of this would be in FreeBSD without the people who reviewed it. Thanks to Michal Meloun (mmel@) and Emmanuel Vadot (manu@) for their careful reviews, and to everyone else on FreeBSD’s arm side who looked over our changes. Thanks also to Mark Johnston (markj@), who approved the commits and mentors Hayzam together with Ed Maste (emaste@).

Bringing Up Your Own Hardware?

Bring-up and driver work is what we do, for brand-new SoCs and for older ones whose vendors never shipped good driver support.