Installing Broadcom WiFi driver on Fedora 28

From Dawg Wiki

This guide is for installing Broadcom B43xxx series of Wifi cards appearing in older models of laptops. This does not support USB wifi dongles. You should try to only use each driver separately. In my case, I needed to install the b43 drivers while also needing the wl kernel module to get wifi to function properly.

Prerequisites

This guide assumes that your system and packages are up to date and you have configured the RPMFusion repository.

Compatibility

Before attempting an install, please make sure your wifi card is compatible in the first place.

Installing b43 and b43legacy

The Broadcom wireless chip needs proprietary software (called "firmware") that runs on the wireless chip itself to work properly. This firmware is copyrighted by Broadcom and must be extracted from Broadcom's proprietary drivers. To get such firmware on your system, you must download the driver from a legal distribution point, extract it, and install it. This is accomplished different ways by different Linux distributions, so please read the section for yours for the best results. You will need an alternate working internet connection (by Ethernet cable, for example) since the firmware cannot be included with the distro itself. With Fedora 10 and above, you should install wget and the b43-fwcutter tool (which will extract firmware from the Windows driver)[1]

sudo dnf install b43-fwcutter wget

After installing b43-fwcutter, download version 5.100.138 of Broadcom's proprietary driver and extract the firmware from it:

wget http://www.lwfinger.com/b43-firmware/broadcom-wl-5.100.138.tar.bz2
tar xjf broadcom-wl-5.100.138.tar.bz2
sudo b43-fwcutter -w "/lib/firmware/" broadcom-wl-5.100.138/linux/wl_apsta.o

Now attempt to load the driver:

sudo modprobe b43

If you wish to unload the driver to try and use the wl driver instead:

sudo modprobe -r b43 bcma
sudo modprobe wl

It is possible to prevent system from auto-loading some drivers by blacklisting them. This can be done with the following command:

echo "blacklist drivername" >> /etc/modprobe.d/blacklist

Installing the wl driver

Check what kernel you're using, then get broadcom-wl driver and kernel-devel package for compilation of broadcom-wl driver for your kernel

[thunderysteak@dhcppc10 ~]$ uname -r
4.17.4-200.fc28.x86_64
[thunderysteak@dhcppc10 ~]$ sudo dnf install kmod-wl akmods akmod-wl kernel-devel-4.16.3-301.fc28.x86_64

It is recommended to restart the system at this point, but not needed. After that, make sure driver "broadcom-wl" is installed, and run akmods to compile the kernel module. After running it, check if the wl driver can be used.

[thunderysteak@dhcppc10 ~]$ rpm -qa | grep broadcom-wl
broadcom-wl-6.30.223.271-6.fc28.noarch
[thunderysteak@dhcppc10 ~]$ sudo akmods
[sudo] password for thunderysteak: 
Checking kmods exist for 4.16.3-301.fc28.x86_64 [ OK ]
Building and installing wl-kmod [ OK ]
[thunderysteak@dhcppc10 ~]$ sudo modprobe wl

Now check if the module "wl" is being used for your wifi card

[thunderysteak@dhcppc10 ~]$ lspci -v
08:00.0 Network controller: Broadcom Limited BCM4322 802.11a/b/g/n Wireless LAN Controller (rev 01)
	Subsystem: Hewlett-Packard Company Device 1380
	Flags: bus master, fast devsel, latency 0, IRQ 18
	Memory at fa000000 (64-bit, non-prefetchable) [size=16K]
	Capabilities: <access denied>
	Kernel driver in use: wl
	Kernel modules: wl

If you don't see anything in NetworkManager, get a list of available wifi network through CLI and connect to your wifi network

[thunderysteak@dhcppc10 ~]$ nmcli dev wifi list
IN-USE  SSID          MODE   CHAN  RATE        SIGNAL  BARS  SECURITY 
*       Hacker-Space  Infra  6     135 Mbit/s  37      ▂▄__  WPA2   
[thunderysteak@dhcppc10 ~]$ nmcli dev wifi con "your_ssid" password "your_ssid_password"

Loading the wl/b43 module on system startup if not loaded automatically

It can sometimes happen that the system doesn't load the module itself on boot, so you need to either run the modprobe every time you turn on your laptop or let the command run during boot. It's possible to run the command on init, but it may always not work. Fedora 28 uses systemd for its init system. To run the command on boot, we need to create a systemd service file. Create a file with the extension .service at /etc/systemd/system/ and put the following text file into it. In my case, this file is called b43.service.

[Unit]
Description=Makes sure to modprobe the b43 driver on boot
After=multi-user.target

[Service]
ExecStart=/path/to/script.sh

[Install]
WantedBy=default.target

Contents of the script file:

#!/bin/bash
modprobe -r wl
modprobe b43

Now enable the b43.service service and set it to run on boot.

Make sure to set the script file permissions as executable:

sudo chmod +x script.sh

After this, the module wl should be unloaded on boot and module b43 loaded instead. This might not be the case for you, so edit the script file accordingly with trial and error. If it doesn't work as init script, set it as a login script. If setting it as systemd service doesn't work, set it as login script, add sudo in front of the script and change the sudoers file to run the script without sudo password. You can do this with sudo by putting the following in your /etc/sudoers file by running visudo.

ALL ALL=NOPASSWD: /path/to/script

And now any user can run

$ sudo /path/to/script

This allows them to run the script without typing in their password.