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: Wed, 14 Sep 2022 13:27:51
Message-Id: 1663162034.76d3346ffb8e85aab192bd0f38f92852f4eee2ed.mpagano@gentoo
1 commit: 76d3346ffb8e85aab192bd0f38f92852f4eee2ed
2 Author: Mike Pagano <mpagano <AT> gentoo <DOT> org>
3 AuthorDate: Wed Sep 14 13:27:14 2022 +0000
4 Commit: Mike Pagano <mpagano <AT> gentoo <DOT> org>
5 CommitDate: Wed Sep 14 13:27:14 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=76d3346f
7
8 sys-kernel/linux-firmware: add 20220913
9
10 Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>
11
12 sys-kernel/linux-firmware/Manifest | 1 +
13 .../linux-firmware/linux-firmware-20220913.ebuild | 349 +++++++++++++++++++++
14 2 files changed, 350 insertions(+)
15
16 diff --git a/sys-kernel/linux-firmware/Manifest b/sys-kernel/linux-firmware/Manifest
17 index d4040cd7e79a..371a15c57d74 100644
18 --- a/sys-kernel/linux-firmware/Manifest
19 +++ b/sys-kernel/linux-firmware/Manifest
20 @@ -8,3 +8,4 @@ DIST linux-firmware-20220509.tar.xz 253717320 BLAKE2B 0181e209a05c3acbdcdc175868
21 DIST linux-firmware-20220610.tar.xz 252543088 BLAKE2B b3f627fe150f76c9a1c7b70bf691587554808275debd56e9d36fd0eff63b7ab2351ba03dd298066b03db7f2e590d7f130677e158ade587fbfb59a9efd8f83c0c SHA512 76176af2bf1e83d91c88289623364bc5d3e45d96c8586bd5c064535ee245d133283d2176d142492139cfbd41ca6ad195522c662d923b6cc76556c8509638ad0d
22 DIST linux-firmware-20220708.tar.xz 242130176 BLAKE2B 7dce1bf1e13c1c59dd0de8485301cc011e8d73ee55d5dfcf9554ebe13c53870d3d6c2b7b8a79984ea0ea0eb8683bdd589c49e7824081c985bb951753431ee35b SHA512 cc3454ba9a26fac8ce87a08f5fef74a586e81ba3225bac53c702749fb6606cea829cea51d6cf55e0cb2fcfb28b2350d60998fe7782cba00d6eb5b26204f57e37
23 DIST linux-firmware-20220815.tar.xz 253238428 BLAKE2B 1de6998f1a993aa035e3eff76abc6cca49445ccff917b2a4d1e48b61087ec5bb15ff1efe7427735f766ae6a169d1c1ee2cede08d4c940362b73c37cae01aae44 SHA512 c8d4a7049fbb9d2b6e52272bded1f88cc49a27ac8a0f8cff57db5bd9f15e549724e140638667b1e60159f523039941c47dfeaa372cd5bcb206f35e9dee38ea73
24 +DIST linux-firmware-20220913.tar.xz 257803764 BLAKE2B 05248f897f653df73adcaefab759a7cbbfa6ac46f2a85a3ddd79539d48cf629b17df15dcea3fe00fd81b945aeeb51854f50ad386cac70f99631fd8d6f40e5fed SHA512 386f18d54c5979bf88c95b8cde4de4819faff4166cc4eee92ca397e86b3e6d408c078706c32c2ed0009402b7683dc985579ba53aa41234cf90d573ced1d7ece8
25
26 diff --git a/sys-kernel/linux-firmware/linux-firmware-20220913.ebuild b/sys-kernel/linux-firmware/linux-firmware-20220913.ebuild
27 new file mode 100644
28 index 000000000000..f4b705f99cb1
29 --- /dev/null
30 +++ b/sys-kernel/linux-firmware/linux-firmware-20220913.ebuild
31 @@ -0,0 +1,349 @@
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 ~loong ~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 + korg/k1212.dsp
222 + ess/maestro3_assp_kernel.fw
223 + ess/maestro3_assp_minisrc.fw
224 + yamaha/ds1_ctrl.fw
225 + yamaha/ds1_dsp.fw
226 + yamaha/ds1e_ctrl.fw
227 + ttusb-budget/dspbootcode.bin
228 + emi62/bitstream.fw
229 + emi62/loader.fw
230 + emi62/midi.fw
231 + emi62/spdif.fw
232 + ti_3410.fw
233 + ti_5052.fw
234 + mts_mt9234mu.fw
235 + mts_mt9234zba.fw
236 + whiteheat.fw
237 + whiteheat_loader.fw
238 + cpia2/stv0672_vp4.bin
239 + vicam/firmware.fw
240 + edgeport/boot.fw
241 + edgeport/boot2.fw
242 + edgeport/down.fw
243 + edgeport/down2.fw
244 + edgeport/down3.bin
245 + sb16/mulaw_main.csp
246 + sb16/alaw_main.csp
247 + sb16/ima_adpcm_init.csp
248 + sb16/ima_adpcm_playback.csp
249 + sb16/ima_adpcm_capture.csp
250 + sun/cassini.bin
251 + acenic/tg1.bin
252 + acenic/tg2.bin
253 + adaptec/starfire_rx.bin
254 + adaptec/starfire_tx.bin
255 + yam/1200.bin
256 + yam/9600.bin
257 + ositech/Xilinx7OD.bin
258 + qlogic/isp1000.bin
259 + myricom/lanai.bin
260 + yamaha/yss225_registers.bin
261 + lgs8g75.fw
262 + )
263 +
264 + if use !unknown-license; then
265 + einfo "Removing files with unknown license ..."
266 + rm -v "${unknown_license[@]}" || die
267 + fi
268 +
269 + if use !redistributable; then
270 + # remove files _not_ in the free_software or unknown_license lists
271 + # everything else is confirmed (or assumed) to be redistributable
272 + # based on upstream acceptance policy
273 + einfo "Removing non-redistributable files ..."
274 + local OLDIFS="${IFS}"
275 + local IFS=$'\n'
276 + set -o pipefail
277 + find ! -type d -printf "%P\n" \
278 + | grep -Fvx -e "${misc_files[*]}" -e "${free_software[*]}" -e "${unknown_license[*]}" \
279 + | xargs -d '\n' --no-run-if-empty rm -v
280 +
281 + [[ ${?} -ne 0 ]] && die "Failed to remove non-redistributable files"
282 +
283 + IFS="${OLDIFS}"
284 + fi
285 +
286 + restore_config ${PN}.conf
287 +}
288 +
289 +src_install() {
290 + ./copy-firmware.sh -v "${ED}/lib/firmware" || die
291 +
292 + pushd "${ED}/lib/firmware" &>/dev/null || die
293 +
294 + # especially use !redistributable will cause some broken symlinks
295 + einfo "Removing broken symlinks ..."
296 + find * -xtype l -print -delete || die
297 +
298 + if use savedconfig; then
299 + if [[ -s "${S}/${PN}.conf" ]]; then
300 + local files_to_keep="${T}/files_to_keep.lst"
301 + grep -v '^#' "${S}/${PN}.conf" 2>/dev/null > "${files_to_keep}" || die
302 + [[ -s "${files_to_keep}" ]] || die "grep failed, empty config file?"
303 +
304 + einfo "Applying USE=savedconfig; Removing all files not listed in config ..."
305 + find ! -type d -printf "%P\n" \
306 + | grep -Fvx -f "${files_to_keep}" \
307 + | xargs -d '\n' --no-run-if-empty rm -v
308 +
309 + if [[ ${PIPESTATUS[0]} -ne 0 ]]; then
310 + die "Find failed to print installed files"
311 + elif [[ ${PIPESTATUS[1]} -eq 2 ]]; then
312 + # grep returns exit status 1 if no lines were selected
313 + # which is the case when we want to keep all files
314 + die "Grep failed to select files to keep"
315 + elif [[ ${PIPESTATUS[2]} -ne 0 ]]; then
316 + die "Failed to remove files not listed in config"
317 + fi
318 + fi
319 + fi
320 +
321 + # remove empty directories, bug #396073
322 + find -type d -empty -delete || die
323 +
324 + # sanity check
325 + if ! ( shopt -s failglob; : * ) 2>/dev/null; then
326 + eerror "No files to install. Check your USE flag settings"
327 + eerror "and the list of files in your saved configuration."
328 + die "Refusing to install an empty package"
329 + fi
330 +
331 + # create config file
332 + echo "# Remove files that shall not be installed from this list." > "${S}"/${PN}.conf || die
333 + find * ! -type d >> "${S}"/${PN}.conf || die
334 + save_config "${S}"/${PN}.conf
335 +
336 + popd &>/dev/null || die
337 +
338 + if use initramfs ; then
339 + insinto /boot
340 + doins "${S}"/amd-uc.img
341 + fi
342 +}
343 +
344 +pkg_preinst() {
345 + if use savedconfig; then
346 + ewarn "USE=savedconfig is active. You must handle file collisions manually."
347 + fi
348 +
349 + # Make sure /boot is available if needed.
350 + use initramfs && mount-boot_pkg_preinst
351 +}
352 +
353 +pkg_postinst() {
354 + elog "If you are only interested in particular firmware files, edit the saved"
355 + elog "configfile and remove those that you do not want."
356 +
357 + local ver
358 + for ver in ${REPLACING_VERSIONS}; do
359 + if ver_test ${ver} -lt 20190514; then
360 + elog
361 + elog 'Starting with version 20190514, installation of many firmware'
362 + elog 'files is controlled by USE flags. Please review your USE flag'
363 + elog 'and package.license settings if you are missing some files.'
364 + break
365 + fi
366 + done
367 +
368 + # Don't forget to umount /boot if it was previously mounted by us.
369 + use initramfs && mount-boot_pkg_postinst
370 +}
371 +
372 +pkg_prerm() {
373 + # Make sure /boot is mounted so that we can remove /boot/amd-uc.img!
374 + use initramfs && mount-boot_pkg_prerm
375 +}
376 +
377 +pkg_postrm() {
378 + # Don't forget to umount /boot if it was previously mounted by us.
379 + use initramfs && mount-boot_pkg_postrm
380 +}