Skip to content

Instantly share code, notes, and snippets.

@thomo
Last active March 13, 2020 12:46
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomo/e11e4c5216229cdc5976 to your computer and use it in GitHub Desktop.
Save thomo/e11e4c5216229cdc5976 to your computer and use it in GitHub Desktop.
Bash script to build a Broadcom Wireless kernel module for CentOS 7 using a Docker container - see http://wiki.centos.org/HowTos/Laptops/Wireless/Broadcom
#!/bin/sh
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
SDIR=${DIR}/src
DRIVER_SRC=`ls ${DIR}/hybrid*.tar.gz 2> /dev/null`
CONTAINER="thomo/centos7-dev:latest"
MYUID=`id -u`
MYGID=`id -g`
if [ ! -f "${DRIVER_SRC}" ]; then
echo "You have to download the Broadcom BCM43xx linux driver archive from Broadcom Official website (http://www.broadcom.com/support) and put it in this diretory."
exit 0
fi
rm -rf ${SDIR}
mkdir -p ${SDIR}/hybrid-wl
tar -xzf ${DRIVER_SRC} -C ${SDIR}/hybrid-wl
wget -q -O ${SDIR}/wl-kmod-fix-ioctl-handling.patch "http://wiki.centos.org/HowTos/Laptops/Wireless/Broadcom?action=AttachFile&do=get&target=wl-kmod-fix-ioctl-handling.patch"
wget -q -O ${SDIR}/wl-kmod-rhel7_1.patch "http://wiki.centos.org/HowTos/Laptops/Wireless/Broadcom?action=AttachFile&do=get&target=wl-kmod-rhel7_1.patch"
chown -R ${MYUID}:${MYGID} ${SDIR}
sudo docker run -v ${SDIR}:/usr/local/src:Z ${CONTAINER} /bin/sh -c 'cd /usr/local/src/hybrid-wl && patch -p1 < ../wl-kmod-fix-ioctl-handling.patch && patch -p1 < ../wl-kmod-rhel7_1.patch && cd /usr/local/src/hybrid-wl && make -C /lib/modules/${KERNEL_VERSION}.x86_64/build M=`pwd` && strip --strip-debug wl.ko && chown -R '"${MYUID}:${MYGID}"' * .*'
cp ${SDIR}/hybrid-wl/wl.ko ${DIR}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment