PKGBUILDs/core/linux-firmware/PKGBUILD

174 lines
5.1 KiB
Bash
Raw Normal View History

2022-01-22 02:46:03 +00:00
# Maintainer: Thomas Bächler <thomas@archlinux.org>
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - don't compress firmware for kernels older than 5.3
pkgbase=linux-firmware
pkgname=(linux-firmware-whence linux-firmware amd-ucode
linux-firmware-{nfp,mellanox,marvell,qcom,liquidio,qlogic,bnx2x}
)
_tag=20221109
pkgver=20221109.60310c2
pkgrel=1
2022-01-22 02:46:03 +00:00
pkgdesc="Firmware files for Linux"
url="https://git.kernel.org/?p=linux/kernel/git/firmware/linux-firmware.git;a=summary"
license=('GPL2' 'GPL3' 'custom')
arch=('any')
makedepends=('git')
options=(!strip)
source=("git+https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git#tag=${_tag}?signed"
2022-01-22 02:46:03 +00:00
0001-Add-support-for-compressing-firmware-in-copy-firmware.patch)
sha256sums=('SKIP'
'aa11b2eed9c0be42571b45eb7153908a43290f02a5fc715aefcaa81030a1832f')
2022-01-22 02:46:03 +00:00
validpgpkeys=('4CDE8575E547BF835FE15807A31B6BD72486CFD6') # Josh Boyer <jwboyer@fedoraproject.org>
_backports=(
)
prepare() {
cd ${pkgbase}
local _c
for _c in "${_backports[@]}"; do
git log --oneline -1 "${_c}"
git cherry-pick -n "${_c}"
done
# add firmware compression support - patch taken from Fedora
patch -Np1 -i ../0001-Add-support-for-compressing-firmware-in-copy-firmware.patch
}
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
2022-01-22 02:46:03 +00:00
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
}
2022-01-22 02:46:03 +00:00
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
2022-01-22 02:46:03 +00:00
}
package_linux-firmware() {
depends=('linux-firmware-whence')
cd ${pkgbase}
2022-01-22 02:46:03 +00:00
make DESTDIR="${pkgdir}" FIRMWAREDIR=/usr/lib/firmware install
# 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*
# split
cd "${pkgdir}"
2022-01-22 02:46:03 +00:00
_pick linux-firmware-nfp usr/lib/firmware/netronome
_pick linux-firmware-nfp usr/share/licenses/${pkgname}/LICENCE.Netronome
2022-01-22 02:46:03 +00:00
_pick linux-firmware-mellanox usr/lib/firmware/mellanox
2022-01-22 02:46:03 +00:00
_pick linux-firmware-marvell usr/lib/firmware/{libertas,mwl8k,mwlwifi,mrvl}
_pick linux-firmware-marvell usr/share/licenses/${pkgname}/LICENCE.{Marvell,NXP}
2022-01-22 02:46:03 +00:00
_pick linux-firmware-qcom usr/lib/firmware/{qcom,a300_*}
_pick linux-firmware-qcom usr/share/licenses/${pkgname}/LICENSE.qcom
2022-01-22 02:46:03 +00:00
_pick linux-firmware-liquidio usr/lib/firmware/liquidio
_pick linux-firmware-liquidio usr/share/licenses/${pkgname}/LICENCE.cavium_liquidio
2022-01-22 02:46:03 +00:00
_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}
2022-01-22 02:46:03 +00:00
_pick linux-firmware-bnx2x usr/lib/firmware/bnx2x*
}
package_amd-ucode() {
pkgdesc="Microcode update image for AMD CPUs"
license=(custom)
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}"
}
# vim:set sw=2 et: