Script postinst of package firmware-b43-installer is modified to load the classic firmware for broadcom-cards,
according to note at https://wiki.archlinux.org/index.php/Broadcom_wireless#b43
Logic is added to also load the correct version, in case the
firmware is unconditionally loaded.
New postinst and diff are attached, I hope.
I did not properly indent the postinst-file!
#!/bin/sh set -e ######################################################################### make_env() { if [ -n "$latest" ]; then VERSION="6.30.163.46" BROADCOM_WL="broadcom-wl-${VERSION}" WL_APSTA="${BROADCOM_WL}.wl_apsta.o" SHA512SUM="0144894fbbb5e8ebab6c423d9bd0f3249be94f2f468a50b8bf721a3b17f1f6e57467c79e87abc8d136bfc92e701ed046885fead892e9a73efa5217d710311ae9" else VERSION="5.100.138" BROADCOM_WL="broadcom-wl-${VERSION}" WL_APSTA="${BROADCOM_WL}/linux/wl_apsta.o" SHA512SUM="02487e76e3eca7fe97ce2ad7dc9c5d39fac82b8d5f7786cce047f9c85e2426f5b7ea085d84c7d4aae43e0fe348d603e3229211bab601726794ef633441d37a8b" fi DOWNLOAD="${BROADCOM_WL}.tar.bz2" URL="https://www.lwfinger.com/b43-firmware/${DOWNLOAD}" FIRMWARE_INSTALL_DIR="/lib/firmware" B43="b43" } ######################################################################### # stable sections below, not updated for firmware updates # ######################################################################### . /usr/share/debconf/confmodule install_firmware () { make_env 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} ${DOWNLOAD} EOF echo "$0: Downloaded firmware did not match known SHA512 checksum, aborting." 1>&2 exit 1 fi if [ "${DOWNLOAD}" != "${WL_APSTA}" ]; then if ! tar xvjf "${DOWNLOAD}" "${WL_APSTA}"; then echo "$0: Unpacking firmware file failed, unable to continue (is /tmp full?)." 1>&2 exit 1 fi fi catalog="${FIRMWARE_INSTALL_DIR}/${B43}/firmware-${B43}-installer.catalog" if [ -f "${catalog}" ]; then echo "$0: Deleting old extracted firmware..." 1>&2 xargs -r -0 -a "${catalog}" dpkg-query -S 2>&1 1>/dev/null | sed -es',[^/]\+,,' | xargs -r rm -- rm "${catalog}" fi mkdir -p "${FIRMWARE_INSTALL_DIR}/${B43}" 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\\000 "${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 -f "${DOWNLOAD}" "${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} } # check environment if [ "$(stat -c %d/%i /)" != "$(stat -Lc %d/%i /proc/1/root 2>/dev/null)" ]; then echo "A chroot environment has been detected." echo "Remember this firmware needs kernel >= 2.6.25." unconditional=1 else echo "No chroot environment found. Starting normal installation" fi if [ -z "$unconditonal" ]; then # check kernel version if dpkg --compare-versions 2.6.25 gt `uname -r | cut -d- -f1`; then echo "Kernel too old. This firmware needs >= 2.6.25!." echo "Aborting!" exit 0 fi # install firmware unconditional if the corresponding debconf value is true # this is usefull for live-systems or similar systems that should work on # changing hardware db_get b43-fwcutter/install-unconditional if [ "$RET" = "true" ] ; then unconditional=1 fi fi # check chip pci=`lspci -n -d 14e4: | grep -o "14e4:[1234567890abcdef]\+"` || true if [ -z "$pci$unconditional" ]; then echo "No known supported Broadcom 802.11 chips found, not installing firmware." echo echo "Aborting." exit 0 fi if [ -n "$pci" ] ; then for device in $pci; do device_id=${device#14e4:} case $device_id in 4301 | 4325) legacy=1 ;; 4306 | 432[04]) chip=`lspci -n -d ${device}` if [ "${chip}" != "${chip%${device} (rev 03)}" ] ; then latest=1 else legacy=1 fi ;; 4307 | 431[59] | 432[1289bc] | 4331 | 435[03789] | 43a[9a] | 4716 | a8d8 | a8db | 5354) latest=1 ;; 431[12]) classic=1 ;; 4318) chip=`lspci -n -d ${device}` if [ "${chip}" != "${chip%${device} (rev 02)}" ] ; then classic=1 else latest=1 fi ;; 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 fi if [ -n "$unconditonal" ]; then if [ -z "$latest$classic" ]; then # default latest firmware if unconditional latest=1 fi install_firmware exit 0 fi if [ -n "$unsupported" ]; then echo -n "Unsupported device(s) found: PCI id " for device_id in $unsupported; do echo -n " * 14e4:$device_id "; done echo 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$classic" ]; then echo "A card known to work was found. Trying to install firmware." install_firmware elif [ -n "$nottested" ]; then echo "An untested card was found. Please install the driver manually." fi #DEBHELPER#
--- firmware-b43-installer.postinst_org 2020-04-11 11:42:37.000000000 +0200 +++ firmware-b43-installer.postinst 2020-04-29 15:35:39.477170391 +0200 @@ -3,21 +3,28 @@ ######################################################################### -VERSION="6.30.163.46" - -BROADCOM_WL="broadcom-wl-${VERSION}" - -WL_APSTA="${BROADCOM_WL}.wl_apsta.o" +make_env() +{ +if [ -n "$latest" ]; then + VERSION="6.30.163.46" + BROADCOM_WL="broadcom-wl-${VERSION}" + WL_APSTA="${BROADCOM_WL}.wl_apsta.o" + SHA512SUM="0144894fbbb5e8ebab6c423d9bd0f3249be94f2f468a50b8bf721a3b17f1f6e57467c79e87abc8d136bfc92e701ed046885fead892e9a73efa5217d710311ae9" +else + VERSION="5.100.138" + BROADCOM_WL="broadcom-wl-${VERSION}" + WL_APSTA="${BROADCOM_WL}/linux/wl_apsta.o" + SHA512SUM="02487e76e3eca7fe97ce2ad7dc9c5d39fac82b8d5f7786cce047f9c85e2426f5b7ea085d84c7d4aae43e0fe348d603e3229211bab601726794ef633441d37a8b" +fi DOWNLOAD="${BROADCOM_WL}.tar.bz2" URL="https://www.lwfinger.com/b43-firmware/${DOWNLOAD}" -SHA512SUM="0144894fbbb5e8ebab6c423d9bd0f3249be94f2f468a50b8bf721a3b17f1f6e57467c79e87abc8d136bfc92e701ed046885fead892e9a73efa5217d710311ae9" - FIRMWARE_INSTALL_DIR="/lib/firmware" B43="b43" +} ######################################################################### # stable sections below, not updated for firmware updates # @@ -25,8 +32,10 @@ . /usr/share/debconf/confmodule -latest_firmware () +install_firmware () { +make_env + tmp=$(mktemp -q -d) cd $tmp @@ -100,15 +109,13 @@ then echo "A chroot environment has been detected." echo "Remember this firmware needs kernel >= 2.6.25." - latest_firmware - exit 0 + unconditional=1 else echo "No chroot environment found. Starting normal installation" fi - - +if [ -z "$unconditonal" ]; then # check kernel version if dpkg --compare-versions 2.6.25 gt `uname -r | cut -d- -f1`; then echo "Kernel too old. This firmware needs >= 2.6.25!." @@ -121,27 +128,28 @@ # changing hardware db_get b43-fwcutter/install-unconditional if [ "$RET" = "true" ] ; then - latest_firmware - exit 0 + unconditional=1 +fi fi # check chip pci=`lspci -n -d 14e4: | grep -o "14e4:[1234567890abcdef]\+"` || true -if [ -z "$pci" ]; then +if [ -z "$pci$unconditional" ]; then echo "No known supported Broadcom 802.11 chips found, not installing firmware." echo echo "Aborting." exit 0 fi +if [ -n "$pci" ] ; then for device in $pci; do device_id=${device#14e4:} case $device_id in - 430[16] | 4325) + 4301 | 4325) legacy=1 ;; - 432[04]) + 4306 | 432[04]) chip=`lspci -n -d ${device}` if [ "${chip}" != "${chip%${device} (rev 03)}" ] ; then latest=1 @@ -149,9 +157,20 @@ legacy=1 fi ;; - 4307 | 431[12589] | 432[1289bc] | 4331 | 435[03789] | 43a[9a] | 4716 | a8d8 | a8db | 5354) + 4307 | 431[59] | 432[1289bc] | 4331 | 435[03789] | 43a[9a] | 4716 | a8d8 | a8db | 5354) latest=1 ;; + 431[12]) + classic=1 + ;; + 4318) + chip=`lspci -n -d ${device}` + if [ "${chip}" != "${chip%${device} (rev 02)}" ] ; then + classic=1 + else + latest=1 + fi + ;; 4322 | 4358 | 436[05] | 43a0 | 43b1 | 4727) unsupported="$unsupported $device_id" ;; @@ -166,6 +185,16 @@ ;; esac done +fi + +if [ -n "$unconditonal" ]; then + if [ -z "$latest$classic" ]; then + # default latest firmware if unconditional + latest=1 + fi + install_firmware + exit 0 +fi if [ -n "$unsupported" ]; then echo -n "Unsupported device(s) found: PCI id " @@ -177,9 +206,9 @@ echo "Please install b43legacy firmware (firmware-b43legacy-installer package)." echo fi -if [ -n "$latest" ]; then +if [ -n "$latest$classic" ]; then echo "A card known to work was found. Trying to install firmware." - latest_firmware + install_firmware elif [ -n "$nottested" ]; then echo "An untested card was found. Please install the driver manually." fi