jobcore/linux-firmware/PKGBUILD
2024-05-13 15:32:51 +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=20240410
pkgver=20240409.1addd7dc
pkgrel=02
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=(60e129b4b0deecc59542487bbff6afde580db47333a01ea34e51421f3b962fc2) # linux-firmware
## 61e037e4d6b81a53edb76aef8c396f259681799c01f20c2c848c713db9d437a0 amd-ucode-20240409.1addd7dc-02-x86_64.pkg.tar.lz
## 13e075724a970b490501d45af4bc262a0f0084a479cd7217304f161376f580ed linux-firmware-20240409.1addd7dc-02-x86_64.pkg.tar.lz
## 63697c0ece58ef68bfa4481dbd1d23c43234551d849e835f2c741f06ac6346c0 linux-firmware-bnx2x-20240409.1addd7dc-02-x86_64.pkg.tar.lz
## 6f50a2f379e8af0da2da288b92d6e0bb1a99a04de6fb8c8a045796b60e1dce26 linux-firmware-liquidio-20240409.1addd7dc-02-x86_64.pkg.tar.lz
## ba6e812cc7da27602b52e160e52164d880527d40e035bf0294f029574f676cac linux-firmware-marvell-20240409.1addd7dc-02-x86_64.pkg.tar.lz
## a506b25660d562c86d597c1fee704181188389feb2d8288a14ff63d8f9f53259 linux-firmware-mellanox-20240409.1addd7dc-02-x86_64.pkg.tar.lz
## 3729ba1c065d7335d1de768f62ea7cc7f4478a65d3993fb424eb1e3fe67e087a linux-firmware-nfp-20240409.1addd7dc-02-x86_64.pkg.tar.lz
## b5ec9fb02b73b8ccc85172f89fab2bc6b59175e1514b1d0ba054d45229260331 linux-firmware-qcom-20240409.1addd7dc-02-x86_64.pkg.tar.lz
## 1d425abeba4cacb2464b48206d4aff55ea6533a9b200306e7a68d2346f1114d5 linux-firmware-qlogic-20240409.1addd7dc-02-x86_64.pkg.tar.lz
## deaef3f5381332fb4fd2cc1f28243d5b4e8f00bc1a00ce84201b0ca495c2eb12 linux-firmware-whence-20240409.1addd7dc-02-x86_64.pkg.tar.lz