* [gentoo-commits] repo/gentoo:master commit in: sys-kernel/linux-firmware/files/, sys-kernel/linux-firmware/
@ 2023-11-26 15:13 Mike Pagano
0 siblings, 0 replies; 11+ messages in thread
From: Mike Pagano @ 2023-11-26 15:13 UTC (permalink / raw
To: gentoo-commits
commit: c7898633e0c2811881fc0fdde6b93e26f2277e8d
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 26 15:12:29 2023 +0000
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Sun Nov 26 15:12:29 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c7898633
sys-kernel/linux-firmware: upd EAPI 7 -> 8, add dedup optional logic
Move upstream's deduplication part of their script,
which requires rdfind, behind a new use flag: deduplicate
Patch will remove the deduplication part of the script based on
use flag.
Add info on deduplicate use flag
Thanks to Sam for the review
Bug: https://bugs.gentoo.org/917324
Closes: https://github.com/gentoo/gentoo/pull/33988
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
.../linux-firmware-remove-rdfind-dep-and-use.patch | 34 ++
.../linux-firmware-20231111-r1.ebuild | 408 +++++++++++++++++++++
sys-kernel/linux-firmware/metadata.xml | 1 +
3 files changed, 443 insertions(+)
diff --git a/sys-kernel/linux-firmware/files/linux-firmware-remove-rdfind-dep-and-use.patch b/sys-kernel/linux-firmware/files/linux-firmware-remove-rdfind-dep-and-use.patch
new file mode 100644
index 000000000000..83646a073224
--- /dev/null
+++ b/sys-kernel/linux-firmware/files/linux-firmware-remove-rdfind-dep-and-use.patch
@@ -0,0 +1,34 @@
+--- a/copy-firmware.sh 2023-11-25 18:07:49.362441380 -0500
++++ b/copy-firmware.sh 2023-11-25 18:19:03.612907595 -0500
+@@ -69,7 +69,7 @@ if [ -z "$destdir" ]; then
+ exit 1
+ fi
+
+-if ! which rdfind 2>/dev/null >/dev/null; then
++if [ -n "$LINUX_FIRMWARE_DO_DEDUPE" ] && ! which rdfind 2>/dev/null >/dev/null; then
+ echo "ERROR: rdfind is not installed"
+ exit 1
+ fi
+@@ -87,13 +87,15 @@ grep -E '^(RawFile|File):' WHENCE | sed
+ fi
+ done
+
+-$verbose "Finding duplicate files"
+-rdfind -makesymlinks true -makeresultsfile false "$destdir" >/dev/null
+-find "$destdir" -type l | while read -r l; do
+- target="$(realpath "$l")"
+- $verbose "Correcting path for $l"
+- ln -fs "$(realpath --relative-to="$(dirname "$(realpath -s "$l")")" "$target")" "$l"
+-done
++if [ -n "$LINUX_FIRMWARE_DO_DEDUPE" ]; then
++ $verbose "Finding duplicate files"
++ rdfind -makesymlinks true -makeresultsfile false "$destdir" >/dev/null
++ find "$destdir" -type l | while read -r l; do
++ target="$(realpath "$l")"
++ $verbose "Correcting path for $l"
++ ln -fs "$(realpath --relative-to="$(dirname "$(realpath -s "$l")")" "$target")" "$l"
++ done
++fi
+
+ # shellcheck disable=SC2162 # file/folder name can include escaped symbols
+ grep -E '^Link:' WHENCE | sed -e 's/^Link: *//g;s/-> //g' | while read f d; do
diff --git a/sys-kernel/linux-firmware/linux-firmware-20231111-r1.ebuild b/sys-kernel/linux-firmware/linux-firmware-20231111-r1.ebuild
new file mode 100644
index 000000000000..c938d07c0ddb
--- /dev/null
+++ b/sys-kernel/linux-firmware/linux-firmware-20231111-r1.ebuild
@@ -0,0 +1,408 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+inherit linux-info mount-boot savedconfig multiprocessing
+
+# In case this is a real snapshot, fill in commit below.
+# For normal, tagged releases, leave blank
+MY_COMMIT=""
+
+if [[ ${PV} == 99999999* ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/${PN}.git"
+else
+ if [[ -n "${MY_COMMIT}" ]]; then
+ SRC_URI="https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/snapshot/${MY_COMMIT}.tar.gz -> ${P}.tar.gz"
+ S="${WORKDIR}/${MY_COMMIT}"
+ else
+ SRC_URI="https://mirrors.edge.kernel.org/pub/linux/kernel/firmware/${P}.tar.xz"
+ fi
+
+ KEYWORDS="~amd64 ~arm ~arm64 ~riscv ~sparc ~x86"
+fi
+
+DESCRIPTION="Linux firmware files"
+HOMEPAGE="https://git.kernel.org/?p=linux/kernel/git/firmware/linux-firmware.git"
+
+LICENSE="GPL-2 GPL-2+ GPL-3 BSD MIT || ( MPL-1.1 GPL-2 )
+ redistributable? ( linux-fw-redistributable BSD-2 BSD BSD-4 ISC MIT )
+ unknown-license? ( all-rights-reserved )"
+SLOT="0"
+IUSE="compress-xz compress-zstd deduplicate initramfs +redistributable savedconfig unknown-license"
+REQUIRED_USE="initramfs? ( redistributable )
+ ?? ( compress-xz compress-zstd )
+ savedconfig? ( !deduplicate )"
+
+RESTRICT="binchecks strip test
+ unknown-license? ( bindist )"
+
+BDEPEND="initramfs? ( app-arch/cpio )
+ compress-xz? ( app-arch/xz-utils )
+ compress-zstd? ( app-arch/zstd )
+ deduplicate? ( app-misc/rdfind )"
+
+#add anything else that collides to this
+RDEPEND="!savedconfig? (
+ redistributable? (
+ !sys-firmware/alsa-firmware[alsa_cards_ca0132]
+ !sys-block/qla-fc-firmware
+ !sys-firmware/iwl1000-ucode
+ !sys-firmware/iwl6005-ucode
+ !sys-firmware/iwl6030-ucode
+ !sys-firmware/iwl3160-ucode
+ !sys-firmware/iwl7260-ucode
+ !sys-firmware/iwl3160-7260-bt-ucode
+ !sys-firmware/raspberrypi-wifi-ucode
+ )
+ unknown-license? (
+ !sys-firmware/alsa-firmware[alsa_cards_korg1212]
+ !sys-firmware/alsa-firmware[alsa_cards_maestro3]
+ !sys-firmware/alsa-firmware[alsa_cards_sb16]
+ !sys-firmware/alsa-firmware[alsa_cards_ymfpci]
+ )
+ )"
+
+QA_PREBUILT="*"
+PATCHES=( "${FILESDIR}/${PN}-remove-rdfind-dep-and-use.patch" )
+
+pkg_setup() {
+ if use compress-xz || use compress-zstd ; then
+ local CONFIG_CHECK
+
+ if kernel_is -ge 5 19; then
+ use compress-xz && CONFIG_CHECK="~FW_LOADER_COMPRESS_XZ"
+ use compress-zstd && CONFIG_CHECK="~FW_LOADER_COMPRESS_ZSTD"
+ else
+ use compress-xz && CONFIG_CHECK="~FW_LOADER_COMPRESS"
+ if use compress-zstd; then
+ eerror "Kernels <5.19 do not support ZSTD-compressed firmware files"
+ fi
+ fi
+ linux-info_pkg_setup
+ fi
+}
+
+pkg_pretend() {
+ use initramfs && mount-boot_pkg_pretend
+}
+
+src_unpack() {
+ if [[ ${PV} == 99999999* ]]; then
+ git-r3_src_unpack
+ else
+ default
+ # rename directory from git snapshot tarball
+ if [[ ${#GIT_COMMIT} -gt 8 ]]; then
+ mv ${PN}-*/ ${P} || die
+ fi
+ fi
+}
+
+src_prepare() {
+
+ use deduplicate && export LINUX_FIRMWARE_DO_DEDUPE=1
+ default
+
+ find . -type f -not -perm 0644 -print0 \
+ | xargs --null --no-run-if-empty chmod 0644 \
+ || die
+
+ chmod +x copy-firmware.sh || die
+
+ if use initramfs; then
+ if [[ -d "${S}/amd-ucode" ]]; then
+ local UCODETMP="${T}/ucode_tmp"
+ local UCODEDIR="${UCODETMP}/kernel/x86/microcode"
+ mkdir -p "${UCODEDIR}" || die
+ echo 1 > "${UCODETMP}/early_cpio"
+
+ local amd_ucode_file="${UCODEDIR}/AuthenticAMD.bin"
+ cat "${S}"/amd-ucode/*.bin > "${amd_ucode_file}" || die "Failed to concat amd cpu ucode"
+
+ if [[ ! -s "${amd_ucode_file}" ]]; then
+ die "Sanity check failed: '${amd_ucode_file}' is empty!"
+ fi
+
+ pushd "${UCODETMP}" &>/dev/null || die
+ find . -print0 | cpio --quiet --null -o -H newc -R 0:0 > "${S}"/amd-uc.img
+ popd &>/dev/null || die
+ if [[ ! -s "${S}/amd-uc.img" ]]; then
+ die "Failed to create '${S}/amd-uc.img'!"
+ fi
+ else
+ # If this will ever happen something has changed which
+ # must be reviewed
+ die "'${S}/amd-ucode' not found!"
+ fi
+ fi
+
+ # whitelist of misc files
+ local misc_files=(
+ copy-firmware.sh
+ WHENCE
+ README
+ )
+
+ # whitelist of images with a free software license
+ local free_software=(
+ # keyspan_pda (GPL-2+)
+ keyspan_pda/keyspan_pda.fw
+ keyspan_pda/xircom_pgs.fw
+ # dsp56k (GPL-2+)
+ dsp56k/bootstrap.bin
+ # ath9k_htc (BSD GPL-2+ MIT)
+ ath9k_htc/htc_7010-1.4.0.fw
+ ath9k_htc/htc_9271-1.4.0.fw
+ # pcnet_cs, 3c589_cs, 3c574_cs, serial_cs (dual GPL-2/MPL-1.1)
+ cis/LA-PCM.cis
+ cis/PCMLM28.cis
+ cis/DP83903.cis
+ cis/NE2K.cis
+ cis/tamarack.cis
+ cis/PE-200.cis
+ cis/PE520.cis
+ cis/3CXEM556.cis
+ cis/3CCFEM556.cis
+ cis/MT5634ZLX.cis
+ cis/RS-COM-2P.cis
+ cis/COMpad2.cis
+ cis/COMpad4.cis
+ # serial_cs (GPL-3)
+ cis/SW_555_SER.cis
+ cis/SW_7xx_SER.cis
+ cis/SW_8xx_SER.cis
+ # dvb-ttpci (GPL-2+)
+ av7110/bootcode.bin
+ # usbdux, usbduxfast, usbduxsigma (GPL-2+)
+ usbdux_firmware.bin
+ usbduxfast_firmware.bin
+ usbduxsigma_firmware.bin
+ # brcmfmac (GPL-2+)
+ brcm/brcmfmac4330-sdio.Prowise-PT301.txt
+ brcm/brcmfmac43340-sdio.meegopad-t08.txt
+ brcm/brcmfmac43362-sdio.cubietech,cubietruck.txt
+ brcm/brcmfmac43362-sdio.lemaker,bananapro.txt
+ brcm/brcmfmac43430a0-sdio.jumper-ezpad-mini3.txt
+ "brcm/brcmfmac43430a0-sdio.ONDA-V80 PLUS.txt"
+ brcm/brcmfmac43430-sdio.AP6212.txt
+ brcm/brcmfmac43430-sdio.Hampoo-D2D3_Vi8A1.txt
+ brcm/brcmfmac43430-sdio.MUR1DX.txt
+ brcm/brcmfmac43430-sdio.raspberrypi,3-model-b.txt
+ brcm/brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt
+ brcm/brcmfmac4356-pcie.gpd-win-pocket.txt
+ # isci (GPL-2)
+ isci/isci_firmware.bin
+ # carl9170 (GPL-2+)
+ carl9170-1.fw
+ # atusb (GPL-2+)
+ atusb/atusb-0.2.dfu
+ atusb/atusb-0.3.dfu
+ atusb/rzusb-0.3.bin
+ # mlxsw_spectrum (dual BSD/GPL-2)
+ mellanox/mlxsw_spectrum-13.1420.122.mfa2
+ mellanox/mlxsw_spectrum-13.1530.152.mfa2
+ mellanox/mlxsw_spectrum-13.1620.192.mfa2
+ mellanox/mlxsw_spectrum-13.1702.6.mfa2
+ mellanox/mlxsw_spectrum-13.1703.4.mfa2
+ mellanox/mlxsw_spectrum-13.1910.622.mfa2
+ mellanox/mlxsw_spectrum-13.2000.1122.mfa2
+ )
+
+ # blacklist of images with unknown license
+ local unknown_license=(
+ korg/k1212.dsp
+ ess/maestro3_assp_kernel.fw
+ ess/maestro3_assp_minisrc.fw
+ yamaha/ds1_ctrl.fw
+ yamaha/ds1_dsp.fw
+ yamaha/ds1e_ctrl.fw
+ ttusb-budget/dspbootcode.bin
+ emi62/bitstream.fw
+ emi62/loader.fw
+ emi62/midi.fw
+ emi62/spdif.fw
+ ti_3410.fw
+ ti_5052.fw
+ mts_mt9234mu.fw
+ mts_mt9234zba.fw
+ whiteheat.fw
+ whiteheat_loader.fw
+ cpia2/stv0672_vp4.bin
+ vicam/firmware.fw
+ edgeport/boot.fw
+ edgeport/boot2.fw
+ edgeport/down.fw
+ edgeport/down2.fw
+ edgeport/down3.bin
+ sb16/mulaw_main.csp
+ sb16/alaw_main.csp
+ sb16/ima_adpcm_init.csp
+ sb16/ima_adpcm_playback.csp
+ sb16/ima_adpcm_capture.csp
+ sun/cassini.bin
+ acenic/tg1.bin
+ acenic/tg2.bin
+ adaptec/starfire_rx.bin
+ adaptec/starfire_tx.bin
+ yam/1200.bin
+ yam/9600.bin
+ ositech/Xilinx7OD.bin
+ qlogic/isp1000.bin
+ myricom/lanai.bin
+ yamaha/yss225_registers.bin
+ lgs8g75.fw
+ )
+
+ if use !unknown-license; then
+ einfo "Removing files with unknown license ..."
+ rm -v "${unknown_license[@]}" || die
+ fi
+
+ if use !redistributable; then
+ # remove files _not_ in the free_software or unknown_license lists
+ # everything else is confirmed (or assumed) to be redistributable
+ # based on upstream acceptance policy
+ einfo "Removing non-redistributable files ..."
+ local OLDIFS="${IFS}"
+ local IFS=$'\n'
+ set -o pipefail
+ find ! -type d -printf "%P\n" \
+ | grep -Fvx -e "${misc_files[*]}" -e "${free_software[*]}" -e "${unknown_license[*]}" \
+ | xargs -d '\n' --no-run-if-empty rm -v
+
+ [[ ${?} -ne 0 ]] && die "Failed to remove non-redistributable files"
+
+ IFS="${OLDIFS}"
+ fi
+
+ restore_config ${PN}.conf
+}
+
+src_install() {
+ ./copy-firmware.sh -v "${ED}/lib/firmware" || die
+
+ pushd "${ED}/lib/firmware" &>/dev/null || die
+
+ # especially use !redistributable will cause some broken symlinks
+ einfo "Removing broken symlinks ..."
+ find * -xtype l -print -delete || die
+
+ if use savedconfig; then
+ if [[ -s "${S}/${PN}.conf" ]]; then
+ local files_to_keep="${T}/files_to_keep.lst"
+ grep -v '^#' "${S}/${PN}.conf" 2>/dev/null > "${files_to_keep}" || die
+ [[ -s "${files_to_keep}" ]] || die "grep failed, empty config file?"
+
+ einfo "Applying USE=savedconfig; Removing all files not listed in config ..."
+ find ! -type d -printf "%P\n" \
+ | grep -Fvx -f "${files_to_keep}" \
+ | xargs -d '\n' --no-run-if-empty rm -v
+
+ if [[ ${PIPESTATUS[0]} -ne 0 ]]; then
+ die "Find failed to print installed files"
+ elif [[ ${PIPESTATUS[1]} -eq 2 ]]; then
+ # grep returns exit status 1 if no lines were selected
+ # which is the case when we want to keep all files
+ die "Grep failed to select files to keep"
+ elif [[ ${PIPESTATUS[2]} -ne 0 ]]; then
+ die "Failed to remove files not listed in config"
+ fi
+ fi
+ fi
+
+ # remove empty directories, bug #396073
+ find -type d -empty -delete || die
+
+ # sanity check
+ if ! ( shopt -s failglob; : * ) 2>/dev/null; then
+ eerror "No files to install. Check your USE flag settings"
+ eerror "and the list of files in your saved configuration."
+ die "Refusing to install an empty package"
+ fi
+
+ # create config file
+ echo "# Remove files that shall not be installed from this list." > "${S}"/${PN}.conf || die
+ find * ! -type d >> "${S}"/${PN}.conf || die
+ save_config "${S}"/${PN}.conf
+
+ if use compress-xz || use compress-zstd; then
+ einfo "Compressing firmware ..."
+ local target
+ local ext
+ local compressor
+
+ if use compress-xz; then
+ ext=xz
+ compressor="xz -T1 -C crc32"
+ elif use compress-zstd; then
+ ext=zst
+ compressor="zstd -15 -T1 -C -q --rm"
+ fi
+
+ # rename symlinks
+ while IFS= read -r -d '' f; do
+ # skip symlinks pointing to directories
+ [[ -d ${f} ]] && continue
+
+ target=$(readlink "${f}")
+ [[ $? -eq 0 ]] || die
+ ln -sf "${target}".${ext} "${f}" || die
+ mv -T "${f}" "${f}".${ext} || die
+ done < <(find . -type l -print0) || die
+
+ find . -type f ! -path "./amd-ucode/*" -print0 | \
+ xargs -0 -P $(makeopts_jobs) -I'{}' ${compressor} '{}' || die
+
+ fi
+
+ popd &>/dev/null || die
+
+ if use initramfs ; then
+ insinto /boot
+ doins "${S}"/amd-uc.img
+ fi
+}
+
+pkg_preinst() {
+ if use savedconfig; then
+ ewarn "USE=savedconfig is active. You must handle file collisions manually."
+ fi
+
+ # Fix 'symlink is blocked by a directory' Bug #871315
+ if has_version "<${CATEGORY}/${PN}-20220913-r2" ; then
+ rm -rf "${EROOT}"/lib/firmware/qcom/LENOVO/21BX
+ fi
+
+ # Make sure /boot is available if needed.
+ use initramfs && mount-boot_pkg_preinst
+}
+
+pkg_postinst() {
+ elog "If you are only interested in particular firmware files, edit the saved"
+ elog "configfile and remove those that you do not want."
+
+ local ver
+ for ver in ${REPLACING_VERSIONS}; do
+ if ver_test ${ver} -lt 20190514; then
+ elog
+ elog 'Starting with version 20190514, installation of many firmware'
+ elog 'files is controlled by USE flags. Please review your USE flag'
+ elog 'and package.license settings if you are missing some files.'
+ break
+ fi
+ done
+
+ # Don't forget to umount /boot if it was previously mounted by us.
+ use initramfs && mount-boot_pkg_postinst
+}
+
+pkg_prerm() {
+ # Make sure /boot is mounted so that we can remove /boot/amd-uc.img!
+ use initramfs && mount-boot_pkg_prerm
+}
+
+pkg_postrm() {
+ # Don't forget to umount /boot if it was previously mounted by us.
+ use initramfs && mount-boot_pkg_postrm
+}
diff --git a/sys-kernel/linux-firmware/metadata.xml b/sys-kernel/linux-firmware/metadata.xml
index 9b0f0b62ea04..ac0d48943ce9 100644
--- a/sys-kernel/linux-firmware/metadata.xml
+++ b/sys-kernel/linux-firmware/metadata.xml
@@ -20,6 +20,7 @@
<use>
<flag name="compress-xz">Compress firmware using xz (<pkg>app-arch/xz-utils</pkg>) before installation</flag>
<flag name="compress-zstd">Compress firmware using zstd (<pkg>app-arch/zstd</pkg>) before installation</flag>
+ <flag name="deduplicate">Create symlinks for all firmware that is duplicate using rdfind</flag>
<flag name="initramfs">Create and install initramfs for early microcode loading in /boot (only AMD for now)</flag>
<flag name="redistributable">Install also non-free (but redistributable) firmware files</flag>
<flag name="savedconfig">Allows individual selection of firmware files</flag>
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-kernel/linux-firmware/files/, sys-kernel/linux-firmware/
@ 2024-01-20 20:01 Mike Pagano
0 siblings, 0 replies; 11+ messages in thread
From: Mike Pagano @ 2024-01-20 20:01 UTC (permalink / raw
To: gentoo-commits
commit: df7daea6e021ab74a4ff7d0c662e428b5cf2b995
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 20 20:00:08 2024 +0000
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Sat Jan 20 20:01:25 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=df7daea6
sys-kernel/linux-firmware: Modifications to USE=savedconfig
Modified to only install files from the config file instead of
deleting them afterwards.
Bug: https://bugs.gentoo.org/913049
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
.../files/linux-firmware-copy-firmware.patch | 59 +++
.../linux-firmware-20240115-r1.ebuild | 403 +++++++++++++++++++++
2 files changed, 462 insertions(+)
diff --git a/sys-kernel/linux-firmware/files/linux-firmware-copy-firmware.patch b/sys-kernel/linux-firmware/files/linux-firmware-copy-firmware.patch
new file mode 100644
index 000000000000..b6ff69d1f577
--- /dev/null
+++ b/sys-kernel/linux-firmware/files/linux-firmware-copy-firmware.patch
@@ -0,0 +1,59 @@
+From 4eee756fa1e02c3e8ea168ac0efa16b30dae3b25 Mon Sep 17 00:00:00 2001
+From: Mike Pagano <mpagano@gentoo.org>
+Date: Sat, 23 Dec 2023 13:14:58 -0500
+Subject: [PATCH] [PATCH] copy-firmware.sh: Support passing in firmware files
+ to install
+Cc: mpagano@gentoo.org
+
+This change adds support to copy-firmware.sh to accept a space separated
+list of firmware files to install.
+
+This allows our users to define a small subset of needed firmware files
+their system requires without installing every firmware file included
+from the repository.
+
+Signed-off-by: Mike Pagano <mpagano@gentoo.org>
+---
+ copy-firmware.sh | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/copy-firmware.sh b/copy-firmware.sh
+index 6757c6ce..d954230d 100755
+--- a/copy-firmware.sh
++++ b/copy-firmware.sh
+@@ -50,6 +50,16 @@ while test $# -gt 0; do
+ shift
+ ;;
+
++ --firmware-list)
++ if [ -n "$2" ]; then
++ FIRMWARE_LIST=$2
++ shift 2
++ else
++ echo "ERROR: '--firmware-list' requires a non-empty option argument of firmware files to install"
++ exit 1
++ fi
++ ;;
++
+ -*)
+ if test "$compress" = "cat"; then
+ echo "ERROR: unknown command-line option: $1"
+@@ -85,6 +95,7 @@ fi
+ # shellcheck disable=SC2162 # file/folder name can include escaped symbols
+ grep -E '^(RawFile|File):' WHENCE | sed -E -e 's/^(RawFile|File): */\1 /;s/"//g' | while read k f; do
+ test -f "$f" || continue
++ [ -n "${FIRMWARE_LIST##*"$f"*}" ] && continue
+ install -d "$destdir/$(dirname "$f")"
+ $verbose "copying/compressing file $f$compext"
+ if test "$compress" != "cat" && test "$k" = "RawFile"; then
+@@ -107,6 +118,7 @@ fi
+
+ # shellcheck disable=SC2162 # file/folder name can include escaped symbols
+ grep -E '^Link:' WHENCE | sed -e 's/^Link: *//g;s/-> //g' | while read f d; do
++ [ -n "${FIRMWARE_LIST##*"$f"*}" ] && continue
+ if test -L "$f$compext"; then
+ test -f "$destdir/$f$compext" && continue
+ $verbose "copying link $f$compext"
+--
+2.41.0
+
diff --git a/sys-kernel/linux-firmware/linux-firmware-20240115-r1.ebuild b/sys-kernel/linux-firmware/linux-firmware-20240115-r1.ebuild
new file mode 100644
index 000000000000..25d02e4a4f38
--- /dev/null
+++ b/sys-kernel/linux-firmware/linux-firmware-20240115-r1.ebuild
@@ -0,0 +1,403 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+inherit linux-info mount-boot savedconfig multiprocessing
+
+# In case this is a real snapshot, fill in commit below.
+# For normal, tagged releases, leave blank
+MY_COMMIT=""
+
+if [[ ${PV} == 99999999* ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/${PN}.git"
+else
+ if [[ -n "${MY_COMMIT}" ]]; then
+ SRC_URI="https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/snapshot/${MY_COMMIT}.tar.gz -> ${P}.tar.gz"
+ S="${WORKDIR}/${MY_COMMIT}"
+ else
+ SRC_URI="https://mirrors.edge.kernel.org/pub/linux/kernel/firmware/${P}.tar.xz"
+ fi
+
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+fi
+
+DESCRIPTION="Linux firmware files"
+HOMEPAGE="https://git.kernel.org/?p=linux/kernel/git/firmware/linux-firmware.git"
+
+LICENSE="GPL-2 GPL-2+ GPL-3 BSD MIT || ( MPL-1.1 GPL-2 )
+ redistributable? ( linux-fw-redistributable BSD-2 BSD BSD-4 ISC MIT )
+ unknown-license? ( all-rights-reserved )"
+SLOT="0"
+IUSE="compress-xz compress-zstd deduplicate initramfs +redistributable savedconfig unknown-license"
+REQUIRED_USE="initramfs? ( redistributable )
+ ?? ( compress-xz compress-zstd )
+ savedconfig? ( !deduplicate )"
+
+RESTRICT="binchecks strip test
+ unknown-license? ( bindist )"
+
+BDEPEND="initramfs? ( app-arch/cpio )
+ compress-xz? ( app-arch/xz-utils )
+ compress-zstd? ( app-arch/zstd )
+ deduplicate? ( app-misc/rdfind )"
+
+#add anything else that collides to this
+RDEPEND="!savedconfig? (
+ redistributable? (
+ !sys-firmware/alsa-firmware[alsa_cards_ca0132]
+ !sys-block/qla-fc-firmware
+ !sys-firmware/iwl1000-ucode
+ !sys-firmware/iwl6005-ucode
+ !sys-firmware/iwl6030-ucode
+ !sys-firmware/iwl3160-ucode
+ !sys-firmware/iwl7260-ucode
+ !sys-firmware/iwl3160-7260-bt-ucode
+ !sys-firmware/raspberrypi-wifi-ucode
+ )
+ unknown-license? (
+ !sys-firmware/alsa-firmware[alsa_cards_korg1212]
+ !sys-firmware/alsa-firmware[alsa_cards_maestro3]
+ !sys-firmware/alsa-firmware[alsa_cards_sb16]
+ !sys-firmware/alsa-firmware[alsa_cards_ymfpci]
+ )
+ )"
+
+QA_PREBUILT="*"
+PATCHES=( "${FILESDIR}"/${PN}-copy-firmware.patch )
+
+pkg_pretend() {
+ use initramfs && mount-boot_pkg_pretend
+}
+
+pkg_setup() {
+ if use compress-xz || use compress-zstd ; then
+ local CONFIG_CHECK
+
+ if kernel_is -ge 5 19; then
+ use compress-xz && CONFIG_CHECK="~FW_LOADER_COMPRESS_XZ"
+ use compress-zstd && CONFIG_CHECK="~FW_LOADER_COMPRESS_ZSTD"
+ else
+ use compress-xz && CONFIG_CHECK="~FW_LOADER_COMPRESS"
+ if use compress-zstd; then
+ eerror "Kernels <5.19 do not support ZSTD-compressed firmware files"
+ fi
+ fi
+ linux-info_pkg_setup
+ fi
+}
+
+src_unpack() {
+ if [[ ${PV} == 99999999* ]]; then
+ git-r3_src_unpack
+ else
+ default
+ # rename directory from git snapshot tarball
+ if [[ ${#GIT_COMMIT} -gt 8 ]]; then
+ mv ${PN}-*/ ${P} || die
+ fi
+ fi
+}
+
+src_prepare() {
+
+ default
+
+ find . -type f -not -perm 0644 -print0 \
+ | xargs --null --no-run-if-empty chmod 0644 \
+ || die
+
+ chmod +x copy-firmware.sh || die
+
+ if use initramfs; then
+ if [[ -d "${S}/amd-ucode" ]]; then
+ local UCODETMP="${T}/ucode_tmp"
+ local UCODEDIR="${UCODETMP}/kernel/x86/microcode"
+ mkdir -p "${UCODEDIR}" || die
+ echo 1 > "${UCODETMP}/early_cpio"
+
+ local amd_ucode_file="${UCODEDIR}/AuthenticAMD.bin"
+ cat "${S}"/amd-ucode/*.bin > "${amd_ucode_file}" || die "Failed to concat amd cpu ucode"
+
+ if [[ ! -s "${amd_ucode_file}" ]]; then
+ die "Sanity check failed: '${amd_ucode_file}' is empty!"
+ fi
+
+ pushd "${UCODETMP}" &>/dev/null || die
+ find . -print0 | cpio --quiet --null -o -H newc -R 0:0 > "${S}"/amd-uc.img
+ popd &>/dev/null || die
+ if [[ ! -s "${S}/amd-uc.img" ]]; then
+ die "Failed to create '${S}/amd-uc.img'!"
+ fi
+ else
+ # If this will ever happen something has changed which
+ # must be reviewed
+ die "'${S}/amd-ucode' not found!"
+ fi
+ fi
+
+ # whitelist of misc files
+ local misc_files=(
+ copy-firmware.sh
+ WHENCE
+ README
+ )
+
+ # whitelist of images with a free software license
+ local free_software=(
+ # keyspan_pda (GPL-2+)
+ keyspan_pda/keyspan_pda.fw
+ keyspan_pda/xircom_pgs.fw
+ # dsp56k (GPL-2+)
+ dsp56k/bootstrap.bin
+ # ath9k_htc (BSD GPL-2+ MIT)
+ ath9k_htc/htc_7010-1.4.0.fw
+ ath9k_htc/htc_9271-1.4.0.fw
+ # pcnet_cs, 3c589_cs, 3c574_cs, serial_cs (dual GPL-2/MPL-1.1)
+ cis/LA-PCM.cis
+ cis/PCMLM28.cis
+ cis/DP83903.cis
+ cis/NE2K.cis
+ cis/tamarack.cis
+ cis/PE-200.cis
+ cis/PE520.cis
+ cis/3CXEM556.cis
+ cis/3CCFEM556.cis
+ cis/MT5634ZLX.cis
+ cis/RS-COM-2P.cis
+ cis/COMpad2.cis
+ cis/COMpad4.cis
+ # serial_cs (GPL-3)
+ cis/SW_555_SER.cis
+ cis/SW_7xx_SER.cis
+ cis/SW_8xx_SER.cis
+ # dvb-ttpci (GPL-2+)
+ av7110/bootcode.bin
+ # usbdux, usbduxfast, usbduxsigma (GPL-2+)
+ usbdux_firmware.bin
+ usbduxfast_firmware.bin
+ usbduxsigma_firmware.bin
+ # brcmfmac (GPL-2+)
+ brcm/brcmfmac4330-sdio.Prowise-PT301.txt
+ brcm/brcmfmac43340-sdio.meegopad-t08.txt
+ brcm/brcmfmac43362-sdio.cubietech,cubietruck.txt
+ brcm/brcmfmac43362-sdio.lemaker,bananapro.txt
+ brcm/brcmfmac43430a0-sdio.jumper-ezpad-mini3.txt
+ "brcm/brcmfmac43430a0-sdio.ONDA-V80 PLUS.txt"
+ brcm/brcmfmac43430-sdio.AP6212.txt
+ brcm/brcmfmac43430-sdio.Hampoo-D2D3_Vi8A1.txt
+ brcm/brcmfmac43430-sdio.MUR1DX.txt
+ brcm/brcmfmac43430-sdio.raspberrypi,3-model-b.txt
+ brcm/brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt
+ brcm/brcmfmac4356-pcie.gpd-win-pocket.txt
+ # isci (GPL-2)
+ isci/isci_firmware.bin
+ # carl9170 (GPL-2+)
+ carl9170-1.fw
+ # atusb (GPL-2+)
+ atusb/atusb-0.2.dfu
+ atusb/atusb-0.3.dfu
+ atusb/rzusb-0.3.bin
+ # mlxsw_spectrum (dual BSD/GPL-2)
+ mellanox/mlxsw_spectrum-13.1420.122.mfa2
+ mellanox/mlxsw_spectrum-13.1530.152.mfa2
+ mellanox/mlxsw_spectrum-13.1620.192.mfa2
+ mellanox/mlxsw_spectrum-13.1702.6.mfa2
+ mellanox/mlxsw_spectrum-13.1703.4.mfa2
+ mellanox/mlxsw_spectrum-13.1910.622.mfa2
+ mellanox/mlxsw_spectrum-13.2000.1122.mfa2
+ )
+
+ # blacklist of images with unknown license
+ local unknown_license=(
+ korg/k1212.dsp
+ ess/maestro3_assp_kernel.fw
+ ess/maestro3_assp_minisrc.fw
+ yamaha/ds1_ctrl.fw
+ yamaha/ds1_dsp.fw
+ yamaha/ds1e_ctrl.fw
+ ttusb-budget/dspbootcode.bin
+ emi62/bitstream.fw
+ emi62/loader.fw
+ emi62/midi.fw
+ emi62/spdif.fw
+ ti_3410.fw
+ ti_5052.fw
+ mts_mt9234mu.fw
+ mts_mt9234zba.fw
+ whiteheat.fw
+ whiteheat_loader.fw
+ cpia2/stv0672_vp4.bin
+ vicam/firmware.fw
+ edgeport/boot.fw
+ edgeport/boot2.fw
+ edgeport/down.fw
+ edgeport/down2.fw
+ edgeport/down3.bin
+ sb16/mulaw_main.csp
+ sb16/alaw_main.csp
+ sb16/ima_adpcm_init.csp
+ sb16/ima_adpcm_playback.csp
+ sb16/ima_adpcm_capture.csp
+ sun/cassini.bin
+ acenic/tg1.bin
+ acenic/tg2.bin
+ adaptec/starfire_rx.bin
+ adaptec/starfire_tx.bin
+ yam/1200.bin
+ yam/9600.bin
+ ositech/Xilinx7OD.bin
+ qlogic/isp1000.bin
+ myricom/lanai.bin
+ yamaha/yss225_registers.bin
+ lgs8g75.fw
+ )
+
+ if use !unknown-license; then
+ einfo "Removing files with unknown license ..."
+ rm -v "${unknown_license[@]}" || die
+ fi
+
+ if use !redistributable; then
+ # remove files _not_ in the free_software or unknown_license lists
+ # everything else is confirmed (or assumed) to be redistributable
+ # based on upstream acceptance policy
+ einfo "Removing non-redistributable files ..."
+ local OLDIFS="${IFS}"
+ local IFS=$'\n'
+ set -o pipefail
+ find ! -type d -printf "%P\n" \
+ | grep -Fvx -e "${misc_files[*]}" -e "${free_software[*]}" -e "${unknown_license[*]}" \
+ | xargs -d '\n' --no-run-if-empty rm -v
+
+ [[ ${?} -ne 0 ]] && die "Failed to remove non-redistributable files"
+
+ IFS="${OLDIFS}"
+ fi
+
+ restore_config ${PN}.conf
+}
+
+src_install() {
+
+ local LINUX_FIRMWARE_SAVED_CONFIG_FILES=
+ local FW_OPTIONS=( "-v" )
+
+ if use savedconfig; then
+ if [[ -s "${S}/${PN}.conf" ]]; then
+ files_to_keep="${T}/files_to_keep.lst"
+ grep -v '^#' "${S}/${PN}.conf" 2>/dev/null > "${files_to_keep}" || die
+ [[ -s "${files_to_keep}" ]] || die "grep failed, empty config file?"
+ LINUX_FIRMWARE_SAVED_CONFIG_FILES=$(<${files_to_keep})
+ LINUX_FIRMWARE_SAVED_CONFIG_FILES="${LINUX_FIRMWARE_SAVED_CONFIG_FILES//$'\n'/ }"
+ FW_OPTIONS+=( "--firmware-list" "${LINUX_FIRMWARE_SAVED_CONFIG_FILES[@]}" )
+ fi
+ fi
+
+ ! use deduplicate && FW_OPTIONS+=( "--ignore-duplicates" )
+ FW_OPTIONS+=( "${ED}/lib/firmware" )
+ ./copy-firmware.sh "${FW_OPTIONS[@]}"
+
+ echo "calling copy-firmwaare.sh ${FW_OPTIONS[@]}"
+
+ pushd "${ED}/lib/firmware" &>/dev/null || die
+
+ # especially use !redistributable will cause some broken symlinks
+ einfo "Removing broken symlinks ..."
+ find * -xtype l -print -delete || die
+
+ # remove empty directories, bug #396073
+ find -type d -empty -delete || die
+
+ # sanity check
+ if ! ( shopt -s failglob; : * ) 2>/dev/null; then
+ eerror "No files to install. Check your USE flag settings"
+ eerror "and the list of files in your saved configuration."
+ die "Refusing to install an empty package"
+ fi
+
+ # create config file
+ echo "# Remove files that shall not be installed from this list." > "${S}"/${PN}.conf || die
+ find * ! -type d >> "${S}"/${PN}.conf || die
+ save_config "${S}"/${PN}.conf
+
+ if use compress-xz || use compress-zstd; then
+ einfo "Compressing firmware ..."
+ local target
+ local ext
+ local compressor
+
+ if use compress-xz; then
+ ext=xz
+ compressor="xz -T1 -C crc32"
+ elif use compress-zstd; then
+ ext=zst
+ compressor="zstd -15 -T1 -C -q --rm"
+ fi
+
+ # rename symlinks
+ while IFS= read -r -d '' f; do
+ # skip symlinks pointing to directories
+ [[ -d ${f} ]] && continue
+
+ target=$(readlink "${f}")
+ [[ $? -eq 0 ]] || die
+ ln -sf "${target}".${ext} "${f}" || die
+ mv -T "${f}" "${f}".${ext} || die
+ done < <(find . -type l -print0) || die
+
+ find . -type f ! -path "./amd-ucode/*" -print0 | \
+ xargs -0 -P $(makeopts_jobs) -I'{}' ${compressor} '{}' || die
+
+ fi
+
+ popd &>/dev/null || die
+
+ if use initramfs ; then
+ insinto /boot
+ doins "${S}"/amd-uc.img
+ fi
+}
+
+pkg_preinst() {
+ if use savedconfig; then
+ ewarn "USE=savedconfig is active. You must handle file collisions manually."
+ fi
+
+ # Fix 'symlink is blocked by a directory' Bug #871315
+ if has_version "<${CATEGORY}/${PN}-20220913-r2" ; then
+ rm -rf "${EROOT}"/lib/firmware/qcom/LENOVO/21BX
+ fi
+
+ # Make sure /boot is available if needed.
+ use initramfs && mount-boot_pkg_preinst
+}
+
+pkg_postinst() {
+ elog "If you are only interested in particular firmware files, edit the saved"
+ elog "configfile and remove those that you do not want."
+
+ local ver
+ for ver in ${REPLACING_VERSIONS}; do
+ if ver_test ${ver} -lt 20190514; then
+ elog
+ elog 'Starting with version 20190514, installation of many firmware'
+ elog 'files is controlled by USE flags. Please review your USE flag'
+ elog 'and package.license settings if you are missing some files.'
+ break
+ fi
+ done
+
+ # Don't forget to umount /boot if it was previously mounted by us.
+ use initramfs && mount-boot_pkg_postinst
+}
+
+pkg_prerm() {
+ # Make sure /boot is mounted so that we can remove /boot/amd-uc.img!
+ use initramfs && mount-boot_pkg_prerm
+}
+
+pkg_postrm() {
+ # Don't forget to umount /boot if it was previously mounted by us.
+ use initramfs && mount-boot_pkg_postrm
+}
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-kernel/linux-firmware/files/, sys-kernel/linux-firmware/
@ 2024-02-15 23:20 Mike Pagano
0 siblings, 0 replies; 11+ messages in thread
From: Mike Pagano @ 2024-02-15 23:20 UTC (permalink / raw
To: gentoo-commits
commit: f00488d02e9bb9d5c85dbdee80bd5b1a780a4100
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 15 23:18:55 2024 +0000
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Thu Feb 15 23:18:55 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f00488d0
sys-kernel/linux-firmware: Update savedconfig patch
Bug: https://bugs.gentoo.org/913049
Closes: https://bugs.gentoo.org/924679
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
.../files/linux-firmware-copy-firmware-r3.patch | 59 +++
.../linux-firmware-20240115-r3.ebuild | 401 +++++++++++++++++++++
2 files changed, 460 insertions(+)
diff --git a/sys-kernel/linux-firmware/files/linux-firmware-copy-firmware-r3.patch b/sys-kernel/linux-firmware/files/linux-firmware-copy-firmware-r3.patch
new file mode 100644
index 000000000000..0801b60f5ffa
--- /dev/null
+++ b/sys-kernel/linux-firmware/files/linux-firmware-copy-firmware-r3.patch
@@ -0,0 +1,59 @@
+From 4eee756fa1e02c3e8ea168ac0efa16b30dae3b25 Mon Sep 17 00:00:00 2001
+From: Mike Pagano <mpagano@gentoo.org>
+Date: Sat, 23 Dec 2023 13:14:58 -0500
+Subject: [PATCH] [PATCH] copy-firmware.sh: Support passing in firmware files
+ to install
+Cc: mpagano@gentoo.org
+
+This change adds support to copy-firmware.sh to accept a space separated
+list of firmware files to install.
+
+This allows our users to define a small subset of needed firmware files
+their system requires without installing every firmware file included
+from the repository.
+
+Signed-off-by: Mike Pagano <mpagano@gentoo.org>
+---
+ copy-firmware.sh | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/copy-firmware.sh b/copy-firmware.sh
+index 6757c6ce..d954230d 100755
+--- a/copy-firmware.sh
++++ b/copy-firmware.sh
+@@ -50,6 +50,16 @@ while test $# -gt 0; do
+ shift
+ ;;
+
++ --firmware-list)
++ if [ -n "$2" ]; then
++ FIRMWARE_LIST=$2
++ shift 2
++ else
++ echo "ERROR: '--firmware-list' requires a non-empty option argument of firmware files to install"
++ exit 1
++ fi
++ ;;
++
+ -*)
+ if test "$compress" = "cat"; then
+ echo "ERROR: unknown command-line option: $1"
+@@ -85,6 +95,7 @@ fi
+ # shellcheck disable=SC2162 # file/folder name can include escaped symbols
+ grep -E '^(RawFile|File):' WHENCE | sed -E -e 's/^(RawFile|File): */\1 /;s/"//g' | while read k f; do
+ test -f "$f" || continue
++ [ -n "${FIRMWARE_LIST}" ] && if ! echo "${FIRMWARE_LIST}" | grep -q "${f}"; then continue; fi
+ install -d "$destdir/$(dirname "$f")"
+ $verbose "copying/compressing file $f$compext"
+ if test "$compress" != "cat" && test "$k" = "RawFile"; then
+@@ -107,6 +118,7 @@ fi
+
+ # shellcheck disable=SC2162 # file/folder name can include escaped symbols
+ grep -E '^Link:' WHENCE | sed -e 's/^Link: *//g;s/-> //g' | while read f d; do
++ [ -n "${FIRMWARE_LIST}" ] && if ! echo "${FIRMWARE_LIST}" | grep -q "${f}"; then continue; fi
+ if test -L "$f$compext"; then
+ test -f "$destdir/$f$compext" && continue
+ $verbose "copying link $f$compext"
+--
+2.41.0
+
diff --git a/sys-kernel/linux-firmware/linux-firmware-20240115-r3.ebuild b/sys-kernel/linux-firmware/linux-firmware-20240115-r3.ebuild
new file mode 100644
index 000000000000..b3fee43ebe5e
--- /dev/null
+++ b/sys-kernel/linux-firmware/linux-firmware-20240115-r3.ebuild
@@ -0,0 +1,401 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+inherit linux-info mount-boot savedconfig multiprocessing
+
+# In case this is a real snapshot, fill in commit below.
+# For normal, tagged releases, leave blank
+MY_COMMIT=""
+
+if [[ ${PV} == 99999999* ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/${PN}.git"
+else
+ if [[ -n "${MY_COMMIT}" ]]; then
+ SRC_URI="https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/snapshot/${MY_COMMIT}.tar.gz -> ${P}.tar.gz"
+ S="${WORKDIR}/${MY_COMMIT}"
+ else
+ SRC_URI="https://mirrors.edge.kernel.org/pub/linux/kernel/firmware/${P}.tar.xz"
+ fi
+
+ KEYWORDS="-alpha -amd64 -arm -arm64 -hppa -ia64 -loong -m68k -mips -ppc -ppc64 -riscv -s390 -sparc -x86"
+fi
+
+DESCRIPTION="Linux firmware files"
+HOMEPAGE="https://git.kernel.org/?p=linux/kernel/git/firmware/linux-firmware.git"
+
+LICENSE="GPL-2 GPL-2+ GPL-3 BSD MIT || ( MPL-1.1 GPL-2 )
+ redistributable? ( linux-fw-redistributable BSD-2 BSD BSD-4 ISC MIT )
+ unknown-license? ( all-rights-reserved )"
+SLOT="0"
+IUSE="compress-xz compress-zstd deduplicate initramfs +redistributable savedconfig unknown-license"
+REQUIRED_USE="initramfs? ( redistributable )
+ ?? ( compress-xz compress-zstd )
+ savedconfig? ( !deduplicate )"
+
+RESTRICT="binchecks strip test
+ unknown-license? ( bindist )"
+
+BDEPEND="initramfs? ( app-alternatives/cpio )
+ compress-xz? ( app-arch/xz-utils )
+ compress-zstd? ( app-arch/zstd )
+ deduplicate? ( app-misc/rdfind )"
+
+#add anything else that collides to this
+RDEPEND="!savedconfig? (
+ redistributable? (
+ !sys-firmware/alsa-firmware[alsa_cards_ca0132]
+ !sys-block/qla-fc-firmware
+ !sys-firmware/iwl1000-ucode
+ !sys-firmware/iwl6005-ucode
+ !sys-firmware/iwl6030-ucode
+ !sys-firmware/iwl3160-ucode
+ !sys-firmware/iwl7260-ucode
+ !sys-firmware/iwl3160-7260-bt-ucode
+ !sys-firmware/raspberrypi-wifi-ucode
+ )
+ unknown-license? (
+ !sys-firmware/alsa-firmware[alsa_cards_korg1212]
+ !sys-firmware/alsa-firmware[alsa_cards_maestro3]
+ !sys-firmware/alsa-firmware[alsa_cards_sb16]
+ !sys-firmware/alsa-firmware[alsa_cards_ymfpci]
+ )
+ )"
+
+QA_PREBUILT="*"
+PATCHES=( "${FILESDIR}"/${PN}-copy-firmware-r3.patch )
+
+pkg_pretend() {
+ use initramfs && mount-boot_pkg_pretend
+}
+
+pkg_setup() {
+ if use compress-xz || use compress-zstd ; then
+ local CONFIG_CHECK
+
+ if kernel_is -ge 5 19; then
+ use compress-xz && CONFIG_CHECK="~FW_LOADER_COMPRESS_XZ"
+ use compress-zstd && CONFIG_CHECK="~FW_LOADER_COMPRESS_ZSTD"
+ else
+ use compress-xz && CONFIG_CHECK="~FW_LOADER_COMPRESS"
+ if use compress-zstd; then
+ eerror "Kernels <5.19 do not support ZSTD-compressed firmware files"
+ fi
+ fi
+ linux-info_pkg_setup
+ fi
+}
+
+src_unpack() {
+ if [[ ${PV} == 99999999* ]]; then
+ git-r3_src_unpack
+ else
+ default
+ # rename directory from git snapshot tarball
+ if [[ ${#GIT_COMMIT} -gt 8 ]]; then
+ mv ${PN}-*/ ${P} || die
+ fi
+ fi
+}
+
+src_prepare() {
+
+ default
+
+ find . -type f -not -perm 0644 -print0 \
+ | xargs --null --no-run-if-empty chmod 0644 \
+ || die
+
+ chmod +x copy-firmware.sh || die
+
+ if use initramfs; then
+ if [[ -d "${S}/amd-ucode" ]]; then
+ local UCODETMP="${T}/ucode_tmp"
+ local UCODEDIR="${UCODETMP}/kernel/x86/microcode"
+ mkdir -p "${UCODEDIR}" || die
+ echo 1 > "${UCODETMP}/early_cpio"
+
+ local amd_ucode_file="${UCODEDIR}/AuthenticAMD.bin"
+ cat "${S}"/amd-ucode/*.bin > "${amd_ucode_file}" || die "Failed to concat amd cpu ucode"
+
+ if [[ ! -s "${amd_ucode_file}" ]]; then
+ die "Sanity check failed: '${amd_ucode_file}' is empty!"
+ fi
+
+ pushd "${UCODETMP}" &>/dev/null || die
+ find . -print0 | cpio --quiet --null -o -H newc -R 0:0 > "${S}"/amd-uc.img
+ popd &>/dev/null || die
+ if [[ ! -s "${S}/amd-uc.img" ]]; then
+ die "Failed to create '${S}/amd-uc.img'!"
+ fi
+ else
+ # If this will ever happen something has changed which
+ # must be reviewed
+ die "'${S}/amd-ucode' not found!"
+ fi
+ fi
+
+ # whitelist of misc files
+ local misc_files=(
+ copy-firmware.sh
+ WHENCE
+ README
+ )
+
+ # whitelist of images with a free software license
+ local free_software=(
+ # keyspan_pda (GPL-2+)
+ keyspan_pda/keyspan_pda.fw
+ keyspan_pda/xircom_pgs.fw
+ # dsp56k (GPL-2+)
+ dsp56k/bootstrap.bin
+ # ath9k_htc (BSD GPL-2+ MIT)
+ ath9k_htc/htc_7010-1.4.0.fw
+ ath9k_htc/htc_9271-1.4.0.fw
+ # pcnet_cs, 3c589_cs, 3c574_cs, serial_cs (dual GPL-2/MPL-1.1)
+ cis/LA-PCM.cis
+ cis/PCMLM28.cis
+ cis/DP83903.cis
+ cis/NE2K.cis
+ cis/tamarack.cis
+ cis/PE-200.cis
+ cis/PE520.cis
+ cis/3CXEM556.cis
+ cis/3CCFEM556.cis
+ cis/MT5634ZLX.cis
+ cis/RS-COM-2P.cis
+ cis/COMpad2.cis
+ cis/COMpad4.cis
+ # serial_cs (GPL-3)
+ cis/SW_555_SER.cis
+ cis/SW_7xx_SER.cis
+ cis/SW_8xx_SER.cis
+ # dvb-ttpci (GPL-2+)
+ av7110/bootcode.bin
+ # usbdux, usbduxfast, usbduxsigma (GPL-2+)
+ usbdux_firmware.bin
+ usbduxfast_firmware.bin
+ usbduxsigma_firmware.bin
+ # brcmfmac (GPL-2+)
+ brcm/brcmfmac4330-sdio.Prowise-PT301.txt
+ brcm/brcmfmac43340-sdio.meegopad-t08.txt
+ brcm/brcmfmac43362-sdio.cubietech,cubietruck.txt
+ brcm/brcmfmac43362-sdio.lemaker,bananapro.txt
+ brcm/brcmfmac43430a0-sdio.jumper-ezpad-mini3.txt
+ "brcm/brcmfmac43430a0-sdio.ONDA-V80 PLUS.txt"
+ brcm/brcmfmac43430-sdio.AP6212.txt
+ brcm/brcmfmac43430-sdio.Hampoo-D2D3_Vi8A1.txt
+ brcm/brcmfmac43430-sdio.MUR1DX.txt
+ brcm/brcmfmac43430-sdio.raspberrypi,3-model-b.txt
+ brcm/brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt
+ brcm/brcmfmac4356-pcie.gpd-win-pocket.txt
+ # isci (GPL-2)
+ isci/isci_firmware.bin
+ # carl9170 (GPL-2+)
+ carl9170-1.fw
+ # atusb (GPL-2+)
+ atusb/atusb-0.2.dfu
+ atusb/atusb-0.3.dfu
+ atusb/rzusb-0.3.bin
+ # mlxsw_spectrum (dual BSD/GPL-2)
+ mellanox/mlxsw_spectrum-13.1420.122.mfa2
+ mellanox/mlxsw_spectrum-13.1530.152.mfa2
+ mellanox/mlxsw_spectrum-13.1620.192.mfa2
+ mellanox/mlxsw_spectrum-13.1702.6.mfa2
+ mellanox/mlxsw_spectrum-13.1703.4.mfa2
+ mellanox/mlxsw_spectrum-13.1910.622.mfa2
+ mellanox/mlxsw_spectrum-13.2000.1122.mfa2
+ )
+
+ # blacklist of images with unknown license
+ local unknown_license=(
+ korg/k1212.dsp
+ ess/maestro3_assp_kernel.fw
+ ess/maestro3_assp_minisrc.fw
+ yamaha/ds1_ctrl.fw
+ yamaha/ds1_dsp.fw
+ yamaha/ds1e_ctrl.fw
+ ttusb-budget/dspbootcode.bin
+ emi62/bitstream.fw
+ emi62/loader.fw
+ emi62/midi.fw
+ emi62/spdif.fw
+ ti_3410.fw
+ ti_5052.fw
+ mts_mt9234mu.fw
+ mts_mt9234zba.fw
+ whiteheat.fw
+ whiteheat_loader.fw
+ cpia2/stv0672_vp4.bin
+ vicam/firmware.fw
+ edgeport/boot.fw
+ edgeport/boot2.fw
+ edgeport/down.fw
+ edgeport/down2.fw
+ edgeport/down3.bin
+ sb16/mulaw_main.csp
+ sb16/alaw_main.csp
+ sb16/ima_adpcm_init.csp
+ sb16/ima_adpcm_playback.csp
+ sb16/ima_adpcm_capture.csp
+ sun/cassini.bin
+ acenic/tg1.bin
+ acenic/tg2.bin
+ adaptec/starfire_rx.bin
+ adaptec/starfire_tx.bin
+ yam/1200.bin
+ yam/9600.bin
+ ositech/Xilinx7OD.bin
+ qlogic/isp1000.bin
+ myricom/lanai.bin
+ yamaha/yss225_registers.bin
+ lgs8g75.fw
+ )
+
+ if use !unknown-license; then
+ einfo "Removing files with unknown license ..."
+ rm -v "${unknown_license[@]}" || die
+ fi
+
+ if use !redistributable; then
+ # remove files _not_ in the free_software or unknown_license lists
+ # everything else is confirmed (or assumed) to be redistributable
+ # based on upstream acceptance policy
+ einfo "Removing non-redistributable files ..."
+ local OLDIFS="${IFS}"
+ local IFS=$'\n'
+ set -o pipefail
+ find ! -type d -printf "%P\n" \
+ | grep -Fvx -e "${misc_files[*]}" -e "${free_software[*]}" -e "${unknown_license[*]}" \
+ | xargs -d '\n' --no-run-if-empty rm -v
+
+ [[ ${?} -ne 0 ]] && die "Failed to remove non-redistributable files"
+
+ IFS="${OLDIFS}"
+ fi
+
+ restore_config ${PN}.conf
+}
+
+src_install() {
+
+ local LINUX_FIRMWARE_SAVED_CONFIG_FILES=
+ local FW_OPTIONS=( "-v" )
+
+ if use savedconfig; then
+ if [[ -s "${S}/${PN}.conf" ]]; then
+ files_to_keep="${T}/files_to_keep.lst"
+ grep -v '^#' "${S}/${PN}.conf" 2>/dev/null > "${files_to_keep}" || die
+ [[ -s "${files_to_keep}" ]] || die "grep failed, empty config file?"
+ LINUX_FIRMWARE_SAVED_CONFIG_FILES=$(<${files_to_keep})
+ LINUX_FIRMWARE_SAVED_CONFIG_FILES="${LINUX_FIRMWARE_SAVED_CONFIG_FILES//$'\n'/ }"
+ FW_OPTIONS+=( "--firmware-list" "${LINUX_FIRMWARE_SAVED_CONFIG_FILES[@]}" )
+ fi
+ fi
+
+ ! use deduplicate && FW_OPTIONS+=( "--ignore-duplicates" )
+ FW_OPTIONS+=( "${ED}/lib/firmware" )
+ ./copy-firmware.sh "${FW_OPTIONS[@]}"
+
+ pushd "${ED}/lib/firmware" &>/dev/null || die
+
+ # especially use !redistributable will cause some broken symlinks
+ einfo "Removing broken symlinks ..."
+ find * -xtype l -print -delete || die
+
+ # remove empty directories, bug #396073
+ find -type d -empty -delete || die
+
+ # sanity check
+ if ! ( shopt -s failglob; : * ) 2>/dev/null; then
+ eerror "No files to install. Check your USE flag settings"
+ eerror "and the list of files in your saved configuration."
+ die "Refusing to install an empty package"
+ fi
+
+ # create config file
+ echo "# Remove files that shall not be installed from this list." > "${S}"/${PN}.conf || die
+ find * ! -type d >> "${S}"/${PN}.conf || die
+ save_config "${S}"/${PN}.conf
+
+ if use compress-xz || use compress-zstd; then
+ einfo "Compressing firmware ..."
+ local target
+ local ext
+ local compressor
+
+ if use compress-xz; then
+ ext=xz
+ compressor="xz -T1 -C crc32"
+ elif use compress-zstd; then
+ ext=zst
+ compressor="zstd -15 -T1 -C -q --rm"
+ fi
+
+ # rename symlinks
+ while IFS= read -r -d '' f; do
+ # skip symlinks pointing to directories
+ [[ -d ${f} ]] && continue
+
+ target=$(readlink "${f}")
+ [[ $? -eq 0 ]] || die
+ ln -sf "${target}".${ext} "${f}" || die
+ mv -T "${f}" "${f}".${ext} || die
+ done < <(find . -type l -print0) || die
+
+ find . -type f ! -path "./amd-ucode/*" -print0 | \
+ xargs -0 -P $(makeopts_jobs) -I'{}' ${compressor} '{}' || die
+
+ fi
+
+ popd &>/dev/null || die
+
+ if use initramfs ; then
+ insinto /boot
+ doins "${S}"/amd-uc.img
+ fi
+}
+
+pkg_preinst() {
+ if use savedconfig; then
+ ewarn "USE=savedconfig is active. You must handle file collisions manually."
+ fi
+
+ # Fix 'symlink is blocked by a directory' Bug #871315
+ if has_version "<${CATEGORY}/${PN}-20220913-r2" ; then
+ rm -rf "${EROOT}"/lib/firmware/qcom/LENOVO/21BX
+ fi
+
+ # Make sure /boot is available if needed.
+ use initramfs && mount-boot_pkg_preinst
+}
+
+pkg_postinst() {
+ elog "If you are only interested in particular firmware files, edit the saved"
+ elog "configfile and remove those that you do not want."
+
+ local ver
+ for ver in ${REPLACING_VERSIONS}; do
+ if ver_test ${ver} -lt 20190514; then
+ elog
+ elog 'Starting with version 20190514, installation of many firmware'
+ elog 'files is controlled by USE flags. Please review your USE flag'
+ elog 'and package.license settings if you are missing some files.'
+ break
+ fi
+ done
+
+ # Don't forget to umount /boot if it was previously mounted by us.
+ use initramfs && mount-boot_pkg_postinst
+}
+
+pkg_prerm() {
+ # Make sure /boot is mounted so that we can remove /boot/amd-uc.img!
+ use initramfs && mount-boot_pkg_prerm
+}
+
+pkg_postrm() {
+ # Don't forget to umount /boot if it was previously mounted by us.
+ use initramfs && mount-boot_pkg_postrm
+}
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-kernel/linux-firmware/files/, sys-kernel/linux-firmware/
@ 2024-02-15 23:20 Mike Pagano
0 siblings, 0 replies; 11+ messages in thread
From: Mike Pagano @ 2024-02-15 23:20 UTC (permalink / raw
To: gentoo-commits
commit: 49a4e6a9717260a578caa209ada9673c804a48e1
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 15 23:20:48 2024 +0000
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Thu Feb 15 23:20:48 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=49a4e6a9
sys-kernel/linux-firmware: drop 20240115-r2
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
.../files/linux-firmware-copy-firmware-r2.patch | 60 ---
.../linux-firmware-20240115-r2.ebuild | 401 ---------------------
2 files changed, 461 deletions(-)
diff --git a/sys-kernel/linux-firmware/files/linux-firmware-copy-firmware-r2.patch b/sys-kernel/linux-firmware/files/linux-firmware-copy-firmware-r2.patch
deleted file mode 100644
index 0c9b5ecfca70..000000000000
--- a/sys-kernel/linux-firmware/files/linux-firmware-copy-firmware-r2.patch
+++ /dev/null
@@ -1,60 +0,0 @@
-From 4eee756fa1e02c3e8ea168ac0efa16b30dae3b25 Mon Sep 17 00:00:00 2001
-From: Mike Pagano <mpagano@gentoo.org>
-Date: Sat, 23 Dec 2023 13:14:58 -0500
-Subject: [PATCH] [PATCH] copy-firmware.sh: Support passing in firmware files
- to install
-Cc: mpagano@gentoo.org
-
-This change adds support to copy-firmware.sh to accept a space separated
-list of firmware files to install.
-
-This allows our users to define a small subset of needed firmware files
-their system requires without installing every firmware file included
-from the repository.
-
-Signed-off-by: Mike Pagano <mpagano@gentoo.org>
----
- copy-firmware.sh | 12 ++++++++++++
- 1 file changed, 12 insertions(+)
-
-diff --git a/copy-firmware.sh b/copy-firmware.sh
-index 6757c6ce..d954230d 100755
---- a/copy-firmware.sh
-+++ b/copy-firmware.sh
-@@ -50,6 +50,16 @@ while test $# -gt 0; do
- shift
- ;;
-
-+ --firmware-list)
-+ if [ -n "$2" ]; then
-+ FIRMWARE_LIST=$2
-+ shift 2
-+ else
-+ echo "ERROR: '--firmware-list' requires a non-empty option argument of firmware files to install"
-+ exit 1
-+ fi
-+ ;;
-+
- -*)
- if test "$compress" = "cat"; then
- echo "ERROR: unknown command-line option: $1"
-@@ -85,6 +95,8 @@ fi
-+ echo "destdir is ${destdir}"
- # shellcheck disable=SC2162 # file/folder name can include escaped symbols
- grep -E '^(RawFile|File):' WHENCE | sed -E -e 's/^(RawFile|File): */\1 /;s/"//g' | while read k f; do
- test -f "$f" || continue
-+ if ! echo "${FIRMWARE_LIST}" | grep -q "${f}"; then continue; fi
- install -d "$destdir/$(dirname "$f")"
- $verbose "copying/compressing file $f$compext"
- if test "$compress" != "cat" && test "$k" = "RawFile"; then
-@@ -107,6 +118,7 @@ fi
-
- # shellcheck disable=SC2162 # file/folder name can include escaped symbols
- grep -E '^Link:' WHENCE | sed -e 's/^Link: *//g;s/-> //g' | while read f d; do
-+ if ! echo "${FIRMWARE_LIST}" | grep -q "${f}"; then continue; fi
- if test -L "$f$compext"; then
- test -f "$destdir/$f$compext" && continue
- $verbose "copying link $f$compext"
---
-2.41.0
-
diff --git a/sys-kernel/linux-firmware/linux-firmware-20240115-r2.ebuild b/sys-kernel/linux-firmware/linux-firmware-20240115-r2.ebuild
deleted file mode 100644
index 13f076e3531b..000000000000
--- a/sys-kernel/linux-firmware/linux-firmware-20240115-r2.ebuild
+++ /dev/null
@@ -1,401 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-inherit linux-info mount-boot savedconfig multiprocessing
-
-# In case this is a real snapshot, fill in commit below.
-# For normal, tagged releases, leave blank
-MY_COMMIT=""
-
-if [[ ${PV} == 99999999* ]]; then
- inherit git-r3
- EGIT_REPO_URI="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/${PN}.git"
-else
- if [[ -n "${MY_COMMIT}" ]]; then
- SRC_URI="https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/snapshot/${MY_COMMIT}.tar.gz -> ${P}.tar.gz"
- S="${WORKDIR}/${MY_COMMIT}"
- else
- SRC_URI="https://mirrors.edge.kernel.org/pub/linux/kernel/firmware/${P}.tar.xz"
- fi
-
- KEYWORDS="-alpha -amd64 -arm -arm64 -hppa -ia64 -loong -m68k -mips -ppc -ppc64 -riscv -s390 -sparc -x86"
-fi
-
-DESCRIPTION="Linux firmware files"
-HOMEPAGE="https://git.kernel.org/?p=linux/kernel/git/firmware/linux-firmware.git"
-
-LICENSE="GPL-2 GPL-2+ GPL-3 BSD MIT || ( MPL-1.1 GPL-2 )
- redistributable? ( linux-fw-redistributable BSD-2 BSD BSD-4 ISC MIT )
- unknown-license? ( all-rights-reserved )"
-SLOT="0"
-IUSE="compress-xz compress-zstd deduplicate initramfs +redistributable savedconfig unknown-license"
-REQUIRED_USE="initramfs? ( redistributable )
- ?? ( compress-xz compress-zstd )
- savedconfig? ( !deduplicate )"
-
-RESTRICT="binchecks strip test
- unknown-license? ( bindist )"
-
-BDEPEND="initramfs? ( app-alternatives/cpio )
- compress-xz? ( app-arch/xz-utils )
- compress-zstd? ( app-arch/zstd )
- deduplicate? ( app-misc/rdfind )"
-
-#add anything else that collides to this
-RDEPEND="!savedconfig? (
- redistributable? (
- !sys-firmware/alsa-firmware[alsa_cards_ca0132]
- !sys-block/qla-fc-firmware
- !sys-firmware/iwl1000-ucode
- !sys-firmware/iwl6005-ucode
- !sys-firmware/iwl6030-ucode
- !sys-firmware/iwl3160-ucode
- !sys-firmware/iwl7260-ucode
- !sys-firmware/iwl3160-7260-bt-ucode
- !sys-firmware/raspberrypi-wifi-ucode
- )
- unknown-license? (
- !sys-firmware/alsa-firmware[alsa_cards_korg1212]
- !sys-firmware/alsa-firmware[alsa_cards_maestro3]
- !sys-firmware/alsa-firmware[alsa_cards_sb16]
- !sys-firmware/alsa-firmware[alsa_cards_ymfpci]
- )
- )"
-
-QA_PREBUILT="*"
-PATCHES=( "${FILESDIR}"/${PN}-copy-firmware-r2.patch )
-
-pkg_pretend() {
- use initramfs && mount-boot_pkg_pretend
-}
-
-pkg_setup() {
- if use compress-xz || use compress-zstd ; then
- local CONFIG_CHECK
-
- if kernel_is -ge 5 19; then
- use compress-xz && CONFIG_CHECK="~FW_LOADER_COMPRESS_XZ"
- use compress-zstd && CONFIG_CHECK="~FW_LOADER_COMPRESS_ZSTD"
- else
- use compress-xz && CONFIG_CHECK="~FW_LOADER_COMPRESS"
- if use compress-zstd; then
- eerror "Kernels <5.19 do not support ZSTD-compressed firmware files"
- fi
- fi
- linux-info_pkg_setup
- fi
-}
-
-src_unpack() {
- if [[ ${PV} == 99999999* ]]; then
- git-r3_src_unpack
- else
- default
- # rename directory from git snapshot tarball
- if [[ ${#GIT_COMMIT} -gt 8 ]]; then
- mv ${PN}-*/ ${P} || die
- fi
- fi
-}
-
-src_prepare() {
-
- default
-
- find . -type f -not -perm 0644 -print0 \
- | xargs --null --no-run-if-empty chmod 0644 \
- || die
-
- chmod +x copy-firmware.sh || die
-
- if use initramfs; then
- if [[ -d "${S}/amd-ucode" ]]; then
- local UCODETMP="${T}/ucode_tmp"
- local UCODEDIR="${UCODETMP}/kernel/x86/microcode"
- mkdir -p "${UCODEDIR}" || die
- echo 1 > "${UCODETMP}/early_cpio"
-
- local amd_ucode_file="${UCODEDIR}/AuthenticAMD.bin"
- cat "${S}"/amd-ucode/*.bin > "${amd_ucode_file}" || die "Failed to concat amd cpu ucode"
-
- if [[ ! -s "${amd_ucode_file}" ]]; then
- die "Sanity check failed: '${amd_ucode_file}' is empty!"
- fi
-
- pushd "${UCODETMP}" &>/dev/null || die
- find . -print0 | cpio --quiet --null -o -H newc -R 0:0 > "${S}"/amd-uc.img
- popd &>/dev/null || die
- if [[ ! -s "${S}/amd-uc.img" ]]; then
- die "Failed to create '${S}/amd-uc.img'!"
- fi
- else
- # If this will ever happen something has changed which
- # must be reviewed
- die "'${S}/amd-ucode' not found!"
- fi
- fi
-
- # whitelist of misc files
- local misc_files=(
- copy-firmware.sh
- WHENCE
- README
- )
-
- # whitelist of images with a free software license
- local free_software=(
- # keyspan_pda (GPL-2+)
- keyspan_pda/keyspan_pda.fw
- keyspan_pda/xircom_pgs.fw
- # dsp56k (GPL-2+)
- dsp56k/bootstrap.bin
- # ath9k_htc (BSD GPL-2+ MIT)
- ath9k_htc/htc_7010-1.4.0.fw
- ath9k_htc/htc_9271-1.4.0.fw
- # pcnet_cs, 3c589_cs, 3c574_cs, serial_cs (dual GPL-2/MPL-1.1)
- cis/LA-PCM.cis
- cis/PCMLM28.cis
- cis/DP83903.cis
- cis/NE2K.cis
- cis/tamarack.cis
- cis/PE-200.cis
- cis/PE520.cis
- cis/3CXEM556.cis
- cis/3CCFEM556.cis
- cis/MT5634ZLX.cis
- cis/RS-COM-2P.cis
- cis/COMpad2.cis
- cis/COMpad4.cis
- # serial_cs (GPL-3)
- cis/SW_555_SER.cis
- cis/SW_7xx_SER.cis
- cis/SW_8xx_SER.cis
- # dvb-ttpci (GPL-2+)
- av7110/bootcode.bin
- # usbdux, usbduxfast, usbduxsigma (GPL-2+)
- usbdux_firmware.bin
- usbduxfast_firmware.bin
- usbduxsigma_firmware.bin
- # brcmfmac (GPL-2+)
- brcm/brcmfmac4330-sdio.Prowise-PT301.txt
- brcm/brcmfmac43340-sdio.meegopad-t08.txt
- brcm/brcmfmac43362-sdio.cubietech,cubietruck.txt
- brcm/brcmfmac43362-sdio.lemaker,bananapro.txt
- brcm/brcmfmac43430a0-sdio.jumper-ezpad-mini3.txt
- "brcm/brcmfmac43430a0-sdio.ONDA-V80 PLUS.txt"
- brcm/brcmfmac43430-sdio.AP6212.txt
- brcm/brcmfmac43430-sdio.Hampoo-D2D3_Vi8A1.txt
- brcm/brcmfmac43430-sdio.MUR1DX.txt
- brcm/brcmfmac43430-sdio.raspberrypi,3-model-b.txt
- brcm/brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt
- brcm/brcmfmac4356-pcie.gpd-win-pocket.txt
- # isci (GPL-2)
- isci/isci_firmware.bin
- # carl9170 (GPL-2+)
- carl9170-1.fw
- # atusb (GPL-2+)
- atusb/atusb-0.2.dfu
- atusb/atusb-0.3.dfu
- atusb/rzusb-0.3.bin
- # mlxsw_spectrum (dual BSD/GPL-2)
- mellanox/mlxsw_spectrum-13.1420.122.mfa2
- mellanox/mlxsw_spectrum-13.1530.152.mfa2
- mellanox/mlxsw_spectrum-13.1620.192.mfa2
- mellanox/mlxsw_spectrum-13.1702.6.mfa2
- mellanox/mlxsw_spectrum-13.1703.4.mfa2
- mellanox/mlxsw_spectrum-13.1910.622.mfa2
- mellanox/mlxsw_spectrum-13.2000.1122.mfa2
- )
-
- # blacklist of images with unknown license
- local unknown_license=(
- korg/k1212.dsp
- ess/maestro3_assp_kernel.fw
- ess/maestro3_assp_minisrc.fw
- yamaha/ds1_ctrl.fw
- yamaha/ds1_dsp.fw
- yamaha/ds1e_ctrl.fw
- ttusb-budget/dspbootcode.bin
- emi62/bitstream.fw
- emi62/loader.fw
- emi62/midi.fw
- emi62/spdif.fw
- ti_3410.fw
- ti_5052.fw
- mts_mt9234mu.fw
- mts_mt9234zba.fw
- whiteheat.fw
- whiteheat_loader.fw
- cpia2/stv0672_vp4.bin
- vicam/firmware.fw
- edgeport/boot.fw
- edgeport/boot2.fw
- edgeport/down.fw
- edgeport/down2.fw
- edgeport/down3.bin
- sb16/mulaw_main.csp
- sb16/alaw_main.csp
- sb16/ima_adpcm_init.csp
- sb16/ima_adpcm_playback.csp
- sb16/ima_adpcm_capture.csp
- sun/cassini.bin
- acenic/tg1.bin
- acenic/tg2.bin
- adaptec/starfire_rx.bin
- adaptec/starfire_tx.bin
- yam/1200.bin
- yam/9600.bin
- ositech/Xilinx7OD.bin
- qlogic/isp1000.bin
- myricom/lanai.bin
- yamaha/yss225_registers.bin
- lgs8g75.fw
- )
-
- if use !unknown-license; then
- einfo "Removing files with unknown license ..."
- rm -v "${unknown_license[@]}" || die
- fi
-
- if use !redistributable; then
- # remove files _not_ in the free_software or unknown_license lists
- # everything else is confirmed (or assumed) to be redistributable
- # based on upstream acceptance policy
- einfo "Removing non-redistributable files ..."
- local OLDIFS="${IFS}"
- local IFS=$'\n'
- set -o pipefail
- find ! -type d -printf "%P\n" \
- | grep -Fvx -e "${misc_files[*]}" -e "${free_software[*]}" -e "${unknown_license[*]}" \
- | xargs -d '\n' --no-run-if-empty rm -v
-
- [[ ${?} -ne 0 ]] && die "Failed to remove non-redistributable files"
-
- IFS="${OLDIFS}"
- fi
-
- restore_config ${PN}.conf
-}
-
-src_install() {
-
- local LINUX_FIRMWARE_SAVED_CONFIG_FILES=
- local FW_OPTIONS=( "-v" )
-
- if use savedconfig; then
- if [[ -s "${S}/${PN}.conf" ]]; then
- files_to_keep="${T}/files_to_keep.lst"
- grep -v '^#' "${S}/${PN}.conf" 2>/dev/null > "${files_to_keep}" || die
- [[ -s "${files_to_keep}" ]] || die "grep failed, empty config file?"
- LINUX_FIRMWARE_SAVED_CONFIG_FILES=$(<${files_to_keep})
- LINUX_FIRMWARE_SAVED_CONFIG_FILES="${LINUX_FIRMWARE_SAVED_CONFIG_FILES//$'\n'/ }"
- FW_OPTIONS+=( "--firmware-list" "${LINUX_FIRMWARE_SAVED_CONFIG_FILES[@]}" )
- fi
- fi
-
- ! use deduplicate && FW_OPTIONS+=( "--ignore-duplicates" )
- FW_OPTIONS+=( "${ED}/lib/firmware" )
- ./copy-firmware.sh "${FW_OPTIONS[@]}"
-
- pushd "${ED}/lib/firmware" &>/dev/null || die
-
- # especially use !redistributable will cause some broken symlinks
- einfo "Removing broken symlinks ..."
- find * -xtype l -print -delete || die
-
- # remove empty directories, bug #396073
- find -type d -empty -delete || die
-
- # sanity check
- if ! ( shopt -s failglob; : * ) 2>/dev/null; then
- eerror "No files to install. Check your USE flag settings"
- eerror "and the list of files in your saved configuration."
- die "Refusing to install an empty package"
- fi
-
- # create config file
- echo "# Remove files that shall not be installed from this list." > "${S}"/${PN}.conf || die
- find * ! -type d >> "${S}"/${PN}.conf || die
- save_config "${S}"/${PN}.conf
-
- if use compress-xz || use compress-zstd; then
- einfo "Compressing firmware ..."
- local target
- local ext
- local compressor
-
- if use compress-xz; then
- ext=xz
- compressor="xz -T1 -C crc32"
- elif use compress-zstd; then
- ext=zst
- compressor="zstd -15 -T1 -C -q --rm"
- fi
-
- # rename symlinks
- while IFS= read -r -d '' f; do
- # skip symlinks pointing to directories
- [[ -d ${f} ]] && continue
-
- target=$(readlink "${f}")
- [[ $? -eq 0 ]] || die
- ln -sf "${target}".${ext} "${f}" || die
- mv -T "${f}" "${f}".${ext} || die
- done < <(find . -type l -print0) || die
-
- find . -type f ! -path "./amd-ucode/*" -print0 | \
- xargs -0 -P $(makeopts_jobs) -I'{}' ${compressor} '{}' || die
-
- fi
-
- popd &>/dev/null || die
-
- if use initramfs ; then
- insinto /boot
- doins "${S}"/amd-uc.img
- fi
-}
-
-pkg_preinst() {
- if use savedconfig; then
- ewarn "USE=savedconfig is active. You must handle file collisions manually."
- fi
-
- # Fix 'symlink is blocked by a directory' Bug #871315
- if has_version "<${CATEGORY}/${PN}-20220913-r2" ; then
- rm -rf "${EROOT}"/lib/firmware/qcom/LENOVO/21BX
- fi
-
- # Make sure /boot is available if needed.
- use initramfs && mount-boot_pkg_preinst
-}
-
-pkg_postinst() {
- elog "If you are only interested in particular firmware files, edit the saved"
- elog "configfile and remove those that you do not want."
-
- local ver
- for ver in ${REPLACING_VERSIONS}; do
- if ver_test ${ver} -lt 20190514; then
- elog
- elog 'Starting with version 20190514, installation of many firmware'
- elog 'files is controlled by USE flags. Please review your USE flag'
- elog 'and package.license settings if you are missing some files.'
- break
- fi
- done
-
- # Don't forget to umount /boot if it was previously mounted by us.
- use initramfs && mount-boot_pkg_postinst
-}
-
-pkg_prerm() {
- # Make sure /boot is mounted so that we can remove /boot/amd-uc.img!
- use initramfs && mount-boot_pkg_prerm
-}
-
-pkg_postrm() {
- # Don't forget to umount /boot if it was previously mounted by us.
- use initramfs && mount-boot_pkg_postrm
-}
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-kernel/linux-firmware/files/, sys-kernel/linux-firmware/
@ 2024-02-16 23:11 Mike Pagano
0 siblings, 0 replies; 11+ messages in thread
From: Mike Pagano @ 2024-02-16 23:11 UTC (permalink / raw
To: gentoo-commits
commit: adcfca8c044a7530344bfe9295e2f4acd9121de2
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 16 23:10:52 2024 +0000
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Fri Feb 16 23:10:52 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=adcfca8c
sys-kernel/linux-firmware: drop 20240115-r1
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
.../files/linux-firmware-copy-firmware.patch | 59 ---
.../linux-firmware-20240115-r1.ebuild | 403 ---------------------
2 files changed, 462 deletions(-)
diff --git a/sys-kernel/linux-firmware/files/linux-firmware-copy-firmware.patch b/sys-kernel/linux-firmware/files/linux-firmware-copy-firmware.patch
deleted file mode 100644
index b6ff69d1f577..000000000000
--- a/sys-kernel/linux-firmware/files/linux-firmware-copy-firmware.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-From 4eee756fa1e02c3e8ea168ac0efa16b30dae3b25 Mon Sep 17 00:00:00 2001
-From: Mike Pagano <mpagano@gentoo.org>
-Date: Sat, 23 Dec 2023 13:14:58 -0500
-Subject: [PATCH] [PATCH] copy-firmware.sh: Support passing in firmware files
- to install
-Cc: mpagano@gentoo.org
-
-This change adds support to copy-firmware.sh to accept a space separated
-list of firmware files to install.
-
-This allows our users to define a small subset of needed firmware files
-their system requires without installing every firmware file included
-from the repository.
-
-Signed-off-by: Mike Pagano <mpagano@gentoo.org>
----
- copy-firmware.sh | 12 ++++++++++++
- 1 file changed, 12 insertions(+)
-
-diff --git a/copy-firmware.sh b/copy-firmware.sh
-index 6757c6ce..d954230d 100755
---- a/copy-firmware.sh
-+++ b/copy-firmware.sh
-@@ -50,6 +50,16 @@ while test $# -gt 0; do
- shift
- ;;
-
-+ --firmware-list)
-+ if [ -n "$2" ]; then
-+ FIRMWARE_LIST=$2
-+ shift 2
-+ else
-+ echo "ERROR: '--firmware-list' requires a non-empty option argument of firmware files to install"
-+ exit 1
-+ fi
-+ ;;
-+
- -*)
- if test "$compress" = "cat"; then
- echo "ERROR: unknown command-line option: $1"
-@@ -85,6 +95,7 @@ fi
- # shellcheck disable=SC2162 # file/folder name can include escaped symbols
- grep -E '^(RawFile|File):' WHENCE | sed -E -e 's/^(RawFile|File): */\1 /;s/"//g' | while read k f; do
- test -f "$f" || continue
-+ [ -n "${FIRMWARE_LIST##*"$f"*}" ] && continue
- install -d "$destdir/$(dirname "$f")"
- $verbose "copying/compressing file $f$compext"
- if test "$compress" != "cat" && test "$k" = "RawFile"; then
-@@ -107,6 +118,7 @@ fi
-
- # shellcheck disable=SC2162 # file/folder name can include escaped symbols
- grep -E '^Link:' WHENCE | sed -e 's/^Link: *//g;s/-> //g' | while read f d; do
-+ [ -n "${FIRMWARE_LIST##*"$f"*}" ] && continue
- if test -L "$f$compext"; then
- test -f "$destdir/$f$compext" && continue
- $verbose "copying link $f$compext"
---
-2.41.0
-
diff --git a/sys-kernel/linux-firmware/linux-firmware-20240115-r1.ebuild b/sys-kernel/linux-firmware/linux-firmware-20240115-r1.ebuild
deleted file mode 100644
index 950b3319518a..000000000000
--- a/sys-kernel/linux-firmware/linux-firmware-20240115-r1.ebuild
+++ /dev/null
@@ -1,403 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-inherit linux-info mount-boot savedconfig multiprocessing
-
-# In case this is a real snapshot, fill in commit below.
-# For normal, tagged releases, leave blank
-MY_COMMIT=""
-
-if [[ ${PV} == 99999999* ]]; then
- inherit git-r3
- EGIT_REPO_URI="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/${PN}.git"
-else
- if [[ -n "${MY_COMMIT}" ]]; then
- SRC_URI="https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/snapshot/${MY_COMMIT}.tar.gz -> ${P}.tar.gz"
- S="${WORKDIR}/${MY_COMMIT}"
- else
- SRC_URI="https://mirrors.edge.kernel.org/pub/linux/kernel/firmware/${P}.tar.xz"
- fi
-
- KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-fi
-
-DESCRIPTION="Linux firmware files"
-HOMEPAGE="https://git.kernel.org/?p=linux/kernel/git/firmware/linux-firmware.git"
-
-LICENSE="GPL-2 GPL-2+ GPL-3 BSD MIT || ( MPL-1.1 GPL-2 )
- redistributable? ( linux-fw-redistributable BSD-2 BSD BSD-4 ISC MIT )
- unknown-license? ( all-rights-reserved )"
-SLOT="0"
-IUSE="compress-xz compress-zstd deduplicate initramfs +redistributable savedconfig unknown-license"
-REQUIRED_USE="initramfs? ( redistributable )
- ?? ( compress-xz compress-zstd )
- savedconfig? ( !deduplicate )"
-
-RESTRICT="binchecks strip test
- unknown-license? ( bindist )"
-
-BDEPEND="initramfs? ( app-alternatives/cpio )
- compress-xz? ( app-arch/xz-utils )
- compress-zstd? ( app-arch/zstd )
- deduplicate? ( app-misc/rdfind )"
-
-#add anything else that collides to this
-RDEPEND="!savedconfig? (
- redistributable? (
- !sys-firmware/alsa-firmware[alsa_cards_ca0132]
- !sys-block/qla-fc-firmware
- !sys-firmware/iwl1000-ucode
- !sys-firmware/iwl6005-ucode
- !sys-firmware/iwl6030-ucode
- !sys-firmware/iwl3160-ucode
- !sys-firmware/iwl7260-ucode
- !sys-firmware/iwl3160-7260-bt-ucode
- !sys-firmware/raspberrypi-wifi-ucode
- )
- unknown-license? (
- !sys-firmware/alsa-firmware[alsa_cards_korg1212]
- !sys-firmware/alsa-firmware[alsa_cards_maestro3]
- !sys-firmware/alsa-firmware[alsa_cards_sb16]
- !sys-firmware/alsa-firmware[alsa_cards_ymfpci]
- )
- )"
-
-QA_PREBUILT="*"
-PATCHES=( "${FILESDIR}"/${PN}-copy-firmware.patch )
-
-pkg_pretend() {
- use initramfs && mount-boot_pkg_pretend
-}
-
-pkg_setup() {
- if use compress-xz || use compress-zstd ; then
- local CONFIG_CHECK
-
- if kernel_is -ge 5 19; then
- use compress-xz && CONFIG_CHECK="~FW_LOADER_COMPRESS_XZ"
- use compress-zstd && CONFIG_CHECK="~FW_LOADER_COMPRESS_ZSTD"
- else
- use compress-xz && CONFIG_CHECK="~FW_LOADER_COMPRESS"
- if use compress-zstd; then
- eerror "Kernels <5.19 do not support ZSTD-compressed firmware files"
- fi
- fi
- linux-info_pkg_setup
- fi
-}
-
-src_unpack() {
- if [[ ${PV} == 99999999* ]]; then
- git-r3_src_unpack
- else
- default
- # rename directory from git snapshot tarball
- if [[ ${#GIT_COMMIT} -gt 8 ]]; then
- mv ${PN}-*/ ${P} || die
- fi
- fi
-}
-
-src_prepare() {
-
- default
-
- find . -type f -not -perm 0644 -print0 \
- | xargs --null --no-run-if-empty chmod 0644 \
- || die
-
- chmod +x copy-firmware.sh || die
-
- if use initramfs; then
- if [[ -d "${S}/amd-ucode" ]]; then
- local UCODETMP="${T}/ucode_tmp"
- local UCODEDIR="${UCODETMP}/kernel/x86/microcode"
- mkdir -p "${UCODEDIR}" || die
- echo 1 > "${UCODETMP}/early_cpio"
-
- local amd_ucode_file="${UCODEDIR}/AuthenticAMD.bin"
- cat "${S}"/amd-ucode/*.bin > "${amd_ucode_file}" || die "Failed to concat amd cpu ucode"
-
- if [[ ! -s "${amd_ucode_file}" ]]; then
- die "Sanity check failed: '${amd_ucode_file}' is empty!"
- fi
-
- pushd "${UCODETMP}" &>/dev/null || die
- find . -print0 | cpio --quiet --null -o -H newc -R 0:0 > "${S}"/amd-uc.img
- popd &>/dev/null || die
- if [[ ! -s "${S}/amd-uc.img" ]]; then
- die "Failed to create '${S}/amd-uc.img'!"
- fi
- else
- # If this will ever happen something has changed which
- # must be reviewed
- die "'${S}/amd-ucode' not found!"
- fi
- fi
-
- # whitelist of misc files
- local misc_files=(
- copy-firmware.sh
- WHENCE
- README
- )
-
- # whitelist of images with a free software license
- local free_software=(
- # keyspan_pda (GPL-2+)
- keyspan_pda/keyspan_pda.fw
- keyspan_pda/xircom_pgs.fw
- # dsp56k (GPL-2+)
- dsp56k/bootstrap.bin
- # ath9k_htc (BSD GPL-2+ MIT)
- ath9k_htc/htc_7010-1.4.0.fw
- ath9k_htc/htc_9271-1.4.0.fw
- # pcnet_cs, 3c589_cs, 3c574_cs, serial_cs (dual GPL-2/MPL-1.1)
- cis/LA-PCM.cis
- cis/PCMLM28.cis
- cis/DP83903.cis
- cis/NE2K.cis
- cis/tamarack.cis
- cis/PE-200.cis
- cis/PE520.cis
- cis/3CXEM556.cis
- cis/3CCFEM556.cis
- cis/MT5634ZLX.cis
- cis/RS-COM-2P.cis
- cis/COMpad2.cis
- cis/COMpad4.cis
- # serial_cs (GPL-3)
- cis/SW_555_SER.cis
- cis/SW_7xx_SER.cis
- cis/SW_8xx_SER.cis
- # dvb-ttpci (GPL-2+)
- av7110/bootcode.bin
- # usbdux, usbduxfast, usbduxsigma (GPL-2+)
- usbdux_firmware.bin
- usbduxfast_firmware.bin
- usbduxsigma_firmware.bin
- # brcmfmac (GPL-2+)
- brcm/brcmfmac4330-sdio.Prowise-PT301.txt
- brcm/brcmfmac43340-sdio.meegopad-t08.txt
- brcm/brcmfmac43362-sdio.cubietech,cubietruck.txt
- brcm/brcmfmac43362-sdio.lemaker,bananapro.txt
- brcm/brcmfmac43430a0-sdio.jumper-ezpad-mini3.txt
- "brcm/brcmfmac43430a0-sdio.ONDA-V80 PLUS.txt"
- brcm/brcmfmac43430-sdio.AP6212.txt
- brcm/brcmfmac43430-sdio.Hampoo-D2D3_Vi8A1.txt
- brcm/brcmfmac43430-sdio.MUR1DX.txt
- brcm/brcmfmac43430-sdio.raspberrypi,3-model-b.txt
- brcm/brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt
- brcm/brcmfmac4356-pcie.gpd-win-pocket.txt
- # isci (GPL-2)
- isci/isci_firmware.bin
- # carl9170 (GPL-2+)
- carl9170-1.fw
- # atusb (GPL-2+)
- atusb/atusb-0.2.dfu
- atusb/atusb-0.3.dfu
- atusb/rzusb-0.3.bin
- # mlxsw_spectrum (dual BSD/GPL-2)
- mellanox/mlxsw_spectrum-13.1420.122.mfa2
- mellanox/mlxsw_spectrum-13.1530.152.mfa2
- mellanox/mlxsw_spectrum-13.1620.192.mfa2
- mellanox/mlxsw_spectrum-13.1702.6.mfa2
- mellanox/mlxsw_spectrum-13.1703.4.mfa2
- mellanox/mlxsw_spectrum-13.1910.622.mfa2
- mellanox/mlxsw_spectrum-13.2000.1122.mfa2
- )
-
- # blacklist of images with unknown license
- local unknown_license=(
- korg/k1212.dsp
- ess/maestro3_assp_kernel.fw
- ess/maestro3_assp_minisrc.fw
- yamaha/ds1_ctrl.fw
- yamaha/ds1_dsp.fw
- yamaha/ds1e_ctrl.fw
- ttusb-budget/dspbootcode.bin
- emi62/bitstream.fw
- emi62/loader.fw
- emi62/midi.fw
- emi62/spdif.fw
- ti_3410.fw
- ti_5052.fw
- mts_mt9234mu.fw
- mts_mt9234zba.fw
- whiteheat.fw
- whiteheat_loader.fw
- cpia2/stv0672_vp4.bin
- vicam/firmware.fw
- edgeport/boot.fw
- edgeport/boot2.fw
- edgeport/down.fw
- edgeport/down2.fw
- edgeport/down3.bin
- sb16/mulaw_main.csp
- sb16/alaw_main.csp
- sb16/ima_adpcm_init.csp
- sb16/ima_adpcm_playback.csp
- sb16/ima_adpcm_capture.csp
- sun/cassini.bin
- acenic/tg1.bin
- acenic/tg2.bin
- adaptec/starfire_rx.bin
- adaptec/starfire_tx.bin
- yam/1200.bin
- yam/9600.bin
- ositech/Xilinx7OD.bin
- qlogic/isp1000.bin
- myricom/lanai.bin
- yamaha/yss225_registers.bin
- lgs8g75.fw
- )
-
- if use !unknown-license; then
- einfo "Removing files with unknown license ..."
- rm -v "${unknown_license[@]}" || die
- fi
-
- if use !redistributable; then
- # remove files _not_ in the free_software or unknown_license lists
- # everything else is confirmed (or assumed) to be redistributable
- # based on upstream acceptance policy
- einfo "Removing non-redistributable files ..."
- local OLDIFS="${IFS}"
- local IFS=$'\n'
- set -o pipefail
- find ! -type d -printf "%P\n" \
- | grep -Fvx -e "${misc_files[*]}" -e "${free_software[*]}" -e "${unknown_license[*]}" \
- | xargs -d '\n' --no-run-if-empty rm -v
-
- [[ ${?} -ne 0 ]] && die "Failed to remove non-redistributable files"
-
- IFS="${OLDIFS}"
- fi
-
- restore_config ${PN}.conf
-}
-
-src_install() {
-
- local LINUX_FIRMWARE_SAVED_CONFIG_FILES=
- local FW_OPTIONS=( "-v" )
-
- if use savedconfig; then
- if [[ -s "${S}/${PN}.conf" ]]; then
- files_to_keep="${T}/files_to_keep.lst"
- grep -v '^#' "${S}/${PN}.conf" 2>/dev/null > "${files_to_keep}" || die
- [[ -s "${files_to_keep}" ]] || die "grep failed, empty config file?"
- LINUX_FIRMWARE_SAVED_CONFIG_FILES=$(<${files_to_keep})
- LINUX_FIRMWARE_SAVED_CONFIG_FILES="${LINUX_FIRMWARE_SAVED_CONFIG_FILES//$'\n'/ }"
- FW_OPTIONS+=( "--firmware-list" "${LINUX_FIRMWARE_SAVED_CONFIG_FILES[@]}" )
- fi
- fi
-
- ! use deduplicate && FW_OPTIONS+=( "--ignore-duplicates" )
- FW_OPTIONS+=( "${ED}/lib/firmware" )
- ./copy-firmware.sh "${FW_OPTIONS[@]}"
-
- echo "calling copy-firmwaare.sh ${FW_OPTIONS[@]}"
-
- pushd "${ED}/lib/firmware" &>/dev/null || die
-
- # especially use !redistributable will cause some broken symlinks
- einfo "Removing broken symlinks ..."
- find * -xtype l -print -delete || die
-
- # remove empty directories, bug #396073
- find -type d -empty -delete || die
-
- # sanity check
- if ! ( shopt -s failglob; : * ) 2>/dev/null; then
- eerror "No files to install. Check your USE flag settings"
- eerror "and the list of files in your saved configuration."
- die "Refusing to install an empty package"
- fi
-
- # create config file
- echo "# Remove files that shall not be installed from this list." > "${S}"/${PN}.conf || die
- find * ! -type d >> "${S}"/${PN}.conf || die
- save_config "${S}"/${PN}.conf
-
- if use compress-xz || use compress-zstd; then
- einfo "Compressing firmware ..."
- local target
- local ext
- local compressor
-
- if use compress-xz; then
- ext=xz
- compressor="xz -T1 -C crc32"
- elif use compress-zstd; then
- ext=zst
- compressor="zstd -15 -T1 -C -q --rm"
- fi
-
- # rename symlinks
- while IFS= read -r -d '' f; do
- # skip symlinks pointing to directories
- [[ -d ${f} ]] && continue
-
- target=$(readlink "${f}")
- [[ $? -eq 0 ]] || die
- ln -sf "${target}".${ext} "${f}" || die
- mv -T "${f}" "${f}".${ext} || die
- done < <(find . -type l -print0) || die
-
- find . -type f ! -path "./amd-ucode/*" -print0 | \
- xargs -0 -P $(makeopts_jobs) -I'{}' ${compressor} '{}' || die
-
- fi
-
- popd &>/dev/null || die
-
- if use initramfs ; then
- insinto /boot
- doins "${S}"/amd-uc.img
- fi
-}
-
-pkg_preinst() {
- if use savedconfig; then
- ewarn "USE=savedconfig is active. You must handle file collisions manually."
- fi
-
- # Fix 'symlink is blocked by a directory' Bug #871315
- if has_version "<${CATEGORY}/${PN}-20220913-r2" ; then
- rm -rf "${EROOT}"/lib/firmware/qcom/LENOVO/21BX
- fi
-
- # Make sure /boot is available if needed.
- use initramfs && mount-boot_pkg_preinst
-}
-
-pkg_postinst() {
- elog "If you are only interested in particular firmware files, edit the saved"
- elog "configfile and remove those that you do not want."
-
- local ver
- for ver in ${REPLACING_VERSIONS}; do
- if ver_test ${ver} -lt 20190514; then
- elog
- elog 'Starting with version 20190514, installation of many firmware'
- elog 'files is controlled by USE flags. Please review your USE flag'
- elog 'and package.license settings if you are missing some files.'
- break
- fi
- done
-
- # Don't forget to umount /boot if it was previously mounted by us.
- use initramfs && mount-boot_pkg_postinst
-}
-
-pkg_prerm() {
- # Make sure /boot is mounted so that we can remove /boot/amd-uc.img!
- use initramfs && mount-boot_pkg_prerm
-}
-
-pkg_postrm() {
- # Don't forget to umount /boot if it was previously mounted by us.
- use initramfs && mount-boot_pkg_postrm
-}
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-kernel/linux-firmware/files/, sys-kernel/linux-firmware/
@ 2024-02-24 16:11 Mike Pagano
0 siblings, 0 replies; 11+ messages in thread
From: Mike Pagano @ 2024-02-24 16:11 UTC (permalink / raw
To: gentoo-commits
commit: ef17f21c1016796a9e010ce8586c0ef8dce7a85d
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Sat Feb 24 16:10:00 2024 +0000
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Sat Feb 24 16:10:00 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ef17f21c
sys-kernel/linux-firmware: Pass savedconfig vals as a file
Keeping posix commpatibility for upstream submission
Bug: https://bugs.gentoo.org/925297
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
.../files/linux-firmware-copy-firmware-r4.patch | 35 ++
.../linux-firmware-20240220-r2.ebuild | 405 +++++++++++++++++++++
2 files changed, 440 insertions(+)
diff --git a/sys-kernel/linux-firmware/files/linux-firmware-copy-firmware-r4.patch b/sys-kernel/linux-firmware/files/linux-firmware-copy-firmware-r4.patch
new file mode 100644
index 000000000000..f8b713bfe0f5
--- /dev/null
+++ b/sys-kernel/linux-firmware/files/linux-firmware-copy-firmware-r4.patch
@@ -0,0 +1,35 @@
+--- a/copy-firmware.sh 2024-02-24 10:47:41.073251066 -0500
++++ b/copy-firmware.sh 2024-02-24 10:25:45.283922934 -0500
+@@ -50,6 +50,16 @@ while test $# -gt 0; do
+ shift
+ ;;
+
++ --firmware-list)
++ if [ -n "$2" ]; then
++ FIRMWARE_LIST=`cat $2`
++ shift 2
++ else
++ echo "ERROR: '--firmware-list' requires a non-empty option argument of firmware files to install"
++ exit 1
++ fi
++ ;;
++
+ -*)
+ if test "$compress" = "cat"; then
+ echo "ERROR: unknown command-line option: $1"
+@@ -85,6 +95,7 @@ fi
+ # shellcheck disable=SC2162 # file/folder name can include escaped symbols
+ grep -E '^(RawFile|File):' WHENCE | sed -E -e 's/^(RawFile|File): */\1 /;s/"//g' | while read k f; do
+ test -f "$f" || continue
++ [ -n "${FIRMWARE_LIST}" ] && if ! echo "${FIRMWARE_LIST}" | grep -q "${f}"; then continue; fi
+ install -d "$destdir/$(dirname "$f")"
+ $verbose "copying/compressing file $f$compext"
+ if test "$compress" != "cat" && test "$k" = "RawFile"; then
+@@ -107,6 +118,7 @@ fi
+
+ # shellcheck disable=SC2162 # file/folder name can include escaped symbols
+ grep -E '^Link:' WHENCE | sed -e 's/^Link: *//g;s/-> //g' | while read f d; do
++ [ -n "${FIRMWARE_LIST}" ] && if ! echo "${FIRMWARE_LIST}" | grep -q "${f}"; then continue; fi
+ if test -L "$f$compext"; then
+ test -f "$destdir/$f$compext" && continue
+ $verbose "copying link $f$compext"
diff --git a/sys-kernel/linux-firmware/linux-firmware-20240220-r2.ebuild b/sys-kernel/linux-firmware/linux-firmware-20240220-r2.ebuild
new file mode 100644
index 000000000000..472d2802f8f3
--- /dev/null
+++ b/sys-kernel/linux-firmware/linux-firmware-20240220-r2.ebuild
@@ -0,0 +1,405 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+inherit linux-info mount-boot savedconfig multiprocessing
+
+# In case this is a real snapshot, fill in commit below.
+# For normal, tagged releases, leave blank
+MY_COMMIT=""
+
+if [[ ${PV} == 99999999* ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/${PN}.git"
+else
+ if [[ -n "${MY_COMMIT}" ]]; then
+ SRC_URI="https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/snapshot/${MY_COMMIT}.tar.gz -> ${P}.tar.gz"
+ S="${WORKDIR}/${MY_COMMIT}"
+ else
+ SRC_URI="https://mirrors.edge.kernel.org/pub/linux/kernel/firmware/${P}.tar.xz"
+ fi
+
+ KEYWORDS="-alpha -amd64 -arm -arm64 -hppa -ia64 -loong -m68k -mips -ppc -ppc64 -riscv -s390 -sparc -x86"
+fi
+
+DESCRIPTION="Linux firmware files"
+HOMEPAGE="https://git.kernel.org/?p=linux/kernel/git/firmware/linux-firmware.git"
+
+LICENSE="GPL-2 GPL-2+ GPL-3 BSD MIT || ( MPL-1.1 GPL-2 )
+ redistributable? ( linux-fw-redistributable BSD-2 BSD BSD-4 ISC MIT )
+ unknown-license? ( all-rights-reserved )"
+SLOT="0"
+IUSE="bindist compress-xz compress-zstd deduplicate initramfs +redistributable savedconfig unknown-license"
+REQUIRED_USE="initramfs? ( redistributable )
+ ?? ( compress-xz compress-zstd )
+ savedconfig? ( !deduplicate )"
+
+RESTRICT="binchecks strip test
+ !bindist? ( bindist )
+ unknown-license? ( bindist )"
+
+BDEPEND="initramfs? ( app-alternatives/cpio )
+ compress-xz? ( app-arch/xz-utils )
+ compress-zstd? ( app-arch/zstd )
+ deduplicate? ( app-misc/rdfind )"
+
+#add anything else that collides to this
+RDEPEND="!savedconfig? (
+ redistributable? (
+ !sys-firmware/alsa-firmware[alsa_cards_ca0132]
+ !sys-block/qla-fc-firmware
+ !sys-firmware/iwl1000-ucode
+ !sys-firmware/iwl6005-ucode
+ !sys-firmware/iwl6030-ucode
+ !sys-firmware/iwl3160-ucode
+ !sys-firmware/iwl7260-ucode
+ !sys-firmware/iwl3160-7260-bt-ucode
+ !sys-firmware/raspberrypi-wifi-ucode
+ )
+ unknown-license? (
+ !sys-firmware/alsa-firmware[alsa_cards_korg1212]
+ !sys-firmware/alsa-firmware[alsa_cards_maestro3]
+ !sys-firmware/alsa-firmware[alsa_cards_sb16]
+ !sys-firmware/alsa-firmware[alsa_cards_ymfpci]
+ )
+ )"
+
+QA_PREBUILT="*"
+PATCHES=( "${FILESDIR}"/${PN}-copy-firmware-r4.patch )
+
+pkg_pretend() {
+ use initramfs && mount-boot_pkg_pretend
+}
+
+pkg_setup() {
+ if use compress-xz || use compress-zstd ; then
+ local CONFIG_CHECK
+
+ if kernel_is -ge 5 19; then
+ use compress-xz && CONFIG_CHECK="~FW_LOADER_COMPRESS_XZ"
+ use compress-zstd && CONFIG_CHECK="~FW_LOADER_COMPRESS_ZSTD"
+ else
+ use compress-xz && CONFIG_CHECK="~FW_LOADER_COMPRESS"
+ if use compress-zstd; then
+ eerror "Kernels <5.19 do not support ZSTD-compressed firmware files"
+ fi
+ fi
+ linux-info_pkg_setup
+ fi
+}
+
+src_unpack() {
+ if [[ ${PV} == 99999999* ]]; then
+ git-r3_src_unpack
+ else
+ default
+ # rename directory from git snapshot tarball
+ if [[ ${#GIT_COMMIT} -gt 8 ]]; then
+ mv ${PN}-*/ ${P} || die
+ fi
+ fi
+}
+
+src_prepare() {
+
+ default
+
+ find . -type f -not -perm 0644 -print0 \
+ | xargs --null --no-run-if-empty chmod 0644 \
+ || die
+
+ chmod +x copy-firmware.sh || die
+
+ if use initramfs; then
+ if [[ -d "${S}/amd-ucode" ]]; then
+ local UCODETMP="${T}/ucode_tmp"
+ local UCODEDIR="${UCODETMP}/kernel/x86/microcode"
+ mkdir -p "${UCODEDIR}" || die
+ echo 1 > "${UCODETMP}/early_cpio"
+
+ local amd_ucode_file="${UCODEDIR}/AuthenticAMD.bin"
+ cat "${S}"/amd-ucode/*.bin > "${amd_ucode_file}" || die "Failed to concat amd cpu ucode"
+
+ if [[ ! -s "${amd_ucode_file}" ]]; then
+ die "Sanity check failed: '${amd_ucode_file}' is empty!"
+ fi
+
+ pushd "${UCODETMP}" &>/dev/null || die
+ find . -print0 | cpio --quiet --null -o -H newc -R 0:0 > "${S}"/amd-uc.img
+ popd &>/dev/null || die
+ if [[ ! -s "${S}/amd-uc.img" ]]; then
+ die "Failed to create '${S}/amd-uc.img'!"
+ fi
+ else
+ # If this will ever happen something has changed which
+ # must be reviewed
+ die "'${S}/amd-ucode' not found!"
+ fi
+ fi
+
+ # whitelist of misc files
+ local misc_files=(
+ copy-firmware.sh
+ README.md
+ WHENCE
+ LICEN[CS]E.*
+ )
+
+ # whitelist of images with a free software license
+ local free_software=(
+ # keyspan_pda (GPL-2+)
+ keyspan_pda/keyspan_pda.fw
+ keyspan_pda/xircom_pgs.fw
+ # dsp56k (GPL-2+)
+ dsp56k/bootstrap.bin
+ # ath9k_htc (BSD GPL-2+ MIT)
+ ath9k_htc/htc_7010-1.4.0.fw
+ ath9k_htc/htc_9271-1.4.0.fw
+ # pcnet_cs, 3c589_cs, 3c574_cs, serial_cs (dual GPL-2/MPL-1.1)
+ cis/LA-PCM.cis
+ cis/PCMLM28.cis
+ cis/DP83903.cis
+ cis/NE2K.cis
+ cis/tamarack.cis
+ cis/PE-200.cis
+ cis/PE520.cis
+ cis/3CXEM556.cis
+ cis/3CCFEM556.cis
+ cis/MT5634ZLX.cis
+ cis/RS-COM-2P.cis
+ cis/COMpad2.cis
+ cis/COMpad4.cis
+ # serial_cs (GPL-3)
+ cis/SW_555_SER.cis
+ cis/SW_7xx_SER.cis
+ cis/SW_8xx_SER.cis
+ # dvb-ttpci (GPL-2+)
+ av7110/bootcode.bin
+ # usbdux, usbduxfast, usbduxsigma (GPL-2+)
+ usbdux_firmware.bin
+ usbduxfast_firmware.bin
+ usbduxsigma_firmware.bin
+ # brcmfmac (GPL-2+)
+ brcm/brcmfmac4330-sdio.Prowise-PT301.txt
+ brcm/brcmfmac43340-sdio.meegopad-t08.txt
+ brcm/brcmfmac43362-sdio.cubietech,cubietruck.txt
+ brcm/brcmfmac43362-sdio.lemaker,bananapro.txt
+ brcm/brcmfmac43430a0-sdio.jumper-ezpad-mini3.txt
+ "brcm/brcmfmac43430a0-sdio.ONDA-V80 PLUS.txt"
+ brcm/brcmfmac43430-sdio.AP6212.txt
+ brcm/brcmfmac43430-sdio.Hampoo-D2D3_Vi8A1.txt
+ brcm/brcmfmac43430-sdio.MUR1DX.txt
+ brcm/brcmfmac43430-sdio.raspberrypi,3-model-b.txt
+ brcm/brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt
+ brcm/brcmfmac4356-pcie.gpd-win-pocket.txt
+ # isci (GPL-2)
+ isci/isci_firmware.bin
+ # carl9170 (GPL-2+)
+ carl9170-1.fw
+ # atusb (GPL-2+)
+ atusb/atusb-0.2.dfu
+ atusb/atusb-0.3.dfu
+ atusb/rzusb-0.3.bin
+ # mlxsw_spectrum (dual BSD/GPL-2)
+ mellanox/mlxsw_spectrum-13.1420.122.mfa2
+ mellanox/mlxsw_spectrum-13.1530.152.mfa2
+ mellanox/mlxsw_spectrum-13.1620.192.mfa2
+ mellanox/mlxsw_spectrum-13.1702.6.mfa2
+ mellanox/mlxsw_spectrum-13.1703.4.mfa2
+ mellanox/mlxsw_spectrum-13.1910.622.mfa2
+ mellanox/mlxsw_spectrum-13.2000.1122.mfa2
+ )
+
+ # blacklist of images with unknown license
+ local unknown_license=(
+ korg/k1212.dsp
+ ess/maestro3_assp_kernel.fw
+ ess/maestro3_assp_minisrc.fw
+ yamaha/ds1_ctrl.fw
+ yamaha/ds1_dsp.fw
+ yamaha/ds1e_ctrl.fw
+ ttusb-budget/dspbootcode.bin
+ emi62/bitstream.fw
+ emi62/loader.fw
+ emi62/midi.fw
+ emi62/spdif.fw
+ ti_3410.fw
+ ti_5052.fw
+ mts_mt9234mu.fw
+ mts_mt9234zba.fw
+ whiteheat.fw
+ whiteheat_loader.fw
+ cpia2/stv0672_vp4.bin
+ vicam/firmware.fw
+ edgeport/boot.fw
+ edgeport/boot2.fw
+ edgeport/down.fw
+ edgeport/down2.fw
+ edgeport/down3.bin
+ sb16/mulaw_main.csp
+ sb16/alaw_main.csp
+ sb16/ima_adpcm_init.csp
+ sb16/ima_adpcm_playback.csp
+ sb16/ima_adpcm_capture.csp
+ sun/cassini.bin
+ acenic/tg1.bin
+ acenic/tg2.bin
+ adaptec/starfire_rx.bin
+ adaptec/starfire_tx.bin
+ yam/1200.bin
+ yam/9600.bin
+ ositech/Xilinx7OD.bin
+ qlogic/isp1000.bin
+ myricom/lanai.bin
+ yamaha/yss225_registers.bin
+ lgs8g75.fw
+ )
+
+ if use !unknown-license; then
+ einfo "Removing files with unknown license ..."
+ rm -v "${unknown_license[@]}" || die
+ fi
+
+ if use !redistributable; then
+ # remove files _not_ in the free_software or unknown_license lists
+ # everything else is confirmed (or assumed) to be redistributable
+ # based on upstream acceptance policy
+ einfo "Removing non-redistributable files ..."
+ local OLDIFS="${IFS}"
+ local IFS=$'\n'
+ set -o pipefail
+ find ! -type d -printf "%P\n" \
+ | grep -Fvx -e "${misc_files[*]}" -e "${free_software[*]}" -e "${unknown_license[*]}" \
+ | xargs -d '\n' --no-run-if-empty rm -v
+
+ [[ ${?} -ne 0 ]] && die "Failed to remove non-redistributable files"
+
+ IFS="${OLDIFS}"
+ fi
+
+ restore_config ${PN}.conf
+}
+
+src_install() {
+
+ local FW_OPTIONS=( "-v" )
+ local files_to_keep=
+
+ if use savedconfig; then
+ if [[ -s "${S}/${PN}.conf" ]]; then
+ files_to_keep="${T}/files_to_keep.lst"
+ grep -v '^#' "${S}/${PN}.conf" 2>/dev/null > "${files_to_keep}" || die
+ [[ -s "${files_to_keep}" ]] || die "grep failed, empty config file?"
+ FW_OPTIONS+=( "--firmware-list" "${files_to_keep}" )
+ fi
+ fi
+
+ ! use deduplicate && FW_OPTIONS+=( "--ignore-duplicates" )
+ FW_OPTIONS+=( "${ED}/lib/firmware" )
+ ./copy-firmware.sh "${FW_OPTIONS[@]}"
+
+ pushd "${ED}/lib/firmware" &>/dev/null || die
+
+ # especially use !redistributable will cause some broken symlinks
+ einfo "Removing broken symlinks ..."
+ find * -xtype l -print -delete || die
+
+ # remove empty directories, bug #396073
+ find -type d -empty -delete || die
+
+ # sanity check
+ if ! ( shopt -s failglob; : * ) 2>/dev/null; then
+ eerror "No files to install. Check your USE flag settings"
+ eerror "and the list of files in your saved configuration."
+ die "Refusing to install an empty package"
+ fi
+
+ # create config file
+ echo "# Remove files that shall not be installed from this list." > "${S}"/${PN}.conf || die
+ find * ! -type d >> "${S}"/${PN}.conf || die
+ save_config "${S}"/${PN}.conf
+
+ if use compress-xz || use compress-zstd; then
+ einfo "Compressing firmware ..."
+ local target
+ local ext
+ local compressor
+
+ if use compress-xz; then
+ ext=xz
+ compressor="xz -T1 -C crc32"
+ elif use compress-zstd; then
+ ext=zst
+ compressor="zstd -15 -T1 -C -q --rm"
+ fi
+
+ # rename symlinks
+ while IFS= read -r -d '' f; do
+ # skip symlinks pointing to directories
+ [[ -d ${f} ]] && continue
+
+ target=$(readlink "${f}")
+ [[ $? -eq 0 ]] || die
+ ln -sf "${target}".${ext} "${f}" || die
+ mv -T "${f}" "${f}".${ext} || die
+ done < <(find . -type l -print0) || die
+
+ find . -type f ! -path "./amd-ucode/*" -print0 | \
+ xargs -0 -P $(makeopts_jobs) -I'{}' ${compressor} '{}' || die
+
+ fi
+
+ popd &>/dev/null || die
+
+ if use initramfs ; then
+ insinto /boot
+ doins "${S}"/amd-uc.img
+ fi
+
+ dodoc README.md
+ # some licenses require copyright and permission notice to be included
+ use bindist && dodoc WHENCE LICEN[CS]E.*
+}
+
+pkg_preinst() {
+ if use savedconfig; then
+ ewarn "USE=savedconfig is active. You must handle file collisions manually."
+ fi
+
+ # Fix 'symlink is blocked by a directory' Bug #871315
+ if has_version "<${CATEGORY}/${PN}-20220913-r2" ; then
+ rm -rf "${EROOT}"/lib/firmware/qcom/LENOVO/21BX
+ fi
+
+ # Make sure /boot is available if needed.
+ use initramfs && mount-boot_pkg_preinst
+}
+
+pkg_postinst() {
+ elog "If you are only interested in particular firmware files, edit the saved"
+ elog "configfile and remove those that you do not want."
+
+ local ver
+ for ver in ${REPLACING_VERSIONS}; do
+ if ver_test ${ver} -lt 20190514; then
+ elog
+ elog 'Starting with version 20190514, installation of many firmware'
+ elog 'files is controlled by USE flags. Please review your USE flag'
+ elog 'and package.license settings if you are missing some files.'
+ break
+ fi
+ done
+
+ # Don't forget to umount /boot if it was previously mounted by us.
+ use initramfs && mount-boot_pkg_postinst
+}
+
+pkg_prerm() {
+ # Make sure /boot is mounted so that we can remove /boot/amd-uc.img!
+ use initramfs && mount-boot_pkg_prerm
+}
+
+pkg_postrm() {
+ # Don't forget to umount /boot if it was previously mounted by us.
+ use initramfs && mount-boot_pkg_postrm
+}
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-kernel/linux-firmware/files/, sys-kernel/linux-firmware/
@ 2024-06-28 13:35 Andrew Ammerlaan
0 siblings, 0 replies; 11+ messages in thread
From: Andrew Ammerlaan @ 2024-06-28 13:35 UTC (permalink / raw
To: gentoo-commits
commit: afeaf7f98275b3d5d7b1902bd22adc93593ba32d
Author: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 27 10:26:35 2024 +0000
Commit: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
CommitDate: Fri Jun 28 13:35:35 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=afeaf7f9
sys-kernel/linux-firmware: add ucode image generator hooks
This creates a AMD microcode image when installing the kernel and when
installkernel/kernel-install is configured to use an initramfs generator other
then dracut. Dracut bundles the microcode in the image it generates, many
other initramfs generators do not and we want these users to also get the
latest CPU microcode.
installkernel-gentoo.git has recently gained support for handling these ucode
images and passing them on to bootloaders and UKI generators.
Note that this should be here and not in installkernel-gentoo.git because we
only want to install this when the initramfs flag is enabled to avoid the
situation where users who don't want an ucode.img get one anyway.
To avoid code-duplication we add and install a little helper script that we can
call both from the ebuild and from the hooks.
Co-authored-by: Zen <z <AT> pyl.onl>
Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/37320
Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org>
.../files/35-amd-microcode-systemd.install | 35 ++++++++++
.../linux-firmware/files/35-amd-microcode.install | 39 +++++++++++
.../files/linux-firmware-make-amd-ucode-img.bash | 79 ++++++++++++++++++++++
...10.ebuild => linux-firmware-20240610-r1.ebuild} | 33 ++++-----
.../linux-firmware/linux-firmware-99999999.ebuild | 32 ++++-----
5 files changed, 181 insertions(+), 37 deletions(-)
diff --git a/sys-kernel/linux-firmware/files/35-amd-microcode-systemd.install b/sys-kernel/linux-firmware/files/35-amd-microcode-systemd.install
new file mode 100644
index 000000000000..edafb4d63035
--- /dev/null
+++ b/sys-kernel/linux-firmware/files/35-amd-microcode-systemd.install
@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+
+# Copyright 2024 Gentoo Authors
+# This script is installed by sys-kernel/linux-firmware, it is executed by
+# systemd's kernel-install, NOT by the traditional installkernel. I.e. this
+# plugin is run when the systemd USE flag is enabled or
+# SYSTEMD_KERNEL_INSTALL=1 is set in the environment.
+
+COMMAND="${1}"
+
+if [[ ${COMMAND} != add ]]; then
+ exit 0
+fi
+
+if [[ ${KERNEL_INSTALL_INITRD_GENERATOR} == dracut ]]; then
+ # Dracut bundles microcode in its initramfs images
+ [[ ${KERNEL_INSTALL_VERBOSE} == 1 ]] && echo \
+ "initrd_generator=${KERNEL_INSTALL_INITRD_GENERATOR} bundles CPU microcode, nothing to do here."
+ exit 0
+fi
+
+# do nothing if somehow make-amd-ucode-img is not installed
+if ! command -v make-amd-ucode-img >/dev/null; then
+ [[ ${KERNEL_INSTALL_VERBOSE} == 1 ]] && echo \
+ "make-amd-ucode-img command not available"
+ exit 1
+fi
+
+[[ ${KERNEL_INSTALL_VERBOSE} == 1 ]] && echo \
+ "Generating AMD CPU Microcode early initramfs image..."
+
+make-amd-ucode-img \
+ ${KERNEL_INSTALL_STAGING_AREA}/microcode-amd \
+ /lib/firmware/amd-ucode ||
+ { echo "make-amd-ucode-img failed" && exit 1; }
diff --git a/sys-kernel/linux-firmware/files/35-amd-microcode.install b/sys-kernel/linux-firmware/files/35-amd-microcode.install
new file mode 100644
index 000000000000..185e57be0dae
--- /dev/null
+++ b/sys-kernel/linux-firmware/files/35-amd-microcode.install
@@ -0,0 +1,39 @@
+#!/usr/bin/env bash
+
+# Copyright 2024 Gentoo Authors
+# This script is installed by sys-kernel/linux-firmware, it is executed by
+# the traditional installkernel, NOT by systemd's kernel-install. I.e. this
+# plugin is run when the systemd USE flag is disabled or
+# SYSTEMD_KERNEL_INSTALL=0 is set in the environment.
+
+# familiar helpers, we intentionally don't use Gentoo functions.sh
+die() {
+ echo -e " ${NOCOLOR-\e[1;31m*\e[0m }${*}" >&2
+ exit 1
+}
+
+einfo() {
+ echo -e " ${NOCOLOR-\e[1;32m*\e[0m }${*}" >&2
+}
+
+main() {
+ # re-define for subst to work
+ [[ -n ${NOCOLOR+yes} ]] && NOCOLOR=
+
+ if [[ ${INSTALLKERNEL_INITRD_GENERATOR} == dracut ]]; then
+ # Dracut bundles microcode in its initramfs images
+ echo "initrd_generator=${INSTALLKERNEL_INITRD_GENERATOR} bundles CPU microcode, nothing to do here."
+ exit 0
+ fi
+
+ # do nothing if somehow make-amd-ucode-img is not installed
+ [[ -x $(command -v make-amd-ucode-img) ]] || die "make-amd-ucode-img command not available"
+
+ [[ ${EUID} -eq 0 ]] || die "Please run this script as root"
+
+ einfo "Generating AMD CPU Microcode early initramfs image..."
+ make-amd-ucode-img /boot/amd-uc.img /lib/firmware/amd-ucode ||
+ die "make-amd-ucode-img failed"
+}
+
+main
diff --git a/sys-kernel/linux-firmware/files/linux-firmware-make-amd-ucode-img.bash b/sys-kernel/linux-firmware/files/linux-firmware-make-amd-ucode-img.bash
new file mode 100644
index 000000000000..5fac567e063d
--- /dev/null
+++ b/sys-kernel/linux-firmware/files/linux-firmware-make-amd-ucode-img.bash
@@ -0,0 +1,79 @@
+#!/usr/bin/env bash
+
+# Copyright 2024 Gentoo Authors
+
+our_name=${0}
+out=${1}
+in=${2}
+
+# familiar helpers, we intentionally don't use Gentoo functions.sh
+die() {
+ echo -e " ${NOCOLOR-\e[1;31m*\e[0m }${*}" >&2
+ exit 1
+}
+
+einfo() {
+ echo -e " ${NOCOLOR-\e[1;32m*\e[0m }${*}" >&2
+}
+
+main() {
+ # re-define for subst to work
+ [[ -n ${NOCOLOR+yes} ]] && NOCOLOR=
+
+
+ # Set the output file to arg 1 if it's not a directory.
+ # If it's a directory, set the out file to the directory with the default name.
+ # If it's a relative filename, include it in the variable.
+ local ucode_file=${out:-"/boot/amd-uc.img"}
+ if [[ -d ${ucode_file} ]]; then
+ ucode_file="${ucode_file}/amd-uc.img"
+ einfo "Output file is a directory. Using default name: ${ucode_file}"
+ elif [[ ${ucode_file} != /* ]]; then
+ ucode_file="$(pwd)/${ucode_file}"
+ einfo "Output file is a relative path. Using full path: ${ucode_file}"
+ elif [[ -z ${ucode_file} ]]; then
+ einfo "Usage: ${our_name} <output image> <microcode directory>"
+ die "No output file specified"
+ fi
+
+ # Only AMD microcode is in the linux-firmmware package
+ local ucode_dir=${in:-"/lib/firmware/amd-ucode"}
+ if [[ ! -d ${ucode_dir} ]]; then
+ einfo "Usage: ${our_name} <output image> <microcode directory>"
+ die "AMD microcode directory does not exist: ${ucode_dir}"
+ fi
+
+ # Make the tmp dir for the microcode archive
+ local ucode_tmp_dir="$(mktemp -d)" || die "Failed to create temporary directory"
+ einfo "Created temporary directory: ${ucode_tmp_dir}"
+ local ucode_bin_dir="${ucode_tmp_dir}/kernel/x86/microcode"
+ local ucode_bin_file="${ucode_bin_dir}/AuthenticAMD.bin"
+
+ # Write "1" to the early_cpio flag file
+ echo 1 > "${ucode_tmp_dir}/early_cpio" || die
+
+ # Make the directory for the microcode bin files
+ mkdir -p "${ucode_bin_dir}" || die "Failed to create microcode bin directory: ${ucode_bin_dir}"
+
+ # Concatenate all microcode bin files into a single file
+ cat "${ucode_dir}"/*.bin > "${ucode_bin_file}" || die "Failed to concatenate microcode files into: ${ucode_bin_file}"
+
+ # Check that the concatenated file is not empty
+ [[ -s "${ucode_bin_file}" ]] || die "Empty microcode file: ${ucode_bin_file}"
+
+ pushd "${ucode_tmp_dir}" &> /dev/null || die
+ # Create the cpio archive
+ find . -print0 | cpio --quiet --null -o -H newc -R 0:0 > "${ucode_file}" || die "Failed to create microcode archive in: ${ucode_file}"
+ popd &> /dev/null || die
+
+ # Check that the cpio archive is not empty
+ [[ -s "${ucode_file}" ]] || die "Empty microcode archive at: ${ucode_file}"
+
+ einfo "Created microcode archive at: ${ucode_file}"
+ # Clean up the tmp dir
+ rm -r "${ucode_tmp_dir}" || die "Failed to remove temporary directory: ${ucode_tmp_dir}"
+ einfo "Cleaned up temporary directory: ${ucode_tmp_dir}"
+}
+
+main
+
diff --git a/sys-kernel/linux-firmware/linux-firmware-20240610.ebuild b/sys-kernel/linux-firmware/linux-firmware-20240610-r1.ebuild
similarity index 94%
rename from sys-kernel/linux-firmware/linux-firmware-20240610.ebuild
rename to sys-kernel/linux-firmware/linux-firmware-20240610-r1.ebuild
index 1bb6954d00c8..32bd327957ea 100644
--- a/sys-kernel/linux-firmware/linux-firmware-20240610.ebuild
+++ b/sys-kernel/linux-firmware/linux-firmware-20240610-r1.ebuild
@@ -102,7 +102,6 @@ src_unpack() {
}
src_prepare() {
-
default
find . -type f -not -perm 0644 -print0 \
@@ -110,27 +109,12 @@ src_prepare() {
|| die
chmod +x copy-firmware.sh || die
+ cp "${FILESDIR}/${PN}-make-amd-ucode-img.bash" "${T}/make-amd-ucode-img" || die
+ chmod +x "${T}/make-amd-ucode-img" || die
if use initramfs && ! use dist-kernel; then
if [[ -d "${S}/amd-ucode" ]]; then
- local UCODETMP="${T}/ucode_tmp"
- local UCODEDIR="${UCODETMP}/kernel/x86/microcode"
- mkdir -p "${UCODEDIR}" || die
- echo 1 > "${UCODETMP}/early_cpio"
-
- local amd_ucode_file="${UCODEDIR}/AuthenticAMD.bin"
- cat "${S}"/amd-ucode/*.bin > "${amd_ucode_file}" || die "Failed to concat amd cpu ucode"
-
- if [[ ! -s "${amd_ucode_file}" ]]; then
- die "Sanity check failed: '${amd_ucode_file}' is empty!"
- fi
-
- pushd "${UCODETMP}" &>/dev/null || die
- find . -print0 | cpio --quiet --null -o -H newc -R 0:0 > "${S}"/amd-uc.img
- popd &>/dev/null || die
- if [[ ! -s "${S}/amd-uc.img" ]]; then
- die "Failed to create '${S}/amd-uc.img'!"
- fi
+ "${T}/make-amd-ucode-img" "${S}" "${S}/amd-ucode" || die
else
# If this will ever happen something has changed which
# must be reviewed
@@ -357,6 +341,17 @@ src_install() {
insinto /usr/lib/dracut/dracut.conf.d
newins - 10-${PN}.conf <<<"early_microcode=$(usex initramfs)"
)
+ if use initramfs; then
+ # Install installkernel/kernel-install hooks for non-dracut initramfs
+ # generators that don't bundled the microcode
+ dobin "${T}/make-amd-ucode-img"
+ (
+ exeinto /usr/lib/kernel/preinst.d
+ doexe "${FILESDIR}/35-amd-microcode.install"
+ exeinto /usr/lib/kernel/install.d
+ doexe "${FILESDIR}/35-amd-microcode-systemd.install"
+ )
+ fi
if use initramfs && ! use dist-kernel; then
insinto /boot
diff --git a/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild b/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild
index dc02d051d7ea..26c21e80395e 100644
--- a/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild
+++ b/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild
@@ -107,27 +107,12 @@ src_prepare() {
|| die
chmod +x copy-firmware.sh || die
+ cp "${FILESDIR}/${PN}-make-amd-ucode-img.bash" "${T}/make-amd-ucode-img" || die
+ chmod +x "${T}/make-amd-ucode-img" || die
if use initramfs && ! use dist-kernel; then
if [[ -d "${S}/amd-ucode" ]]; then
- local UCODETMP="${T}/ucode_tmp"
- local UCODEDIR="${UCODETMP}/kernel/x86/microcode"
- mkdir -p "${UCODEDIR}" || die
- echo 1 > "${UCODETMP}/early_cpio"
-
- local amd_ucode_file="${UCODEDIR}/AuthenticAMD.bin"
- cat "${S}"/amd-ucode/*.bin > "${amd_ucode_file}" || die "Failed to concat amd cpu ucode"
-
- if [[ ! -s "${amd_ucode_file}" ]]; then
- die "Sanity check failed: '${amd_ucode_file}' is empty!"
- fi
-
- pushd "${UCODETMP}" &>/dev/null || die
- find . -print0 | cpio --quiet --null -o -H newc -R 0:0 > "${S}"/amd-uc.img
- popd &>/dev/null || die
- if [[ ! -s "${S}/amd-uc.img" ]]; then
- die "Failed to create '${S}/amd-uc.img'!"
- fi
+ ."/${T}/make-amd-ucode-img" "${S}/amd-ucode" "${S}/amd-ucode.img" || die
else
# If this will ever happen something has changed which
# must be reviewed
@@ -361,6 +346,17 @@ src_install() {
insinto /usr/lib/dracut/dracut.conf.d
newins - 10-${PN}.conf <<<"early_microcode=$(usex initramfs)"
)
+ if use initramfs; then
+ # Install installkernel/kernel-install hooks for non-dracut initramfs
+ # generators that don't bundled the microcode
+ dobin "${T}/make-amd-ucode-img"
+ (
+ exeinto /usr/lib/kernel/preinst.d
+ doexe "${FILESDIR}/35-amd-microcode.install"
+ exeinto /usr/lib/kernel/install.d
+ doexe "${FILESDIR}/35-amd-microcode-systemd.install"
+ )
+ fi
if use initramfs && ! use dist-kernel; then
insinto /boot
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-kernel/linux-firmware/files/, sys-kernel/linux-firmware/
@ 2024-07-16 18:00 Andrew Ammerlaan
0 siblings, 0 replies; 11+ messages in thread
From: Andrew Ammerlaan @ 2024-07-16 18:00 UTC (permalink / raw
To: gentoo-commits
commit: 206362fe92d3387d6ae9a9832047f64910722eef
Author: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 16 17:51:13 2024 +0000
Commit: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org>
CommitDate: Tue Jul 16 17:59:56 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=206362fe
sys-kernel/linux-firmware: *.install exit early if no ucode installed
If we have USE="initramfs savedconfig" we may exclude the microcode
from installation. This should be handled gracefully in the hooks.
Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org>
.../files/35-amd-microcode-systemd.install | 17 +++++++++++------
.../linux-firmware/files/35-amd-microcode.install | 10 +++++++---
...0610-r2.ebuild => linux-firmware-20240610-r3.ebuild} | 0
...0240709.ebuild => linux-firmware-20240709-r1.ebuild} | 0
4 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/sys-kernel/linux-firmware/files/35-amd-microcode-systemd.install b/sys-kernel/linux-firmware/files/35-amd-microcode-systemd.install
index edafb4d63035..7f2586f29e66 100644
--- a/sys-kernel/linux-firmware/files/35-amd-microcode-systemd.install
+++ b/sys-kernel/linux-firmware/files/35-amd-microcode-systemd.install
@@ -26,10 +26,15 @@ if ! command -v make-amd-ucode-img >/dev/null; then
exit 1
fi
-[[ ${KERNEL_INSTALL_VERBOSE} == 1 ]] && echo \
- "Generating AMD CPU Microcode early initramfs image..."
+if [[ -d /lib/firmware/amd-ucode ]]; then
+ [[ ${KERNEL_INSTALL_VERBOSE} == 1 ]] && echo \
+ "Generating AMD CPU Microcode early initramfs image..."
-make-amd-ucode-img \
- ${KERNEL_INSTALL_STAGING_AREA}/microcode-amd \
- /lib/firmware/amd-ucode ||
- { echo "make-amd-ucode-img failed" && exit 1; }
+ make-amd-ucode-img \
+ ${KERNEL_INSTALL_STAGING_AREA}/microcode-amd \
+ /lib/firmware/amd-ucode ||
+ { echo "make-amd-ucode-img failed" && exit 1; }
+else
+ [[ ${KERNEL_INSTALL_VERBOSE} == 1 ]] && echo \
+ "No AMD CPU Microcode installed, nothing to do here."
+fi
diff --git a/sys-kernel/linux-firmware/files/35-amd-microcode.install b/sys-kernel/linux-firmware/files/35-amd-microcode.install
index 185e57be0dae..504a06c9fbcc 100644
--- a/sys-kernel/linux-firmware/files/35-amd-microcode.install
+++ b/sys-kernel/linux-firmware/files/35-amd-microcode.install
@@ -31,9 +31,13 @@ main() {
[[ ${EUID} -eq 0 ]] || die "Please run this script as root"
- einfo "Generating AMD CPU Microcode early initramfs image..."
- make-amd-ucode-img /boot/amd-uc.img /lib/firmware/amd-ucode ||
- die "make-amd-ucode-img failed"
+ if [[ -d /lib/firmware/amd-ucode ]]; then
+ einfo "Generating AMD CPU Microcode early initramfs image..."
+ make-amd-ucode-img /boot/amd-uc.img /lib/firmware/amd-ucode ||
+ die "make-amd-ucode-img failed"
+ else
+ einfo "No AMD CPU Microcode installed, nothing to do here."
+ fi
}
main
diff --git a/sys-kernel/linux-firmware/linux-firmware-20240610-r2.ebuild b/sys-kernel/linux-firmware/linux-firmware-20240610-r3.ebuild
similarity index 100%
rename from sys-kernel/linux-firmware/linux-firmware-20240610-r2.ebuild
rename to sys-kernel/linux-firmware/linux-firmware-20240610-r3.ebuild
diff --git a/sys-kernel/linux-firmware/linux-firmware-20240709.ebuild b/sys-kernel/linux-firmware/linux-firmware-20240709-r1.ebuild
similarity index 100%
rename from sys-kernel/linux-firmware/linux-firmware-20240709.ebuild
rename to sys-kernel/linux-firmware/linux-firmware-20240709-r1.ebuild
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-kernel/linux-firmware/files/, sys-kernel/linux-firmware/
@ 2024-10-18 16:35 Mike Pagano
0 siblings, 0 replies; 11+ messages in thread
From: Mike Pagano @ 2024-10-18 16:35 UTC (permalink / raw
To: gentoo-commits
commit: 19d98640fa73ee9a30639a0561d5972a2a4e0efe
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Fri Oct 18 16:29:39 2024 +0000
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Fri Oct 18 16:35:31 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=19d98640
sys-kernel/linux-firmware: add 20241017, with user contributed patch
Committed with patch authored by Emil Velikov to workaround
the check_whency.py failing for installation from source tarball.
Thank-you, Emil. Will track upstream PR and incorporate any fixes
identified.
See: https://gitlab.com/kernel-firmware/linux-firmware/-/merge_requests/339/diffs?commit_id=040558a71ea1b3f579d98e561dc56afb9842b78c
Closes: https://bugs.gentoo.org/941762
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
sys-kernel/linux-firmware/Manifest | 1 +
.../files/linux-firmware-copy-firmware-r5.patch | 36 ++
.../linux-firmware/linux-firmware-20241017.ebuild | 410 +++++++++++++++++++++
3 files changed, 447 insertions(+)
diff --git a/sys-kernel/linux-firmware/Manifest b/sys-kernel/linux-firmware/Manifest
index 2ccdeae12917..f938c86c6346 100644
--- a/sys-kernel/linux-firmware/Manifest
+++ b/sys-kernel/linux-firmware/Manifest
@@ -1,3 +1,4 @@
DIST linux-firmware-20240709.tar.xz 376713860 BLAKE2B 33ea1ca0ffafa37b72604386954f05d9eab09dba29c7d28a8b34dabd2c3133b6d4727998b5dad27a8e629877fc63555ee96359a84eb1d133603c3098bac49e72 SHA512 705d092b0ec5002300a91b679e806137e92bf3d4e1edd998e885e8da88297d8791048ee8ad9727546b13fa08aeadab54254eaed8f6f5a9663429eb54746dfb63
DIST linux-firmware-20240811.tar.xz 379287388 BLAKE2B abcd5eff8e7bd7200079a691e4c09dcc7f349e09eb35c3eae594a7b27eef714767f0eaa92e259b32f4d347f7b6a2ee710332b728546305a01558d732dd947ac6 SHA512 4ea6c24f4bf60eb7ae4cd2993ce4e9dadb03ca7e92f8ccb4778fcebd5c32e16ba8c6095e74b9ed6a111f1b44b983177b52f35a9ad8be7d1dfec2de29a296b8d1
DIST linux-firmware-20240909.tar.xz 383099276 BLAKE2B 3769ca5501db43a6d1ca54ac11d6857087c51d064ee58f3da543ab713ce8280dbe4206a2d3d00431518e509b260fe9be0f1eb15fe2e737647468f76f2e7282ac SHA512 d1918364f9925291da722075cf2d038082a6b6b5c6d7e5ab8b0888c5e87563718934f493fe172db21608d6eace92ade5c519b5f50b1fc7f25a328e45be059142
+DIST linux-firmware-20241017.tar.xz 397400292 BLAKE2B b158855a61324e3194274b0d6dc146bde2b517915a3f1fe5ddba1cc80fca39d7c0c5058eaaf4189c85cd43f1e432c8ccc9c338fc35cd8289e0d661cc5c321b18 SHA512 2b72f1e7651acc04209ab12841915e1bed5819964d9d31f0be5523ad0ea50b51557687b6005014dff1b1f9caa38038321522b17a5de86ee065961fbb5462b5b6
diff --git a/sys-kernel/linux-firmware/files/linux-firmware-copy-firmware-r5.patch b/sys-kernel/linux-firmware/files/linux-firmware-copy-firmware-r5.patch
new file mode 100644
index 000000000000..15e6ba0ebeb6
--- /dev/null
+++ b/sys-kernel/linux-firmware/files/linux-firmware-copy-firmware-r5.patch
@@ -0,0 +1,36 @@
+--- a/copy-firmware.sh 2024-10-18 06:39:44.742506779 -0400
++++ b/copy-firmware.sh 2024-10-18 06:42:04.853498628 -0400
+@@ -46,6 +46,17 @@ while test $# -gt 0; do
+ shift
+ ;;
+
++ --firmware-list)
++ if [ -n "$2" ]; then
++ FIRMWARE_LIST=`cat $2`
++ shift 2
++ else
++ echo "ERROR: '--firmware-list' requires a non-empty option argument of firmware files to install"
++ exit 1
++ fi
++ ;;
++
++
+ *)
+ if test -n "$destdir"; then
+ err "unknown command-line options: $*"
+@@ -70,6 +81,7 @@ $verbose "Checking that WHENCE file is f
+
+ # shellcheck disable=SC2162 # file/folder name can include escaped symbols
+ grep -E '^(RawFile|File):' WHENCE | sed -E -e 's/^(RawFile|File): */\1 /;s/"//g' | while read k f; do
++ [ -n "${FIRMWARE_LIST}" ] && if ! echo "${FIRMWARE_LIST}" | grep -q "${f}"; then continue; fi
+ install -d "$destdir/$(dirname "$f")"
+ $verbose "copying/compressing file $f$compext"
+ if test "$compress" != "cat" && test "$k" = "RawFile"; then
+@@ -82,6 +94,7 @@ done
+
+ # shellcheck disable=SC2162 # file/folder name can include escaped symbols
+ grep -E '^Link:' WHENCE | sed -e 's/^Link: *//g;s/-> //g' | while read l t; do
++ [ -n "${FIRMWARE_LIST}" ] && if ! echo "${FIRMWARE_LIST}" | grep -q "${f}"; then continue; fi
+ directory="$destdir/$(dirname "$l")"
+ install -d "$directory"
+ target="$(cd "$directory" && realpath -m -s "$t")"
diff --git a/sys-kernel/linux-firmware/linux-firmware-20241017.ebuild b/sys-kernel/linux-firmware/linux-firmware-20241017.ebuild
new file mode 100644
index 000000000000..7a0527c9a1e0
--- /dev/null
+++ b/sys-kernel/linux-firmware/linux-firmware-20241017.ebuild
@@ -0,0 +1,410 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+PYTHON_COMPAT=( python3_{10..13} )
+inherit dist-kernel-utils linux-info mount-boot python-any-r1 savedconfig
+
+# In case this is a real snapshot, fill in commit below.
+# For normal, tagged releases, leave blank
+MY_COMMIT=""
+
+if [[ ${PV} == 99999999* ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/${PN}.git"
+else
+ if [[ -n "${MY_COMMIT}" ]]; then
+ SRC_URI="https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/snapshot/${MY_COMMIT}.tar.gz -> ${P}.tar.gz"
+ S="${WORKDIR}/${MY_COMMIT}"
+ else
+ SRC_URI="https://mirrors.edge.kernel.org/pub/linux/kernel/firmware/${P}.tar.xz"
+ fi
+
+ KEYWORDS="~alpha amd64 arm arm64 hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
+fi
+
+DESCRIPTION="Linux firmware files"
+HOMEPAGE="https://git.kernel.org/?p=linux/kernel/git/firmware/linux-firmware.git"
+
+LICENSE="GPL-2 GPL-2+ GPL-3 BSD MIT || ( MPL-1.1 GPL-2 )
+ redistributable? ( linux-fw-redistributable BSD-2 BSD BSD-4 ISC MIT )
+ unknown-license? ( all-rights-reserved )"
+SLOT="0"
+IUSE="bindist compress-xz compress-zstd deduplicate dist-kernel +initramfs +redistributable savedconfig unknown-license"
+REQUIRED_USE="initramfs? ( redistributable )
+ ?? ( compress-xz compress-zstd )
+ savedconfig? ( !deduplicate )"
+
+RESTRICT="binchecks strip test
+ !bindist? ( bindist )
+ unknown-license? ( bindist )"
+
+BDEPEND="initramfs? ( app-alternatives/cpio )
+ compress-xz? ( app-arch/xz-utils )
+ compress-zstd? ( app-arch/zstd )
+ deduplicate? ( app-misc/rdfind )
+ ${PYTHON_DEPS}"
+
+#add anything else that collides to this
+RDEPEND="!savedconfig? (
+ redistributable? (
+ !sys-firmware/alsa-firmware[alsa_cards_ca0132]
+ !sys-block/qla-fc-firmware
+ !sys-firmware/raspberrypi-wifi-ucode
+ )
+ unknown-license? (
+ !sys-firmware/alsa-firmware[alsa_cards_korg1212]
+ !sys-firmware/alsa-firmware[alsa_cards_maestro3]
+ !sys-firmware/alsa-firmware[alsa_cards_sb16]
+ !sys-firmware/alsa-firmware[alsa_cards_ymfpci]
+ )
+ )
+ dist-kernel? (
+ virtual/dist-kernel
+ initramfs? (
+ app-alternatives/cpio
+ )
+ )
+"
+IDEPEND="
+ dist-kernel? (
+ initramfs? ( sys-kernel/installkernel )
+ )
+"
+
+QA_PREBUILT="*"
+PATCHES=(
+ "${FILESDIR}"/${PN}-copy-firmware-r5.patch
+ "${FILESDIR}"/${PN}-check-whence.patch
+)
+
+pkg_pretend() {
+ if use initramfs; then
+ if use dist-kernel; then
+ # Check, but don't die because we can fix the problem and then
+ # emerge --config ... to re-run installation.
+ [[ -z ${ROOT} ]] && nonfatal mount-boot_check_status
+ else
+ mount-boot_pkg_pretend
+ fi
+ fi
+}
+
+pkg_setup() {
+ if use compress-xz || use compress-zstd ; then
+ local CONFIG_CHECK
+
+ if kernel_is -ge 5 19; then
+ use compress-xz && CONFIG_CHECK="~FW_LOADER_COMPRESS_XZ"
+ use compress-zstd && CONFIG_CHECK="~FW_LOADER_COMPRESS_ZSTD"
+ else
+ use compress-xz && CONFIG_CHECK="~FW_LOADER_COMPRESS"
+ if use compress-zstd; then
+ eerror "Kernels <5.19 do not support ZSTD-compressed firmware files"
+ fi
+ fi
+ fi
+ linux-info_pkg_setup
+}
+
+src_unpack() {
+ if [[ ${PV} == 99999999* ]]; then
+ git-r3_src_unpack
+ else
+ default
+ # rename directory from git snapshot tarball
+ if [[ ${#GIT_COMMIT} -gt 8 ]]; then
+ mv ${PN}-*/ ${P} || die
+ fi
+ fi
+}
+
+src_prepare() {
+ default
+
+ find . -type f -not -perm 0644 -print0 \
+ | xargs --null --no-run-if-empty chmod 0644 \
+ || die
+
+ chmod +x "${S}"/{copy-firmware.sh,dedup-firmware.sh,check_whence.py,build_packages.py} || die
+ chmod +x "${S}"/{carl9170fw/autogen.sh,carl9170fw/genapi.sh} || die
+ chmod +x "${S}"/contrib/process_linux_firmware.py || di
+ cp "${FILESDIR}/${PN}-make-amd-ucode-img.bash" "${T}/make-amd-ucode-img" || die
+ chmod +x "${T}/make-amd-ucode-img" || die
+
+ if use initramfs && ! use dist-kernel; then
+ if [[ -d "${S}/amd-ucode" ]]; then
+ "${T}/make-amd-ucode-img" "${S}" "${S}/amd-ucode" || die
+ else
+ # If this will ever happen something has changed which
+ # must be reviewed
+ die "'${S}/amd-ucode' not found!"
+ fi
+ fi
+
+ # whitelist of misc files
+ local misc_files=(
+ copy-firmware.sh
+ check_whence.py
+ dedup-firmware.sh
+ LICEN[CS]E.*
+ README.md
+ WHENCE
+ )
+
+ # whitelist of images with a free software license
+ local free_software=(
+ # keyspan_pda (GPL-2+)
+ keyspan_pda/keyspan_pda.fw
+ keyspan_pda/xircom_pgs.fw
+ # dsp56k (GPL-2+)
+ dsp56k/bootstrap.bin
+ # ath9k_htc (BSD GPL-2+ MIT)
+ ath9k_htc/htc_7010-1.4.0.fw
+ ath9k_htc/htc_9271-1.4.0.fw
+ # pcnet_cs, 3c589_cs, 3c574_cs, serial_cs (dual GPL-2/MPL-1.1)
+ cis/LA-PCM.cis
+ cis/PCMLM28.cis
+ cis/DP83903.cis
+ cis/NE2K.cis
+ cis/tamarack.cis
+ cis/PE-200.cis
+ cis/PE520.cis
+ cis/3CXEM556.cis
+ cis/3CCFEM556.cis
+ cis/MT5634ZLX.cis
+ cis/RS-COM-2P.cis
+ cis/COMpad2.cis
+ cis/COMpad4.cis
+ # serial_cs (GPL-3)
+ cis/SW_555_SER.cis
+ cis/SW_7xx_SER.cis
+ cis/SW_8xx_SER.cis
+ # dvb-ttpci (GPL-2+)
+ av7110/bootcode.bin
+ # usbdux, usbduxfast, usbduxsigma (GPL-2+)
+ usbdux_firmware.bin
+ usbduxfast_firmware.bin
+ usbduxsigma_firmware.bin
+ # brcmfmac (GPL-2+)
+ brcm/brcmfmac4330-sdio.Prowise-PT301.txt
+ brcm/brcmfmac43340-sdio.meegopad-t08.txt
+ brcm/brcmfmac43362-sdio.cubietech,cubietruck.txt
+ brcm/brcmfmac43362-sdio.lemaker,bananapro.txt
+ brcm/brcmfmac43430a0-sdio.jumper-ezpad-mini3.txt
+ "brcm/brcmfmac43430a0-sdio.ONDA-V80 PLUS.txt"
+ brcm/brcmfmac43430-sdio.AP6212.txt
+ brcm/brcmfmac43430-sdio.Hampoo-D2D3_Vi8A1.txt
+ brcm/brcmfmac43430-sdio.MUR1DX.txt
+ brcm/brcmfmac43430-sdio.raspberrypi,3-model-b.txt
+ brcm/brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt
+ brcm/brcmfmac4356-pcie.gpd-win-pocket.txt
+ # isci (GPL-2)
+ isci/isci_firmware.bin
+ # carl9170 (GPL-2+)
+ carl9170-1.fw
+ # atusb (GPL-2+)
+ atusb/atusb-0.2.dfu
+ atusb/atusb-0.3.dfu
+ atusb/rzusb-0.3.bin
+ # mlxsw_spectrum (dual BSD/GPL-2)
+ mellanox/mlxsw_spectrum-13.1420.122.mfa2
+ mellanox/mlxsw_spectrum-13.1530.152.mfa2
+ mellanox/mlxsw_spectrum-13.1620.192.mfa2
+ mellanox/mlxsw_spectrum-13.1702.6.mfa2
+ mellanox/mlxsw_spectrum-13.1703.4.mfa2
+ mellanox/mlxsw_spectrum-13.1910.622.mfa2
+ mellanox/mlxsw_spectrum-13.2000.1122.mfa2
+ )
+
+ # blacklist of images with unknown license
+ local unknown_license=(
+ korg/k1212.dsp
+ ess/maestro3_assp_kernel.fw
+ ess/maestro3_assp_minisrc.fw
+ yamaha/ds1_ctrl.fw
+ yamaha/ds1_dsp.fw
+ yamaha/ds1e_ctrl.fw
+ ttusb-budget/dspbootcode.bin
+ emi62/bitstream.fw
+ emi62/loader.fw
+ emi62/midi.fw
+ emi62/spdif.fw
+ ti_3410.fw
+ ti_5052.fw
+ mts_mt9234mu.fw
+ mts_mt9234zba.fw
+ whiteheat.fw
+ whiteheat_loader.fw
+ cpia2/stv0672_vp4.bin
+ vicam/firmware.fw
+ edgeport/boot.fw
+ edgeport/boot2.fw
+ edgeport/down.fw
+ edgeport/down2.fw
+ edgeport/down3.bin
+ sb16/mulaw_main.csp
+ sb16/alaw_main.csp
+ sb16/ima_adpcm_init.csp
+ sb16/ima_adpcm_playback.csp
+ sb16/ima_adpcm_capture.csp
+ sun/cassini.bin
+ acenic/tg1.bin
+ acenic/tg2.bin
+ adaptec/starfire_rx.bin
+ adaptec/starfire_tx.bin
+ yam/1200.bin
+ yam/9600.bin
+ ositech/Xilinx7OD.bin
+ qlogic/isp1000.bin
+ myricom/lanai.bin
+ yamaha/yss225_registers.bin
+ lgs8g75.fw
+ )
+
+ if use !unknown-license; then
+ einfo "Removing files with unknown license ..."
+ rm -v "${unknown_license[@]}" || die
+ fi
+
+ if use !redistributable; then
+ # remove files _not_ in the free_software or unknown_license lists
+ # everything else is confirmed (or assumed) to be redistributable
+ # based on upstream acceptance policy
+ einfo "Removing non-redistributable files ..."
+ local OLDIFS="${IFS}"
+ local IFS=$'\n'
+ set -o pipefail
+ find ! -type d -printf "%P\n" \
+ | grep -Fvx -e "${misc_files[*]}" -e "${free_software[*]}" -e "${unknown_license[*]}" \
+ | xargs -d '\n' --no-run-if-empty rm -v
+
+ [[ ${?} -ne 0 ]] && die "Failed to remove non-redistributable files"
+
+ IFS="${OLDIFS}"
+ fi
+
+ restore_config ${PN}.conf
+}
+
+src_install() {
+
+ local FW_OPTIONS=( "-v" )
+ local files_to_keep=
+
+ if use savedconfig; then
+ if [[ -s "${S}/${PN}.conf" ]]; then
+ files_to_keep="${T}/files_to_keep.lst"
+ grep -v '^#' "${S}/${PN}.conf" 2>/dev/null > "${files_to_keep}" || die
+ [[ -s "${files_to_keep}" ]] || die "grep failed, empty config file?"
+ FW_OPTIONS+=( "--firmware-list" "${files_to_keep}" )
+ fi
+ fi
+
+ if use compress-xz; then
+ FW_OPTIONS+=( "--xz" )
+ elif use compress-zstd; then
+ FW_OPTIONS+=( "--zstd" )
+ fi
+ FW_OPTIONS+=( "${ED}/lib/firmware" )
+ ./copy-firmware.sh "${FW_OPTIONS[@]}" || die
+ use deduplicate && { ./dedup-firmware.sh "${ED}/lib/firmware" || die; }
+
+ pushd "${ED}/lib/firmware" &>/dev/null || die
+
+ # especially use !redistributable will cause some broken symlinks
+ einfo "Removing broken symlinks ..."
+ find * -xtype l -print -delete || die
+
+ # remove empty directories, bug #396073
+ find -type d -empty -delete || die
+
+ # sanity check
+ if ! ( shopt -s failglob; : * ) 2>/dev/null; then
+ eerror "No files to install. Check your USE flag settings"
+ eerror "and the list of files in your saved configuration."
+ die "Refusing to install an empty package"
+ fi
+
+ # create config file
+ echo "# Remove files that shall not be installed from this list." > "${S}"/${PN}.conf || die
+ find * ! -type d >> "${S}"/${PN}.conf || die
+ save_config "${S}"/${PN}.conf
+
+ popd &>/dev/null || die
+
+ # Instruct Dracut on whether or not we want the microcode in initramfs
+ (
+ insinto /usr/lib/dracut/dracut.conf.d
+ newins - 10-${PN}.conf <<<"early_microcode=$(usex initramfs)"
+ )
+ if use initramfs; then
+ # Install installkernel/kernel-install hooks for non-dracut initramfs
+ # generators that don't bundled the microcode
+ dobin "${T}/make-amd-ucode-img"
+ (
+ exeinto /usr/lib/kernel/preinst.d
+ doexe "${FILESDIR}/35-amd-microcode.install"
+ exeinto /usr/lib/kernel/install.d
+ doexe "${FILESDIR}/35-amd-microcode-systemd.install"
+ )
+ fi
+
+ if use initramfs && ! use dist-kernel; then
+ insinto /boot
+ doins "${S}"/amd-uc.img
+ fi
+
+ dodoc README.md
+ # some licenses require copyright and permission notice to be included
+ use bindist && dodoc WHENCE LICEN[CS]E.*
+}
+
+pkg_preinst() {
+ if use savedconfig; then
+ ewarn "USE=savedconfig is active. You must handle file collisions manually."
+ fi
+
+ # Fix 'symlink is blocked by a directory' Bug #871315
+ if has_version "<${CATEGORY}/${PN}-20220913-r2" ; then
+ rm -rf "${EROOT}"/lib/firmware/qcom/LENOVO/21BX
+ fi
+
+ # Make sure /boot is available if needed.
+ use initramfs && ! use dist-kernel && mount-boot_pkg_preinst
+}
+
+pkg_postinst() {
+ elog "If you are only interested in particular firmware files, edit the saved"
+ elog "configfile and remove those that you do not want."
+
+ local ver
+ for ver in ${REPLACING_VERSIONS}; do
+ if ver_test ${ver} -lt 20190514; then
+ elog
+ elog 'Starting with version 20190514, installation of many firmware'
+ elog 'files is controlled by USE flags. Please review your USE flag'
+ elog 'and package.license settings if you are missing some files.'
+ break
+ fi
+ done
+
+ if use initramfs; then
+ if use dist-kernel; then
+ [[ -z ${ROOT} ]] && dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}"
+ else
+ # Don't forget to umount /boot if it was previously mounted by us.
+ mount-boot_pkg_postinst
+ fi
+ fi
+}
+
+pkg_prerm() {
+ # Make sure /boot is mounted so that we can remove /boot/amd-uc.img!
+ use initramfs && ! use dist-kernel && mount-boot_pkg_prerm
+}
+
+pkg_postrm() {
+ # Don't forget to umount /boot if it was previously mounted by us.
+ use initramfs && ! use dist-kernel && mount-boot_pkg_postrm
+}
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-kernel/linux-firmware/files/, sys-kernel/linux-firmware/
@ 2024-10-19 13:29 Mike Pagano
0 siblings, 0 replies; 11+ messages in thread
From: Mike Pagano @ 2024-10-19 13:29 UTC (permalink / raw
To: gentoo-commits
commit: 44b358c2437431ba2addd455a6f1c6627d5a37e2
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 19 13:29:10 2024 +0000
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Sat Oct 19 13:29:10 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=44b358c2
sys-kernel/linux-firmware: Don't check for broken links with savedconfig
Bug: https://bugs.gentoo.org/941786
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
.../files/linux-firmware-copy-firmware-r6.patch | 47 +++
.../linux-firmware-20241017-r1.ebuild | 403 +++++++++++++++++++++
2 files changed, 450 insertions(+)
diff --git a/sys-kernel/linux-firmware/files/linux-firmware-copy-firmware-r6.patch b/sys-kernel/linux-firmware/files/linux-firmware-copy-firmware-r6.patch
new file mode 100644
index 000000000000..d9ae09a8ad23
--- /dev/null
+++ b/sys-kernel/linux-firmware/files/linux-firmware-copy-firmware-r6.patch
@@ -0,0 +1,47 @@
+--- a/copy-firmware.sh 2024-10-19 13:21:08.888499335 -0000
++++ b/copy-firmware.sh 2024-10-19 13:23:16.775386475 -0000
+@@ -46,6 +46,17 @@ while test $# -gt 0; do
+ shift
+ ;;
+
++ --firmware-list)
++ if [ -n "$2" ]; then
++ FIRMWARE_LIST=`cat $2`
++ shift 2
++ else
++ echo "ERROR: '--firmware-list' requires a non-empty option argument of firmware files to install"
++ exit 1
++ fi
++ ;;
++
++
+ *)
+ if test -n "$destdir"; then
+ err "unknown command-line options: $*"
+@@ -70,6 +81,7 @@ $verbose "Checking that WHENCE file is f
+
+ # shellcheck disable=SC2162 # file/folder name can include escaped symbols
+ grep -E '^(RawFile|File):' WHENCE | sed -E -e 's/^(RawFile|File): */\1 /;s/"//g' | while read k f; do
++ [ -n "${FIRMWARE_LIST}" ] && if ! echo "${FIRMWARE_LIST}" | grep -q "${f}"; then continue; fi
+ install -d "$destdir/$(dirname "$f")"
+ $verbose "copying/compressing file $f$compext"
+ if test "$compress" != "cat" && test "$k" = "RawFile"; then
+@@ -82,6 +94,7 @@ done
+
+ # shellcheck disable=SC2162 # file/folder name can include escaped symbols
+ grep -E '^Link:' WHENCE | sed -e 's/^Link: *//g;s/-> //g' | while read l t; do
++ [ -n "${FIRMWARE_LIST}" ] && if ! echo "${FIRMWARE_LIST}" | grep -q "${f}"; then continue; fi
+ directory="$destdir/$(dirname "$l")"
+ install -d "$directory"
+ target="$(cd "$directory" && realpath -m -s "$t")"
+@@ -96,7 +109,9 @@ done
+
+ # Verify no broken symlinks
+ if test "$(find "$destdir" -xtype l | wc -l)" -ne 0 ; then
+- err "Broken symlinks found:\\n$(find "$destdir" -xtype l)"
++ if [ -z "${FIRMWARE_LIST}" ]; then
++ err "Broken symlinks found:\\n$(find "$destdir" -xtype l)"
++ fi
+ fi
+
+ exit 0
diff --git a/sys-kernel/linux-firmware/linux-firmware-20241017-r1.ebuild b/sys-kernel/linux-firmware/linux-firmware-20241017-r1.ebuild
new file mode 100644
index 000000000000..04e0082e6dbe
--- /dev/null
+++ b/sys-kernel/linux-firmware/linux-firmware-20241017-r1.ebuild
@@ -0,0 +1,403 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+PYTHON_COMPAT=( python3_{10..13} )
+inherit dist-kernel-utils linux-info mount-boot python-any-r1 savedconfig
+
+# In case this is a real snapshot, fill in commit below.
+# For normal, tagged releases, leave blank
+MY_COMMIT=""
+
+if [[ ${PV} == 99999999* ]]; then
+ inherit git-r3
+ EGIT_REPO_URI="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/${PN}.git"
+else
+ if [[ -n "${MY_COMMIT}" ]]; then
+ SRC_URI="https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/snapshot/${MY_COMMIT}.tar.gz -> ${P}.tar.gz"
+ S="${WORKDIR}/${MY_COMMIT}"
+ else
+ SRC_URI="https://mirrors.edge.kernel.org/pub/linux/kernel/firmware/${P}.tar.xz"
+ fi
+
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
+fi
+
+DESCRIPTION="Linux firmware files"
+HOMEPAGE="https://git.kernel.org/?p=linux/kernel/git/firmware/linux-firmware.git"
+
+LICENSE="GPL-2 GPL-2+ GPL-3 BSD MIT || ( MPL-1.1 GPL-2 )
+ redistributable? ( linux-fw-redistributable BSD-2 BSD BSD-4 ISC MIT )
+ unknown-license? ( all-rights-reserved )"
+SLOT="0"
+IUSE="bindist compress-xz compress-zstd deduplicate dist-kernel +initramfs +redistributable savedconfig unknown-license"
+REQUIRED_USE="initramfs? ( redistributable )
+ ?? ( compress-xz compress-zstd )
+ savedconfig? ( !deduplicate )"
+
+RESTRICT="binchecks strip test
+ !bindist? ( bindist )
+ unknown-license? ( bindist )"
+
+BDEPEND="initramfs? ( app-alternatives/cpio )
+ compress-xz? ( app-arch/xz-utils )
+ compress-zstd? ( app-arch/zstd )
+ deduplicate? ( app-misc/rdfind )
+ ${PYTHON_DEPS}"
+
+#add anything else that collides to this
+RDEPEND="!savedconfig? (
+ redistributable? (
+ !sys-firmware/alsa-firmware[alsa_cards_ca0132]
+ !sys-block/qla-fc-firmware
+ !sys-firmware/raspberrypi-wifi-ucode
+ )
+ unknown-license? (
+ !sys-firmware/alsa-firmware[alsa_cards_korg1212]
+ !sys-firmware/alsa-firmware[alsa_cards_maestro3]
+ !sys-firmware/alsa-firmware[alsa_cards_sb16]
+ !sys-firmware/alsa-firmware[alsa_cards_ymfpci]
+ )
+ )
+ dist-kernel? (
+ virtual/dist-kernel
+ initramfs? (
+ app-alternatives/cpio
+ )
+ )
+"
+IDEPEND="
+ dist-kernel? (
+ initramfs? ( sys-kernel/installkernel )
+ )
+"
+
+QA_PREBUILT="*"
+PATCHES=(
+ "${FILESDIR}"/${PN}-copy-firmware-r6.patch
+ "${FILESDIR}"/${PN}-check-whence.patch
+)
+
+pkg_pretend() {
+ if use initramfs; then
+ if use dist-kernel; then
+ # Check, but don't die because we can fix the problem and then
+ # emerge --config ... to re-run installation.
+ [[ -z ${ROOT} ]] && nonfatal mount-boot_check_status
+ else
+ mount-boot_pkg_pretend
+ fi
+ fi
+}
+
+pkg_setup() {
+ if use compress-xz || use compress-zstd ; then
+ local CONFIG_CHECK
+
+ if kernel_is -ge 5 19; then
+ use compress-xz && CONFIG_CHECK="~FW_LOADER_COMPRESS_XZ"
+ use compress-zstd && CONFIG_CHECK="~FW_LOADER_COMPRESS_ZSTD"
+ else
+ use compress-xz && CONFIG_CHECK="~FW_LOADER_COMPRESS"
+ if use compress-zstd; then
+ eerror "Kernels <5.19 do not support ZSTD-compressed firmware files"
+ fi
+ fi
+ fi
+ linux-info_pkg_setup
+}
+
+src_unpack() {
+ if [[ ${PV} == 99999999* ]]; then
+ git-r3_src_unpack
+ else
+ default
+ # rename directory from git snapshot tarball
+ if [[ ${#GIT_COMMIT} -gt 8 ]]; then
+ mv ${PN}-*/ ${P} || die
+ fi
+ fi
+}
+
+src_prepare() {
+ default
+
+ cp "${FILESDIR}/${PN}-make-amd-ucode-img.bash" "${T}/make-amd-ucode-img" || die
+ chmod +x "${T}/make-amd-ucode-img" || die
+
+ if use initramfs && ! use dist-kernel; then
+ if [[ -d "${S}/amd-ucode" ]]; then
+ "${T}/make-amd-ucode-img" "${S}" "${S}/amd-ucode" || die
+ else
+ # If this will ever happen something has changed which
+ # must be reviewed
+ die "'${S}/amd-ucode' not found!"
+ fi
+ fi
+
+ # whitelist of misc files
+ local misc_files=(
+ copy-firmware.sh
+ check_whence.py
+ dedup-firmware.sh
+ LICEN[CS]E.*
+ README.md
+ WHENCE
+ )
+
+ # whitelist of images with a free software license
+ local free_software=(
+ # keyspan_pda (GPL-2+)
+ keyspan_pda/keyspan_pda.fw
+ keyspan_pda/xircom_pgs.fw
+ # dsp56k (GPL-2+)
+ dsp56k/bootstrap.bin
+ # ath9k_htc (BSD GPL-2+ MIT)
+ ath9k_htc/htc_7010-1.4.0.fw
+ ath9k_htc/htc_9271-1.4.0.fw
+ # pcnet_cs, 3c589_cs, 3c574_cs, serial_cs (dual GPL-2/MPL-1.1)
+ cis/LA-PCM.cis
+ cis/PCMLM28.cis
+ cis/DP83903.cis
+ cis/NE2K.cis
+ cis/tamarack.cis
+ cis/PE-200.cis
+ cis/PE520.cis
+ cis/3CXEM556.cis
+ cis/3CCFEM556.cis
+ cis/MT5634ZLX.cis
+ cis/RS-COM-2P.cis
+ cis/COMpad2.cis
+ cis/COMpad4.cis
+ # serial_cs (GPL-3)
+ cis/SW_555_SER.cis
+ cis/SW_7xx_SER.cis
+ cis/SW_8xx_SER.cis
+ # dvb-ttpci (GPL-2+)
+ av7110/bootcode.bin
+ # usbdux, usbduxfast, usbduxsigma (GPL-2+)
+ usbdux_firmware.bin
+ usbduxfast_firmware.bin
+ usbduxsigma_firmware.bin
+ # brcmfmac (GPL-2+)
+ brcm/brcmfmac4330-sdio.Prowise-PT301.txt
+ brcm/brcmfmac43340-sdio.meegopad-t08.txt
+ brcm/brcmfmac43362-sdio.cubietech,cubietruck.txt
+ brcm/brcmfmac43362-sdio.lemaker,bananapro.txt
+ brcm/brcmfmac43430a0-sdio.jumper-ezpad-mini3.txt
+ "brcm/brcmfmac43430a0-sdio.ONDA-V80 PLUS.txt"
+ brcm/brcmfmac43430-sdio.AP6212.txt
+ brcm/brcmfmac43430-sdio.Hampoo-D2D3_Vi8A1.txt
+ brcm/brcmfmac43430-sdio.MUR1DX.txt
+ brcm/brcmfmac43430-sdio.raspberrypi,3-model-b.txt
+ brcm/brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt
+ brcm/brcmfmac4356-pcie.gpd-win-pocket.txt
+ # isci (GPL-2)
+ isci/isci_firmware.bin
+ # carl9170 (GPL-2+)
+ carl9170-1.fw
+ # atusb (GPL-2+)
+ atusb/atusb-0.2.dfu
+ atusb/atusb-0.3.dfu
+ atusb/rzusb-0.3.bin
+ # mlxsw_spectrum (dual BSD/GPL-2)
+ mellanox/mlxsw_spectrum-13.1420.122.mfa2
+ mellanox/mlxsw_spectrum-13.1530.152.mfa2
+ mellanox/mlxsw_spectrum-13.1620.192.mfa2
+ mellanox/mlxsw_spectrum-13.1702.6.mfa2
+ mellanox/mlxsw_spectrum-13.1703.4.mfa2
+ mellanox/mlxsw_spectrum-13.1910.622.mfa2
+ mellanox/mlxsw_spectrum-13.2000.1122.mfa2
+ )
+
+ # blacklist of images with unknown license
+ local unknown_license=(
+ korg/k1212.dsp
+ ess/maestro3_assp_kernel.fw
+ ess/maestro3_assp_minisrc.fw
+ yamaha/ds1_ctrl.fw
+ yamaha/ds1_dsp.fw
+ yamaha/ds1e_ctrl.fw
+ ttusb-budget/dspbootcode.bin
+ emi62/bitstream.fw
+ emi62/loader.fw
+ emi62/midi.fw
+ emi62/spdif.fw
+ ti_3410.fw
+ ti_5052.fw
+ mts_mt9234mu.fw
+ mts_mt9234zba.fw
+ whiteheat.fw
+ whiteheat_loader.fw
+ cpia2/stv0672_vp4.bin
+ vicam/firmware.fw
+ edgeport/boot.fw
+ edgeport/boot2.fw
+ edgeport/down.fw
+ edgeport/down2.fw
+ edgeport/down3.bin
+ sb16/mulaw_main.csp
+ sb16/alaw_main.csp
+ sb16/ima_adpcm_init.csp
+ sb16/ima_adpcm_playback.csp
+ sb16/ima_adpcm_capture.csp
+ sun/cassini.bin
+ acenic/tg1.bin
+ acenic/tg2.bin
+ adaptec/starfire_rx.bin
+ adaptec/starfire_tx.bin
+ yam/1200.bin
+ yam/9600.bin
+ ositech/Xilinx7OD.bin
+ qlogic/isp1000.bin
+ myricom/lanai.bin
+ yamaha/yss225_registers.bin
+ lgs8g75.fw
+ )
+
+ if use !unknown-license; then
+ einfo "Removing files with unknown license ..."
+ rm -v "${unknown_license[@]}" || die
+ fi
+
+ if use !redistributable; then
+ # remove files _not_ in the free_software or unknown_license lists
+ # everything else is confirmed (or assumed) to be redistributable
+ # based on upstream acceptance policy
+ einfo "Removing non-redistributable files ..."
+ local OLDIFS="${IFS}"
+ local IFS=$'\n'
+ set -o pipefail
+ find ! -type d -printf "%P\n" \
+ | grep -Fvx -e "${misc_files[*]}" -e "${free_software[*]}" -e "${unknown_license[*]}" \
+ | xargs -d '\n' --no-run-if-empty rm -v
+
+ [[ ${?} -ne 0 ]] && die "Failed to remove non-redistributable files"
+
+ IFS="${OLDIFS}"
+ fi
+
+ restore_config ${PN}.conf
+}
+
+src_install() {
+
+ local FW_OPTIONS=( "-v" )
+ local files_to_keep=
+
+ if use savedconfig; then
+ if [[ -s "${S}/${PN}.conf" ]]; then
+ files_to_keep="${T}/files_to_keep.lst"
+ grep -v '^#' "${S}/${PN}.conf" 2>/dev/null > "${files_to_keep}" || die
+ [[ -s "${files_to_keep}" ]] || die "grep failed, empty config file?"
+ FW_OPTIONS+=( "--firmware-list" "${files_to_keep}" )
+ fi
+ fi
+
+ if use compress-xz; then
+ FW_OPTIONS+=( "--xz" )
+ elif use compress-zstd; then
+ FW_OPTIONS+=( "--zstd" )
+ fi
+ FW_OPTIONS+=( "${ED}/lib/firmware" )
+ ./copy-firmware.sh "${FW_OPTIONS[@]}" || die
+ use deduplicate && { ./dedup-firmware.sh "${ED}/lib/firmware" || die; }
+
+ pushd "${ED}/lib/firmware" &>/dev/null || die
+
+ # especially use !redistributable will cause some broken symlinks
+ einfo "Removing broken symlinks ..."
+ find * -xtype l -print -delete || die
+
+ # remove empty directories, bug #396073
+ find -type d -empty -delete || die
+
+ # sanity check
+ if ! ( shopt -s failglob; : * ) 2>/dev/null; then
+ eerror "No files to install. Check your USE flag settings"
+ eerror "and the list of files in your saved configuration."
+ die "Refusing to install an empty package"
+ fi
+
+ # create config file
+ echo "# Remove files that shall not be installed from this list." > "${S}"/${PN}.conf || die
+ find * ! -type d >> "${S}"/${PN}.conf || die
+ save_config "${S}"/${PN}.conf
+
+ popd &>/dev/null || die
+
+ # Instruct Dracut on whether or not we want the microcode in initramfs
+ (
+ insinto /usr/lib/dracut/dracut.conf.d
+ newins - 10-${PN}.conf <<<"early_microcode=$(usex initramfs)"
+ )
+ if use initramfs; then
+ # Install installkernel/kernel-install hooks for non-dracut initramfs
+ # generators that don't bundled the microcode
+ dobin "${T}/make-amd-ucode-img"
+ (
+ exeinto /usr/lib/kernel/preinst.d
+ doexe "${FILESDIR}/35-amd-microcode.install"
+ exeinto /usr/lib/kernel/install.d
+ doexe "${FILESDIR}/35-amd-microcode-systemd.install"
+ )
+ fi
+
+ if use initramfs && ! use dist-kernel; then
+ insinto /boot
+ doins "${S}"/amd-uc.img
+ fi
+
+ dodoc README.md
+ # some licenses require copyright and permission notice to be included
+ use bindist && dodoc WHENCE LICEN[CS]E.*
+}
+
+pkg_preinst() {
+ if use savedconfig; then
+ ewarn "USE=savedconfig is active. You must handle file collisions manually."
+ fi
+
+ # Fix 'symlink is blocked by a directory' Bug #871315
+ if has_version "<${CATEGORY}/${PN}-20220913-r2" ; then
+ rm -rf "${EROOT}"/lib/firmware/qcom/LENOVO/21BX
+ fi
+
+ # Make sure /boot is available if needed.
+ use initramfs && ! use dist-kernel && mount-boot_pkg_preinst
+}
+
+pkg_postinst() {
+ elog "If you are only interested in particular firmware files, edit the saved"
+ elog "configfile and remove those that you do not want."
+
+ local ver
+ for ver in ${REPLACING_VERSIONS}; do
+ if ver_test ${ver} -lt 20190514; then
+ elog
+ elog 'Starting with version 20190514, installation of many firmware'
+ elog 'files is controlled by USE flags. Please review your USE flag'
+ elog 'and package.license settings if you are missing some files.'
+ break
+ fi
+ done
+
+ if use initramfs; then
+ if use dist-kernel; then
+ [[ -z ${ROOT} ]] && dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}"
+ else
+ # Don't forget to umount /boot if it was previously mounted by us.
+ mount-boot_pkg_postinst
+ fi
+ fi
+}
+
+pkg_prerm() {
+ # Make sure /boot is mounted so that we can remove /boot/amd-uc.img!
+ use initramfs && ! use dist-kernel && mount-boot_pkg_prerm
+}
+
+pkg_postrm() {
+ # Don't forget to umount /boot if it was previously mounted by us.
+ use initramfs && ! use dist-kernel && mount-boot_pkg_postrm
+}
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: sys-kernel/linux-firmware/files/, sys-kernel/linux-firmware/
@ 2024-10-19 20:08 Mike Pagano
0 siblings, 0 replies; 11+ messages in thread
From: Mike Pagano @ 2024-10-19 20:08 UTC (permalink / raw
To: gentoo-commits
commit: 018935f3db624207320049282af915089c481cd5
Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 19 20:08:27 2024 +0000
Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Sat Oct 19 20:08:27 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=018935f3
sys-kernel/linux-firmware: drop 20241017-r1
Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
.../files/linux-firmware-copy-firmware-r5.patch | 36 --
.../linux-firmware-20241017-r1.ebuild | 403 ---------------------
2 files changed, 439 deletions(-)
diff --git a/sys-kernel/linux-firmware/files/linux-firmware-copy-firmware-r5.patch b/sys-kernel/linux-firmware/files/linux-firmware-copy-firmware-r5.patch
deleted file mode 100644
index 15e6ba0ebeb6..000000000000
--- a/sys-kernel/linux-firmware/files/linux-firmware-copy-firmware-r5.patch
+++ /dev/null
@@ -1,36 +0,0 @@
---- a/copy-firmware.sh 2024-10-18 06:39:44.742506779 -0400
-+++ b/copy-firmware.sh 2024-10-18 06:42:04.853498628 -0400
-@@ -46,6 +46,17 @@ while test $# -gt 0; do
- shift
- ;;
-
-+ --firmware-list)
-+ if [ -n "$2" ]; then
-+ FIRMWARE_LIST=`cat $2`
-+ shift 2
-+ else
-+ echo "ERROR: '--firmware-list' requires a non-empty option argument of firmware files to install"
-+ exit 1
-+ fi
-+ ;;
-+
-+
- *)
- if test -n "$destdir"; then
- err "unknown command-line options: $*"
-@@ -70,6 +81,7 @@ $verbose "Checking that WHENCE file is f
-
- # shellcheck disable=SC2162 # file/folder name can include escaped symbols
- grep -E '^(RawFile|File):' WHENCE | sed -E -e 's/^(RawFile|File): */\1 /;s/"//g' | while read k f; do
-+ [ -n "${FIRMWARE_LIST}" ] && if ! echo "${FIRMWARE_LIST}" | grep -q "${f}"; then continue; fi
- install -d "$destdir/$(dirname "$f")"
- $verbose "copying/compressing file $f$compext"
- if test "$compress" != "cat" && test "$k" = "RawFile"; then
-@@ -82,6 +94,7 @@ done
-
- # shellcheck disable=SC2162 # file/folder name can include escaped symbols
- grep -E '^Link:' WHENCE | sed -e 's/^Link: *//g;s/-> //g' | while read l t; do
-+ [ -n "${FIRMWARE_LIST}" ] && if ! echo "${FIRMWARE_LIST}" | grep -q "${f}"; then continue; fi
- directory="$destdir/$(dirname "$l")"
- install -d "$directory"
- target="$(cd "$directory" && realpath -m -s "$t")"
diff --git a/sys-kernel/linux-firmware/linux-firmware-20241017-r1.ebuild b/sys-kernel/linux-firmware/linux-firmware-20241017-r1.ebuild
deleted file mode 100644
index 04e0082e6dbe..000000000000
--- a/sys-kernel/linux-firmware/linux-firmware-20241017-r1.ebuild
+++ /dev/null
@@ -1,403 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=8
-PYTHON_COMPAT=( python3_{10..13} )
-inherit dist-kernel-utils linux-info mount-boot python-any-r1 savedconfig
-
-# In case this is a real snapshot, fill in commit below.
-# For normal, tagged releases, leave blank
-MY_COMMIT=""
-
-if [[ ${PV} == 99999999* ]]; then
- inherit git-r3
- EGIT_REPO_URI="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/${PN}.git"
-else
- if [[ -n "${MY_COMMIT}" ]]; then
- SRC_URI="https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/snapshot/${MY_COMMIT}.tar.gz -> ${P}.tar.gz"
- S="${WORKDIR}/${MY_COMMIT}"
- else
- SRC_URI="https://mirrors.edge.kernel.org/pub/linux/kernel/firmware/${P}.tar.xz"
- fi
-
- KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
-fi
-
-DESCRIPTION="Linux firmware files"
-HOMEPAGE="https://git.kernel.org/?p=linux/kernel/git/firmware/linux-firmware.git"
-
-LICENSE="GPL-2 GPL-2+ GPL-3 BSD MIT || ( MPL-1.1 GPL-2 )
- redistributable? ( linux-fw-redistributable BSD-2 BSD BSD-4 ISC MIT )
- unknown-license? ( all-rights-reserved )"
-SLOT="0"
-IUSE="bindist compress-xz compress-zstd deduplicate dist-kernel +initramfs +redistributable savedconfig unknown-license"
-REQUIRED_USE="initramfs? ( redistributable )
- ?? ( compress-xz compress-zstd )
- savedconfig? ( !deduplicate )"
-
-RESTRICT="binchecks strip test
- !bindist? ( bindist )
- unknown-license? ( bindist )"
-
-BDEPEND="initramfs? ( app-alternatives/cpio )
- compress-xz? ( app-arch/xz-utils )
- compress-zstd? ( app-arch/zstd )
- deduplicate? ( app-misc/rdfind )
- ${PYTHON_DEPS}"
-
-#add anything else that collides to this
-RDEPEND="!savedconfig? (
- redistributable? (
- !sys-firmware/alsa-firmware[alsa_cards_ca0132]
- !sys-block/qla-fc-firmware
- !sys-firmware/raspberrypi-wifi-ucode
- )
- unknown-license? (
- !sys-firmware/alsa-firmware[alsa_cards_korg1212]
- !sys-firmware/alsa-firmware[alsa_cards_maestro3]
- !sys-firmware/alsa-firmware[alsa_cards_sb16]
- !sys-firmware/alsa-firmware[alsa_cards_ymfpci]
- )
- )
- dist-kernel? (
- virtual/dist-kernel
- initramfs? (
- app-alternatives/cpio
- )
- )
-"
-IDEPEND="
- dist-kernel? (
- initramfs? ( sys-kernel/installkernel )
- )
-"
-
-QA_PREBUILT="*"
-PATCHES=(
- "${FILESDIR}"/${PN}-copy-firmware-r6.patch
- "${FILESDIR}"/${PN}-check-whence.patch
-)
-
-pkg_pretend() {
- if use initramfs; then
- if use dist-kernel; then
- # Check, but don't die because we can fix the problem and then
- # emerge --config ... to re-run installation.
- [[ -z ${ROOT} ]] && nonfatal mount-boot_check_status
- else
- mount-boot_pkg_pretend
- fi
- fi
-}
-
-pkg_setup() {
- if use compress-xz || use compress-zstd ; then
- local CONFIG_CHECK
-
- if kernel_is -ge 5 19; then
- use compress-xz && CONFIG_CHECK="~FW_LOADER_COMPRESS_XZ"
- use compress-zstd && CONFIG_CHECK="~FW_LOADER_COMPRESS_ZSTD"
- else
- use compress-xz && CONFIG_CHECK="~FW_LOADER_COMPRESS"
- if use compress-zstd; then
- eerror "Kernels <5.19 do not support ZSTD-compressed firmware files"
- fi
- fi
- fi
- linux-info_pkg_setup
-}
-
-src_unpack() {
- if [[ ${PV} == 99999999* ]]; then
- git-r3_src_unpack
- else
- default
- # rename directory from git snapshot tarball
- if [[ ${#GIT_COMMIT} -gt 8 ]]; then
- mv ${PN}-*/ ${P} || die
- fi
- fi
-}
-
-src_prepare() {
- default
-
- cp "${FILESDIR}/${PN}-make-amd-ucode-img.bash" "${T}/make-amd-ucode-img" || die
- chmod +x "${T}/make-amd-ucode-img" || die
-
- if use initramfs && ! use dist-kernel; then
- if [[ -d "${S}/amd-ucode" ]]; then
- "${T}/make-amd-ucode-img" "${S}" "${S}/amd-ucode" || die
- else
- # If this will ever happen something has changed which
- # must be reviewed
- die "'${S}/amd-ucode' not found!"
- fi
- fi
-
- # whitelist of misc files
- local misc_files=(
- copy-firmware.sh
- check_whence.py
- dedup-firmware.sh
- LICEN[CS]E.*
- README.md
- WHENCE
- )
-
- # whitelist of images with a free software license
- local free_software=(
- # keyspan_pda (GPL-2+)
- keyspan_pda/keyspan_pda.fw
- keyspan_pda/xircom_pgs.fw
- # dsp56k (GPL-2+)
- dsp56k/bootstrap.bin
- # ath9k_htc (BSD GPL-2+ MIT)
- ath9k_htc/htc_7010-1.4.0.fw
- ath9k_htc/htc_9271-1.4.0.fw
- # pcnet_cs, 3c589_cs, 3c574_cs, serial_cs (dual GPL-2/MPL-1.1)
- cis/LA-PCM.cis
- cis/PCMLM28.cis
- cis/DP83903.cis
- cis/NE2K.cis
- cis/tamarack.cis
- cis/PE-200.cis
- cis/PE520.cis
- cis/3CXEM556.cis
- cis/3CCFEM556.cis
- cis/MT5634ZLX.cis
- cis/RS-COM-2P.cis
- cis/COMpad2.cis
- cis/COMpad4.cis
- # serial_cs (GPL-3)
- cis/SW_555_SER.cis
- cis/SW_7xx_SER.cis
- cis/SW_8xx_SER.cis
- # dvb-ttpci (GPL-2+)
- av7110/bootcode.bin
- # usbdux, usbduxfast, usbduxsigma (GPL-2+)
- usbdux_firmware.bin
- usbduxfast_firmware.bin
- usbduxsigma_firmware.bin
- # brcmfmac (GPL-2+)
- brcm/brcmfmac4330-sdio.Prowise-PT301.txt
- brcm/brcmfmac43340-sdio.meegopad-t08.txt
- brcm/brcmfmac43362-sdio.cubietech,cubietruck.txt
- brcm/brcmfmac43362-sdio.lemaker,bananapro.txt
- brcm/brcmfmac43430a0-sdio.jumper-ezpad-mini3.txt
- "brcm/brcmfmac43430a0-sdio.ONDA-V80 PLUS.txt"
- brcm/brcmfmac43430-sdio.AP6212.txt
- brcm/brcmfmac43430-sdio.Hampoo-D2D3_Vi8A1.txt
- brcm/brcmfmac43430-sdio.MUR1DX.txt
- brcm/brcmfmac43430-sdio.raspberrypi,3-model-b.txt
- brcm/brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt
- brcm/brcmfmac4356-pcie.gpd-win-pocket.txt
- # isci (GPL-2)
- isci/isci_firmware.bin
- # carl9170 (GPL-2+)
- carl9170-1.fw
- # atusb (GPL-2+)
- atusb/atusb-0.2.dfu
- atusb/atusb-0.3.dfu
- atusb/rzusb-0.3.bin
- # mlxsw_spectrum (dual BSD/GPL-2)
- mellanox/mlxsw_spectrum-13.1420.122.mfa2
- mellanox/mlxsw_spectrum-13.1530.152.mfa2
- mellanox/mlxsw_spectrum-13.1620.192.mfa2
- mellanox/mlxsw_spectrum-13.1702.6.mfa2
- mellanox/mlxsw_spectrum-13.1703.4.mfa2
- mellanox/mlxsw_spectrum-13.1910.622.mfa2
- mellanox/mlxsw_spectrum-13.2000.1122.mfa2
- )
-
- # blacklist of images with unknown license
- local unknown_license=(
- korg/k1212.dsp
- ess/maestro3_assp_kernel.fw
- ess/maestro3_assp_minisrc.fw
- yamaha/ds1_ctrl.fw
- yamaha/ds1_dsp.fw
- yamaha/ds1e_ctrl.fw
- ttusb-budget/dspbootcode.bin
- emi62/bitstream.fw
- emi62/loader.fw
- emi62/midi.fw
- emi62/spdif.fw
- ti_3410.fw
- ti_5052.fw
- mts_mt9234mu.fw
- mts_mt9234zba.fw
- whiteheat.fw
- whiteheat_loader.fw
- cpia2/stv0672_vp4.bin
- vicam/firmware.fw
- edgeport/boot.fw
- edgeport/boot2.fw
- edgeport/down.fw
- edgeport/down2.fw
- edgeport/down3.bin
- sb16/mulaw_main.csp
- sb16/alaw_main.csp
- sb16/ima_adpcm_init.csp
- sb16/ima_adpcm_playback.csp
- sb16/ima_adpcm_capture.csp
- sun/cassini.bin
- acenic/tg1.bin
- acenic/tg2.bin
- adaptec/starfire_rx.bin
- adaptec/starfire_tx.bin
- yam/1200.bin
- yam/9600.bin
- ositech/Xilinx7OD.bin
- qlogic/isp1000.bin
- myricom/lanai.bin
- yamaha/yss225_registers.bin
- lgs8g75.fw
- )
-
- if use !unknown-license; then
- einfo "Removing files with unknown license ..."
- rm -v "${unknown_license[@]}" || die
- fi
-
- if use !redistributable; then
- # remove files _not_ in the free_software or unknown_license lists
- # everything else is confirmed (or assumed) to be redistributable
- # based on upstream acceptance policy
- einfo "Removing non-redistributable files ..."
- local OLDIFS="${IFS}"
- local IFS=$'\n'
- set -o pipefail
- find ! -type d -printf "%P\n" \
- | grep -Fvx -e "${misc_files[*]}" -e "${free_software[*]}" -e "${unknown_license[*]}" \
- | xargs -d '\n' --no-run-if-empty rm -v
-
- [[ ${?} -ne 0 ]] && die "Failed to remove non-redistributable files"
-
- IFS="${OLDIFS}"
- fi
-
- restore_config ${PN}.conf
-}
-
-src_install() {
-
- local FW_OPTIONS=( "-v" )
- local files_to_keep=
-
- if use savedconfig; then
- if [[ -s "${S}/${PN}.conf" ]]; then
- files_to_keep="${T}/files_to_keep.lst"
- grep -v '^#' "${S}/${PN}.conf" 2>/dev/null > "${files_to_keep}" || die
- [[ -s "${files_to_keep}" ]] || die "grep failed, empty config file?"
- FW_OPTIONS+=( "--firmware-list" "${files_to_keep}" )
- fi
- fi
-
- if use compress-xz; then
- FW_OPTIONS+=( "--xz" )
- elif use compress-zstd; then
- FW_OPTIONS+=( "--zstd" )
- fi
- FW_OPTIONS+=( "${ED}/lib/firmware" )
- ./copy-firmware.sh "${FW_OPTIONS[@]}" || die
- use deduplicate && { ./dedup-firmware.sh "${ED}/lib/firmware" || die; }
-
- pushd "${ED}/lib/firmware" &>/dev/null || die
-
- # especially use !redistributable will cause some broken symlinks
- einfo "Removing broken symlinks ..."
- find * -xtype l -print -delete || die
-
- # remove empty directories, bug #396073
- find -type d -empty -delete || die
-
- # sanity check
- if ! ( shopt -s failglob; : * ) 2>/dev/null; then
- eerror "No files to install. Check your USE flag settings"
- eerror "and the list of files in your saved configuration."
- die "Refusing to install an empty package"
- fi
-
- # create config file
- echo "# Remove files that shall not be installed from this list." > "${S}"/${PN}.conf || die
- find * ! -type d >> "${S}"/${PN}.conf || die
- save_config "${S}"/${PN}.conf
-
- popd &>/dev/null || die
-
- # Instruct Dracut on whether or not we want the microcode in initramfs
- (
- insinto /usr/lib/dracut/dracut.conf.d
- newins - 10-${PN}.conf <<<"early_microcode=$(usex initramfs)"
- )
- if use initramfs; then
- # Install installkernel/kernel-install hooks for non-dracut initramfs
- # generators that don't bundled the microcode
- dobin "${T}/make-amd-ucode-img"
- (
- exeinto /usr/lib/kernel/preinst.d
- doexe "${FILESDIR}/35-amd-microcode.install"
- exeinto /usr/lib/kernel/install.d
- doexe "${FILESDIR}/35-amd-microcode-systemd.install"
- )
- fi
-
- if use initramfs && ! use dist-kernel; then
- insinto /boot
- doins "${S}"/amd-uc.img
- fi
-
- dodoc README.md
- # some licenses require copyright and permission notice to be included
- use bindist && dodoc WHENCE LICEN[CS]E.*
-}
-
-pkg_preinst() {
- if use savedconfig; then
- ewarn "USE=savedconfig is active. You must handle file collisions manually."
- fi
-
- # Fix 'symlink is blocked by a directory' Bug #871315
- if has_version "<${CATEGORY}/${PN}-20220913-r2" ; then
- rm -rf "${EROOT}"/lib/firmware/qcom/LENOVO/21BX
- fi
-
- # Make sure /boot is available if needed.
- use initramfs && ! use dist-kernel && mount-boot_pkg_preinst
-}
-
-pkg_postinst() {
- elog "If you are only interested in particular firmware files, edit the saved"
- elog "configfile and remove those that you do not want."
-
- local ver
- for ver in ${REPLACING_VERSIONS}; do
- if ver_test ${ver} -lt 20190514; then
- elog
- elog 'Starting with version 20190514, installation of many firmware'
- elog 'files is controlled by USE flags. Please review your USE flag'
- elog 'and package.license settings if you are missing some files.'
- break
- fi
- done
-
- if use initramfs; then
- if use dist-kernel; then
- [[ -z ${ROOT} ]] && dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}"
- else
- # Don't forget to umount /boot if it was previously mounted by us.
- mount-boot_pkg_postinst
- fi
- fi
-}
-
-pkg_prerm() {
- # Make sure /boot is mounted so that we can remove /boot/amd-uc.img!
- use initramfs && ! use dist-kernel && mount-boot_pkg_prerm
-}
-
-pkg_postrm() {
- # Don't forget to umount /boot if it was previously mounted by us.
- use initramfs && ! use dist-kernel && mount-boot_pkg_postrm
-}
^ permalink raw reply related [flat|nested] 11+ messages in thread
end of thread, other threads:[~2024-10-19 20:08 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-16 18:00 [gentoo-commits] repo/gentoo:master commit in: sys-kernel/linux-firmware/files/, sys-kernel/linux-firmware/ Andrew Ammerlaan
-- strict thread matches above, loose matches on Subject: below --
2024-10-19 20:08 Mike Pagano
2024-10-19 13:29 Mike Pagano
2024-10-18 16:35 Mike Pagano
2024-06-28 13:35 Andrew Ammerlaan
2024-02-24 16:11 Mike Pagano
2024-02-16 23:11 Mike Pagano
2024-02-15 23:20 Mike Pagano
2024-02-15 23:20 Mike Pagano
2024-01-20 20:01 Mike Pagano
2023-11-26 15:13 Mike Pagano
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox