Updating the patches I'd submitted to bug #819136. What had been patch 0005 is now part of bug #819705 as patch 0001, and is attached to that bug. I'm attaching 0002-0010 to this message/bug.
-- (\___(\___(\______ --=> 8-) EHM <=-- ______/)___/)___/) \BS ( | ehem+sig...@m5p.com PGP 87145445 | ) / \_CS\ | _____ -O #include <stddisclaimer.h> O- _____ | / _/ 8A19\___\_|_/58D2 7E3D DDF4 7BA6 <-PGP-> 41D1 B375 37D0 8714\_|_/___/5445
>From 5035dedcbc12612cf19928a229658843907ac318 Mon Sep 17 00:00:00 2001 From: Elliott Mitchell <ehem+deb...@drgnwing.com> Date: Thu, 31 Mar 2016 17:40:07 -0700 Subject: [PATCH 02/10] Introduce variables for many magic constants Introduce variables for many of the likely to change magic constants. Notably the version of the upstream firmware tarball, the exact filename within the tarball, and the base URL for upstream. Take advantage of the object file name (${WL_APSTA}) to only extract the relevant object file from the upstream tarball. This potentially saves a lot of storage space during extraction, fixes bug #819129. --- debian/firmware-b43-installer.postinst | 34 +++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/debian/firmware-b43-installer.postinst b/debian/firmware-b43-installer.postinst index d8794c2..d9a1568 100644 --- a/debian/firmware-b43-installer.postinst +++ b/debian/firmware-b43-installer.postinst @@ -1,15 +1,36 @@ #!/bin/sh +######################################################################### +#$Id$ # +######################################################################### + +VERSION="5.100.138" + +BROADCOM_WL="broadcom-wl-${VERSION}" + +WL_APSTA="${BROADCOM_WL}/linux/wl_apsta.o" + +TARBALL="${BROADCOM_WL}.tar.bz2" + +URL="http://www.lwfinger.com/b43-firmware/${TARBALL}" + +FIRMWARE_INSTALL_DIR="/lib/firmware" + +######################################################################### +# stable sections below, not updated for firmware updates # +######################################################################### + set -e . /usr/share/debconf/confmodule -tmp=`mktemp -q -d` - latest_firmware () { +umask 027 + +tmp=`mktemp -q -d` + cd $tmp -export FIRMWARE_INSTALL_DIR="/lib/firmware" # use apt proxy APT_PROXIES=$(apt-config shell \ @@ -22,12 +43,11 @@ if [ -n "$APT_PROXIES" ]; then eval export $APT_PROXIES fi -if ! wget --timeout=60 http://www.lwfinger.com/b43-firmware/broadcom-wl-5.100.138.tar.bz2 ; then +if ! wget --timeout=60 "${URL}"; then echo "Some problem occurred during the firmware download. Please check your internet connection." exit 0 fi -tar xvjf broadcom-wl-5.100.138.tar.bz2 -cd broadcom-wl-5.100.138/linux +tar xvjf "${TARBALL}" "${WL_APSTA}" if [ -d "${FIRMWARE_INSTALL_DIR}/b43" ]; then echo "Deleting old extracted firmware..." xargs -r -0 -a "${FIRMWARE_INSTALL_DIR}/b43/firmware-b43-installer.catalog" dpkg-query -S 2>&1 1>/dev/null | cut -d/ -f4- | xargs rm -- @@ -36,7 +56,7 @@ fi mkdir "${FIRMWARE_INSTALL_DIR}/b43" || true catalog="${FIRMWARE_INSTALL_DIR}/b43/firmware-b43-installer.catalog" retcode=0 -b43-fwcutter -w "${FIRMWARE_INSTALL_DIR}" wl_apsta.o | while read line +b43-fwcutter -w "${FIRMWARE_INSTALL_DIR}" "${WL_APSTA}" | while read line do echo "${line}" file="${line#Extracting }" if [ "${file}" != "${line}" ] -- 1.7.10.4
>From f39e6a6794ef144c85cdbc882c01721b0b7cd7fd Mon Sep 17 00:00:00 2001 From: Elliott Mitchell <ehem+deb...@drgnwing.com> Date: Thu, 31 Mar 2016 17:45:32 -0700 Subject: [PATCH 03/10] Need to get out of temporary directory before removal ...otherwise the removal WILL fail (minor, unreported bug). Also implement targeted cleaning that should get rid of all the intermediate files without the sledgehammer of `rm -rf`. --- debian/firmware-b43-installer.postinst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/debian/firmware-b43-installer.postinst b/debian/firmware-b43-installer.postinst index d9a1568..5f3da5d 100644 --- a/debian/firmware-b43-installer.postinst +++ b/debian/firmware-b43-installer.postinst @@ -72,6 +72,15 @@ do echo "${line}" fi fi done + +rm "${TARBALL}" "${WL_APSTA}" +rm -rf "${BROADCOM_WL}" + +# otherwise can't delete things +cd / + +rmdir $tmp || echo "$0: DEBUG: targeted cleaning failed" 1>&2 + rm -rf $tmp [ ${retcode} -eq 0 ] || exit ${retcode} } -- 1.7.10.4
>From 5a2a7c00df39f45130202c7acf85d65153eaaee3 Mon Sep 17 00:00:00 2001 From: Elliott Mitchell <ehem+deb...@drgnwing.com> Date: Thu, 31 Mar 2016 17:50:17 -0700 Subject: [PATCH 04/10] Check return codes of all commands, flag errors better Errors on various commands were being ignored. Notably failures by `wget` wouldn't tell `dpkg` that installation had failed. Other commands weren't explicitly checked or flagged. The report of this accidentally ended up attached to bug #756664. --- debian/firmware-b43-installer.postinst | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/debian/firmware-b43-installer.postinst b/debian/firmware-b43-installer.postinst index 5f3da5d..80957bc 100644 --- a/debian/firmware-b43-installer.postinst +++ b/debian/firmware-b43-installer.postinst @@ -44,12 +44,15 @@ if [ -n "$APT_PROXIES" ]; then fi if ! wget --timeout=60 "${URL}"; then - echo "Some problem occurred during the firmware download. Please check your internet connection." - exit 0 + echo "$0: Some problem occurred during the firmware download. Please check your internet connection." 1>&2 + exit 1 +fi +if ! tar xvjf "${TARBALL}" "${WL_APSTA}"; then + echo "$0: Unpacking firmware file failed, unable to continue (is /tmp full?)." 1>&2 + exit 1 fi -tar xvjf "${TARBALL}" "${WL_APSTA}" if [ -d "${FIRMWARE_INSTALL_DIR}/b43" ]; then - echo "Deleting old extracted firmware..." + echo "$0: Deleting old extracted firmware..." 1>&2 xargs -r -0 -a "${FIRMWARE_INSTALL_DIR}/b43/firmware-b43-installer.catalog" dpkg-query -S 2>&1 1>/dev/null | cut -d/ -f4- | xargs rm -- rm "${FIRMWARE_INSTALL_DIR}/b43/firmware-b43-installer.catalog" fi -- 1.7.10.4
>From ad48d2474968e0030f0ef9bdae3b63491c101ff7 Mon Sep 17 00:00:00 2001 From: Elliott Mitchell <ehem+deb...@drgnwing.com> Date: Thu, 31 Mar 2016 18:11:46 -0700 Subject: [PATCH 05/10] Add checking of SHA512 checksum of downloaded tarball Most of the programs invoked on the firmware should be fairly resistant to attacks, but implement some additional protection. This should also guard against corrupted downloads. Fixes #756664. --- debian/firmware-b43-installer.postinst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/debian/firmware-b43-installer.postinst b/debian/firmware-b43-installer.postinst index 80957bc..82e0af6 100644 --- a/debian/firmware-b43-installer.postinst +++ b/debian/firmware-b43-installer.postinst @@ -10,6 +10,8 @@ BROADCOM_WL="broadcom-wl-${VERSION}" WL_APSTA="${BROADCOM_WL}/linux/wl_apsta.o" +SHA512SUM="02487e76e3eca7fe97ce2ad7dc9c5d39fac82b8d5f7786cce047f9c85e2426f5b7ea085d84c7d4aae43e0fe348d603e3229211bab601726794ef633441d37a8b" + TARBALL="${BROADCOM_WL}.tar.bz2" URL="http://www.lwfinger.com/b43-firmware/${TARBALL}" @@ -47,6 +49,12 @@ if ! wget --timeout=60 "${URL}"; then echo "$0: Some problem occurred during the firmware download. Please check your internet connection." 1>&2 exit 1 fi +if ! sha512sum -c /dev/stdin << EOF; then +${SHA512SUM} ${TARBALL} +EOF + echo "$0: Downloaded firmware did not match known SHA512 checksum, aborting." 1>&2 + exit 1 +fi if ! tar xvjf "${TARBALL}" "${WL_APSTA}"; then echo "$0: Unpacking firmware file failed, unable to continue (is /tmp full?)." 1>&2 exit 1 -- 1.7.10.4
>From b4911ccdf849aaaaebc20ea53bf6cf158d14836c Mon Sep 17 00:00:00 2001 From: Elliott Mitchell <ehem+deb...@drgnwing.com> Date: Thu, 31 Mar 2016 19:10:14 -0700 Subject: [PATCH 06/10] Break firmware installation into separate script (that can be run by hand) This package now features the `firmware-b43-install` script. This script can be run by hand to install firmware unconditionally. Firmware will still be installed by the postinst script, but this is done via this script. --- debian/firmware-b43-installer.dirs | 3 +- debian/firmware-b43-installer.postinst | 85 +---------------------- debian/rules | 2 + firmware-b43-install | 117 ++++++++++++++++++++++++++++++++ 4 files changed, 122 insertions(+), 85 deletions(-) create mode 100755 firmware-b43-install diff --git a/debian/firmware-b43-installer.dirs b/debian/firmware-b43-installer.dirs index 5eeb6b9..b732776 100644 --- a/debian/firmware-b43-installer.dirs +++ b/debian/firmware-b43-installer.dirs @@ -1 +1,2 @@ -/lib/firmware/b43/ +/lib/firmware/ +/usr/sbin/ diff --git a/debian/firmware-b43-installer.postinst b/debian/firmware-b43-installer.postinst index 82e0af6..1c6e250 100644 --- a/debian/firmware-b43-installer.postinst +++ b/debian/firmware-b43-installer.postinst @@ -4,96 +4,13 @@ #$Id$ # ######################################################################### -VERSION="5.100.138" - -BROADCOM_WL="broadcom-wl-${VERSION}" - -WL_APSTA="${BROADCOM_WL}/linux/wl_apsta.o" - -SHA512SUM="02487e76e3eca7fe97ce2ad7dc9c5d39fac82b8d5f7786cce047f9c85e2426f5b7ea085d84c7d4aae43e0fe348d603e3229211bab601726794ef633441d37a8b" - -TARBALL="${BROADCOM_WL}.tar.bz2" - -URL="http://www.lwfinger.com/b43-firmware/${TARBALL}" - -FIRMWARE_INSTALL_DIR="/lib/firmware" - -######################################################################### -# stable sections below, not updated for firmware updates # -######################################################################### - set -e . /usr/share/debconf/confmodule latest_firmware () { -umask 027 - -tmp=`mktemp -q -d` - -cd $tmp - -# use apt proxy -APT_PROXIES=$(apt-config shell \ -http_proxy Acquire::http::Proxy \ -https_proxy Acquire::https::Proxy \ -ftp_proxy Acquire::ftp::Proxy \ -) - -if [ -n "$APT_PROXIES" ]; then - eval export $APT_PROXIES -fi - -if ! wget --timeout=60 "${URL}"; then - echo "$0: Some problem occurred during the firmware download. Please check your internet connection." 1>&2 - exit 1 -fi -if ! sha512sum -c /dev/stdin << EOF; then -${SHA512SUM} ${TARBALL} -EOF - echo "$0: Downloaded firmware did not match known SHA512 checksum, aborting." 1>&2 - exit 1 -fi -if ! tar xvjf "${TARBALL}" "${WL_APSTA}"; then - echo "$0: Unpacking firmware file failed, unable to continue (is /tmp full?)." 1>&2 - exit 1 -fi -if [ -d "${FIRMWARE_INSTALL_DIR}/b43" ]; then - echo "$0: Deleting old extracted firmware..." 1>&2 - xargs -r -0 -a "${FIRMWARE_INSTALL_DIR}/b43/firmware-b43-installer.catalog" dpkg-query -S 2>&1 1>/dev/null | cut -d/ -f4- | xargs rm -- - rm "${FIRMWARE_INSTALL_DIR}/b43/firmware-b43-installer.catalog" -fi -mkdir "${FIRMWARE_INSTALL_DIR}/b43" || true -catalog="${FIRMWARE_INSTALL_DIR}/b43/firmware-b43-installer.catalog" -retcode=0 -b43-fwcutter -w "${FIRMWARE_INSTALL_DIR}" "${WL_APSTA}" | while read line -do echo "${line}" - file="${line#Extracting }" - if [ "${file}" != "${line}" ] - then if [ "${retcode}" -ne 0 ] - then rm "${FIRMWARE_INSTALL_DIR}/${file}" - - elif [ -z "${FIRMWARE_INSTALL_DIR}/${file}" ] || \ - ! printf %s/%s\\x00 "${FIRMWARE_INSTALL_DIR}" "${file}" >> "${catalog}" - then echo "$0: Failed during extraction of ${file} from ${WL_APSTA}" 1>&2 - echo "$0: Warning, manual removal/cleaning of ${FIRMWARE_INSTALL_DIR}/b43 may be needed!" 1>&2 - rm "${FIRMWARE_INSTALL_DIR}/${file}" - retcode=1 - fi - fi -done - -rm "${TARBALL}" "${WL_APSTA}" -rm -rf "${BROADCOM_WL}" - -# otherwise can't delete things -cd / - -rmdir $tmp || echo "$0: DEBUG: targeted cleaning failed" 1>&2 - -rm -rf $tmp -[ ${retcode} -eq 0 ] || exit ${retcode} + /usr/sbin/firmware-b43-install || exit 1 } # check environment diff --git a/debian/rules b/debian/rules index dfd8ff2..3d6d76e 100755 --- a/debian/rules +++ b/debian/rules @@ -27,3 +27,5 @@ override_dh_installchangelogs: override_dh_auto_install: $(INSTALL) b43-fwcutter $(CURDIR)/debian/b43-fwcutter/usr/bin + $(INSTALL) firmware-b43-install $(CURDIR)/debian/firmware-b43-installer/usr/sbin + diff --git a/firmware-b43-install b/firmware-b43-install new file mode 100755 index 0000000..4c1b21e --- /dev/null +++ b/firmware-b43-install @@ -0,0 +1,117 @@ +#!/bin/sh + +######################################################################### +#$Id$ # +######################################################################### + +VERSION="5.100.138" + +BROADCOM_WL="broadcom-wl-${VERSION}" + +WL_APSTA="${BROADCOM_WL}/linux/wl_apsta.o" + +SHA512SUM="02487e76e3eca7fe97ce2ad7dc9c5d39fac82b8d5f7786cce047f9c85e2426f5b7ea085d84c7d4aae43e0fe348d603e3229211bab601726794ef633441d37a8b" + +TARBALL="${BROADCOM_WL}.tar.bz2" + +URL="http://www.lwfinger.com/b43-firmware/${TARBALL}" + +FIRMWARE_INSTALL_DIR="/lib/firmware" + +######################################################################### +# stable sections below, not updated for firmware updates # +######################################################################### + +set -e + +if [ $# -gt 2 ] +then echo "$0: Too many arguments" 1>&2 + exit 1 +elif [ $# -eq 1 ] +then if [ "$1" = "-h" -o "$1" = "--help" ] + then echo "$0 <output directory>" 1>&2 + exit 0 + elif [ "${1#-}" != "$1" ] + then echo "$0: No options other than -h are supported" 1>&2 + exit 1 + fi + + if [ "${1#/}" = "$1" ] + then FIRMWARE_INSTALL_DIR="`pwd`/$1" + else FIRMWARE_INSTALL_DIR="$1" + fi +fi + + +umask 027 + +tmp=`mktemp -q -d` + +cd $tmp + + + +# use apt proxy +APT_PROXIES=$(apt-config shell \ +http_proxy Acquire::http::Proxy \ +https_proxy Acquire::https::Proxy \ +ftp_proxy Acquire::ftp::Proxy \ +) + +if [ -n "$APT_PROXIES" ]; then + eval export $APT_PROXIES +fi + +if ! wget --timeout=60 "${URL}"; then + echo "$0: Some problem occurred during the firmware download. Please check your internet connection." 1>&2 + exit 1 +fi +if ! sha512sum -c /dev/stdin << EOF; then +${SHA512SUM} ${TARBALL} +EOF + echo "$0: Downloaded firmware did not match known SHA512 checksum, aborting." 1>&2 + exit 1 +fi +if ! tar xvjf "${TARBALL}" "${WL_APSTA}"; then + echo "$0: Unpacking firmware file failed, unable to continue (is /tmp full?)." 1>&2 + exit 1 +fi +if [ -d "${FIRMWARE_INSTALL_DIR}/b43" ]; then + echo "$0: Deleting old extracted firmware..." 1>&2 + xargs -r -0 -a "${FIRMWARE_INSTALL_DIR}/b43/firmware-b43-installer.catalog" dpkg-query -S 2>&1 1>/dev/null | cut -d/ -f4- | xargs rm -- + rm "${FIRMWARE_INSTALL_DIR}/b43/firmware-b43-installer.catalog" + rmdir "${FIRMWARE_INSTALL_DIR}/b43" || exit 1 +fi +mkdir "${FIRMWARE_INSTALL_DIR}/b43" || true +catalog="${FIRMWARE_INSTALL_DIR}/b43/firmware-b43-installer.catalog" +retcode=0 +b43-fwcutter -w "${FIRMWARE_INSTALL_DIR}" "${WL_APSTA}" | while read line +do echo "${line}" + file="${line#Extracting }" + if [ "${file}" != "${line}" ] + then if [ "${retcode}" -ne 0 ] + then rm "${FIRMWARE_INSTALL_DIR}/${file}" + + elif [ -z "${FIRMWARE_INSTALL_DIR}/${file}" ] || \ + ! printf %s/%s\\x00 "${FIRMWARE_INSTALL_DIR}" "${file}" >> "${catalog}" + then echo "$0: Failed during extraction of ${file} from ${WL_APSTA}" 1>&2 + echo "$0: Warning, manual removal/cleaning of ${FIRMWARE_INSTALL_DIR}/b43 may be needed!" 1>&2 + rm "${FIRMWARE_INSTALL_DIR}/${file}" + retcode=1 + fi + fi +done + +rm "${TARBALL}" "${WL_APSTA}" +rm -rf "${BROADCOM_WL}" + +# otherwise can't delete things +cd / + +rmdir $tmp || echo "$0: DEBUG: targeted cleaning failed" 1>&2 + +# this line *should* now be redundant, but leave it alone for now +rm -rf $tmp + +exit ${retcode} + -- 1.7.10.4
>From 632006893eb41873760a9621f7a04402e9b86adc Mon Sep 17 00:00:00 2001 From: Elliott Mitchell <ehem+deb...@drgnwing.com> Date: Thu, 31 Mar 2016 19:42:08 -0700 Subject: [PATCH 07/10] Implement package building script These changes now create the script `firmware-b43-buildpackage`, which will download the b43 firmware and turn it into a Debian package. This package can then be installed on single or multiple systems, which do not need any development tools installed. --- debian/control | 3 ++- debian/firmware-b43-installer.postinst | 2 ++ debian/rules | 5 +++++ firmware-b43-buildpackage.control | 27 +++++++++++++++++++++++++++ firmware-b43-buildpackage.dirs | 1 + firmware-b43-buildpackage.footer | 16 ++++++++++++++++ firmware-b43-buildpackage.header | 20 ++++++++++++++++++++ firmware-b43-buildpackage.preinst | 24 ++++++++++++++++++++++++ firmware-b43-buildpackage.rules | 18 ++++++++++++++++++ 9 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 firmware-b43-buildpackage.control create mode 100644 firmware-b43-buildpackage.dirs create mode 100644 firmware-b43-buildpackage.footer create mode 100644 firmware-b43-buildpackage.header create mode 100644 firmware-b43-buildpackage.preinst create mode 100755 firmware-b43-buildpackage.rules diff --git a/debian/control b/debian/control index e1030bf..715c119 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: b43-fwcutter Section: contrib/utils Priority: optional Maintainer: Daniel Echeverry <epsilo...@gmail.com> -Build-Depends: debhelper (>= 9), po-debconf, debconf +Build-Depends: debhelper (>= 9), po-debconf, debconf, sharutils Standards-Version: 3.9.5 Homepage: http://wireless.kernel.org/en/users/Drivers/b43 Vcs-Git: git://anonscm.debian.org/collab-maint/b43-fwcutter.git @@ -22,6 +22,7 @@ Package: firmware-b43-installer Section: contrib/kernel Architecture: all Depends: b43-fwcutter (>= ${source:Version}), bzip2, wget, ${misc:Depends} +Suggests: dpkg-dev, debhelper, fakeroot Replaces: firmware-b43-lpphy-installer (<= 1:015-14) Breaks: firmware-b43-lpphy-installer (<= 1:015-14) Description: firmware installer for the b43 driver diff --git a/debian/firmware-b43-installer.postinst b/debian/firmware-b43-installer.postinst index 1c6e250..aecffcc 100644 --- a/debian/firmware-b43-installer.postinst +++ b/debian/firmware-b43-installer.postinst @@ -10,6 +10,8 @@ set -e latest_firmware () { + # indicates presence of firmware-b43 ? + [ -d /lib/firmware/b43 ] || exit 0 /usr/sbin/firmware-b43-install || exit 1 } diff --git a/debian/rules b/debian/rules index 3d6d76e..f130f42 100755 --- a/debian/rules +++ b/debian/rules @@ -17,6 +17,10 @@ sed -e s/"("// -e s/")"// | cut -d"-" -f1) override_dh_auto_build: dh_auto_build -- CFLAGS="$(CFLAGS) $(CPPFLAGS) -std=c99 -fomit-frame-pointer -pedantic -D_BSD_SOURCE \ -DFWCUTTER_VERSION_=`echo $(version) | cut -d: -f2`" + shar debian/compat debian/source firmware-b43-buildpackage.[cdpr]* \ + | sed -es',firmware-b43-buildpackage\.\(control\|rules\),debian/\1,g' \ + -es',\(firmware-b43\)-buildpackage\.\(dirs\|preinst\),debian/\1.\2,g' \ + | head -n -1 | cat firmware-b43-buildpackage.header /dev/stdin firmware-b43-buildpackage.footer > firmware-b43-buildpackage override_dh_auto_clean: rm -f b43-fwcutter @@ -28,4 +32,5 @@ override_dh_installchangelogs: override_dh_auto_install: $(INSTALL) b43-fwcutter $(CURDIR)/debian/b43-fwcutter/usr/bin $(INSTALL) firmware-b43-install $(CURDIR)/debian/firmware-b43-installer/usr/sbin + $(INSTALL) firmware-b43-buildpackage $(CURDIR)/debian/firmware-b43-installer/usr/sbin diff --git a/firmware-b43-buildpackage.control b/firmware-b43-buildpackage.control new file mode 100644 index 0000000..393dc14 --- /dev/null +++ b/firmware-b43-buildpackage.control @@ -0,0 +1,27 @@ +Source: b43-fwcutter +Section: contrib/utils +Priority: optional +Maintainer: Daniel Echeverry <epsilo...@gmail.com> +Build-Depends: debhelper (>= 9), po-debconf, debconf, firmware-b43-installer +Standards-Version: 3.9.5 +Homepage: http://wireless.kernel.org/en/users/Drivers/b43 +Vcs-Git: git://anonscm.debian.org/collab-maint/b43-fwcutter.git +Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/b43-fwcutter.git + +Package: firmware-b43 +Section: contrib/kernel +Architecture: all +Depends: ${misc:Depends} +Conflicts: firmware-b43-installer (<= 1:019-2) +Description: firmware installer for the b43 driver + This package installs the firmware needed by the b43 kernel driver for some + Broadcom 43xx wireless network cards. + . + Supported chipsets: + * BCM4306/3; + * BCM4311; + * BCM4318; + * BCM4321; + * BCM4322 (only 14e4:432b); + * BCM4312 (with Low-Power a.k.a. LP-PHY). + diff --git a/firmware-b43-buildpackage.dirs b/firmware-b43-buildpackage.dirs new file mode 100644 index 0000000..e146a72 --- /dev/null +++ b/firmware-b43-buildpackage.dirs @@ -0,0 +1 @@ +/lib/firmware/ diff --git a/firmware-b43-buildpackage.footer b/firmware-b43-buildpackage.footer new file mode 100644 index 0000000..5e00b7e --- /dev/null +++ b/firmware-b43-buildpackage.footer @@ -0,0 +1,16 @@ +######################################################################### +# .shar file above, do not edit, regenerate from build script # +######################################################################### + +gunzip -c /usr/share/doc/firmware-b43-installer/changelog.Debian.gz > debian/changelog + +dpkg-buildpackage -b + +cd .. + +rm b43-fwcutter_*_*.changes + +if [ -z "${DEBUG}" -o "${DEBUG}" -le 0] +then rm -rf firmware-b43 +fi + diff --git a/firmware-b43-buildpackage.header b/firmware-b43-buildpackage.header new file mode 100644 index 0000000..0c92bb7 --- /dev/null +++ b/firmware-b43-buildpackage.header @@ -0,0 +1,20 @@ +#!/bin/sh + +set -e + +for util in dpkg-dev debhelper fakeroot +do + if [ ! -s "/var/lib/dpkg/info/${util}.list" ] + then + echo "$0: utilit(ies) needed missing, notably ${util}" + exit 1 + fi +done + +mkdir firmware-b43 +cd firmware-b43 + +######################################################################### +# .shar file below, do not edit, regenerate from build script # +######################################################################### + diff --git a/firmware-b43-buildpackage.preinst b/firmware-b43-buildpackage.preinst new file mode 100644 index 0000000..67666c8 --- /dev/null +++ b/firmware-b43-buildpackage.preinst @@ -0,0 +1,24 @@ +#!/bin/sh + +######################################################################### +#$Id$ # +######################################################################### + +FIRMWARE_INSTALL_DIR="/lib/firmware" + +######################################################################### +# stable sections below, not updated for firmware updates # +######################################################################### + + +set -e + +# remove firmware installed by firmware-b43-install +if [ -e "${FIRMWARE_INSTALL_DIR}/b43/firmware-b43.catalog" ]; then + echo "$0: Deleting installed firmware..." 1>&2 + xargs -r -0 -a "${FIRMWARE_INSTALL_DIR}/b43/firmware-b43-installer.catalog" dpkg-query -S 2>&1 1>/dev/null | cut -d/ -f4- | xargs rm -- + rm "${FIRMWARE_INSTALL_DIR}/b43/firmware-b43.catalog" + # something else /could/ have placed files there... + rmdir "${FIRMWARE_INSTALL_DIR}/b43" || sleep 10 || true +fi + diff --git a/firmware-b43-buildpackage.rules b/firmware-b43-buildpackage.rules new file mode 100755 index 0000000..0f99890 --- /dev/null +++ b/firmware-b43-buildpackage.rules @@ -0,0 +1,18 @@ +#!/usr/bin/make -f + +#export DH_VERBOSE=1 + +%: + dh $@ + +override_dh_auto_build: + /usr/sbin/firmware-b43-install . + rm b43/firmware-b43-installer.catalog + +override_dh_auto_clean: + rm -rf $(CURDIR)/debian/firmware-b43 + +override_dh_auto_install: + cp -rp b43 $(CURDIR)/debian/firmware-b43/lib/firmware + cp -p /usr/share/doc/firmware-b43-installer/copyright $(CURDIR)/debian + -- 1.7.10.4
>From fb42c977856489e59fe06ffcf75a38046f9c1afa Mon Sep 17 00:00:00 2001 From: Elliott Mitchell <ehem+deb...@drgnwing.com> Date: Sat, 26 Mar 2016 19:18:52 -0700 Subject: [PATCH 08/10] Update lists of known to be supported chips This updates the packages to list all PCI chips currently listed on: https://wireless.wiki.kernel.org/en/users/Drivers/b43 The package descriptions are also updated to list these chips. A pseudo entry was added for the BCM4716, where the supported chip isn't actually on the PCI bus, but does have a bus that can be detected. This also adjusts the postinst detection script to allow for a system which has both supported and unsupported chips. --- debian/control | 19 ++++-- debian/firmware-b43-installer.postinst | 105 ++++++++++++++++---------------- firmware-b43-buildpackage.control | 19 ++++-- 3 files changed, 79 insertions(+), 64 deletions(-) diff --git a/debian/control b/debian/control index 715c119..10ab3ee 100644 --- a/debian/control +++ b/debian/control @@ -30,12 +30,21 @@ Description: firmware installer for the b43 driver kernel driver for some Broadcom 43xx wireless network cards. . Supported chipsets: - * BCM4306/3; - * BCM4311; + * BCM4306/3 (chip revision 3 only); + * BCM4311 (NOT PCI Id 14e4:4313); + * BCM4312; + * BCM43131; * BCM4318; - * BCM4321; - * BCM4322 (only 14e4:432b); - * BCM4312 (with Low-Power a.k.a. LP-PHY). + * BCM4321 (only partial support, not all versions tested); + * BCM43217; + * BCM4322 (only partial support for some versions, not all versions tested); + * BCM43222 (not all versions tested); + * BCM43224 (not all versions tested); + * BCM43225; + * BCM43227; + * BCM43228; + * BCM4331; + * BCM47xx (detection not reliable, may not support all versions). Package: firmware-b43legacy-installer Section: contrib/kernel diff --git a/debian/firmware-b43-installer.postinst b/debian/firmware-b43-installer.postinst index aecffcc..3d0596a 100644 --- a/debian/firmware-b43-installer.postinst +++ b/debian/firmware-b43-installer.postinst @@ -45,66 +45,63 @@ if [ "$RET" = "true" ] ; then exit 0 fi -# Fix for BCM4306/3 [14e4:4320] (rev 03) -chip=`lspci -n | grep -o "14e4:4320 (rev 03)"` || true -if [ "$chip" ] ; then - echo "Your card is BCM4306/3 [14e4:4320] (rev 03), firwmare 5.100.138 will be used" - latest_firmware - exit 0 -fi - -# Fix for BCM4306/3 [14e4:4324] (rev 03) -chip=`lspci -n | grep -o "14e4:4324 (rev 03)"` || true -if [ "$chip" ] ; then - echo "Your card is BCM4306/3 [14e4:4324] (rev 03), firwmare 5.100.138 will be used" - latest_firmware - exit 0 -fi - # check chip -pci=`lspci -n | grep -o "14e4:[1234567890abcdef]\+"` || true - -if [ -n "$pci" ]; then - for device in $pci; do - device_id=`echo $device | cut -d: -f2` - case $device_id in - 4301 | 4306 | 4320 |4324 | 4325) - legacy=1 - ;; - 4307 | 4311 | 4312 | 4315 | 4318 | 4319 | 4321 | 4328 | 4329 | 432b | 432c | 4331 | 4353 | 4357 | 5354) - latest=1 - ;; - 4322 | 4358 | 4365 | 4727 | a8d8) - # b43 upstream says 3.6+ for a8d8 - unsupported="$unsupported $device_id" - ;; - 0576 | 4313 | 432a | 432d | 4358 | 4359 | 435a | a99d) - nottested=1 - ;; - *) - ;; - esac - done -fi +pci=`lspci -n -d 14e4: | grep -o "14e4:[1234567890abcdef]\+"` || true -if [ "$legacy" ]; then - echo "An unsupported BCM4301, BCM4306 or BCM4306/2 device was found." - echo "Use b43legacy firmware (firmware-b43legacy-installer package) instead." +if [ -z "$pci" ]; then + echo "No known supported Broadcom 802.11 chips found, not installing firmware." + echo echo "Aborting." exit 0 -elif [ "$unsupported" ]; then +fi + +for device in $pci; do + device_id=${device#14e4:} + case $device_id in + 430[16] | 4325) + legacy=1 + ;; + 432[04]) + chip=`lspci -n -d ${device}` + if [ "${chip}" != "${chip%${device} (rev 03)}" ] ; then + latest=1 + else + legacy=1 + fi + ;; + 4307 | 431[12589] | 432[1289bc] | 4331 | 435[03789] | 43a[9a] | 4716 | a8d8 | a8db | 5354) + latest=1 + ;; + 4322 | 4358 | 436[05] | 43a0 | 43b1 | 4727) + unsupported="$unsupported $device_id" + ;; + 4313) + # need to distinguish BCM4311 (untested) from BCM4313 (not supported) + nottested=1 + ;; + 0576 | 432[ad] | 435[89a] | a8d6 | a99d) + nottested=1 + ;; + *) + ;; + esac +done + +if [ -n "$unsupported" ]; then echo -n "Unsupported device(s) found: PCI id " - for device_id in $unsupported; do echo -n "14e4:$device_id "; done + for device_id in $unsupported; do echo -n " * 14e4:$device_id "; done echo - echo "Aborting." - exit 0 -elif [ "$nottested" ]; then - echo "This card is actually not tested. Please install the driver manually." - exit 0 -elif [ "$latest" ]; then - echo "This card work with newer 5.100.138 firmware. Trying to install it." - latest_firmware - exit 0 +fi +if [ -n "$legacy" ]; then + echo "An unsupported BCM4301, BCM4306 or BCM4306/2 device was found." + echo "Please install b43legacy firmware (firmware-b43legacy-installer package)." + echo +fi +if [ -n "$latest" ]; then + echo "A card known to work was found. Trying to install firmware." + latest_firmware +elif [ -n "$nottested" ]; then + echo "An untested card was found. Please install the driver manually." fi #DEBHELPER# diff --git a/firmware-b43-buildpackage.control b/firmware-b43-buildpackage.control index 393dc14..01e1a07 100644 --- a/firmware-b43-buildpackage.control +++ b/firmware-b43-buildpackage.control @@ -18,10 +18,19 @@ Description: firmware installer for the b43 driver Broadcom 43xx wireless network cards. . Supported chipsets: - * BCM4306/3; - * BCM4311; + * BCM4306/3 (chip revision 3 only); + * BCM4311 (NOT PCI Id 14e4:4313); + * BCM4312; + * BCM43131; * BCM4318; - * BCM4321; - * BCM4322 (only 14e4:432b); - * BCM4312 (with Low-Power a.k.a. LP-PHY). + * BCM4321 (only partial support, not all versions tested); + * BCM43217; + * BCM4322 (only partial support for some versions, not all versions tested); + * BCM43222 (not all versions tested); + * BCM43224 (not all versions tested); + * BCM43225; + * BCM43227; + * BCM43228; + * BCM4331; + * BCM47xx (detection not reliable, may not support all versions). -- 1.7.10.4
>From 20cac8efb67d2dd046507137b9185f26ada9d267 Mon Sep 17 00:00:00 2001 From: Elliott Mitchell <ehem+deb...@drgnwing.com> Date: Sat, 26 Mar 2016 19:27:03 -0700 Subject: [PATCH 09/10] Add updated constants for driver v6.30.163.46 This solves bug #810161, getting a newer version of the driver firmware. --- firmware-b43-install | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/firmware-b43-install b/firmware-b43-install index 4c1b21e..be509a4 100755 --- a/firmware-b43-install +++ b/firmware-b43-install @@ -4,13 +4,13 @@ #$Id$ # ######################################################################### -VERSION="5.100.138" +VERSION="6.30.163.46" BROADCOM_WL="broadcom-wl-${VERSION}" -WL_APSTA="${BROADCOM_WL}/linux/wl_apsta.o" +WL_APSTA="${BROADCOM_WL}.wl_apsta.o" -SHA512SUM="02487e76e3eca7fe97ce2ad7dc9c5d39fac82b8d5f7786cce047f9c85e2426f5b7ea085d84c7d4aae43e0fe348d603e3229211bab601726794ef633441d37a8b" +SHA512SUM="0144894fbbb5e8ebab6c423d9bd0f3249be94f2f468a50b8bf721a3b17f1f6e57467c79e87abc8d136bfc92e701ed046885fead892e9a73efa5217d710311ae9" TARBALL="${BROADCOM_WL}.tar.bz2" -- 1.7.10.4
>From bfbcefe79886618ab493c744da2004b78c77e3ce Mon Sep 17 00:00:00 2001 From: Elliott Mitchell <ehem+deb...@drgnwing.com> Date: Sat, 26 Mar 2016 19:37:25 -0700 Subject: [PATCH 10/10] Simplify debian/rules I'm sure these lines evolved this way for some reason, but that reason doesn't look too applicable today. This also reduces the number of shell processes involved and so should make building faster. --- debian/rules | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/debian/rules b/debian/rules index f130f42..9ac23d2 100755 --- a/debian/rules +++ b/debian/rules @@ -8,15 +8,14 @@ INSTALL := install -o root -g root -m 755 CFLAGS:=$(shell dpkg-buildflags --get CFLAGS) CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS) -version=$(shell dpkg-parsechangelog | grep urgency | awk '{ print $$2; }'| \ -sed -e s/"("// -e s/")"// | cut -d"-" -f1) +version=$(filter-out Version:,$(shell dpkg-parsechangelog | grep ^Version:\ )) %: dh $@ override_dh_auto_build: dh_auto_build -- CFLAGS="$(CFLAGS) $(CPPFLAGS) -std=c99 -fomit-frame-pointer -pedantic -D_BSD_SOURCE \ - -DFWCUTTER_VERSION_=`echo $(version) | cut -d: -f2`" + -DFWCUTTER_VERSION_=$(word 2,$(subst -, ,$(subst :, ,$(version))))" shar debian/compat debian/source firmware-b43-buildpackage.[cdpr]* \ | sed -es',firmware-b43-buildpackage\.\(control\|rules\),debian/\1,g' \ -es',\(firmware-b43\)-buildpackage\.\(dirs\|preinst\),debian/\1.\2,g' \ -- 1.7.10.4