Gentoo Archives: gentoo-commits

From: Mike Pagano <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-kernel/linux-firmware/
Date: Thu, 12 May 2022 13:18:13
Message-Id: 1652361476.5ae3cd103ec807dfee6c07ef5eb3c378235b1b5c.mpagano@gentoo
1 commit: 5ae3cd103ec807dfee6c07ef5eb3c378235b1b5c
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Thu May 12 13:17:56 2022 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Thu May 12 13:17:56 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5ae3cd10
7
8 sys-kernel/linux-firmware: add 20220509
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 sys-kernel/linux-firmware/Manifest | 1 +
13 .../linux-firmware/linux-firmware-20220509.ebuild | 353 +++++++++++++++++++++
14 2 files changed, 354 insertions(+)
15
16 diff --git a/sys-kernel/linux-firmware/Manifest b/sys-kernel/linux-firmware/Manifest
17 index 5a292840826e..4ba9b5abab94 100644
18 --- a/sys-kernel/linux-firmware/Manifest
19 +++ b/sys-kernel/linux-firmware/Manifest
20 @@ -8,3 +8,4 @@ DIST linux-firmware-20211216.tar.xz 198929516 BLAKE2B 01391e29d742b7e618563bdf01
21 DIST linux-firmware-20220209.tar.xz 227688608 BLAKE2B 56ff71b7184f6b2fbbac4b14be37f62f8543114939de9f474fe22b4e472d1e1e0c3d3aa3089a2b8c31ff54679799a84cbc44a8378ca87666836ba07dc6d09c40 SHA512 518bf082b26c18e67ef0fb0e16fad757b6faf04742ce6c8423bc894c28ce6b06099f3f88bc36da7092e708460b1c8ec89543ae04d3cc817b2e813ffc6af0bf8e
22 DIST linux-firmware-20220310.tar.xz 237571732 BLAKE2B 9246d4fcdca0a9514606eb7b4ea7e18ea072b8d4302f62fd7aea4d85014c9f7da3eadc650e7c678bfe867c6f5ae9278b68b9a27c6074472ec9574ac922df23a5 SHA512 bafd5795d27c871c199e37f1e39f316e3577186283880da3b86cbc690749313342f8297342bf3ddfc6b3da7903ab2d5d24465240dfff1b0be51aa47f90872758
23 DIST linux-firmware-20220411.tar.xz 237957584 BLAKE2B 441699abac0a7554c96324e40676218401febe9ea2a11ff9ab9f9ea4945b4c590c10c9a353aa8c5c66325b408ab9ebcb57fa77b520066f1d9995cb5989bc5b75 SHA512 5470701872ed4670962d3ccb4fd046c1f00145d69e942d76b21ccce08077ca4db867bbb31b87668e6298e130f28fc522a6ff4d66927fbfcee44042e1d908f71d
24 +DIST linux-firmware-20220509.tar.xz 253717320 BLAKE2B 0181e209a05c3acbdcdc175868dca0ae2993effac0b265335f502a03d3a38cc4849366bb229ade87621426e99112f520f4d50444e438572c61cfc2c6d01ed6a6 SHA512 17d48222a0029d0540a7071b541653a42d66676c4dde88b7c148249450cfcb09087318cb4558ca7a0a7583f3bf0b00948d9383073e038c4f76bc4e807c757c2a
25
26 diff --git a/sys-kernel/linux-firmware/linux-firmware-20220509.ebuild b/sys-kernel/linux-firmware/linux-firmware-20220509.ebuild
27 new file mode 100644
28 index 000000000000..38cb90b53b9b
29 --- /dev/null
30 +++ b/sys-kernel/linux-firmware/linux-firmware-20220509.ebuild
31 @@ -0,0 +1,353 @@
32 +# Copyright 1999-2022 Gentoo Authors
33 +# Distributed under the terms of the GNU General Public License v2
34 +
35 +EAPI=7
36 +inherit mount-boot savedconfig
37 +
38 +# In case this is a real snapshot, fill in commit below.
39 +# For normal, tagged releases, leave blank
40 +MY_COMMIT=""
41 +
42 +if [[ ${PV} == 99999999* ]]; then
43 + inherit git-r3
44 + EGIT_REPO_URI="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/${PN}.git"
45 +else
46 + if [[ -n "${MY_COMMIT}" ]]; then
47 + SRC_URI="https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/snapshot/${MY_COMMIT}.tar.gz -> ${P}.tar.gz"
48 + S="${WORKDIR}/${MY_COMMIT}"
49 + else
50 + SRC_URI="https://mirrors.edge.kernel.org/pub/linux/kernel/firmware/${P}.tar.xz"
51 + fi
52 +
53 + KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
54 +fi
55 +
56 +DESCRIPTION="Linux firmware files"
57 +HOMEPAGE="https://git.kernel.org/?p=linux/kernel/git/firmware/linux-firmware.git"
58 +
59 +LICENSE="GPL-2 GPL-2+ GPL-3 BSD MIT || ( MPL-1.1 GPL-2 )
60 + redistributable? (
61 + linux-fw-redistributable ( BSD-2 BSD BSD-4 ISC MIT no-source-code ) )
62 + unknown-license? ( all-rights-reserved )"
63 +SLOT="0"
64 +IUSE="initramfs +redistributable savedconfig unknown-license"
65 +REQUIRED_USE="initramfs? ( redistributable )"
66 +
67 +RESTRICT="binchecks strip test
68 + unknown-license? ( bindist )"
69 +
70 +BDEPEND="initramfs? ( app-arch/cpio )"
71 +
72 +#add anything else that collides to this
73 +RDEPEND="!savedconfig? (
74 + redistributable? (
75 + !sys-firmware/alsa-firmware[alsa_cards_ca0132]
76 + !sys-block/qla-fc-firmware
77 + !sys-firmware/iwl1000-ucode
78 + !sys-firmware/iwl6005-ucode
79 + !sys-firmware/iwl6030-ucode
80 + !sys-firmware/iwl3160-ucode
81 + !sys-firmware/iwl7260-ucode
82 + !sys-firmware/iwl3160-7260-bt-ucode
83 + !sys-firmware/raspberrypi-wifi-ucode
84 + )
85 + unknown-license? (
86 + !sys-firmware/alsa-firmware[alsa_cards_korg1212]
87 + !sys-firmware/alsa-firmware[alsa_cards_maestro3]
88 + !sys-firmware/alsa-firmware[alsa_cards_sb16]
89 + !sys-firmware/alsa-firmware[alsa_cards_ymfpci]
90 + )
91 + )"
92 +
93 +QA_PREBUILT="*"
94 +
95 +pkg_pretend() {
96 + use initramfs && mount-boot_pkg_pretend
97 +}
98 +
99 +src_unpack() {
100 + if [[ ${PV} == 99999999* ]]; then
101 + git-r3_src_unpack
102 + else
103 + default
104 + # rename directory from git snapshot tarball
105 + if [[ ${#GIT_COMMIT} -gt 8 ]]; then
106 + mv ${PN}-*/ ${P} || die
107 + fi
108 + fi
109 +}
110 +
111 +src_prepare() {
112 + default
113 +
114 + find . -type f -not -perm 0644 -print0 \
115 + | xargs --null --no-run-if-empty chmod 0644 \
116 + || die
117 +
118 + chmod +x copy-firmware.sh || die
119 +
120 + if use initramfs; then
121 + if [[ -d "${S}/amd-ucode" ]]; then
122 + local UCODETMP="${T}/ucode_tmp"
123 + local UCODEDIR="${UCODETMP}/kernel/x86/microcode"
124 + mkdir -p "${UCODEDIR}" || die
125 + echo 1 > "${UCODETMP}/early_cpio"
126 +
127 + local amd_ucode_file="${UCODEDIR}/AuthenticAMD.bin"
128 + cat "${S}"/amd-ucode/*.bin > "${amd_ucode_file}" || die "Failed to concat amd cpu ucode"
129 +
130 + if [[ ! -s "${amd_ucode_file}" ]]; then
131 + die "Sanity check failed: '${amd_ucode_file}' is empty!"
132 + fi
133 +
134 + pushd "${UCODETMP}" &>/dev/null || die
135 + find . -print0 | cpio --quiet --null -o -H newc -R 0:0 > "${S}"/amd-uc.img
136 + popd &>/dev/null || die
137 + if [[ ! -s "${S}/amd-uc.img" ]]; then
138 + die "Failed to create '${S}/amd-uc.img'!"
139 + fi
140 + else
141 + # If this will ever happen something has changed which
142 + # must be reviewed
143 + die "'${S}/amd-ucode' not found!"
144 + fi
145 + fi
146 +
147 + # whitelist of misc files
148 + local misc_files=(
149 + copy-firmware.sh
150 + WHENCE
151 + README
152 + )
153 +
154 + # whitelist of images with a free software license
155 + local free_software=(
156 + # keyspan_pda (GPL-2+)
157 + keyspan_pda/keyspan_pda.fw
158 + keyspan_pda/xircom_pgs.fw
159 + # dsp56k (GPL-2+)
160 + dsp56k/bootstrap.bin
161 + # ath9k_htc (BSD GPL-2+ MIT)
162 + ath9k_htc/htc_7010-1.4.0.fw
163 + ath9k_htc/htc_9271-1.4.0.fw
164 + # pcnet_cs, 3c589_cs, 3c574_cs, serial_cs (dual GPL-2/MPL-1.1)
165 + cis/LA-PCM.cis
166 + cis/PCMLM28.cis
167 + cis/DP83903.cis
168 + cis/NE2K.cis
169 + cis/tamarack.cis
170 + cis/PE-200.cis
171 + cis/PE520.cis
172 + cis/3CXEM556.cis
173 + cis/3CCFEM556.cis
174 + cis/MT5634ZLX.cis
175 + cis/RS-COM-2P.cis
176 + cis/COMpad2.cis
177 + cis/COMpad4.cis
178 + # serial_cs (GPL-3)
179 + cis/SW_555_SER.cis
180 + cis/SW_7xx_SER.cis
181 + cis/SW_8xx_SER.cis
182 + # dvb-ttpci (GPL-2+)
183 + av7110/bootcode.bin
184 + # usbdux, usbduxfast, usbduxsigma (GPL-2+)
185 + usbdux_firmware.bin
186 + usbduxfast_firmware.bin
187 + usbduxsigma_firmware.bin
188 + # brcmfmac (GPL-2+)
189 + brcm/brcmfmac4330-sdio.Prowise-PT301.txt
190 + brcm/brcmfmac43340-sdio.meegopad-t08.txt
191 + brcm/brcmfmac43362-sdio.cubietech,cubietruck.txt
192 + brcm/brcmfmac43362-sdio.lemaker,bananapro.txt
193 + brcm/brcmfmac43430a0-sdio.jumper-ezpad-mini3.txt
194 + "brcm/brcmfmac43430a0-sdio.ONDA-V80 PLUS.txt"
195 + brcm/brcmfmac43430-sdio.AP6212.txt
196 + brcm/brcmfmac43430-sdio.Hampoo-D2D3_Vi8A1.txt
197 + brcm/brcmfmac43430-sdio.MUR1DX.txt
198 + brcm/brcmfmac43430-sdio.raspberrypi,3-model-b.txt
199 + brcm/brcmfmac43455-sdio.raspberrypi,3-model-b-plus.txt
200 + brcm/brcmfmac4356-pcie.gpd-win-pocket.txt
201 + # isci (GPL-2)
202 + isci/isci_firmware.bin
203 + # carl9170 (GPL-2+)
204 + carl9170-1.fw
205 + # atusb (GPL-2+)
206 + atusb/atusb-0.2.dfu
207 + atusb/atusb-0.3.dfu
208 + atusb/rzusb-0.3.bin
209 + # mlxsw_spectrum (dual BSD/GPL-2)
210 + mellanox/mlxsw_spectrum-13.1420.122.mfa2
211 + mellanox/mlxsw_spectrum-13.1530.152.mfa2
212 + mellanox/mlxsw_spectrum-13.1620.192.mfa2
213 + mellanox/mlxsw_spectrum-13.1702.6.mfa2
214 + mellanox/mlxsw_spectrum-13.1703.4.mfa2
215 + mellanox/mlxsw_spectrum-13.1910.622.mfa2
216 + mellanox/mlxsw_spectrum-13.2000.1122.mfa2
217 + )
218 +
219 + # blacklist of images with unknown license
220 + local unknown_license=(
221 + atmsar11.fw
222 + korg/k1212.dsp
223 + ess/maestro3_assp_kernel.fw
224 + ess/maestro3_assp_minisrc.fw
225 + yamaha/ds1_ctrl.fw
226 + yamaha/ds1_dsp.fw
227 + yamaha/ds1e_ctrl.fw
228 + tr_smctr.bin
229 + ttusb-budget/dspbootcode.bin
230 + emi62/bitstream.fw
231 + emi62/loader.fw
232 + emi62/midi.fw
233 + emi62/spdif.fw
234 + ti_3410.fw
235 + ti_5052.fw
236 + mts_mt9234mu.fw
237 + mts_mt9234zba.fw
238 + whiteheat.fw
239 + whiteheat_loader.fw
240 + intelliport2.bin
241 + cpia2/stv0672_vp4.bin
242 + vicam/firmware.fw
243 + edgeport/boot.fw
244 + edgeport/boot2.fw
245 + edgeport/down.fw
246 + edgeport/down2.fw
247 + edgeport/down3.bin
248 + sb16/mulaw_main.csp
249 + sb16/alaw_main.csp
250 + sb16/ima_adpcm_init.csp
251 + sb16/ima_adpcm_playback.csp
252 + sb16/ima_adpcm_capture.csp
253 + sun/cassini.bin
254 + acenic/tg1.bin
255 + acenic/tg2.bin
256 + adaptec/starfire_rx.bin
257 + adaptec/starfire_tx.bin
258 + yam/1200.bin
259 + yam/9600.bin
260 + 3com/3C359.bin
261 + ositech/Xilinx7OD.bin
262 + qlogic/isp1000.bin
263 + myricom/lanai.bin
264 + yamaha/yss225_registers.bin
265 + lgs8g75.fw
266 + )
267 +
268 + if use !unknown-license; then
269 + einfo "Removing files with unknown license ..."
270 + rm -v "${unknown_license[@]}" || die
271 + fi
272 +
273 + if use !redistributable; then
274 + # remove files _not_ in the free_software or unknown_license lists
275 + # everything else is confirmed (or assumed) to be redistributable
276 + # based on upstream acceptance policy
277 + einfo "Removing non-redistributable files ..."
278 + local OLDIFS="${IFS}"
279 + local IFS=$'\n'
280 + set -o pipefail
281 + find ! -type d -printf "%P\n" \
282 + | grep -Fvx -e "${misc_files[*]}" -e "${free_software[*]}" -e "${unknown_license[*]}" \
283 + | xargs -d '\n' --no-run-if-empty rm -v
284 +
285 + [[ ${?} -ne 0 ]] && die "Failed to remove non-redistributable files"
286 +
287 + IFS="${OLDIFS}"
288 + fi
289 +
290 + restore_config ${PN}.conf
291 +}
292 +
293 +src_install() {
294 + ./copy-firmware.sh -v "${ED}/lib/firmware" || die
295 +
296 + pushd "${ED}/lib/firmware" &>/dev/null || die
297 +
298 + # especially use !redistributable will cause some broken symlinks
299 + einfo "Removing broken symlinks ..."
300 + find * -xtype l -print -delete || die
301 +
302 + if use savedconfig; then
303 + if [[ -s "${S}/${PN}.conf" ]]; then
304 + local files_to_keep="${T}/files_to_keep.lst"
305 + grep -v '^#' "${S}/${PN}.conf" 2>/dev/null > "${files_to_keep}" || die
306 + [[ -s "${files_to_keep}" ]] || die "grep failed, empty config file?"
307 +
308 + einfo "Applying USE=savedconfig; Removing all files not listed in config ..."
309 + find ! -type d -printf "%P\n" \
310 + | grep -Fvx -f "${files_to_keep}" \
311 + | xargs -d '\n' --no-run-if-empty rm -v
312 +
313 + if [[ ${PIPESTATUS[0]} -ne 0 ]]; then
314 + die "Find failed to print installed files"
315 + elif [[ ${PIPESTATUS[1]} -eq 2 ]]; then
316 + # grep returns exit status 1 if no lines were selected
317 + # which is the case when we want to keep all files
318 + die "Grep failed to select files to keep"
319 + elif [[ ${PIPESTATUS[2]} -ne 0 ]]; then
320 + die "Failed to remove files not listed in config"
321 + fi
322 + fi
323 + fi
324 +
325 + # remove empty directories, bug #396073
326 + find -type d -empty -delete || die
327 +
328 + # sanity check
329 + if ! ( shopt -s failglob; : * ) 2>/dev/null; then
330 + eerror "No files to install. Check your USE flag settings"
331 + eerror "and the list of files in your saved configuration."
332 + die "Refusing to install an empty package"
333 + fi
334 +
335 + # create config file
336 + echo "# Remove files that shall not be installed from this list." > "${S}"/${PN}.conf || die
337 + find * ! -type d >> "${S}"/${PN}.conf || die
338 + save_config "${S}"/${PN}.conf
339 +
340 + popd &>/dev/null || die
341 +
342 + if use initramfs ; then
343 + insinto /boot
344 + doins "${S}"/amd-uc.img
345 + fi
346 +}
347 +
348 +pkg_preinst() {
349 + if use savedconfig; then
350 + ewarn "USE=savedconfig is active. You must handle file collisions manually."
351 + fi
352 +
353 + # Make sure /boot is available if needed.
354 + use initramfs && mount-boot_pkg_preinst
355 +}
356 +
357 +pkg_postinst() {
358 + elog "If you are only interested in particular firmware files, edit the saved"
359 + elog "configfile and remove those that you do not want."
360 +
361 + local ver
362 + for ver in ${REPLACING_VERSIONS}; do
363 + if ver_test ${ver} -lt 20190514; then
364 + elog
365 + elog 'Starting with version 20190514, installation of many firmware'
366 + elog 'files is controlled by USE flags. Please review your USE flag'
367 + elog 'and package.license settings if you are missing some files.'
368 + break
369 + fi
370 + done
371 +
372 + # Don't forget to umount /boot if it was previously mounted by us.
373 + use initramfs && mount-boot_pkg_postinst
374 +}
375 +
376 +pkg_prerm() {
377 + # Make sure /boot is mounted so that we can remove /boot/amd-uc.img!
378 + use initramfs && mount-boot_pkg_prerm
379 +}
380 +
381 +pkg_postrm() {
382 + # Don't forget to umount /boot if it was previously mounted by us.
383 + use initramfs && mount-boot_pkg_postrm
384 +}