diff --git a/sys-kernel/gentoo-kernel/Manifest b/sys-kernel/gentoo-kernel/Manifest index 3afecc8ea3559..6e393354cae29 100644 --- a/sys-kernel/gentoo-kernel/Manifest +++ b/sys-kernel/gentoo-kernel/Manifest @@ -52,6 +52,7 @@ DIST linux-gentoo-patches-6.1.169_p1.tar.xz 29504 BLAKE2B bf9c9a55c628c6905bf0e9 DIST linux-gentoo-patches-6.12.75.tar.xz 20180 BLAKE2B 436ae2c1b00442e961c1bdb14f658bb14c02e1a73f9ea0b2125fcc6614d5f8ebb630cd22dcf5bc26fc3d5b2cca75fe88903f31e0c44cb76379596ba415e30f65 SHA512 6d1a953bc1b123da4dabbf393ff0dca83556accac535f2d6683e104297413f10e9dbb393ff76f316c7fe892849d0ea73834976c7637872151443586584ce0123 DIST linux-gentoo-patches-6.12.84_p1.tar.xz 20748 BLAKE2B f29bf79bf2d8502d6274f4935e44fba2951c7ba2af65cf68a630085f9ba07615e5b4ec294b2f4f69f2694b6a6a2c658609e8b411d4a89c42823d27ead9dfdf1e SHA512 ec2a9a76a3ae652b6cabe2118a978d5a3ddbbaea7522e28b97c8341b93ecefea964e28593fbf31f084a5597c85590950e1b6f3b049a7f879971cc9dc83fe38df DIST linux-gentoo-patches-6.18.16.tar.xz 10832 BLAKE2B 3bd240cfc5f62689dcae40cdb08c447bb4cf275395bbaba72ed2b9a63dc3b37446245d7dff88f639ca80e5b66f1a53f73d88af832c2655c16249f919c9896199 SHA512 a57c0a62b14701e8a776ed5f8eec45798edc8f79e089c4a22976a091c693c3f03e9cf26f2a592bd92f4ebacf100cce55523a99c3a3197eeeefcdbf995f3bf55a +DIST linux-gentoo-patches-6.18.27_p1.tar.xz 12092 BLAKE2B a0c3f357e0a53476b8e03ca38b2a1b3954bf78d7c72130f0781c3f2ad9b20a45d96d2602b731c685a7b7736685eba1480ff61dd663e41ef5fcf2f363feff7269 SHA512 0e641459886e06b81bad2196840ddafd79d4134ff658fbafe5a42f597e9099e85658aa46d9a1cd02a726e58d5d61598f8e40edef741862dcc65f3b71c9dcb110 DIST linux-gentoo-patches-6.6.134.tar.xz 42820 BLAKE2B 14164c31817dbc4bd6c421ddd0b87bf16e9f8fd493f082b17e5780277ff9d0cef4d827ba2cb10db47142b0f528f924721fa6ff057f30b7e2ab916767b069836d SHA512 97177a8e8254b8a5fa2b6f380f36a27219015fb8d026f3080331bce9f8d289666dd7388f3cc70b017d3c61acbdeb887b25556d66aed2947a917f217ad80b5312 DIST linux-gentoo-patches-6.6.136_p1.tar.xz 43372 BLAKE2B 3d152e481dc8f9a6ff4d8bcf5cf7bbe9eca44fc69e26f5424ab75431f8956898df6dccdeec906e8274c81c81ee90a5e4d6248526ee1e98738157ee0cd4ed2007 SHA512 a9079127241744c5fb0c6b5ad508e81c9196b7c97091162635b4d1cfc60a8ff826e26ffafe3bf056cea3c56f8cc5ff0cdbba31eee90da7659ac88c7e1c3d80b3 DIST linux-gentoo-patches-7.0.1.tar.xz 9556 BLAKE2B 3b665b8912767095caceadc826fedc836b62dcd490f04f0ae4bdc64e8ee84403d0f70b973f1afec1a627028b6ea6f179aeedcafe70102a59e07152054d09f2af SHA512 59a43b5c6e11315393ca4549a6d8e53863399ee3d1f478daeb970652c37f18d99dc6827a190118dffee84ea86f3a63362e3aa062ac5ac499d7340c59170ed654 diff --git a/sys-kernel/gentoo-kernel/gentoo-kernel-6.18.27_p1.ebuild b/sys-kernel/gentoo-kernel/gentoo-kernel-6.18.27_p1.ebuild new file mode 100644 index 0000000000000..4e77ec6b5c03f --- /dev/null +++ b/sys-kernel/gentoo-kernel/gentoo-kernel-6.18.27_p1.ebuild @@ -0,0 +1,175 @@ +# Copyright 2020-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +KERNEL_IUSE_GENERIC_UKI=1 + +inherit kernel-build toolchain-funcs verify-sig + +BASE_P=linux-${PV%.*} +PATCH_PV=${PV%_p*} +PATCHSET=linux-gentoo-patches-6.18.27_p1 +# https://koji.fedoraproject.org/koji/packageinfo?packageID=8 +# forked to https://github.com/projg2/fedora-kernel-config-for-gentoo +CONFIG_VER=6.18.12-gentoo +GENTOO_CONFIG_VER=g18 +SHA256SUM_DATE=20260507 + +DESCRIPTION="Linux kernel built with Gentoo patches" +HOMEPAGE=" + https://wiki.gentoo.org/wiki/Project:Distribution_Kernel + https://www.kernel.org/ +" +SRC_URI+=" + https://cdn.kernel.org/pub/linux/kernel/v$(ver_cut 1).x/${BASE_P}.tar.xz + https://cdn.kernel.org/pub/linux/kernel/v$(ver_cut 1).x/patch-${PATCH_PV}.xz + https://distfiles.gentoo.org/pub/proj/dist-kernel/patchsets/$(ver_cut 1-2)/${PATCHSET}.tar.xz + https://github.com/projg2/gentoo-kernel-config/archive/${GENTOO_CONFIG_VER}.tar.gz + -> gentoo-kernel-config-${GENTOO_CONFIG_VER}.tar.gz + verify-sig? ( + https://cdn.kernel.org/pub/linux/kernel/v$(ver_cut 1).x/sha256sums.asc + -> linux-$(ver_cut 1).x-sha256sums-${SHA256SUM_DATE}.asc + ) + amd64? ( + https://raw.githubusercontent.com/projg2/fedora-kernel-config-for-gentoo/${CONFIG_VER}/kernel-x86_64-fedora.config + -> kernel-x86_64-fedora.config.${CONFIG_VER} + ) + arm64? ( + https://raw.githubusercontent.com/projg2/fedora-kernel-config-for-gentoo/${CONFIG_VER}/kernel-aarch64-fedora.config + -> kernel-aarch64-fedora.config.${CONFIG_VER} + ) + ppc64? ( + https://raw.githubusercontent.com/projg2/fedora-kernel-config-for-gentoo/${CONFIG_VER}/kernel-ppc64le-fedora.config + -> kernel-ppc64le-fedora.config.${CONFIG_VER} + ) + riscv? ( + https://raw.githubusercontent.com/projg2/fedora-kernel-config-for-gentoo/${CONFIG_VER}/kernel-riscv64-fedora.config + -> kernel-riscv64-fedora.config.${CONFIG_VER} + ) + x86? ( + https://raw.githubusercontent.com/projg2/fedora-kernel-config-for-gentoo/${CONFIG_VER}/kernel-i686-fedora.config + -> kernel-i686-fedora.config.${CONFIG_VER} + ) +" +S=${WORKDIR}/${BASE_P} + +KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86" +IUSE="debug hardened" +REQUIRED_USE=" + arm? ( savedconfig ) + hppa? ( savedconfig ) + sparc? ( savedconfig ) +" + +RDEPEND=" + !sys-kernel/gentoo-kernel-bin:${SLOT} +" +BDEPEND=" + debug? ( dev-util/pahole ) + verify-sig? ( >=sec-keys/openpgp-keys-kernel-20250702 ) +" +PDEPEND=" + >=virtual/dist-kernel-${PV} +" + +QA_FLAGS_IGNORED=" + usr/src/linux-.*/scripts/gcc-plugins/.*.so + usr/src/linux-.*/vmlinux + usr/src/linux-.*/arch/powerpc/kernel/vdso.*/vdso.*.so.dbg +" + +VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/kernel.org.asc + +src_unpack() { + if use verify-sig; then + cd "${DISTDIR}" || die + verify-sig_verify_signed_checksums \ + "linux-$(ver_cut 1).x-sha256sums-${SHA256SUM_DATE}.asc" \ + sha256 "${BASE_P}.tar.xz patch-${PATCH_PV}.xz" + cd "${WORKDIR}" || die + fi + + default +} + +src_prepare() { + local patch + eapply "${WORKDIR}/patch-${PATCH_PV}" + eapply "${WORKDIR}/${PATCHSET}" + + default + + # add Gentoo patchset version + local extraversion=${PV#${PATCH_PV}} + sed -i -e "s:^\(EXTRAVERSION =\).*:\1 ${extraversion/_/-}:" Makefile || die + + local biendian=false + + # prepare the default config + case ${ARCH} in + arm | hppa | loong | sparc) + > .config || die + ;; + amd64) + cp "${DISTDIR}/kernel-x86_64-fedora.config.${CONFIG_VER}" .config || die + ;; + arm64) + cp "${DISTDIR}/kernel-aarch64-fedora.config.${CONFIG_VER}" .config || die + biendian=true + ;; + ppc) + # assume powermac/powerbook defconfig + # we still package.use.force savedconfig + cp "${WORKDIR}/${BASE_P}/arch/powerpc/configs/pmac32_defconfig" .config || die + ;; + ppc64) + cp "${DISTDIR}/kernel-ppc64le-fedora.config.${CONFIG_VER}" .config || die + biendian=true + ;; + riscv) + cp "${DISTDIR}/kernel-riscv64-fedora.config.${CONFIG_VER}" .config || die + ;; + x86) + cp "${DISTDIR}/kernel-i686-fedora.config.${CONFIG_VER}" .config || die + ;; + *) + die "Unsupported arch ${ARCH}" + ;; + esac + + local myversion="-gentoo-dist" + use hardened && myversion+="-hardened" + echo "CONFIG_LOCALVERSION=\"${myversion}\"" > "${T}"/version.config || die + local dist_conf_path="${WORKDIR}/gentoo-kernel-config-${GENTOO_CONFIG_VER}" + + local merge_configs=( + "${T}"/version.config + "${dist_conf_path}"/base.config + "${dist_conf_path}"/6.12+.config + ) + use debug || merge_configs+=( + "${dist_conf_path}"/no-debug.config + ) + if use hardened; then + merge_configs+=( "${dist_conf_path}"/hardened-base.config ) + + tc-is-gcc && merge_configs+=( "${dist_conf_path}"/hardened-gcc-plugins.config ) + + if [[ -f "${dist_conf_path}/hardened-${ARCH}.config" ]]; then + merge_configs+=( "${dist_conf_path}/hardened-${ARCH}.config" ) + fi + fi + + # this covers ppc64 and aarch64_be only for now + if [[ ${biendian} == true && $(tc-endian) == big ]]; then + merge_configs+=( "${dist_conf_path}/big-endian.config" ) + fi + + use secureboot && merge_configs+=( + "${dist_conf_path}/secureboot.config" + "${dist_conf_path}/zboot.config" + ) + + kernel-build_merge_configs "${merge_configs[@]}" +}