Skip to content

Commit 303f2a6

Browse files
committed
sys-kernel/coreos-firmware: Partially resync with Gentoo
KV_FULL wasn't being set before, so it was actually scanning all modules under /lib/modules, not just the ones for the current kernel version. Hopefully, we can eventually create an env file so that we can use the upstream ebuild directly, but this at least brings them closer in line. Signed-off-by: James Le Cuirot <[email protected]>
1 parent ebb732d commit 303f2a6

File tree

2 files changed

+63
-71
lines changed

2 files changed

+63
-71
lines changed

sdk_container/src/third_party/coreos-overlay/profiles/coreos/base/package.use

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ sys-fs/zfs minimal -rootfs
158158

159159
# Do not tinker with /boot partition at installation time.
160160
sys-fs/zfs-kmod -initramfs
161+
sys-kernel/coreos-firmware -initramfs
161162

162163
# Only needed for direct loading by the kernel, which is dangerous, and we
163164
# include all the microcode in the initrd anyway.

sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-firmware/coreos-firmware-99999999.ebuild

Lines changed: 62 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
# Copyright 1999-2023 Gentoo Authors
1+
# Copyright 1999-2025 Gentoo Authors
22
# Distributed under the terms of the GNU General Public License v2
33

4-
EAPI=7
4+
EAPI=8
55

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
107

118
# In case this is a real snapshot, fill in commit below.
129
# For normal, tagged releases, leave blank
@@ -18,7 +15,7 @@ if [[ ${PV} == 99999999* ]]; then
1815
EGIT_REPO_URI="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git"
1916
else
2017
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"
2219
S="${WORKDIR}/${MY_COMMIT}"
2320
else
2421
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 )
3330
redistributable? ( linux-fw-redistributable BSD-2 BSD BSD-4 ISC MIT )
3431
unknown-license? ( all-rights-reserved )"
3532
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"
3734
REQUIRED_USE="initramfs? ( redistributable )
38-
?? ( compress-xz compress-zstd )"
35+
?? ( compress-xz compress-zstd )
36+
savedconfig? ( !deduplicate )"
3937

4038
RESTRICT="binchecks strip test
39+
!bindist? ( bindist )
4140
unknown-license? ( bindist )"
4241

43-
BDEPEND="initramfs? ( app-arch/cpio )
42+
BDEPEND="initramfs? ( app-alternatives/cpio )
4443
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+
4648

4749
# Flatcar: depend on Kernel source and modules
4850
DEPEND=">=sys-kernel/coreos-modules-6.1:=
@@ -52,12 +54,6 @@ RDEPEND="!savedconfig? (
5254
redistributable? (
5355
!sys-firmware/alsa-firmware[alsa_cards_ca0132]
5456
!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
6157
!sys-firmware/raspberrypi-wifi-ucode
6258
)
6359
unknown-license? (
@@ -66,13 +62,37 @@ RDEPEND="!savedconfig? (
6662
!sys-firmware/alsa-firmware[alsa_cards_sb16]
6763
!sys-firmware/alsa-firmware[alsa_cards_ymfpci]
6864
)
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+
"
7078

7179
QA_PREBUILT="*"
7280

7381
# Flatcar: source name is linux-firmware, not coreos-firmware
7482
S="${WORKDIR}/linux-firmware-${PV}"
7583

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+
7696
pkg_setup() {
7797
if use compress-xz || use compress-zstd ; then
7898
local CONFIG_CHECK
@@ -86,12 +106,8 @@ pkg_setup() {
86106
eerror "Kernels <5.19 do not support ZSTD-compressed firmware files"
87107
fi
88108
fi
89-
linux-info_pkg_setup
90109
fi
91-
}
92-
93-
pkg_pretend() {
94-
use initramfs && mount-boot_pkg_pretend
110+
linux-info_pkg_setup
95111
}
96112

97113
# Flatcar: create symlinks for cxgb and ice firmwares
@@ -175,43 +191,18 @@ src_prepare() {
175191
echo "# Remove files that shall not be installed from this list." > ${PN}.conf
176192
find * \( \! -type d -and \! -name ${PN}.conf \) >> ${PN}.conf
177193

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-
210194
# whitelist of misc files
211195
local misc_files=(
196+
build_packages.py
197+
carl9170fw/autogen.sh
198+
carl9170fw/genapi.sh
199+
contrib/process_linux_firmware.py
212200
copy-firmware.sh
201+
check_whence.py
202+
dedup-firmware.sh
203+
LICEN[CS]E.*
204+
README.md
213205
WHENCE
214-
README
215206
)
216207

217208
# whitelist of images with a free software license
@@ -373,35 +364,35 @@ pkg_preinst() {
373364
rm -rf "${EROOT}"/lib/firmware/qcom/LENOVO/21BX
374365
fi
375366

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+
376372
# Make sure /boot is available if needed.
377-
use initramfs && mount-boot_pkg_preinst
373+
use initramfs && ! use dist-kernel && mount-boot_pkg_preinst
378374
}
379375

380376
pkg_postinst() {
381377
elog "If you are only interested in particular firmware files, edit the saved"
382378
elog "configfile and remove those that you do not want."
383379

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
392386
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
397388
}
398389

399390
pkg_prerm() {
400391
# 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
402393
}
403394

404395
pkg_postrm() {
405396
# 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
407398
}

0 commit comments

Comments
 (0)