FreeBSD Wifi on a BCM4328 Wireless Card

Overview

Notes about configuring a wifi wireless network on FreeBSD 12.1, using an old laptop with an unsupported wireless card. Lots of forums said that the card is not supported and that it could not be done. But I refused to believe it, and this is a testimony to the resilience of FreeBSD.

    OS: FreeBSD 12.1-RELEASE-p10
    Laptop: Dell Inspiron 1525 (circa 2007)
    Memory: 4GB
    Wireless Card: 802.11g Broadcom BCM4328 SIBA bus BCM4312 rev 15

The history: while running FreeBSD 12.1 everything worked on my old Dell Inspiron 1525 laptop, except my wifi network. Going through blogs I discovered that the wifi card is not supported by generic FreeBSD kernel, so it does not work by default; and requires special tweaking. There’s no official guide for this wireless card. Tried many different recommendations from forum postings. Below is what what worked for me. There may be better ways; but if so then please comment.

Query Hardware

While running the GENERIC kernel, investigate which hardware is detectable. Take note of all the device names.

# dmesg | more
# pciconf -lv

My hardware is as follows:

CPU: Pentium Pentium Dual Core T3200 2.0GHz
DVR+/-RW
Vid: Intel Crestline GM965
Mem: Intel PM965/GM965/GL960 
Aud: Sigmatel 9205 hdacc2 pcm1 STAC9228X
Modem: hdaac0 Conexant HDA D330 MDC
SD Card: Ricoh R5C832/22/42/92
HD Toshiba ada0 
        320g, 7200 RPM
	cyl 16383
	hd 16
	s/t 63
	lba 625
	sec 142448
CDROM: cd0 Removable SCSI device.
Wifi:	bwn0 Broadcom 802.11  BCM4328/4312 
	bhnd0 BCM4312 SIBA Bus
	gpio0 Broadcom Chip GPIO
USB: Intel 82801H ICH8 USB-D 2.0
Ethernet:	msck0 Marvell Yukon 88E8040
		e1000phy0 Marvell E3016 

Install Latest Ports

# portsnap fetch
# portsnap extract

Compile Broadcom BCM Drivers

Install the latest port for the Ports Management:

# cd /usr/ports/ports-mgmt/pkg/
# make install clean

Install the latest port for the Broadcom BCM wifi drivers:

# cd /usr/ports/net/bwn-firmware-kmod/
# make install clean

Download Latest Source

# /usr/src
# wget ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/12.1-RELEASE/src.txz
# tar -xf src.txz -C /

Compile Kernel

Download source tree and compile a new kernel. Remove all the unnecessary drivers. My kernel went from 30MB to 19MB. A more lean compiled kernel reduces memory footprint, boots faster and overall performs better with less overhead.

Copy the kernel config, create a symblink, then edit:

# cd /usr/src/sys/`uname -m`/conf
# mkdir /root/kernels
# cp GENERIC /root/kernels/INSPIRON
# ln -s /root/mykernels/INSPIRON
# vi INSPIRON

Go through the settings, or download my kernel config file that I already made, which works:

# wget https://sotosystems.com/download/INSPIRON.xz
# xz -dc INSPIRON.xz > /root/kernels/INSPIRON

Verify that the following entries are present in the kernel config file:

    device bhnd
    device bhndb
    device bhndb_pci
    device bcma
    device siba
    device gpio
    device wlan
    device wlan_amrr
    device firmware

Begin the compilation. This took 20 minutes with an Intel i7, but with the Dell Inspiron 1525 it took 2 hours. The kernel should be reduced from 30MB to 19MB. I did notice performance improvements afterward:

# /usr/sbin/config INSPIRON
# cd ../compile/INSPIRON
# make cleandepend
# make depend
# make install

Wifi Configuration

For simplicity I am using wifi WEP authentication for now. Configure the following system settings (follow the logic):

# vi /boot/loader.conf 
siba_bwn_load="YES"
if_bwn_load="YES"
f_bwn_load="YES"
bwn_v4_lp_ucode_load="YES"
wlan_wep_load="YES"
wlan_ccmp_load="YES"
wlan_tkip_load="YES"
legal.intel_bwn.license_ack=1
# vi /etc/rc.conf
create_args_wlan0="country US regdomain FCC"
wlans_bwn0="wlan0"

Create the encrypted WEP key encryption. Add it to your wpa file below:

# wpa_passphrase myssid mypassword
network={
	ssid="myssid"
	psk=14829a0059f1025b2f4c6c911320fa9fasdkfeysdkfd1acde4b2026be4d2a7ca4
}
# vi /etc/wpa_supplicant.conf 
ctrl_interface=/var/run/wpa_supplicant
eapol_version=2
ap_scan=1
fast_reauth=1
network={
	ssid="myssid"
	key_mgmt=NONE
	wep_key1=MYPASSWORD
	wep_tx_keyidx=1
        psk=14829a0059f1025b2f4c6c911320fa9fasdkfeysdkfd1acde4b2026be4d2a7ca4
}

Wifi Script

Running the wifi settings from rc.conf does not work. The only way I was able to make it work was via a script. Every time you want to use use wifi simply run the following script as root. It disables all interfaces, then enables wifi, then restarts networking processes.

# vi /root/wifi_enable.sh

#!//bin/sh
ifconfig msk0 destroy
ifconfig wlan0 destroy
sleep 1
ifconfig wlan0 create wlandev bwn0 
ifconfig wlan0 inet 192.168.1.201 netmask 255.255.255.0 authmode open ssid myssid wepmode on weptxkey 1 wepkey 1:0xAAAAAAAAAA mode 11g
route add default 192.168.1.1
sleep 1
service sshd restart
service ntpd restart

Diagnostic Commands

Some diagnostic commands to try:

# bsdconfig wireless
# ifconfig wlan0 list scan
# sysctl net.wlan.devices

Performance

Broadcom Wifi drivers do not work well with FreeBSD, and I also heard similar comments about Broadcom wifi with Linux. Apparently this model was designed for Windows XP. This wifi not so great on FreeBSD 12.1. It is slow some times and seems very unstable. Sometimes I can connect via SSH and run commands, and other times it gets stuck and I have to retry again; like there is a memory cache problem. But for the sake of learning it is cool to be able to make it run and boast about it when nobody else can.

Update

Install the i386 or x86 32 bit distros. They run much better. Do not install the 64bit AMD64 or x86_64 versions. Although they both install on this machine, the 64 bit versions don’t run well. Debian 9 i386 (32bit) is the best distro that I’ve been able to make run the best on this laptop. Install the firmware:

# cat /etc/debian_version
9.13
# uname -m
i686
# vi /etc/apt/sources.list
 deb http://deb.debian.org/debian/ stretch main contrib non-free
# apt-get update
# apt-get install firmware-b43-installer b43-fwcutter firmware-misc-nonfree firmware-brcm80211
# reboot

Afterward the b43 firmware errors go away and the wlan0 interface appears connected via DHCP. Configure via gnome-control-center network.

After successfully configuring wlan0, running with a discoverable IP address, run:

# update-grub2
# reboot

Conclusion: Even in Linux this old Broadcom wifi card runs crappy. Lots of errors and slow downs occur. DHCP does not work well or at all. Disabling the wifi works. As an alternative used an external antenna wifi USB dongle stick: Eastech Ralink RT5370.

The End.

Add comment

Fill out the form below to add your own comments

User data





Add your comment