FreeBSD 14.3 WiFi with BCM43224 on a mid-2010 Macbook Pro 6,2

Finally got this old Macbook Pro's wifi running, well - walking, on FreeBSD. I had attempted to get this chip working with bwn(4) in the past and although I was very close, it still wouldn't work. So today, after finding some extra RAM for this 15 year-old laptop with a massive display(!) I decided to give it another go!

Following standard FreeBSD processes, I tried to install bwn-firmware-kmod (from ports; pkg doesn't exist), add if_bwn_load="YES" and bwn_v4_ucode_load="YES" to /boot/loader.conf and reboot.

Following that, you'll see something like the following in dmesg:

bwn_pci0: Broadcom BCM42334 802.11n 
bwn0: <broadcom 802.11 MAC/PHY/Radio, rev 23>
bwn0: bwn_phy_n_attach: BWN_GPL_PHY not in kernel config; no PHY-N support
bwn0: failed

This is because of old GPLv2 interface code which FreeBSD can't include, partly the same reason some old DRM drivers are no longer available (including for this MacBook's Intel Ironlake!). The solution is in fact rather simple, but do bear in mind you will only get 802.11g mode with this and I cannot guarantee your chip won't explode out of protest!

Step 1: Rebuild the kernel with BWN_GPL_PHY

Rebuilding bwn(4) alone with BWN_GPL_PHY=1 is not enough, so we rebuild the kernel.

Fetch sources

git clone https://git.freebsd.org/src.git /usr/src
cd /usr/src
git checkout releng/14.3

Configure custom kernel

Create /usr/src/sys/amd64/conf/MBP62:

include GENERIC
ident   MBP62
options BWN_GPL_PHY

Compile and install kernel

cd /usr/src
make buildkernel KERNCONF=MBP62
make installkernel KERNCONF=MBP62

After your first cup of tea||coffee, you may receive an error like the following:

/usr/src/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_ppr.c:250:11 
error: comparison of different enumeration types ('bwn_phy_band_t' and 'bwn_band_t')

Warnings are rightly being treated as errors, but we're desperate people so compile bwn(4) separately and ignore them (a little OTT and redundant, but as I said - we're desperate people):

cd /usr/src/sys/modules/bwn
make clean
make BWN_GPL_PHY=1 MK_WERROR=no WERROR= CFLAGS+=-Wno-error=enum-compare
make install

Go back to /usr/src and re-run make buildkernel KERNCONF=MBP62 and make another cup of coffee then installkernel as above.

Step 2: Install bwn-firmware-kmod

This isn't available as a package, but it's in ports:

git clone https://git.freebsd.org/ports.git /usr/ports
cd /usr/ports/net/bwn-firmware-kmod
make install clean

/boot/loader.conf

if_bwn_load="YES"
bwn_v4_n_ucode_load="YES"

Finishing up

Reboot!

dmesg should report report the firmware has been loaded:

bwn0: WLAN (BCM43224 rev 23 sromrev 8) PHY (analog 8 type 4 rev 6)
  RADIO (manuf 0x17f ver 0x2056 rev 11)
bwn0: DMA (64 bits)
bwn0: Note: compiled with BWN_GPL_PHY; includes GPLv2 code
bwn0: ucode fw: ucode16_mimo
bwn0: firmware version (rev 666 patch 2 date 0xb217 time 0x9e7)

Configure and bring up our bwn(4) device:

ifconfig wlan0 create wlandev bwn0
ifconfig wlan0 up scan

You shouldn't see any errors, and can continue to configure wifi.

I wouldn't say it's great, it's running in 802.11g mode but it seems stable enough. I am receiving ~360KB/s from https://proof.ovh.net/files/10Gb.dat ... :)


Written by int16h (Danyal Samak) for Cryogenix