Getting The Macbook Pro Mid 2009 Wifi Working on FreeBSD 13.5

 Wifi modules are terribly hard and complex to configure on FreeBSD especially when dealing with Broadcom wifi modules. I had been trying to install these on my Macbook Pro Mid 2009 model and make it work but eventually able to managed to get it working. Here's how I'm doing to install this (PS: I'm still need an internet connection coming from the LAN cable):

Note: This guide is for FreeBSD version 13.5. 

1. Obtain the copy of kernel source file (src.txz) from the FreeBSD install disk. It should be located at FreeBSD_Install/usr/freebsd-dist. Much faster than downloading the file from the internet. Copy the src.txz file and extract it. Then, paste the kernel directory into /usr directory

$ tar -xvf src.txz
$ cd usr && cp -r src /usr


2. Go to /usr/src/sys/amd64/conf and make a copy of the file called GENERIC into a new file called WIFI

$ cd /usr/src/sys/amd64/conf
$ cp GENERIC WIFI


3. Edit the WIFI file to add the lines and search for lines that contain bwn and then uncommenting it. Then add these lines below:
$ nano WIFI

device      bwn     #Broadcom BCM43XX wireless NICs
option      BWN_DEBUG
option      BWN_GPL_PHY


4. I had to make some changes in kernel source code due to Clang compiler throws out error due to differences in enumeration. to fix this, open up the source code:
$ nano /usr/src/sys/gnu/dev/bwn/phy_n/if_bwn_phy_n_ppr.c

Then, fine the code in line 250 and edit into something like this:
//old default code in line 250
if(band == BWN_BAND_2G)

 //new edited code in line 250, hope it works
if((uint16_t)band == (uint16_t)BWN_BAND_2G)


5. Compile the custom kernel and install the custom kernel. It may take at least an hour. 
$ cd /usr/src
$ make buildkernel KERNCONF=WIFI
$ make installkernel KERNCONF=WIFI


6. Install the bwn-firmware-kmod module. Has to be installed in ports. 
$ cd /usr/ports/net/bwn-firmware-kmod
$ make install


7. Add modules to /boot/loader.conf
$ nano /boot/loader.conf

hw.bwn_pci.preferred="1"
if_bwn_pci_load="YES"
bwn_v4_ucode_load="YES"
bwn_v4_n_ucode_load="YES"
bwn_v4_lp_ucode_load="YES"


8. Add wlan interface in /etc/rc.conf
$ nano /etc/rc.conf

wlans_bwn0="wlan0"
ifconfig_wlan0="WPA SYNCDHCP"

9. Edit the wpa_supplicant.conf file
$ nano /etc/wpa_supplicant.conf

network={
   ssid="MyWIFI_2.4GHz"
   psk="12345678abcde"
}

10. Reboot the machine and test the connection with ping command. If no internet connection detected, double-check the SSID and also look for ifconfig status. If you see the SSID in the ifconfig, run the command ifconfig wlan0 up to initiate the connection. 

Reference links:
    

Comments

Popular posts from this blog

Installing nvidia-drm-kmod on FreeBSD

Setting Up GPU Cards on FreeBSD 13

Installing Jdownloader on FreeBSD