FreeBSD on MacBook Mid 2009 with BroadCom WIFI

Overview

After years, I decided to try a FreeBSD fresh install, to revive a old MacBookPro: the results was great and impressive, also if you think the hardware is over 15 years old. I want to share with you my success.

Press Option button on Start

I own a very old MacBook mid-2009. I bought it with a 4GB RAM and during the year I upgraded it with a 256 SSD Samsung Evo disk remving the CDROM, and retaining the old mechanical disk.

So I decided to try it out FreeBSD, installing it on the mechanical disk, while retaining MacOS on the speediest one, for the meantime.

The installation of the base system (done with a usb stick) take very little time, and I was impressed by the speed.

The base system was tiny (about 1Gb) By default root user was unable to log in from ssh via a password, which is quite good. I enabled a normal user in the sudoers list following a simple manual 1. Also, I installed ZFS just to give it a try, and I was quite impressed. Native ZFS support on FreeBSD is a plus: even if Linux community is more active on this side, the ability to install it out-of-the box is fantastic.

And, I repeat, the entire core kernel installed in 5 minutes on my mechanical 14-years old disk!

Then I need to get the WIFI working, an old Broadcom BCM4322. I found guys with the same problem 2 and also some insights on how to recompile the BSD kernel. The route was not linear, and outdated, so I report below my How-TO for FreeBSD 14.2:

Install FreeBSD 14 on MacBook Pro Mid-2009 and get the Broadcome WIFI working

I collected the information from this forum, but I adapted to FreeBSD14 and clarified some points.

Recompile the Kernel

Prerequisite: you need FreeBSD source, they are located under /usr/src

First you need to add to your kernel configuration by making a custom kernconf. https://www.freebsd.org/doc/handbook/kernelconfig-config.html I am assuming here that you are using FreeBSD 14 AMD64 build.

1cd /usr/src
2## move to top level directory ##
3
4cp /usr/src/sys/amd64/conf/GENERIC /usr/src/sys/amd64/conf/GENERIC/WIFI
5## Copy the GENERIC kernconf to a file named WIFI ##
6
7ee /usr/src/sys/amd64/conf/WIFI
8## This is the easy editor. You are opening your new kernconf to add the options you need ##

Down around line 296-297 near BWN add the following BWN options, it must look something like:

 1options         AH_AR5416_INTERRUPT_MITIGATION # AR5416 interrupt mitigation
 2device          ath_rate_sample         # SampleRate tx rate control for ath
 3#device         bwi                     # Broadcom BCM430x/BCM431x wireless NICs.
 4#device         bwn                     # Broadcom BCM43xx wireless NICs.
 5# GG was here: add the following two
 6option          BWN_DEBUG
 7option          BWN_GPL_PHY
 8
 9device          ipw                     # Intel 2100 wireless NICs.
10device          iwi                     # Intel 2200BG/2225BG/2915ABG wireless NICs.

and save changes.

This is the KERNCONF now fixed up with your custom kernel options and saved as your WIFI kernconf.

Check the /usr/src/sys/modules/bwn/Makefile I have no need to edit it, SRCS.BWN_GPL_PHY was already included.

Otherwise search for something like

1# Uncomment this for the GPL PHY code; this requires the
2# module be built with BWN_GPL_PHY set in the kernel
3# configuration.

and uncomment the relevant part

Now you can compile the custom kernel and install it with

1cd /usr/src
2make -j 2 buildkernel KERNCONF=WIFI
3make -j 2 installkernel KERNCONF=WIFI

Take a long tea, because it require 2 hours to recompile everything

Reboot.

Install the service

Install the bwn-firmware-kmod from the ports source distribution (It is not clear if this step is really needed on FrerBSD 14):

1cd /usr/ports/net/bwn-firmware-kmod
2make install

Then in /boot/loader.conf set the following:

1bwn_v4_n_ucode_load="YES"
2if_bwn_load="YES"

The last important part is:

In the /etc/rc.conf configure the bwn device as wlan0 with

1wlans_bwn0="wlan0"
2ifconfig_wlan0="WPA SYNCDHCP"

Then on /etc/wpa_supplicant.conf put your ssid and password:

1network={
2ssid="SkyNet-XYZ666"
3psk="SECRETP4$$w0rd"
4}

And then reboot again

Post sanity checks

Verify dmesg and ifconfig:

 1# dmesg | grep -i broadcom  | head -3
 2bwn_pci0: <Broadcom BCM4322 802.11n Dual-Band Wireless> mem 0xd3200000-0xd3203fff at device 0.0 on pci4
 3bhnd_chipc0: <Broadcom ChipCommon I/O Controller, rev 23> mem 0x18000000-0x18000dff,0xffff0000-0xffffffff,0x1c000000-0x1dffffff,0x18000f00-0x18000fff,0x18000e00-0x18000eff irq 0 at core 0 on bhnd0
 4bhnd_pmu0: <Broadcom ChipCommon PMU, rev 2> on bhnd_chipc0
 5# ifconfig
 6...
 7wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
 8        options=0
 9        ether ba:df:00:d0:00:00
10        inet 192.168.1.2 netmask 0xffffff00 broadcast 192.168.1.255
11        groups: wlan
12        ssid ZIM-99999999 channel 6 (2437 MHz 11g) bssid ba:df:00:d0:00:00
13        regdomain FCC country US authmode WPA2/802.11i privacy ON
14        deftxkey UNDEF AES-CCM 2:128-bit txpower 30 bmiss 7 scanvalid 60
15        protmode CTS wme roaming MANUAL
16        parent interface: bwn0
17        media: IEEE 802.11 Wireless Ethernet OFDM/24Mbps mode 11g
18        status: associated
19        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
20...

References