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
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
7
+ KERNEL_DIR=" ${ESYSROOT %/ } /usr/src/linux"
8
+ KBUILD_OUTPUT=" ${ESYSROOT %/ } /var/cache/portage/sys-kernel/coreos-kernel"
9
+ inherit dist-kernel-utils linux-info mount-boot savedconfig
10
10
11
11
# In case this is a real snapshot, fill in commit below.
12
12
# For normal, tagged releases, leave blank
@@ -18,7 +18,7 @@ if [[ ${PV} == 99999999* ]]; then
18
18
EGIT_REPO_URI=" https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git"
19
19
else
20
20
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 "
21
+ SRC_URI=" https://gitlab.com/ kernel-firmware/ linux-firmware/-/archive/ ${MY_COMMIT} /linux-firmware- ${MY_COMMIT} .tar.bz2 -> linux-firmware-${PV} .tar.bz2 "
22
22
S=" ${WORKDIR} /${MY_COMMIT} "
23
23
else
24
24
SRC_URI=" https://mirrors.edge.kernel.org/pub/linux/kernel/firmware/linux-firmware-${PV} .tar.xz -> linux-firmware-${PV} .tar.xz"
@@ -33,16 +33,21 @@ LICENSE="GPL-2 GPL-2+ GPL-3 BSD MIT || ( MPL-1.1 GPL-2 )
33
33
redistributable? ( linux-fw-redistributable BSD-2 BSD BSD-4 ISC MIT )
34
34
unknown-license? ( all-rights-reserved )"
35
35
SLOT=" 0"
36
- IUSE=" compress-xz compress-zstd initramfs +redistributable savedconfig unknown-license"
36
+ IUSE=" bindist compress-xz compress-zstd deduplicate dist-kernel + initramfs +redistributable unknown-license"
37
37
REQUIRED_USE=" initramfs? ( redistributable )
38
- ?? ( compress-xz compress-zstd )"
38
+ ?? ( compress-xz compress-zstd )
39
+ savedconfig? ( !deduplicate )"
39
40
40
41
RESTRICT=" binchecks strip test
42
+ !bindist? ( bindist )
41
43
unknown-license? ( bindist )"
42
44
43
- BDEPEND=" initramfs? ( app-arch /cpio )
45
+ BDEPEND=" initramfs? ( app-alternatives /cpio )
44
46
compress-xz? ( app-arch/xz-utils )
45
- compress-zstd? ( app-arch/zstd )"
47
+ compress-zstd? ( app-arch/zstd )
48
+ deduplicate? ( app-misc/rdfind )
49
+ ${PYTHON_DEPS} "
50
+
46
51
47
52
# Flatcar: depend on Kernel source and modules
48
53
DEPEND=" >=sys-kernel/coreos-modules-6.1:=
@@ -52,12 +57,6 @@ RDEPEND="!savedconfig? (
52
57
redistributable? (
53
58
!sys-firmware/alsa-firmware[alsa_cards_ca0132]
54
59
!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
60
!sys-firmware/raspberrypi-wifi-ucode
62
61
)
63
62
unknown-license? (
@@ -66,13 +65,37 @@ RDEPEND="!savedconfig? (
66
65
!sys-firmware/alsa-firmware[alsa_cards_sb16]
67
66
!sys-firmware/alsa-firmware[alsa_cards_ymfpci]
68
67
)
69
- )"
68
+ )
69
+ dist-kernel? (
70
+ virtual/dist-kernel
71
+ initramfs? (
72
+ app-alternatives/cpio
73
+ )
74
+ )
75
+ "
76
+ IDEPEND="
77
+ dist-kernel? (
78
+ initramfs? ( sys-kernel/installkernel )
79
+ )
80
+ "
70
81
71
82
QA_PREBUILT=" *"
72
83
73
84
# Flatcar: source name is linux-firmware, not coreos-firmware
74
85
S=" ${WORKDIR} /linux-firmware-${PV} "
75
86
87
+ pkg_pretend () {
88
+ if use initramfs; then
89
+ if use dist-kernel; then
90
+ # Check, but don't die because we can fix the problem and then
91
+ # emerge --config ... to re-run installation.
92
+ nonfatal mount-boot_check_status
93
+ else
94
+ mount-boot_pkg_pretend
95
+ fi
96
+ fi
97
+ }
98
+
76
99
pkg_setup () {
77
100
if use compress-xz || use compress-zstd ; then
78
101
local CONFIG_CHECK
@@ -86,12 +109,8 @@ pkg_setup() {
86
109
eerror " Kernels <5.19 do not support ZSTD-compressed firmware files"
87
110
fi
88
111
fi
89
- linux-info_pkg_setup
90
112
fi
91
- }
92
-
93
- pkg_pretend () {
94
- use initramfs && mount-boot_pkg_pretend
113
+ linux-info_pkg_setup
95
114
}
96
115
97
116
# Flatcar: create symlinks for cxgb and ice firmwares
@@ -175,43 +194,18 @@ src_prepare() {
175
194
echo " # Remove files that shall not be installed from this list." > ${PN} .conf
176
195
find * \( \! -type d -and \! -name ${PN} .conf \) >> ${PN} .conf
177
196
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
197
# whitelist of misc files
211
198
local misc_files=(
199
+ build_packages.py
200
+ carl9170fw/autogen.sh
201
+ carl9170fw/genapi.sh
202
+ contrib/process_linux_firmware.py
212
203
copy-firmware.sh
204
+ check_whence.py
205
+ dedup-firmware.sh
206
+ LICEN[CS]E.*
207
+ README.md
213
208
WHENCE
214
- README
215
209
)
216
210
217
211
# whitelist of images with a free software license
@@ -373,35 +367,35 @@ pkg_preinst() {
373
367
rm -rf " ${EROOT} " /lib/firmware/qcom/LENOVO/21BX
374
368
fi
375
369
370
+ # Fix 'symlink is blocked by a directory' https://bugs.gentoo.org/958268#c3
371
+ if has_version " <${CATEGORY} /${PN} -20250613" ; then
372
+ rm -rf " ${EROOT} " /lib/firmware/nvidia/{ad103,ad104,ad106,ad107}
373
+ fi
374
+
376
375
# Make sure /boot is available if needed.
377
- use initramfs && mount-boot_pkg_preinst
376
+ use initramfs && ! use dist-kernel && mount-boot_pkg_preinst
378
377
}
379
378
380
379
pkg_postinst () {
381
380
elog " If you are only interested in particular firmware files, edit the saved"
382
381
elog " configfile and remove those that you do not want."
383
382
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
383
+ if use initramfs; then
384
+ if use dist-kernel; then
385
+ dist-kernel_reinstall_initramfs " ${KV_DIR} " " ${KV_FULL} " --all
386
+ else
387
+ # Don't forget to umount /boot if it was previously mounted by us.
388
+ mount-boot_pkg_postinst
392
389
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
390
+ fi
397
391
}
398
392
399
393
pkg_prerm () {
400
394
# Make sure /boot is mounted so that we can remove /boot/amd-uc.img!
401
- use initramfs && mount-boot_pkg_prerm
395
+ use initramfs && ! use dist-kernel && mount-boot_pkg_prerm
402
396
}
403
397
404
398
pkg_postrm () {
405
399
# Don't forget to umount /boot if it was previously mounted by us.
406
- use initramfs && mount-boot_pkg_postrm
400
+ use initramfs && ! use dist-kernel && mount-boot_pkg_postrm
407
401
}
0 commit comments