Dragonfly BSD on Macbook Air 2017 (Part 1)

Dragonfly BSD /mostly/ works on a Macbook Air (2017), provided you can source a very specific shim to allow replacing the (proprietary) broadcom wifi card, and can tolerate trackpad issues.

The 2017 macbook air is awful, but better than more contemporary macbooks in that the wireless card and SSD are user-replacable (although both really require adapters). I've ran Xubuntu on my laptop for a long while, and while it works, it always bothered me that I had to build a module for the broadcom wifi every time the kernel updated. Sure, DKMS does it for me - I still don't like it. When I took the macbook apart to see what type of connector it used for the troublesome wifi card, I was bemused to see it was entirely proprietary.

Worse than propritary, it isn't even well documented. Most places will refer to it as “12+6 Pin”, given the location of the gap in the edge connector of the wifi board. So trying to find an Atheros card, or an Intel card with that pinout is a lost cause. Interestingly, however, there's a derth of 12+6 Pin to M.2 A+E boards. This seems to be down to people using discarded 12+6 cards in hackintosh builds, as the card is naturally well supported in MacOS.

The existence of these apple-to-rest-of-the-world adapter cards led me to believe that the only thing different was the pinout, meaning that a largely trivial to design passive adapter would work in the other direction. Unfortunately, people using not MacOS on Macbooks is uncommon. People using not MacOS and in need of a different wifi card are even more so. This is a niche product.

After an hour or so plugging in variations on ‘airport to m2’, ‘12+6 to a+e’ and ‘macbook air ngff’, I finally found what I was looking for. Given the low price, I purchased the appropriate shape and began working out what M.2 A+E card was best supported on Dragonfly BSD.

The best supported wifi cards are, without a doubt, any card that is covered by Linux's ath9k driver. ath9k is completely free and open, and requires no microcode to operate. Unfortunately, ath9k cards don't cover 802.11ac, and they're typically mini-pci-e, rather than m.2. ath10k does support 802.11ac, and cards do come in the right form factor - but doesn't have a Dragonfly driver. There is (as far as I can gather) an ongoing project to bring support to FreeBSD, which will likely benefit Dragonfly. But this is far from being merged.

I combed through the manpages for a while, until I eventually found the iwm driver manpage. This would have been faster had the driver been listed on the Wikipedia page. I've since added it. The iwm driver covers the 9260 chipset - which is an M.2 A+E card readily available on Amazon UK. The card and the adapter match the form-factor of the original card, and work on Dragonfly with no issues (so far).

Audio support is unsurprisingly well-handled by loading snd_hda on boot, however requires some tweaking to make the speakers (pcm2) work. The manpage specifically recommends playing with GPIO configuration, and a little trial and error will lead you to setting GPIO 0.

sysctl dev.hdaa.1.gpio_config=0=set

The only issue I haven't managed to work through is the trackpad, which insists on firing off right click and middle click events of its own accord. I imagine I'll have an update on this at some point.