From a5b65c81168c90928784a1e92cda84ed5d6b9eb3 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Wed, 25 Sep 2019 19:33:39 +0100 Subject: gentoo resync : 25.09.2019 --- .../linux-firmware/linux-firmware-20190923.ebuild | 354 +++++++++++++++++++++ 1 file changed, 354 insertions(+) create mode 100644 sys-kernel/linux-firmware/linux-firmware-20190923.ebuild (limited to 'sys-kernel/linux-firmware/linux-firmware-20190923.ebuild') diff --git a/sys-kernel/linux-firmware/linux-firmware-20190923.ebuild b/sys-kernel/linux-firmware/linux-firmware-20190923.ebuild new file mode 100644 index 000000000000..fddfa4cd585f --- /dev/null +++ b/sys-kernel/linux-firmware/linux-firmware-20190923.ebuild @@ -0,0 +1,354 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +inherit mount-boot savedconfig + +if [[ ${PV} == 99999999* ]]; then + inherit git-r3 + EGIT_REPO_URI="https://git.kernel.org/pub/scm/linux/kernel/git/firmware/${PN}.git" +else + GIT_COMMIT="417a9c6e197a8d3eec792494efc87a2b42f76324" + SRC_URI="https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/snapshot/linux-firmware-${GIT_COMMIT}.tar.gz -> ${P}.tar.gz" + KEYWORDS="alpha amd64 arm arm64 hppa ia64 mips ppc ppc64 s390 sh 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 no-source-code ) ) + unknown-license? ( all-rights-reserved )" +SLOT="0" +IUSE="initramfs +redistributable savedconfig unknown-license" +RESTRICT="binchecks strip + unknown-license? ( bindist )" + +REQUIRED_USE="initramfs? ( redistributable )" + +BDEPEND="initramfs? ( app-arch/cpio )" + +#add anything else that collides to this +RDEPEND="!savedconfig? ( + redistributable? ( + !sys-firmware/alsa-firmware[alsa_cards_ca0132] + !media-tv/cx18-firmware + ! "${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 + + if use savedconfig; then + restore_config ${PN}.conf + + ebegin "Removing all files not listed in config" + find ! -type d ! \( -name ${PN}.conf -o -name amd-uc.img \) -printf "%P\n" \ + | grep -Fvx -f <(grep -v '^#' ${PN}.conf \ + || die "grep failed, empty config file?") \ + | xargs -d '\n' --no-run-if-empty rm + eend $? || die + fi + + # remove empty directories, bug #396073 + find -type d -empty -delete || die +} + +src_install() { + save_config ${PN}.conf + rm ${PN}.conf || die + + if use initramfs ; then + mkdir "${ED}/boot" || die + mv "${S}"/amd-uc.img "${ED}/boot" || die + fi + + 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 + + insinto /lib/firmware/ + doins -r * +} + +pkg_preinst() { + if use savedconfig; then + ewarn "USE=savedconfig is active. You must handle file collisions manually." + fi + + # Make sure /boot is available if needed. + use initramfs && mount-boot_pkg_preinst +} + +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." + + local ver + for ver in ${REPLACING_VERSIONS}; do + if ver_test ${ver} -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.' + break + fi + done + + # Don't forget to umount /boot if it was previously mounted by us. + use initramfs && mount-boot_pkg_postinst +} + +pkg_prerm() { + # Make sure /boot is mounted so that we can remove /boot/amd-uc.img! + use initramfs && mount-boot_pkg_prerm +} + +pkg_postrm() { + # Don't forget to umount /boot if it was previously mounted by us. + use initramfs && mount-boot_pkg_postrm +} -- cgit v1.2.3