git » linux-firmware.git » commit d8bba92

split package to reduce download and install size from most use cases - FS#72559

author Andreas Radke
2022-01-19 22:11:54 UTC
committer Andreas Radke
2022-01-19 22:11:54 UTC
parent a0fbc05ed2d0dcc995ddcd37ccc1fb486f9f1336

split package to reduce download and install size from most use cases - FS#72559

PKGBUILD +96 -6

diff --git a/PKGBUILD b/PKGBUILD
index db8f5ad..a97ff10 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,11 +1,13 @@
 # Maintainer: Thomas Bächler <thomas@archlinux.org>
 
 pkgbase=linux-firmware
-pkgname=(linux-firmware amd-ucode)
-#_tag=2021216
+pkgname=(linux-firmware-whence linux-firmware amd-ucode
+         linux-firmware-{nfp,mellanox,marvell,qcom,liquidio,qlogic,bnx2x}
+)
+#_tag=20211216
 _commit=0c6a7b3bf728b95c8b7b95328f94335e2bb2c967
 pkgver=20220119.0c6a7b3
-pkgrel=1
+pkgrel=2
 pkgdesc="Firmware files for Linux"
 url="https://git.kernel.org/?p=linux/kernel/git/firmware/linux-firmware.git;a=summary"
 license=('GPL2' 'GPL3' 'custom')
@@ -21,8 +23,19 @@ validpgpkeys=('4CDE8575E547BF835FE15807A31B6BD72486CFD6') # Josh Boyer <jwboyer@
 _backports=(
 )
 
+
+_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
+}
+
 prepare() {
-  cd ${pkgname}
+  cd ${pkgbase}
 
   local _c
   for _c in "${_backports[@]}"; do
@@ -35,7 +48,7 @@ prepare() {
 }
 
 pkgver() {
-  cd ${pkgname}
+  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)
@@ -56,7 +69,14 @@ build() {
     bsdtar --null -cf - --format=newc @- > amd-ucode.img
 }
 
+package_linux-firmware-whence() {
+  cd "$pkgbase"
+  install -Dt "${pkgdir}/usr/share/licenses/${pkgname}" -m644 WHENCE
+}
+
 package_linux-firmware() {
+  depends=('linux-firmware-whence')
+  
   cd ${pkgname}
 
   make DESTDIR="${pkgdir}" FIRMWAREDIR=/usr/lib/firmware installcompress
@@ -65,7 +85,28 @@ package_linux-firmware() {
   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* WHENCE
+  install -Dt "${pkgdir}/usr/share/licenses/${pkgname}" -m644 LICEN*
+
+  # split
+  cd "$pkgdir"
+  _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() {
@@ -77,4 +118,53 @@ package_amd-ucode() {
   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: