diff options
author | Sam James <sam@gentoo.org> | 2022-10-28 17:56:33 +0100 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2022-10-28 18:01:51 +0100 |
commit | 12113f5d57730f8c36d3df433ec7f1606519e360 (patch) | |
tree | fe75405b09cc9d1d759ba72f97ec4e4a282c9d97 /sys-kernel/linux-firmware/linux-firmware-99999999.ebuild | |
parent | net-firewall/nftlb: add github upstream metadata (diff) | |
download | gentoo-12113f5d57730f8c36d3df433ec7f1606519e360.tar.gz gentoo-12113f5d57730f8c36d3df433ec7f1606519e360.tar.bz2 gentoo-12113f5d57730f8c36d3df433ec7f1606519e360.zip |
sys-kernel/linux-firmware: add USE=compress
This compresses installed firmware with xz. Note that
FW_LOADER_COMPRESS must be enabled in the kernel.
Closes: https://bugs.gentoo.org/695666
Thanks-to: Alexander Tsoy <alexander@tsoy.me>
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'sys-kernel/linux-firmware/linux-firmware-99999999.ebuild')
-rw-r--r-- | sys-kernel/linux-firmware/linux-firmware-99999999.ebuild | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild b/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild index 838ce9db7b42..83806f04167f 100644 --- a/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild +++ b/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild @@ -2,11 +2,11 @@ # Distributed under the terms of the GNU General Public License v2 EAPI=7 -inherit mount-boot savedconfig +inherit linux-info mount-boot savedconfig multiprocessing # In case this is a real snapshot, fill in commit below. # For normal, tagged releases, leave blank -MY_COMMIT= +MY_COMMIT="" if [[ ${PV} == 99999999* ]]; then inherit git-r3 @@ -14,11 +14,12 @@ if [[ ${PV} == 99999999* ]]; then else if [[ -n "${MY_COMMIT}" ]]; then SRC_URI="https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/snapshot/${MY_COMMIT}.tar.gz -> ${P}.tar.gz" + S="${WORKDIR}/${MY_COMMIT}" else SRC_URI="https://mirrors.edge.kernel.org/pub/linux/kernel/firmware/${P}.tar.xz" fi - KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~mips ppc ppc64 ~riscv ~s390 sparc x86" + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" fi DESCRIPTION="Linux firmware files" @@ -29,7 +30,7 @@ LICENSE="GPL-2 GPL-2+ GPL-3 BSD MIT || ( MPL-1.1 GPL-2 ) linux-fw-redistributable ( BSD-2 BSD BSD-4 ISC MIT no-source-code ) ) unknown-license? ( all-rights-reserved )" SLOT="0" -IUSE="initramfs +redistributable savedconfig unknown-license" +IUSE="compress initramfs +redistributable savedconfig unknown-license" REQUIRED_USE="initramfs? ( redistributable )" RESTRICT="binchecks strip test @@ -60,6 +61,15 @@ RDEPEND="!savedconfig? ( QA_PREBUILT="*" +pkg_setup() { + if ! use compress ; then + return + fi + + local CONFIG_CHECK="~FW_LOADER_COMPRESS" + linux-info_pkg_setup +} + pkg_pretend() { use initramfs && mount-boot_pkg_pretend } @@ -301,6 +311,17 @@ src_install() { find * ! -type d >> "${S}"/${PN}.conf || die save_config "${S}"/${PN}.conf + if use compress ; then + while IFS= read -r -d '' f; do + target=$(readlink "${f}") + ln -sf "${target}".xz "${f}" || die + mv "${f}" "${f}".xz || die + done < <(find . -type l -print0) || die + + find . -type f ! -path "./amd-ucode/*" -print0 | \ + xargs -0 -P $(makeopts_jobs) -I'{}' xz -T1 -C crc32 '{}' || die + fi + popd &>/dev/null || die if use initramfs ; then @@ -314,6 +335,11 @@ pkg_preinst() { ewarn "USE=savedconfig is active. You must handle file collisions manually." fi + # Fix 'symlink is blocked by a directory' Bug #871315 + if has_version "<${CATEGORY}/${PN}-20220913-r2" ; then + rm -rf "${EROOT}"/lib/firmware/qcom/LENOVO/21BX + fi + # Make sure /boot is available if needed. use initramfs && mount-boot_pkg_preinst } |