# This is the recipe.sh script. It is executed by BPM in a temporary directory when compiling a source package # BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE # BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT build() { # Create temporary directory for firmware installation install -dm755 "$BPM_SOURCE"/temp # Install and compress firmware files ZSTD_CLEVEL=19 make -j1 install-zst FIRMWAREDIR=/usr/lib/firmware/ DESTDIR="$BPM_SOURCE"/temp make dedup FIRMWAREDIR=/usr/lib/firmware/ DESTDIR="$BPM_SOURCE"/temp } package_linux-firmware-whence() { # Install whence file install -Dm644 WHENCE "$BPM_OUTPUT"/usr/share/licenses/linux-firmware/WHENCE } # Function for packaging AMD CPU and GPU microcode package_linux-firmware-amd() { # Copy firmware files to amd package install -dm755 "$BPM_OUTPUT"/usr/lib/firmware/ mv temp/usr/lib/firmware/amd* "$BPM_OUTPUT"/usr/lib/firmware/ mv temp/usr/lib/firmware/radeon "$BPM_OUTPUT"/usr/lib/firmware/ # Install package licenses install -Dm644 LICENSE.amdgpu "$BPM_OUTPUT"/usr/share/licenses/linux-firmware/amd/LICENSE.amdgpu install -Dm644 LICENSE.amd-ucode "$BPM_OUTPUT"/usr/share/licenses/linux-firmware/amd/LICENSE.amd-ucode install -Dm644 LICENSE.radeon "$BPM_OUTPUT"/usr/share/licenses/linux-firmware/amd/LICENSE.radeon # Create dracut config for amd microcode install -dm755 "$BPM_OUTPUT"/usr/lib/dracut/dracut.conf.d echo "early_microcode=yes" >> "$BPM_OUTPUT"/usr/lib/dracut/dracut.conf.d/amd_ucode.conf } # Function for packaging Intel CPU and GPU microcode package_linux-firmware-intel() { # Copy firmware files to intel package install -dm755 "$BPM_OUTPUT"/usr/lib/firmware/ mv temp/usr/lib/firmware/i915 "$BPM_OUTPUT"/usr/lib/firmware/ # Install package license install -Dm644 LICENSE.i915 "$BPM_OUTPUT"/usr/share/licenses/linux-firmware/intel/LICENSE.i915 } # Function for packaging Nvidia GPU microcode package_linux-firmware-nvidia() { # Copy firmware files to nvidia package install -dm755 "$BPM_OUTPUT"/usr/lib/firmware/ mv temp/usr/lib/firmware/nvidia "$BPM_OUTPUT"/usr/lib/firmware/ # Install package license install -Dm644 LICENCE.nvidia "$BPM_OUTPUT"/usr/share/licenses/linux-firmware/nvidia/LICENSE.nvidia } package_linux-firmware-broadcom() { # Copy firmware files to broadcom packages install -dm755 "$BPM_OUTPUT"/usr/lib/firmware/ mv temp/usr/lib/firmware/brcm "$BPM_OUTPUT"/usr/lib/firmware/ mv temp/usr/lib/firmware/cypress "$BPM_OUTPUT"/usr/lib/firmware/ # Install package licenses install -Dm644 LICENCE.{broadcom_bcm43xx,cypress} -t "$BPM_OUTPUT"/usr/share/licenses/linux-firmware/broadcom/ } package_linux-firmware-network() { _dirs=( # Airoha Ethernet PHY airoha # Amlogic bluetooth "amlogic/aml_w*_bt_uart.bin*" # Atheros WLAN/bluetooth "ath*" "ar*" "carl9170*" "htc*" # Atmel WLAN atmel # ATUSB transceiver atusb # BNX2 Ethernet "bnx2*" # Sun Cassini Ethernet "sun/cassini*" # Chelsio Ethernet "cxgb*" # ST-E WLAN "wsm_22.bin*" # Intel WLAN/Ethernet/bluetooth e100 "hfi1_*.fw*" "intel*" "iwlwifi*" # Orinoco WLAN "agere*" # IXP4xx ixp4xx # KL5KUSB101 Ethernet kaweth # Cavium LiquidIO NIC liquidio # Mediatek WLAN/bluetooth "mt7*.bin*" # Mellanox ethernet mellanox # Marvell WLAN/bluetooth mrvl "lbtf_usb.bin*" libertas mwl8k # Multi-Tech modem "mts_*.fw*" # Myricom ethernet "myri10ge*" myricom # NXP UWB/bluetooth "nxp/sr150_fw.bin*" "nxp/helper_uart*.bin*" "nxp/uartiw*.bin*" "nxp/uartspi*.se*" "nxp/uartuart*" # Qualcomm WLAN/bluetooth qca "wil6210*" # QLogic HBA "cbfw*.bin*" "ct2fw*.bin*" "ctfw*.bin*" "qed" "ql2*.bin*" "qlogic" "phanfw.bin*" # Ralink WLAN "rt*.bin*" # Redpine WLAN/bluetooth "rsi*" # Realtek bluetooth/ethernet/WLAN "rtl*" "rtw*" # Sagrad WLAN "sdd_sagrad_*.bin*" # Slicoss NICs slicoss # Adaptec ethernet "adaptec/starfire*" # Tehuti NICs tehuti # TI WLAN/bluetooth ti-connectivity # Tigon ethernet acenic tigon # 3Com ethernet 3com # Eagle USB modem ueagle-atm # Via USB WLAN "vntwusb.fw*" # Microchip Ethernet "microchip/mscc_vsc85*.bin*" # Exar Ethernet vxge # SiLabs WLAN wfx ) install -dm755 "$BPM_OUTPUT"/usr/lib/firmware/ for _dir in "${_dirs[@]}"; do mv temp/usr/lib/firmware/${_dir} "$BPM_OUTPUT"/usr/lib/firmware/ done # Move mediatek directory contents except for SoC firmware install -dm755 "$BPM_OUTPUT"/usr/lib/firmware/mediatek/ for file in $(find temp/usr/lib/firmware/mediatek/ -maxdepth 1 -mindepth 1 ! \( -name 'mt7981*' -o -name 'mt7986*' -o -name 'mt81*' -o -name 'sof*' \)); do mv $file -t "$BPM_OUTPUT"/usr/lib/firmware/mediatek/ done #mv /!(mt7981*|mt7986*|mt81*|sof*) "$BPM_OUTPUT"/usr/lib/firmware/ }