For anyone cannot use
sudo apt install bcmwl-kernel-source
So you guy can manually build from their source code (with patches applied to build for kernel 6.x).
!note: mine is kernel 6.5, test OK.
First, we clone the source:
git clone https://git.launchpad.net/ubuntu/+source/bcmwl/
(to be detailed, my latest commit is cd76516d116a73018ca4cbe6b580bfd603465cb9 , you can 'git checkout cd76516d116a73018ca4cbe6b580bfd603465cb9' if you want to have the same branch with me)
Go into the source code, you will see Makefile, README, debian and src, move Makefile into src folder
mv Makefile ./src/
Now create script in src directory for applying patches (already in source code)
#!/bin/bash
path to your patches (change if you want absolute dir)
PATCH_DIR="../debian/patches"
PATCHES=(
"0002-Makefile.patch"
"0003-Make-up-for-missing-init_MUTEX.patch"
"0010-change-the-network-interface-name-from-eth-to-wlan.patch"
"0013-gcc.patch"
"0019-broadcom-sta-6.30.223.248-3.18-null-pointer-fix.patch"
"0020-add-support-for-linux-4.3.patch"
"0021-add-support-for-Linux-4.7.patch"
"0022-add-support-for-Linux-4.8.patch"
"0023-add-support-for-Linux-4.11.patch"
"0024-add-support-for-Linux-4.12.patch"
"0025-add-support-for-Linux-4.14.patch"
"0026-add-support-for-Linux-4.15.patch"
"0027-add-support-for-linux-5.1.patch"
"0028-add-support-for-linux-5.6.patch"
"0029-Update-for-set_fs-removal-in-Linux-5.10.patch"
"0040-add-support-for-linux-5.18.patch"
"0041-dev-addr-access.patch"
"0042-add-support-for-linux-6.x.patch"
)
Apply all
for PATCH in "${PATCHES[@]}"; do
echo "Applying patch: $PATCH"
patch -p1 < "$PATCH_DIR/$PATCH"
if [ $? -ne 0 ]; then
echo "Failed to apply $PATCH, skipping."
fi
done
echo "All patches applied successfully."
Now we can build
make -C /lib/modules/$(uname -r)/build M="$(pwd)"
or just :
make
after building, we can install by using command:
sudo make install
sudo modprobe -r wl
sudo modprobe wl
lsmod |grep wl
If there is wl, you can see wifi works.
For anyone want to use dkms to build:
You guys need to get source code and apply patch like above.
Copy the src folder to
/var/lib/dkms/bcmwl/6.30.223.271+bdcom/source
Now check if there is any dkms installed before, we need to delete it:
dkms status
sudo dkms remove bcmwl/6.30.223.271+bdcom --all
dkms status
Go to /var/lib/dkms/bcmwl/6.30.223.271+bdcom/source/dkms.conf and delete all patches:
PACKAGE_NAME="bcmwl"
PACKAGE_VERSION="#VERSION#"
CLEAN="rm -f *.*o"
BUILT_MODULE_NAME[0]="wl"
MAKE[0]="make -C $kernel_source_dir M=$dkms_tree/$PACKAGE_NAME/$PACKAGE_VERSION/build"
DEST_MODULE_LOCATION[0]="/updates"
AUTOINSTALL="yes"
Now everything is clean, just go to build
sudo dkms build bcmwl/6.30.223.271+bdcom
sudo dkms install bcmwl/6.30.223.271+bdcom
or just do this:
sudo apt update
sudo apt install bcmwl-kernel-source
Now everything works normally.