jobcore/linux-firmware/PKGBUILD
2024-07-16 12:21:34 +03:00

200 lines
6.9 KiB
Bash

#!/usr/bin/bash
# JOBoRun : Jwm OpenBox Obarun RUNit
# Maintainer : Joe Bo Run <joborun@disroot.org>
# PkgSource : url="https://gittea.disroot.org/joborun-pkg/jobcore/$pkgname"
# Website : https://pozol.eu
#-----------------------------------------| DESCRIPTION |---------------------------------------
pkgbase=linux-firmware
pkgname=(linux-firmware-whence linux-firmware amd-ucode
linux-firmware-{nfp,mellanox,marvell,qcom,liquidio,qlogic,bnx2x})
_tag=20240709
pkgver=20240703.e94a2a3b
pkgrel=01
pkgdesc="Firmware files for Linux"
#url="https://git.kernel.org/?p=linux/kernel/git/firmware/linux-firmware.git;a=summary"
url="https://gitlab.com/kernel-firmware/linux-firmware"
makedepends=(git rdfind)
options=(!strip)
#source=("git+https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git#tag=${_tag}?signed")
source=("git+$url.git?signed#tag=${_tag}")
#_backports=(
# f2eb058afc57348cde66852272d6bf11da1eef8f # fixes for "inception": https://www.amd.com/en/resources/product-security/bulletin/amd-sb-7005.html
#)
prepare() {
cd ${pkgbase}
local _c
for _c in "${_backports[@]}"; do
git log --oneline -1 "${_c}"
git cherry-pick -n "${_c}"
done
}
pkgver() {
cd ${pkgbase}
# Commit date + short rev
echo $(TZ=UTC git show -s --pretty=%cd --date=format-local:%Y%m%d HEAD).$(git rev-parse --short HEAD)
}
build() {
mkdir -p kernel/x86/microcode
cat ${pkgbase}/amd-ucode/microcode_amd*.bin > kernel/x86/microcode/AuthenticAMD.bin
# Reproducibility: set the timestamp on the bin file
if [[ -n ${SOURCE_DATE_EPOCH} ]]; then
touch -d @${SOURCE_DATE_EPOCH} kernel/x86/microcode/AuthenticAMD.bin
fi
# Reproducibility: strip the inode and device numbers from the cpio archive
echo kernel/x86/microcode/AuthenticAMD.bin |
bsdtar --uid 0 --gid 0 -cnf - -T - |
bsdtar --null -cf - --format=newc @- > amd-ucode.img
}
_pick() {
local p="$1" f d; shift
for f; do
d="$srcdir/$p/${f#$pkgdir/}"
mkdir -p "$(dirname "$d")"
mv "$f" "$d"
rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")"
done
}
package_linux-firmware-whence() {
pkgdesc+=" - contains the WHENCE license file which documents the vendor license details"
install -Dt "${pkgdir}/usr/share/licenses/${pkgname}" -m644 ${pkgbase}/WHENCE
}
package_linux-firmware() {
depends=('linux-firmware-whence')
cd ${pkgbase}
## Avoid ZSTD wherever we can - xz will have to do
## ZSTD_CLEVEL=19 make DESTDIR="${pkgdir}" FIRMWAREDIR=/usr/lib/firmware install-zst
make DESTDIR="${pkgdir}" FIRMWAREDIR=/usr/lib/firmware install-xz
# useless (FS#46591)
# Trigger a microcode reload for configurations not using early updates
#echo 'w /sys/devices/system/cpu/microcode/reload - - - - 1' |
# install -Dm644 /dev/stdin "${pkgdir}/usr/lib/tmpfiles.d/${pkgname}.conf"
install -Dt "${pkgdir}/usr/share/licenses/${pkgname}" -m644 LICEN*
cd "${pkgdir}"
# remove arm64 firmware https://bugs.archlinux.org/task/76583
# it is .xz not zst
rm usr/lib/firmware/mrvl/prestera/mvsw_prestera_fw_arm64-v4.1.img.xz
# split
_pick amd-ucode usr/lib/firmware/amd-ucode
_pick linux-firmware-nfp usr/lib/firmware/netronome
_pick linux-firmware-nfp usr/share/licenses/${pkgname}/LICENCE.Netronome
_pick linux-firmware-mellanox usr/lib/firmware/mellanox
_pick linux-firmware-marvell usr/lib/firmware/{libertas,mwl8k,mwlwifi,mrvl}
_pick linux-firmware-marvell usr/share/licenses/${pkgname}/LICENCE.{Marvell,NXP}
_pick linux-firmware-qcom usr/lib/firmware/{qcom,a300_*}
_pick linux-firmware-qcom usr/share/licenses/${pkgname}/LICENSE.qcom*
_pick linux-firmware-liquidio usr/lib/firmware/liquidio
_pick linux-firmware-liquidio usr/share/licenses/${pkgname}/LICENCE.cavium_liquidio
_pick linux-firmware-qlogic usr/lib/firmware/{qlogic,qed,ql2???_*,c{b,t,t2}fw-*}
_pick linux-firmware-qlogic usr/share/licenses/${pkgname}/LICENCE.{qla1280,qla2xxx}
_pick linux-firmware-bnx2x usr/lib/firmware/bnx2x*
}
package_amd-ucode() {
pkgdesc="Microcode update image for AMD CPUs"
license=(custom)
mv -v $pkgname/* "$pkgdir"
install -Dt "${pkgdir}/boot" -m644 amd-ucode.img
install -Dt "${pkgdir}/usr/share/licenses/${pkgname}" -m644 ${pkgbase}/LICENSE.amd-ucode
}
package_linux-firmware-nfp() {
pkgdesc+=" - nfp / Firmware for Netronome Flow Processors"
depends=('linux-firmware-whence')
mv -v linux-firmware-nfp/* "${pkgdir}"
}
package_linux-firmware-mellanox() {
pkgdesc+=" - mellanox / Firmware for Mellanox Spectrum switches"
depends=('linux-firmware-whence')
mv -v linux-firmware-mellanox/* "${pkgdir}"
}
package_linux-firmware-marvell() {
pkgdesc+=" - marvell / Firmware for Marvell devices"
depends=('linux-firmware-whence')
mv -v linux-firmware-marvell/* "${pkgdir}"
}
package_linux-firmware-qcom() {
pkgdesc+=" - qcom / Firmware for Qualcomm SoCs"
depends=('linux-firmware-whence')
mv -v linux-firmware-qcom/* "${pkgdir}"
}
package_linux-firmware-liquidio() {
pkgdesc+=" - liquidio / Firmware for Cavium LiquidIO server adapters"
depends=('linux-firmware-whence')
mv -v linux-firmware-liquidio/* "${pkgdir}"
}
package_linux-firmware-qlogic() {
pkgdesc+=" - qlogic / Firmware for QLogic devices"
depends=('linux-firmware-whence')
mv -v linux-firmware-qlogic/* "${pkgdir}"
}
package_linux-firmware-bnx2x() {
pkgdesc+=" - bnx2x / Firmware for Broadcom NetXtreme II 10Gb ethernet adapters"
depends=('linux-firmware-whence')
mv -v linux-firmware-bnx2x/* "${pkgdir}"
}
#---- arch license gpg-key & sha256sums ----
arch=(x86_64)
license=('GPL2' 'GPL3' 'custom')
validpgpkeys=(4CDE8575E547BF835FE15807A31B6BD72486CFD6) # Josh Boyer <jwboyer@fedoraproject.org>
sha256sums=(5504403f513abdcee95756a15fb5a1ac13231e50c0dcadeeff54d5fcc0d330f5) # linux-firmware
## 41cc02b49bed856b9c1a3dd9d1619f256b1e73f6368113418dfe9305fe3c2df6 amd-ucode-20240703.e94a2a3b-01-x86_64.pkg.tar.lz
## 408edbde9eb78b9d3c426e6410d8eb35b9e78d7c9420f935f8df8d2f35e70c55 linux-firmware-20240703.e94a2a3b-01-x86_64.pkg.tar.lz
## ccaaa6b2d4ad711ccc4622105beac9850451650905555d1601431a2d75a64407 linux-firmware-bnx2x-20240703.e94a2a3b-01-x86_64.pkg.tar.lz
## cebbb922520f620093a4951fb47efc457bd7cc6ef828ecf4251305a984ddc031 linux-firmware-liquidio-20240703.e94a2a3b-01-x86_64.pkg.tar.lz
## 6d57e517fd7b4eb10e6acd0146d4ce11076a448a50ab3be4eee436a7ac59462d linux-firmware-marvell-20240703.e94a2a3b-01-x86_64.pkg.tar.lz
## b530abf286e78cd5b0924614340b9f0fcbfdbc18e93a614570f4deaba9c25850 linux-firmware-mellanox-20240703.e94a2a3b-01-x86_64.pkg.tar.lz
## 76eed15b6aaccdca22134183aaa524b0066dfa465b0c23019c1d599af8b43f18 linux-firmware-nfp-20240703.e94a2a3b-01-x86_64.pkg.tar.lz
## 69f3a2d74cd5eb5263fac2c9e81f35b1487c20c6bbddb5daf723677d2bc1adc8 linux-firmware-qcom-20240703.e94a2a3b-01-x86_64.pkg.tar.lz
## 640d243e8d82d730a922f7249236f523c3f0632e3e207bf52e2ea660ef1be2fd linux-firmware-qlogic-20240703.e94a2a3b-01-x86_64.pkg.tar.lz
## 29528a7be8ed08fd1b567a1840b345c9c42538d69861a740d12ad4e3d183f951 linux-firmware-whence-20240703.e94a2a3b-01-x86_64.pkg.tar.lz