diff --git a/sys-kernel/linux-firmware/Manifest b/sys-kernel/linux-firmware/Manifest index 3fd8ae3..2834d10 100644 --- a/sys-kernel/linux-firmware/Manifest +++ b/sys-kernel/linux-firmware/Manifest @@ -1 +1,2 @@ DIST linux-firmware-20250410.tar.gz 713941971 BLAKE2B f89d6dea6f677d48e2cd68ef05017abb1cce30f53aa28ae422b3f74bd2498d3f1bf385e5c5c77f77c4981248a044d0e42e915fe0a8cbb038ab884e0c68a24ae0 SHA512 e34fa5942c60eb4feda952a30b883af33e99fc1c85ad327b51ef07db418df8499adaf70eebe3cd7d28d06b55ac47c4bab3d15b0f49826eb866256d3be56b264b +DIST linux-firmware-20250509.tar.gz 719860938 BLAKE2B 9ee56ef8387ed7bf483f28bb525e4237fb7eac1cfee1d4f394e692f83e3fb426ee1e44eb9522e1f534df25b775b44e985e082995995261645c841fad86286aa9 SHA512 b039e652e6c3bd28f8818975e70a52715308d591c03f7979f3f717a0a81f7b0eb9b7ff3af8f0185e6b9daf2e261f9b187caccea56a83b2aebb00dc1bd825f9d3 diff --git a/sys-kernel/linux-firmware/linux-firmware-20250509.ebuild b/sys-kernel/linux-firmware/linux-firmware-20250509.ebuild new file mode 100644 index 0000000..314ce97 --- /dev/null +++ b/sys-kernel/linux-firmware/linux-firmware-20250509.ebuild @@ -0,0 +1,93 @@ +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +inherit ego + +DESCRIPTION="Linux firmware files" +HOMEPAGE="https://git.kernel.org/?p=linux/kernel/git/firmware/linux-firmware.git" +SRC_URI="https://mirrors.edge.kernel.org/pub/linux/kernel/firmware/linux-firmware-20250509.tar.gz -> linux-firmware-20250509.tar.gz +" + +LICENSE="GPL-2 GPL-2+ GPL-3 BSD MIT MPL-1.1 linux-fw-redistributable BSD-2 BSD-4 ISC no-source-code" +SLOT="0" +IUSE="initramfs" +KEYWORDS="*" +RESTRICT="strip test" +QA_PREBUILT="*" + +BDEPEND="initramfs? ( app-arch/cpio ) app-misc/rdfind" +RDEPEND="initramfs? ( !<=app-admin/ego-2.8.5 )" + +PATCHES=( + "${FILESDIR}"/${PN}-copy-firmware.patch +) + +src_prepare() { + default + + if use initramfs; then + if [[ -d "${S}/amd-ucode" ]]; then + local UCODETMP="${T}/ucode_tmp" + local UCODEDIR="${UCODETMP}/kernel/x86/microcode" + mkdir -p "${UCODEDIR}" || die + echo 1 > "${UCODETMP}/early_cpio" + + local amd_ucode_file="${UCODEDIR}/AuthenticAMD.bin" + cat "${S}"/amd-ucode/*.bin > "${amd_ucode_file}" || die "Failed to concat amd cpu ucode" + + if [[ ! -s "${amd_ucode_file}" ]]; then + die "Sanity check failed: '${amd_ucode_file}' is empty!" + fi + + pushd "${UCODETMP}" &>/dev/null || die + find . -print0 | cpio --quiet --null -o -H newc -R 0:0 > "${S}"/amd-uc.img + popd &>/dev/null || die + if [[ ! -s "${S}/amd-uc.img" ]]; then + die "Failed to create '${S}/amd-uc.img'!" + fi + else + # If this will ever happen something has changed which + # must be reviewed + die "'${S}/amd-ucode' not found!" + fi + fi + + echo "# Remove files that shall not be installed from this list." > ${PN}.conf + find * ! -type d ! \( -name ${PN}.conf -o -name amd-uc.img \) >> ${PN}.conf +} + +src_install() { + ./copy-firmware.sh -v "${ED}/lib/firmware" || die + + if use initramfs ; then + insinto /lib/firmware/amd-ucode + doins "${S}"/amd-uc.img + fi +} + +pkg_preinst() { + # Make sure /boot is available if needed. + use initramfs && ego_pkg_preinst + + # Fix 'symlink is blocked by a directory' Bug #871315 on Gentoo and FL-10491 on Funtoo + if has_version "<${CATEGORY}/${PN}-20220913-r1" ; then + rm -rf "${EROOT}"/lib/firmware/qcom/LENOVO/21BX* + fi + + +} + +pkg_postinst() { + # Don't forget to umount /boot if it was previously mounted by us. + use initramfs && ego_pkg_postinst +} + +pkg_prerm() { + # Make sure /boot is mounted so that we can remove /boot/amd-uc.img! + use initramfs && ego_pkg_prerm +} + +pkg_postrm() { + # Don't forget to umount /boot if it was previously mounted by us. + use initramfs && ego_pkg_postrm +} \ No newline at end of file