1
- # Copyright 1999-2023 Gentoo Authors
1
+ # Copyright 1999-2025 Gentoo Authors
2
2
# Distributed under the terms of the GNU General Public License v2
3
3
4
- EAPI=7
4
+ EAPI=8
5
5
6
- # Flatcar: Tell linux-info where to find the kernel source/build
7
- KERNEL_DIR=" ${SYSROOT%/ } /usr/src/linux"
8
- KBUILD_OUTPUT=" ${SYSROOT%/ } /var/cache/portage/sys-kernel/coreos-kernel"
9
- inherit linux-info savedconfig
6
+ inherit dist-kernel-utils linux-info mount-boot savedconfig
10
7
11
8
# In case this is a real snapshot, fill in commit below.
12
9
# For normal, tagged releases, leave blank
@@ -18,7 +15,7 @@ if [[ ${PV} == 99999999* ]]; then
18
15
EGIT_REPO_URI=" https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git"
19
16
else
20
17
if [[ -n " ${MY_COMMIT} " ]]; then
21
- SRC_URI=" https://git. kernel.org/cgit/ linux/kernel/git/firmware /linux-firmware.git/snapshot/ ${MY_COMMIT} .tar.gz -> linux-firmware-${PV} .tar.gz "
18
+ SRC_URI=" https://gitlab.com/ kernel-firmware/ linux-firmware/-/archive/ ${MY_COMMIT} /linux-firmware- ${MY_COMMIT} .tar.bz2 -> linux-firmware-${PV} .tar.bz2 "
22
19
S=" ${WORKDIR} /${MY_COMMIT} "
23
20
else
24
21
SRC_URI=" https://mirrors.edge.kernel.org/pub/linux/kernel/firmware/linux-firmware-${PV} .tar.xz -> linux-firmware-${PV} .tar.xz"
@@ -33,16 +30,21 @@ LICENSE="GPL-2 GPL-2+ GPL-3 BSD MIT || ( MPL-1.1 GPL-2 )
33
30
redistributable? ( linux-fw-redistributable BSD-2 BSD BSD-4 ISC MIT )
34
31
unknown-license? ( all-rights-reserved )"
35
32
SLOT=" 0"
36
- IUSE=" compress-xz compress-zstd initramfs +redistributable savedconfig unknown-license"
33
+ IUSE=" bindist compress-xz compress-zstd deduplicate dist-kernel + initramfs +redistributable unknown-license"
37
34
REQUIRED_USE=" initramfs? ( redistributable )
38
- ?? ( compress-xz compress-zstd )"
35
+ ?? ( compress-xz compress-zstd )
36
+ savedconfig? ( !deduplicate )"
39
37
40
38
RESTRICT=" binchecks strip test
39
+ !bindist? ( bindist )
41
40
unknown-license? ( bindist )"
42
41
43
- BDEPEND=" initramfs? ( app-arch /cpio )
42
+ BDEPEND=" initramfs? ( app-alternatives /cpio )
44
43
compress-xz? ( app-arch/xz-utils )
45
- compress-zstd? ( app-arch/zstd )"
44
+ compress-zstd? ( app-arch/zstd )
45
+ deduplicate? ( app-misc/rdfind )
46
+ ${PYTHON_DEPS} "
47
+
46
48
47
49
# Flatcar: depend on Kernel source and modules
48
50
DEPEND=" >=sys-kernel/coreos-modules-6.1:=
@@ -52,12 +54,6 @@ RDEPEND="!savedconfig? (
52
54
redistributable? (
53
55
!sys-firmware/alsa-firmware[alsa_cards_ca0132]
54
56
!sys-block/qla-fc-firmware
55
- !sys-firmware/iwl1000-ucode
56
- !sys-firmware/iwl6005-ucode
57
- !sys-firmware/iwl6030-ucode
58
- !sys-firmware/iwl3160-ucode
59
- !sys-firmware/iwl7260-ucode
60
- !sys-firmware/iwl3160-7260-bt-ucode
61
57
!sys-firmware/raspberrypi-wifi-ucode
62
58
)
63
59
unknown-license? (
@@ -66,13 +62,37 @@ RDEPEND="!savedconfig? (
66
62
!sys-firmware/alsa-firmware[alsa_cards_sb16]
67
63
!sys-firmware/alsa-firmware[alsa_cards_ymfpci]
68
64
)
69
- )"
65
+ )
66
+ dist-kernel? (
67
+ virtual/dist-kernel
68
+ initramfs? (
69
+ app-alternatives/cpio
70
+ )
71
+ )
72
+ "
73
+ IDEPEND="
74
+ dist-kernel? (
75
+ initramfs? ( sys-kernel/installkernel )
76
+ )
77
+ "
70
78
71
79
QA_PREBUILT=" *"
72
80
73
81
# Flatcar: source name is linux-firmware, not coreos-firmware
74
82
S=" ${WORKDIR} /linux-firmware-${PV} "
75
83
84
+ pkg_pretend () {
85
+ if use initramfs; then
86
+ if use dist-kernel; then
87
+ # Check, but don't die because we can fix the problem and then
88
+ # emerge --config ... to re-run installation.
89
+ nonfatal mount-boot_check_status
90
+ else
91
+ mount-boot_pkg_pretend
92
+ fi
93
+ fi
94
+ }
95
+
76
96
pkg_setup () {
77
97
if use compress-xz || use compress-zstd ; then
78
98
local CONFIG_CHECK
@@ -86,12 +106,8 @@ pkg_setup() {
86
106
eerror " Kernels <5.19 do not support ZSTD-compressed firmware files"
87
107
fi
88
108
fi
89
- linux-info_pkg_setup
90
109
fi
91
- }
92
-
93
- pkg_pretend () {
94
- use initramfs && mount-boot_pkg_pretend
110
+ linux-info_pkg_setup
95
111
}
96
112
97
113
# Flatcar: create symlinks for cxgb and ice firmwares
@@ -175,43 +191,18 @@ src_prepare() {
175
191
echo " # Remove files that shall not be installed from this list." > ${PN} .conf
176
192
find * \( \! -type d -and \! -name ${PN} .conf \) >> ${PN} .conf
177
193
178
- if use savedconfig; then
179
- restore_config ${PN} .conf
180
- ebegin " Removing all files not listed in config"
181
-
182
- local file delete_file preserved_file preserved_files=()
183
-
184
- while IFS= read -r file; do
185
- # Ignore comments.
186
- if [[ ${file} != " #" * ]]; then
187
- preserved_files+=(" ${file} " )
188
- fi
189
- done < ${PN} .conf || die
190
-
191
- while IFS= read -d " " -r file; do
192
- delete_file=true
193
- for preserved_file in " ${preserved_files[@]} " ; do
194
- if [[ " ${file} " == " ${preserved_file} " ]]; then
195
- delete_file=false
196
- fi
197
- done
198
-
199
- if ${delete_file} ; then
200
- rm " ${file} " || die
201
- fi
202
- done < <( find * \( \! -type d -and \! -name ${PN} .conf \) -print0 || die)
203
-
204
- eend || die
205
-
206
- # remove empty directories, bug #396073
207
- find -type d -empty -delete || die
208
- fi
209
-
210
194
# whitelist of misc files
211
195
local misc_files=(
196
+ build_packages.py
197
+ carl9170fw/autogen.sh
198
+ carl9170fw/genapi.sh
199
+ contrib/process_linux_firmware.py
212
200
copy-firmware.sh
201
+ check_whence.py
202
+ dedup-firmware.sh
203
+ LICEN[CS]E.*
204
+ README.md
213
205
WHENCE
214
- README
215
206
)
216
207
217
208
# whitelist of images with a free software license
@@ -373,35 +364,35 @@ pkg_preinst() {
373
364
rm -rf " ${EROOT} " /lib/firmware/qcom/LENOVO/21BX
374
365
fi
375
366
367
+ # Fix 'symlink is blocked by a directory' https://bugs.gentoo.org/958268#c3
368
+ if has_version " <${CATEGORY} /${PN} -20250613" ; then
369
+ rm -rf " ${EROOT} " /lib/firmware/nvidia/{ad103,ad104,ad106,ad107}
370
+ fi
371
+
376
372
# Make sure /boot is available if needed.
377
- use initramfs && mount-boot_pkg_preinst
373
+ use initramfs && ! use dist-kernel && mount-boot_pkg_preinst
378
374
}
379
375
380
376
pkg_postinst () {
381
377
elog " If you are only interested in particular firmware files, edit the saved"
382
378
elog " configfile and remove those that you do not want."
383
379
384
- local ver
385
- for ver in ${REPLACING_VERSIONS} ; do
386
- if ver_test ${ver} -lt 20190514; then
387
- elog
388
- elog ' Starting with version 20190514, installation of many firmware'
389
- elog ' files is controlled by USE flags. Please review your USE flag'
390
- elog ' and package.license settings if you are missing some files.'
391
- break
380
+ if use initramfs; then
381
+ if use dist-kernel; then
382
+ dist-kernel_reinstall_initramfs " ${KV_DIR} " " ${KV_FULL} " --all
383
+ else
384
+ # Don't forget to umount /boot if it was previously mounted by us.
385
+ mount-boot_pkg_postinst
392
386
fi
393
- done
394
-
395
- # Don't forget to umount /boot if it was previously mounted by us.
396
- use initramfs && mount-boot_pkg_postinst
387
+ fi
397
388
}
398
389
399
390
pkg_prerm () {
400
391
# Make sure /boot is mounted so that we can remove /boot/amd-uc.img!
401
- use initramfs && mount-boot_pkg_prerm
392
+ use initramfs && ! use dist-kernel && mount-boot_pkg_prerm
402
393
}
403
394
404
395
pkg_postrm () {
405
396
# Don't forget to umount /boot if it was previously mounted by us.
406
- use initramfs && mount-boot_pkg_postrm
397
+ use initramfs && ! use dist-kernel && mount-boot_pkg_postrm
407
398
}
0 commit comments