From: Michał Górny Date: Wed, 25 Dec 2019 21:40:03 +0000 (+0100) Subject: sys-kernel/vanilla-kernel-bin: New package for prebuilt kernel X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=111b813a4298833fc035a10a64595f12405321e0;p=gentoo.git sys-kernel/vanilla-kernel-bin: New package for prebuilt kernel Add a binary counterpart for sys-kernel/vanilla-kernel. Signed-off-by: Michał Górny --- diff --git a/sys-kernel/vanilla-kernel-bin/Manifest b/sys-kernel/vanilla-kernel-bin/Manifest new file mode 100644 index 000000000000..f6929ff3c520 --- /dev/null +++ b/sys-kernel/vanilla-kernel-bin/Manifest @@ -0,0 +1,2 @@ +DIST vanilla-kernel-5.4.6-r1-1.amd64.xpak 89795144 BLAKE2B cca6e78f991cc79165a528d95fa1202b6f99dcf763f890609a0bf3e273cb81e786e39365a89e14282b75e259aa298b7349ee2868ef8437faae400475ad7e1c42 SHA512 de609b831db05c42350fe57e3248be3208c190ff99082088b5d2a1d69ec54734784f8143befbfd397deb9446228781ba25c1e50ecc020a651f6beda30be6ba97 +DIST vanilla-kernel-5.4.6-r1-1.x86.xpak 81308308 BLAKE2B f499c5a8e65d3754fd0e1ba65a2dfa7eb4fa9b8cbdf5e5957186dc40b1c5572dd66433284529b0ca93b7a3073103243d5f45ad8749ca891b1f86d838cbf363be SHA512 f8334097566ce8b1852ec65a5205221a2bb5193fc638756e87f6da2199cde1d1e73f85f9dd60679fccd18be11055c37da873b92a0e209775e7a9926f6ae94134 diff --git a/sys-kernel/vanilla-kernel-bin/metadata.xml b/sys-kernel/vanilla-kernel-bin/metadata.xml new file mode 100644 index 000000000000..cd6a1d015181 --- /dev/null +++ b/sys-kernel/vanilla-kernel-bin/metadata.xml @@ -0,0 +1,15 @@ + + + + + mgorny@gentoo.org + Michał Górny + + + zlogene@gentoo.org + Mikle Kolyada + + + Build initramfs along with the kernel. + + diff --git a/sys-kernel/vanilla-kernel-bin/vanilla-kernel-bin-5.4.6.ebuild b/sys-kernel/vanilla-kernel-bin/vanilla-kernel-bin-5.4.6.ebuild new file mode 100644 index 000000000000..fa1b7e994f20 --- /dev/null +++ b/sys-kernel/vanilla-kernel-bin/vanilla-kernel-bin-5.4.6.ebuild @@ -0,0 +1,106 @@ +# Copyright 2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit mount-boot + +MY_P=vanilla-kernel-${PV}-r1-1 +DESCRIPTION="Pre-built vanilla Linux kernel" +HOMEPAGE="https://www.kernel.org/" +SRC_URI=" + amd64? ( + https://dev.gentoo.org/~mgorny/binpkg/amd64/kernel/sys-kernel/vanilla-kernel/${MY_P}.xpak + -> ${MY_P}.amd64.xpak + ) + x86? ( + https://dev.gentoo.org/~mgorny/binpkg/x86/kernel/sys-kernel/vanilla-kernel/${MY_P}.xpak + -> ${MY_P}.x86.xpak + )" +S=${WORKDIR} + +LICENSE="GPL-2" +SLOT="${PV}" +KEYWORDS="~amd64 ~x86" +IUSE="+initramfs" + +# install-DEPEND actually +# note: we need installkernel with initramfs support! +RDEPEND=" + || ( + sys-kernel/installkernel-gentoo + sys-kernel/installkernel-systemd-boot + ) + initramfs? ( sys-kernel/dracut ) + !sys-kernel/vanilla-kernel:${SLOT}" + +QA_PREBUILT='*' + +pkg_pretend() { + mount-boot_pkg_pretend + + ewarn "This is an experimental package. The built kernel and/or initramfs" + ewarn "may not work at all or fail with your bootloader configuration. Please" + ewarn "make sure to keep a backup kernel available before testing it." +} + +src_unpack() { + ebegin "Unpacking ${MY_P}.${ARCH}.xpak" + tar -x < <(xz -c -d --single-stream "${DISTDIR}/${MY_P}.${ARCH}.xpak") + eend ${?} || die "Unpacking ${MY_P} failed" +} + +src_install() { + # cp is easier for preserving +x bits + cp -p -R . "${ED}" || die +} + +pkg_preinst() { + : +} + +pkg_postinst() { + if [[ -z ${ROOT} ]]; then + mount-boot_pkg_preinst + + if use initramfs; then + ebegin "Building initramfs via dracut" + # putting it alongside kernel image as 'initrd' makes + # kernel-install happier + dracut --force "${EROOT}/usr/src/linux-${PV}/initrd" "${PV}" + eend ${?} || die "Building initramfs failed" + fi + + ebegin "Installing the kernel via installkernel" + # note: .config is taken relatively to System.map; + # initrd relatively to bzImage + installkernel "${PV}" \ + "${EROOT}/usr/src/linux-${PV}/bzImage" \ + "${EROOT}/usr/src/linux-${PV}/System.map" + eend ${?} || die "Installing the kernel failed" + fi + + local symlink_target=$(readlink "${EROOT}"/usr/src/linux) + if [[ ${symlink_target} == linux-[0-9]* ]]; then + local symlink_ver=${symlink_target#linux-} + local symlink_pkg=${CATEGORY}/${PN}-${symlink_ver} + # if the current target is either being replaced, or still + # installed (probably depclean candidate), update the symlink + if has "${symlink_ver}" ${REPLACING_VERSIONS} || + has_version -r "~${symlink_pkg}" + then + ebegin "Updating /usr/src/linux symlink" + ln -f -n -s linux-${PV} "${EROOT}"/usr/src/linux + eend ${?} + fi + fi +} + +pkg_prerm() { + : +} + +pkg_postrm() { + rm -f "${EROOT}/usr/src/linux-${PV}/initrd" && + rmdir --ignore-fail-on-non-empty "${EROOT}/usr/src/linux-${PV}" +}