From 02b80b7948ffc306a498183d78656d5792b83f34 Mon Sep 17 00:00:00 2001 From: Dongsu Park Date: Wed, 19 Aug 2026 15:11:59 +0200 Subject: [PATCH 1/3] overlay coreos-firmware: update to 20260810 Update coreos-firmware to 20260810, syncing with linux-firmware of Gentoo. Gentoo ref: 05f7620d93b0355b2ca4b03307099f1c0b509b93 Signed-off-by: Dongsu Park --- .../sys-kernel/coreos-firmware/Manifest | 2 +- ...ebuild => coreos-firmware-20260810.ebuild} | 0 .../coreos-firmware-99999999.ebuild | 277 +++++++----------- 3 files changed, 114 insertions(+), 165 deletions(-) rename sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-firmware/{coreos-firmware-20260519.ebuild => coreos-firmware-20260810.ebuild} (100%) diff --git a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-firmware/Manifest b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-firmware/Manifest index e1b5078381a..97df4b8f16e 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-firmware/Manifest +++ b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-firmware/Manifest @@ -1 +1 @@ -DIST linux-firmware-20260519.tar.xz 622942528 BLAKE2B ff91ed099c4df0cc59dcca628270d5e533ab522d616fbf4f40fda79977f409a49c9cc57826dcc999470ce6c117526ce07cf595d01dea202184bfb55d1efadfd6 SHA512 c7177fc092e5f1a896d98690ce13f3f1ba023b003caf0cd5bfb6286d90b9b23e763d5c9bc54532e90d97b37286a872a4071915478f87706f4392253543cd40af +DIST linux-firmware-20260810.tar.xz 648855508 BLAKE2B 9dd9c6656a026d1d5336c58deecb46ff8b62ef7c5c7870af366c2ce7857bdc9c0a3342aca6a67798c1560cdff146a8299d381188d20bda83b80bd4fa20b9debb SHA512 2ef755194eb022e539aa677474ca5c6c8c3616b3302ebc14e1698c62ccb6ba6f8149e507b46c2a0563297c53502defb892ce4d37eb02646d99d955ae899eebe7 diff --git a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-firmware/coreos-firmware-20260519.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-firmware/coreos-firmware-20260810.ebuild similarity index 100% rename from sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-firmware/coreos-firmware-20260519.ebuild rename to sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-firmware/coreos-firmware-20260810.ebuild diff --git a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-firmware/coreos-firmware-99999999.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-firmware/coreos-firmware-99999999.ebuild index 848efbde139..a2dd2400a23 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-firmware/coreos-firmware-99999999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-firmware/coreos-firmware-99999999.ebuild @@ -1,43 +1,40 @@ -# Copyright 1999-2025 Gentoo Authors +# Copyright 1999-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 - -inherit dist-kernel-utils linux-info mount-boot savedconfig +inherit dist-kernel-utils eapi9-ver linux-info mount-boot savedconfig # In case this is a real snapshot, fill in commit below. # For normal, tagged releases, leave blank MY_COMMIT="" -# Flatcar: use linux-firmware instead of ${PN}, coreos-firmware to avoid naming conflicts. if [[ ${PV} == 99999999* ]]; then inherit git-r3 - EGIT_REPO_URI="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git" + EGIT_REPO_URI="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/${PN}.git" else if [[ -n "${MY_COMMIT}" ]]; then - SRC_URI="https://gitlab.com/kernel-firmware/linux-firmware/-/archive/${MY_COMMIT}/linux-firmware-${MY_COMMIT}.tar.bz2 -> linux-firmware-${PV}.tar.bz2" - S="${WORKDIR}/${MY_COMMIT}" + SRC_URI="https://gitlab.com/kernel-firmware/linux-firmware/-/archive/${MY_COMMIT}/linux-firmware-${MY_COMMIT}.tar.bz2 -> ${P}.tar.bz2" + S="${WORKDIR}/${PN}-${MY_COMMIT}" else - SRC_URI="https://mirrors.edge.kernel.org/pub/linux/kernel/firmware/linux-firmware-${PV}.tar.xz -> linux-firmware-${PV}.tar.xz" + SRC_URI="https://mirrors.edge.kernel.org/pub/linux/kernel/firmware/${P}.tar.xz" fi - KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86" + + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" fi DESCRIPTION="Linux firmware files" HOMEPAGE="https://git.kernel.org/?p=linux/kernel/git/firmware/linux-firmware.git" LICENSE="GPL-2 GPL-2+ GPL-3 BSD MIT || ( MPL-1.1 GPL-2 ) - redistributable? ( linux-fw-redistributable BSD-2 BSD BSD-4 ISC MIT ) - unknown-license? ( all-rights-reserved )" + redistributable? ( linux-fw-redistributable BSD-2 BSD BSD-4 ISC MIT )" SLOT="0" -IUSE="bindist compress-xz compress-zstd deduplicate dist-kernel +initramfs +redistributable unknown-license" +IUSE="bindist compress-xz compress-zstd deduplicate dist-kernel +initramfs +redistributable" REQUIRED_USE="initramfs? ( redistributable ) ?? ( compress-xz compress-zstd ) savedconfig? ( !deduplicate )" RESTRICT="binchecks strip test - !bindist? ( bindist ) - unknown-license? ( bindist )" + !bindist? ( bindist )" BDEPEND="initramfs? ( app-alternatives/cpio ) compress-xz? ( app-arch/xz-utils ) @@ -45,23 +42,13 @@ BDEPEND="initramfs? ( app-alternatives/cpio ) deduplicate? ( app-misc/rdfind ) ${PYTHON_DEPS}" - -# Flatcar: depend on Kernel source and modules -DEPEND=">=sys-kernel/coreos-modules-6.1:= - sys-kernel/coreos-sources" #add anything else that collides to this RDEPEND="!savedconfig? ( redistributable? ( - !sys-firmware/alsa-firmware[alsa_cards_ca0132] + !sys-firmware/alsa-firmware[alsa_cards_ca0132,-deduplicate(-)] !sys-block/qla-fc-firmware !sys-firmware/raspberrypi-wifi-ucode ) - unknown-license? ( - !sys-firmware/alsa-firmware[alsa_cards_korg1212] - !sys-firmware/alsa-firmware[alsa_cards_maestro3] - !sys-firmware/alsa-firmware[alsa_cards_sb16] - !sys-firmware/alsa-firmware[alsa_cards_ymfpci] - ) ) dist-kernel? ( virtual/dist-kernel @@ -77,9 +64,9 @@ IDEPEND=" " QA_PREBUILT="*" - -# Flatcar: source name is linux-firmware, not coreos-firmware -S="${WORKDIR}/linux-firmware-${PV}" +PATCHES=( + "${FILESDIR}"/${PN}-copy-firmware-r9.patch +) pkg_pretend() { if use initramfs; then @@ -110,93 +97,39 @@ pkg_setup() { linux-info_pkg_setup } -# Flatcar: create symlinks for cxgb and ice firmwares -CXGB_VERSION="1.27.5.0" -ICE_DDP_VERSION="1.3.43.0" - src_unpack() { if [[ ${PV} == 99999999* ]]; then git-r3_src_unpack else default # rename directory from git snapshot tarball - # Flatcar: move a correct directory ${MY_COMMIT}, as defined - # above in ${S}. - if [[ ${#MY_COMMIT} -gt 8 ]]; then - mv ${MY_COMMIT}/ linux-firmware-${PV} || die + if [[ ${#GIT_COMMIT} -gt 8 ]]; then + mv ${PN}-*/ ${P} || die fi - - # Flatcar: Upstream linux-firmware tarball does not contain - # symlinks for cxgb4 firmware files, but "modinfo - # cxgb4.ko" shows it requires t?fw.bin files. These - # normally are installed by the copy-firmware.sh - # script, which refers to the WHENCE file. Both the - # script and the file are in the tarball. The WHENCE - # file actually mentions that these symlinks should be - # created, but apparently our ebuild is not using this - # way of installing the firmware files, so we need to - # create the symlinks to avoid failures at the - # firmware scanning stage. - ln -sfn t4fw-${CXGB_VERSION}.bin linux-firmware-${PV}/cxgb4/t4fw.bin - ln -sfn t5fw-${CXGB_VERSION}.bin linux-firmware-${PV}/cxgb4/t5fw.bin - ln -sfn t6fw-${CXGB_VERSION}.bin linux-firmware-${PV}/cxgb4/t6fw.bin - - # Flatcar: Upstream linux-firmware tarball does not contain - # a correct symlink to intel/ice/ddp/ice-1.3.28.0.pkg, - # but "modinfo ice.ko" shows it requires ice.pkg. - # So we need to create the symlink to avoid failures at the - # firmware scanning stage. - ln -sfn ice-${ICE_DDP_VERSION}.pkg linux-firmware-${PV}/intel/ice/ddp/ice.pkg fi } src_prepare() { - # Flatcar: generate a list of firmware - local kernel_mods="${SYSROOT%/}/lib/modules/${KV_FULL}" - - # It happens that some modules uses `MODULE_FIRMWARE` with a file - # not shipped into 'linux-firmware'. - # In such a case, we can safely ignore those. - # e.g 'amdgpu/ip_discovery.bin' is not a file shipped by linux-firmware (see: https://github.com/torvalds/linux/commit/a79d3709c40d492fb859fb5cec4bb0b3eaa09a12) - local module_firmware_skip_list=( - amdgpu/cyan_skillfish_gpu_info.bin - amdgpu/ip_discovery.bin - amdgpu/vega10_cap.bin - amdgpu/sienna_cichlid_cap.bin - amdgpu/navi12_cap.bin - amdgpu/aldebaran_cap.bin - amdgpu/gc_11_0_0_toc.bin - amdgpu/gc_11_0_3_mes.bin - ) - - # Fail if any firmware is missing. - einfo "Scanning for files required by ${KV_FULL}" - echo "# Remove files that shall not be installed from this list." > ${PN}.conf - local kofile fwfile failed - for kofile in $(find "${kernel_mods}" -name '*.ko' -o -name '*.ko.xz'); do - for fwfile in $(modinfo --field firmware "${kofile}"); do - if [[ ! -e "${fwfile}" ]] && ! [[ "${module_firmware_skip_list[*]}" =~ "${fwfile}" ]]; then - eerror "Missing firmware: ${fwfile} (${kofile##*/})" - failed=1 - elif [[ -L "${fwfile}" ]]; then - printf "%s\n" "${fwfile}" "$(realpath --relative-to=. "${fwfile}")" >> ${PN}.conf - else - printf "%s\n" "${fwfile}" >> ${PN}.conf - fi - done - done - if [[ -n "${failed}" ]]; then - die "Missing firmware" - fi + default - # AMD's microcode is shipped as part of coreos-firmware, but not a dependency to - # any module, so add it manually - use amd64 && find amd-ucode/ -type f -not -name "*.asc" >> ${PN}.conf + # Stub out this script to avoid errors in the live ebuild + cat >check_whence.py<<-EOF + #!/bin/sh + exit 0 + EOF - einfo "Pruning all unneeded firmware files..." - find * -not -type d -not -name ${PN}.conf -print0 | grep -Fzxvf ${PN}.conf | xargs -r0 rm -v + cp "${FILESDIR}/${PN}-make-amd-ucode-img.bash" "${T}/make-amd-ucode-img" || die + chmod +x "${T}/make-amd-ucode-img" || die - default + if use initramfs && ! use dist-kernel; then + if [[ -d "${S}/amd-ucode" ]]; then + "${T}/make-amd-ucode-img" "${S}" "${S}/amd-ucode" || die + else + # If this will ever happen something has changed which + # must be reviewed + die "'${S}/amd-ucode' not found!" + fi + fi # whitelist of misc files local misc_files=( @@ -277,59 +210,8 @@ src_prepare() { mellanox/mlxsw_spectrum-13.2000.1122.mfa2 ) - # blacklist of images with unknown license - # Flatcar: remove Alteon AceNIC drivers from unknown_license to install - # the firmware files: acenic/tg?.bin. - local unknown_license=( - korg/k1212.dsp - ess/maestro3_assp_kernel.fw - ess/maestro3_assp_minisrc.fw - yamaha/ds1_ctrl.fw - yamaha/ds1_dsp.fw - yamaha/ds1e_ctrl.fw - ttusb-budget/dspbootcode.bin - emi62/bitstream.fw - emi62/loader.fw - emi62/midi.fw - emi62/spdif.fw - ti_3410.fw - ti_5052.fw - mts_mt9234mu.fw - mts_mt9234zba.fw - whiteheat.fw - whiteheat_loader.fw - cpia2/stv0672_vp4.bin - vicam/firmware.fw - edgeport/boot.fw - edgeport/boot2.fw - edgeport/down.fw - edgeport/down2.fw - edgeport/down3.bin - sb16/mulaw_main.csp - sb16/alaw_main.csp - sb16/ima_adpcm_init.csp - sb16/ima_adpcm_playback.csp - sb16/ima_adpcm_capture.csp - sun/cassini.bin - adaptec/starfire_rx.bin - adaptec/starfire_tx.bin - yam/1200.bin - yam/9600.bin - ositech/Xilinx7OD.bin - qlogic/isp1000.bin - myricom/lanai.bin - yamaha/yss225_registers.bin - lgs8g75.fw - ) - - if use !unknown-license; then - einfo "Removing files with unknown license ..." - # Flatcar: do not die even if no such license file is there. - rm -vf "${unknown_license[@]}" - fi - if use !redistributable; then - # remove files _not_ in the free_software or unknown_license lists + # remove files _not_ in the free_software lists # everything else is confirmed (or assumed) to be redistributable # based on upstream acceptance policy einfo "Removing non-redistributable files ..." @@ -337,7 +219,7 @@ src_prepare() { local IFS=$'\n' set -o pipefail find ! -type d -printf "%P\n" \ - | grep -Fvx -e "${misc_files[*]}" -e "${free_software[*]}" -e "${unknown_license[*]}" \ + | grep -Fvx -e "${misc_files[*]}" -e "${free_software[*]}" \ | xargs -d '\n' --no-run-if-empty rm -v [[ ${?} -ne 0 ]] && die "Failed to remove non-redistributable files" @@ -349,16 +231,76 @@ src_prepare() { } src_install() { - # Flatcar: take a simplified approach instead of cumbersome installation - # like done in Gentoo. - # - # Don't save the firmware config to /etc/portage/savedconfig/ - # if we use !savedconfig; then - # save_config ${PN}.conf - # fi - rm ${PN}.conf || die - insinto /lib/firmware/ - doins -r * + local FW_OPTIONS=( "-v" "-j1" ) + local files_to_keep= + + if use savedconfig; then + if [[ -s "${S}/${PN}.conf" ]]; then + files_to_keep="${T}/files_to_keep.lst" + grep -v '^#' "${S}/${PN}.conf" 2>/dev/null > "${files_to_keep}" || die + [[ -s "${files_to_keep}" ]] || die "grep failed, empty config file?" + FW_OPTIONS+=( "--firmware-list" "${files_to_keep}" ) + fi + fi + + if use compress-xz; then + FW_OPTIONS+=( "--xz" ) + elif use compress-zstd; then + FW_OPTIONS+=( "--zstd" ) + fi + FW_OPTIONS+=( "${ED}/lib/firmware" ) + ./copy-firmware.sh "${FW_OPTIONS[@]}" || die + use deduplicate && { ./dedup-firmware.sh "${ED}/lib/firmware" || die; } + + pushd "${ED}/lib/firmware" &>/dev/null || die + + # especially use !redistributable will cause some broken symlinks + einfo "Removing broken symlinks ..." + find * -xtype l -print -delete || die + + # remove empty files and directories, bug #396073 + # Copy-firmware.sh may have made empty copies of files we removed + find -empty -delete || die + + # sanity check + if ! ( shopt -s failglob; : * ) 2>/dev/null; then + eerror "No files to install. Check your USE flag settings" + eerror "and the list of files in your saved configuration." + die "Refusing to install an empty package" + fi + + # create config file + echo "# Remove files that shall not be installed from this list." > "${S}"/${PN}.conf || die + find * ! -type d >> "${S}"/${PN}.conf || die + save_config "${S}"/${PN}.conf + + popd &>/dev/null || die + + # Instruct Dracut on whether or not we want the microcode in initramfs + ( + insinto /usr/lib/dracut/dracut.conf.d + newins - 10-${PN}.conf <<<"early_microcode=$(usex initramfs)" + ) + if use initramfs; then + # Install installkernel/kernel-install hooks for non-dracut initramfs + # generators that don't bundled the microcode + dobin "${T}/make-amd-ucode-img" + ( + exeinto /usr/lib/kernel/preinst.d + doexe "${FILESDIR}/35-amd-microcode.install" + exeinto /usr/lib/kernel/install.d + doexe "${FILESDIR}/35-amd-microcode-systemd.install" + ) + fi + + if use initramfs && ! use dist-kernel; then + insinto /boot + doins "${S}"/amd-uc.img + fi + + dodoc README.md + # some licenses require copyright and permission notice to be included + use bindist && dodoc -r WHENCE LICENSES } pkg_preinst() { @@ -384,6 +326,13 @@ pkg_postinst() { elog "If you are only interested in particular firmware files, edit the saved" elog "configfile and remove those that you do not want." + if ver_replacing -lt 20190514; then + elog + elog 'Starting with version 20190514, installation of many firmware' + elog 'files is controlled by USE flags. Please review your USE flag' + elog 'and package.license settings if you are missing some files.' + fi + if use initramfs; then if use dist-kernel; then dist-kernel_reinstall_initramfs "${KV_DIR}" "${KV_FULL}" --all From 0389097fde3c7ff81b4d3569412ceeb615abe0ff Mon Sep 17 00:00:00 2001 From: Dongsu Park Date: Wed, 19 Aug 2026 16:06:26 +0200 Subject: [PATCH 2/3] overlay coreos-firmware: Apply Flatcar modifications Apply Flatcar modifications on top of Gentoo ebuilds. * Use hard-coded linux-firmware directory instead of ${PN} as well as ${S} to avoid naming conflicts. * Depend on packages of Kernel source and modules. * Create symlinks for CXGB and ICE DDP firmware files. * Rewrite src_prepare and src_install. * Fix deletion of unneeded firmware files. * Ignore some missing amdgpu firmware. Signed-off-by: Dongsu Park --- .../coreos-firmware-99999999.ebuild | 217 ++++++++++-------- 1 file changed, 126 insertions(+), 91 deletions(-) diff --git a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-firmware/coreos-firmware-99999999.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-firmware/coreos-firmware-99999999.ebuild index a2dd2400a23..d2e4a935e75 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-firmware/coreos-firmware-99999999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-firmware/coreos-firmware-99999999.ebuild @@ -8,18 +8,18 @@ inherit dist-kernel-utils eapi9-ver linux-info mount-boot savedconfig # For normal, tagged releases, leave blank MY_COMMIT="" +# Flatcar: use linux-firmware instead of ${PN}, coreos-firmware to avoid naming conflicts. if [[ ${PV} == 99999999* ]]; then inherit git-r3 - EGIT_REPO_URI="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/${PN}.git" + EGIT_REPO_URI="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git" else if [[ -n "${MY_COMMIT}" ]]; then - SRC_URI="https://gitlab.com/kernel-firmware/linux-firmware/-/archive/${MY_COMMIT}/linux-firmware-${MY_COMMIT}.tar.bz2 -> ${P}.tar.bz2" - S="${WORKDIR}/${PN}-${MY_COMMIT}" + SRC_URI="https://gitlab.com/kernel-firmware/linux-firmware/-/archive/${MY_COMMIT}/linux-firmware-${MY_COMMIT}.tar.bz2 -> linux-firmware-${PV}.tar.bz2" + S="${WORKDIR}/${MY_COMMIT}" else - SRC_URI="https://mirrors.edge.kernel.org/pub/linux/kernel/firmware/${P}.tar.xz" + SRC_URI="https://mirrors.edge.kernel.org/pub/linux/kernel/firmware/linux-firmware-${PV}.tar.xz -> linux-firmware-${PV}.tar.xz" fi - - KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" + KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" fi DESCRIPTION="Linux firmware files" @@ -42,6 +42,10 @@ BDEPEND="initramfs? ( app-alternatives/cpio ) deduplicate? ( app-misc/rdfind ) ${PYTHON_DEPS}" + +# Flatcar: depend on Kernel source and modules +DEPEND=">=sys-kernel/coreos-modules-6.1:= + sys-kernel/coreos-sources" #add anything else that collides to this RDEPEND="!savedconfig? ( redistributable? ( @@ -64,9 +68,8 @@ IDEPEND=" " QA_PREBUILT="*" -PATCHES=( - "${FILESDIR}"/${PN}-copy-firmware-r9.patch -) +# Flatcar: source name is linux-firmware, not coreos-firmware +S="${WORKDIR}/linux-firmware-${PV}" pkg_pretend() { if use initramfs; then @@ -97,19 +100,92 @@ pkg_setup() { linux-info_pkg_setup } +# Flatcar: create symlinks for cxgb and ice firmwares +CXGB_VERSION="1.27.5.0" +ICE_DDP_VERSION="1.3.43.0" + src_unpack() { if [[ ${PV} == 99999999* ]]; then git-r3_src_unpack else default # rename directory from git snapshot tarball - if [[ ${#GIT_COMMIT} -gt 8 ]]; then - mv ${PN}-*/ ${P} || die + # Flatcar: move a correct directory ${MY_COMMIT}, as defined + # above in ${S}. + if [[ ${#MY_COMMIT} -gt 8 ]]; then + mv ${MY_COMMIT}/ linux-firmware-${PV} || die fi + + # Flatcar: Upstream linux-firmware tarball does not contain + # symlinks for cxgb4 firmware files, but "modinfo + # cxgb4.ko" shows it requires t?fw.bin files. These + # normally are installed by the copy-firmware.sh + # script, which refers to the WHENCE file. Both the + # script and the file are in the tarball. The WHENCE + # file actually mentions that these symlinks should be + # created, but apparently our ebuild is not using this + # way of installing the firmware files, so we need to + # create the symlinks to avoid failures at the + # firmware scanning stage. + ln -sfn t4fw-${CXGB_VERSION}.bin linux-firmware-${PV}/cxgb4/t4fw.bin + ln -sfn t5fw-${CXGB_VERSION}.bin linux-firmware-${PV}/cxgb4/t5fw.bin + ln -sfn t6fw-${CXGB_VERSION}.bin linux-firmware-${PV}/cxgb4/t6fw.bin + + # Flatcar: Upstream linux-firmware tarball does not contain + # a correct symlink to intel/ice/ddp/ice-1.3.28.0.pkg, + # but "modinfo ice.ko" shows it requires ice.pkg. + # So we need to create the symlink to avoid failures at the + # firmware scanning stage. + ln -sfn ice-${ICE_DDP_VERSION}.pkg linux-firmware-${PV}/intel/ice/ddp/ice.pkg fi } src_prepare() { + # Flatcar: generate a list of firmware + local kernel_mods="${SYSROOT%/}/lib/modules/${KV_FULL}" + + # It happens that some modules uses `MODULE_FIRMWARE` with a file + # not shipped into 'linux-firmware'. + # In such a case, we can safely ignore those. + # e.g 'amdgpu/ip_discovery.bin' is not a file shipped by linux-firmware (see: https://github.com/torvalds/linux/commit/a79d3709c40d492fb859fb5cec4bb0b3eaa09a12) + local module_firmware_skip_list=( + amdgpu/cyan_skillfish_gpu_info.bin + amdgpu/ip_discovery.bin + amdgpu/vega10_cap.bin + amdgpu/sienna_cichlid_cap.bin + amdgpu/navi12_cap.bin + amdgpu/aldebaran_cap.bin + amdgpu/gc_11_0_0_toc.bin + amdgpu/gc_11_0_3_mes.bin + ) + + # Fail if any firmware is missing. + einfo "Scanning for files required by ${KV_FULL}" + echo "# Remove files that shall not be installed from this list." > ${PN}.conf + local kofile fwfile failed + for kofile in $(find "${kernel_mods}" -name '*.ko' -o -name '*.ko.xz'); do + for fwfile in $(modinfo --field firmware "${kofile}"); do + if [[ ! -e "${fwfile}" ]] && ! [[ "${module_firmware_skip_list[*]}" =~ "${fwfile}" ]]; then + eerror "Missing firmware: ${fwfile} (${kofile##*/})" + failed=1 + elif [[ -L "${fwfile}" ]]; then + printf "%s\n" "${fwfile}" "$(realpath --relative-to=. "${fwfile}")" >> ${PN}.conf + else + printf "%s\n" "${fwfile}" >> ${PN}.conf + fi + done + done + if [[ -n "${failed}" ]]; then + die "Missing firmware" + fi + + # AMD's microcode is shipped as part of coreos-firmware, but not a dependency to + # any module, so add it manually + use amd64 && find amd-ucode/ -type f -not -name "*.asc" >> ${PN}.conf + + einfo "Pruning all unneeded firmware files..." + find * -not -type d -not -name ${PN}.conf -print0 | grep -Fzxvf ${PN}.conf | xargs -r0 rm -v + default # Stub out this script to avoid errors in the live ebuild @@ -118,17 +194,36 @@ src_prepare() { exit 0 EOF - cp "${FILESDIR}/${PN}-make-amd-ucode-img.bash" "${T}/make-amd-ucode-img" || die - chmod +x "${T}/make-amd-ucode-img" || die + if use savedconfig; then + restore_config ${PN}.conf + ebegin "Removing all files not listed in config" - if use initramfs && ! use dist-kernel; then - if [[ -d "${S}/amd-ucode" ]]; then - "${T}/make-amd-ucode-img" "${S}" "${S}/amd-ucode" || die - else - # If this will ever happen something has changed which - # must be reviewed - die "'${S}/amd-ucode' not found!" - fi + local file delete_file preserved_file preserved_files=() + + while IFS= read -r file; do + # Ignore comments. + if [[ ${file} != "#"* ]]; then + preserved_files+=("${file}") + fi + done < ${PN}.conf || die + + while IFS= read -d "" -r file; do + delete_file=true + for preserved_file in "${preserved_files[@]}"; do + if [[ "${file}" == "${preserved_file}" ]]; then + delete_file=false + fi + done + + if ${delete_file}; then + rm "${file}" || die + fi + done < <(find * \( \! -type d -and \! -name ${PN}.conf \) -print0 || die) + + eend || die + + # remove empty directories, bug #396073 + find -type d -empty -delete || die fi # whitelist of misc files @@ -231,76 +326,16 @@ src_prepare() { } src_install() { - local FW_OPTIONS=( "-v" "-j1" ) - local files_to_keep= - - if use savedconfig; then - if [[ -s "${S}/${PN}.conf" ]]; then - files_to_keep="${T}/files_to_keep.lst" - grep -v '^#' "${S}/${PN}.conf" 2>/dev/null > "${files_to_keep}" || die - [[ -s "${files_to_keep}" ]] || die "grep failed, empty config file?" - FW_OPTIONS+=( "--firmware-list" "${files_to_keep}" ) - fi - fi - - if use compress-xz; then - FW_OPTIONS+=( "--xz" ) - elif use compress-zstd; then - FW_OPTIONS+=( "--zstd" ) - fi - FW_OPTIONS+=( "${ED}/lib/firmware" ) - ./copy-firmware.sh "${FW_OPTIONS[@]}" || die - use deduplicate && { ./dedup-firmware.sh "${ED}/lib/firmware" || die; } - - pushd "${ED}/lib/firmware" &>/dev/null || die - - # especially use !redistributable will cause some broken symlinks - einfo "Removing broken symlinks ..." - find * -xtype l -print -delete || die - - # remove empty files and directories, bug #396073 - # Copy-firmware.sh may have made empty copies of files we removed - find -empty -delete || die - - # sanity check - if ! ( shopt -s failglob; : * ) 2>/dev/null; then - eerror "No files to install. Check your USE flag settings" - eerror "and the list of files in your saved configuration." - die "Refusing to install an empty package" - fi - - # create config file - echo "# Remove files that shall not be installed from this list." > "${S}"/${PN}.conf || die - find * ! -type d >> "${S}"/${PN}.conf || die - save_config "${S}"/${PN}.conf - - popd &>/dev/null || die - - # Instruct Dracut on whether or not we want the microcode in initramfs - ( - insinto /usr/lib/dracut/dracut.conf.d - newins - 10-${PN}.conf <<<"early_microcode=$(usex initramfs)" - ) - if use initramfs; then - # Install installkernel/kernel-install hooks for non-dracut initramfs - # generators that don't bundled the microcode - dobin "${T}/make-amd-ucode-img" - ( - exeinto /usr/lib/kernel/preinst.d - doexe "${FILESDIR}/35-amd-microcode.install" - exeinto /usr/lib/kernel/install.d - doexe "${FILESDIR}/35-amd-microcode-systemd.install" - ) - fi - - if use initramfs && ! use dist-kernel; then - insinto /boot - doins "${S}"/amd-uc.img - fi - - dodoc README.md - # some licenses require copyright and permission notice to be included - use bindist && dodoc -r WHENCE LICENSES + # Flatcar: take a simplified approach instead of cumbersome installation + # like done in Gentoo. + # + # Don't save the firmware config to /etc/portage/savedconfig/ + # if we use !savedconfig; then + # save_config ${PN}.conf + # fi + rm ${PN}.conf || die + insinto /lib/firmware/ + doins -r * } pkg_preinst() { From 33888c436bdd58ee09ec894e253df07ee2e3af7d Mon Sep 17 00:00:00 2001 From: Dongsu Park Date: Thu, 20 Aug 2026 10:06:50 +0200 Subject: [PATCH 3/3] changelog: add changelog for linux-firmware 20260810 Signed-off-by: Dongsu Park --- changelog/updates/2026-08-19-linux-firmware-20260810-update.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/updates/2026-08-19-linux-firmware-20260810-update.md diff --git a/changelog/updates/2026-08-19-linux-firmware-20260810-update.md b/changelog/updates/2026-08-19-linux-firmware-20260810-update.md new file mode 100644 index 00000000000..2fe7180d063 --- /dev/null +++ b/changelog/updates/2026-08-19-linux-firmware-20260810-update.md @@ -0,0 +1 @@ +- Linux Firmware ([20260810](https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tag/?h=20260810))