archrelease: copy trunk to extra-x86_64
[arch-packages.git] / linux-firmware / repos / core-any / PKGBUILD
blobb7ccaca913b58551607377de60cb45f2e2d683b2
1 # Maintainer: Thomas Bächler <thomas@archlinux.org>
3 pkgbase=linux-firmware
4 pkgname=(linux-firmware-whence linux-firmware amd-ucode
5          linux-firmware-{nfp,mellanox,marvell,qcom,liquidio,qlogic,bnx2x}
7 _tag=20230404
8 pkgver=20230404.2e92a49f
9 pkgrel=1
10 pkgdesc="Firmware files for Linux"
11 url="https://git.kernel.org/?p=linux/kernel/git/firmware/linux-firmware.git;a=summary"
12 license=('GPL2' 'GPL3' 'custom')
13 arch=('any')
14 makedepends=('git')
15 options=(!strip)
16 source=("git+https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git#tag=${_tag}?signed"
17          0001-Add-support-for-compressing-firmware-in-copy-firmware.patch)
18 sha256sums=('SKIP'
19             'aa11b2eed9c0be42571b45eb7153908a43290f02a5fc715aefcaa81030a1832f')
20 validpgpkeys=('4CDE8575E547BF835FE15807A31B6BD72486CFD6') # Josh Boyer <jwboyer@fedoraproject.org>
22 _backports=(
25 prepare() {
26   cd ${pkgbase}
28   local _c
29   for _c in "${_backports[@]}"; do
30     git log --oneline -1 "${_c}"
31     git cherry-pick -n "${_c}"
32   done
34   # add firmware compression support - patch taken from Fedora
35   patch -Np1 -i ../0001-Add-support-for-compressing-firmware-in-copy-firmware.patch
38 pkgver() {
39   cd ${pkgbase}
41   # Commit date + short rev
42   echo $(TZ=UTC git show -s --pretty=%cd --date=format-local:%Y%m%d HEAD).$(git rev-parse --short HEAD)
45 build() {
46   mkdir -p kernel/x86/microcode
47   cat ${pkgbase}/amd-ucode/microcode_amd*.bin > kernel/x86/microcode/AuthenticAMD.bin
49   # Reproducibility: set the timestamp on the bin file
50   if [[ -n ${SOURCE_DATE_EPOCH} ]]; then
51     touch -d @${SOURCE_DATE_EPOCH} kernel/x86/microcode/AuthenticAMD.bin
52   fi
54   # Reproducibility: strip the inode and device numbers from the cpio archive
55   echo kernel/x86/microcode/AuthenticAMD.bin |
56     bsdtar --uid 0 --gid 0 -cnf - -T - |
57     bsdtar --null -cf - --format=newc @- > amd-ucode.img
60 _pick() {
61   local p="$1" f d; shift
62   for f; do
63     d="$srcdir/$p/${f#$pkgdir/}"
64     mkdir -p "$(dirname "$d")"
65     mv "$f" "$d"
66     rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")"
67   done
70 package_linux-firmware-whence() {
71   pkgdesc+=" - contains the WHENCE license file which documents the vendor license details"
73   install -Dt "${pkgdir}/usr/share/licenses/${pkgname}" -m644 ${pkgbase}/WHENCE
76 package_linux-firmware() {
77   depends=('linux-firmware-whence')
79   cd ${pkgbase}
81   make DESTDIR="${pkgdir}" FIRMWAREDIR=/usr/lib/firmware installcompress
83   # Trigger a microcode reload for configurations not using early updates
84   echo 'w /sys/devices/system/cpu/microcode/reload - - - - 1' |
85     install -Dm644 /dev/stdin "${pkgdir}/usr/lib/tmpfiles.d/${pkgname}.conf"
87   install -Dt "${pkgdir}/usr/share/licenses/${pkgname}" -m644 LICEN*
89   # split
90   cd "${pkgdir}"
92   _pick linux-firmware-nfp usr/lib/firmware/netronome
93   _pick linux-firmware-nfp usr/share/licenses/${pkgname}/LICENCE.Netronome
95   _pick linux-firmware-mellanox usr/lib/firmware/mellanox
97   _pick linux-firmware-marvell usr/lib/firmware/{libertas,mwl8k,mwlwifi,mrvl}
98   _pick linux-firmware-marvell usr/share/licenses/${pkgname}/LICENCE.{Marvell,NXP}
100   _pick linux-firmware-qcom usr/lib/firmware/{qcom,a300_*}
101   _pick linux-firmware-qcom usr/share/licenses/${pkgname}/LICENSE.qcom*
103   _pick linux-firmware-liquidio usr/lib/firmware/liquidio
104   _pick linux-firmware-liquidio usr/share/licenses/${pkgname}/LICENCE.cavium_liquidio
106   _pick linux-firmware-qlogic usr/lib/firmware/{qlogic,qed,ql2???_*,c{b,t,t2}fw-*}
107   _pick linux-firmware-qlogic usr/share/licenses/${pkgname}/LICENCE.{qla1280,qla2xxx}
109   _pick linux-firmware-bnx2x usr/lib/firmware/bnx2x*
112 package_amd-ucode() {
113   pkgdesc="Microcode update image for AMD CPUs"
114   license=(custom)
116   install -Dt "${pkgdir}/boot" -m644 amd-ucode.img
118   install -Dt "${pkgdir}/usr/share/licenses/${pkgname}" -m644 ${pkgbase}/LICENSE.amd-ucode
121 package_linux-firmware-nfp() {
122   pkgdesc+=" - nfp / Firmware for Netronome Flow Processors"
123   depends=('linux-firmware-whence')
125   mv -v linux-firmware-nfp/* "${pkgdir}"
128 package_linux-firmware-mellanox() {
129   pkgdesc+=" - mellanox / Firmware for Mellanox Spectrum switches"
130   depends=('linux-firmware-whence')
132   mv -v linux-firmware-mellanox/* "${pkgdir}"
135 package_linux-firmware-marvell() {
136   pkgdesc+=" - marvell / Firmware for Marvell devices"
137   depends=('linux-firmware-whence')
138   
139   mv -v linux-firmware-marvell/* "${pkgdir}"
140   # remove arm64 firmware #76583
141   rm "${pkgdir}"/usr/lib/firmware/mrvl/prestera/mvsw_prestera_fw_arm64-v4.1.img.xz
144 package_linux-firmware-qcom() {
145   pkgdesc+=" - qcom / Firmware for Qualcomm SoCs"
146   depends=('linux-firmware-whence')
148   mv -v linux-firmware-qcom/* "${pkgdir}"
151 package_linux-firmware-liquidio() {
152   pkgdesc+=" - liquidio / Firmware for Cavium LiquidIO server adapters"
153   depends=('linux-firmware-whence')
155   mv -v linux-firmware-liquidio/* "${pkgdir}"
158 package_linux-firmware-qlogic() {
159   pkgdesc+=" - qlogic / Firmware for QLogic devices"
160   depends=('linux-firmware-whence')
162   mv -v linux-firmware-qlogic/* "${pkgdir}"
165 package_linux-firmware-bnx2x() {
166   pkgdesc+=" - bnx2x / Firmware for Broadcom NetXtreme II 10Gb ethernet adapters"
167   depends=('linux-firmware-whence')
169   mv -v linux-firmware-bnx2x/* "${pkgdir}"
172 # vim:set sw=2 et: