Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.