commit: fb414b1dbc7a1b4d48c2a1f62421b312137f103a Author: Tony Olagbaiye <bqv <AT> fron <DOT> io> AuthorDate: Thu Dec 15 22:42:19 2022 +0000 Commit: Tony Olagbaiye <gentoo <AT> fron <DOT> io> CommitDate: Thu Dec 15 22:42:31 2022 +0000 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=fb414b1d
sys-kernel/usermode-kernel: new package, add 6.0.12 Signed-off-by: Tony Olagbaiye <bqv <AT> fron.io> sys-kernel/usermode-kernel/Manifest | 8 + .../usermode-kernel/usermode-kernel-6.0.12.ebuild | 282 +++++++++++++++++++++ 2 files changed, 290 insertions(+) diff --git a/sys-kernel/usermode-kernel/Manifest b/sys-kernel/usermode-kernel/Manifest new file mode 100644 index 000000000..a1af33cea --- /dev/null +++ b/sys-kernel/usermode-kernel/Manifest @@ -0,0 +1,8 @@ +DIST genpatches-6.0-12.base.tar.xz 658212 BLAKE2B 0daa718dd00d76224db3776d6792d51e072a2e4c8094ec22814d84cffcff8d18a670b73f94b5fe231e1eb586e05b42aa44942b8706ced76ac5c172777f8f8519 SHA512 e960c0a687b06ab108429ee99e5ef27dcc826dd3e6d90471addcb215284d37c1ed0cf40eb9d442a7ac90a5c4696a0ad95e0c5997ee954e4677b949a2c7ffcecf +DIST genpatches-6.0-12.extras.tar.xz 3804 BLAKE2B fbf21f852110ac732124e5a227b38462d7a94ec17d788fbd48ab35e08c2a941f9c3549e58e7cdb4279f8a273daa2cfbde0a560a769d808ca9d26d2419b303b96 SHA512 efdc24c196c10ee2b47d6f81482b4408a5a7e829c21d9c2eff6426a92a1c17f0315c64875d45795cda7b735d183b7560ec44e308fee34b09e89c171526c9ee4f +DIST gentoo-kernel-config-g3.tar.gz 4411 BLAKE2B 00edc4b5dc943834bc7ee977382b2960160888db00a25c5a7f73968784aa39a2b3b69f0bbda89b3ce8eb55e746006cff2839481493ac8bfca6a21de2299564f7 SHA512 44beae869bebf5445655dafe1facc47c3dbe602b34c5bf2fa984a581bfe3250fa0df908b8807c333c2e66ab9d1a2bb8026e22140f2a1f522d0dd647c96ca4d5e +DIST kernel-aarch64-fedora.config.6.0.8-gentoo 249703 BLAKE2B d62624ff7072694a5ad98084925fbc892ac381fec0fce0aa01309df06ce9f115b0aaecf578a3e2ce6e6c3b25de9fe14d0c5b4ec2182fdf21dff30ed393ebbd8a SHA512 dc7d2aaa191f0ee2a61b563716c60dd1d62c741f16b6599dbc97a86e076cd5af7c93c264cf94ee4ab5570c7dc268ff50076372a8ffceeed4d0731b6b88757f9c +DIST kernel-i686-fedora.config.6.0.8-gentoo 225904 BLAKE2B 4ff7e1866d3a76b34e462a20d539ea0a9a588b3588c222c1b17737414c7e883f68095959d68e374819a1e14079e410fa049cf6d264bd4995299299275de95b5b SHA512 6c518d1dd2130dfcb8001d97df66dd10cdc55e6e4d7a751d9a01978d2c47735a63a9c4e04e42965484ecff42255aa82f7d6725f018b0436140511ca6b4b7bc6a +DIST kernel-ppc64le-fedora.config.6.0.8-gentoo 215817 BLAKE2B 75cb973385e1580b5d3b03762db6ad830e1cf2d6748a5f2591a0296d98c6e3fb9f3730c333e3dc85c8b06ebac41716a3e762e3b612017dbf7db75c7e4bc90872 SHA512 a568e97367927fb5e390ff7d30eba9b27ef27c89f8a20c02919589b8098205d94970685e386ca559b9d92898dd75a3a34b4113426dd2fa95bb025de284573a5a +DIST kernel-x86_64-fedora.config.6.0.8-gentoo 226579 BLAKE2B 61661976712081684f28daf26559b489f1e9e0bae749c2ab19f8de7154c86408791fc5333ff589b277fe060bf44edf02b525f0233e44fdcb3c90e519b51f6fc9 SHA512 5dc327afaa87e51330881f5f8b1b83d7cad360626744023fe98146390c8a745da00f60c6f7363e594eee87bc4dc27970af88e9e31a415267b0d2752bea8ca08d +DIST linux-6.0.tar.xz 133886176 BLAKE2B c09a9c877ac0fac83dc31d2d04d96f0a3331d4ed78e3ad4edfd4dc077e1c11d0c49f419fdac4008b5c93d1b09c2b724e12ef0b38371ad0962908abf85dfa95fa SHA512 bac41a7aeb6e809616cee2f13dcd1c45e829dfd1ccf60aee1dc4c46b1e28532f4485c7d819a32940de84fdfbf89db80a4e919bce8a74b2948c5a01551771b714 diff --git a/sys-kernel/usermode-kernel/usermode-kernel-6.0.12.ebuild b/sys-kernel/usermode-kernel/usermode-kernel-6.0.12.ebuild new file mode 100644 index 000000000..e6ca2dbde --- /dev/null +++ b/sys-kernel/usermode-kernel/usermode-kernel-6.0.12.ebuild @@ -0,0 +1,282 @@ +# Copyright 2020-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit kernel-build toolchain-funcs + +MY_P=linux-${PV%.*} +GENPATCHES_P=genpatches-${PV%.*}-$(( ${PV##*.} + 0 )) +# https://koji.fedoraproject.org/koji/packageinfo?packageID=8 +# forked to https://github.com/projg2/fedora-kernel-config-for-gentoo +CONFIG_VER=6.0.8-gentoo +GENTOO_CONFIG_VER=g3 + +DESCRIPTION="Linux kernel built with Gentoo patches" +HOMEPAGE="https://www.kernel.org/" +SRC_URI+=" + https://cdn.kernel.org/pub/linux/kernel/v$(ver_cut 1).x/${MY_P}.tar.xz + https://dev.gentoo.org/~alicef/dist/genpatches/${GENPATCHES_P}.base.tar.xz + https://dev.gentoo.org/~alicef/dist/genpatches/${GENPATCHES_P}.extras.tar.xz + https://github.com/projg2/gentoo-kernel-config/archive/${GENTOO_CONFIG_VER}.tar.gz + -> gentoo-kernel-config-${GENTOO_CONFIG_VER}.tar.gz + 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} + ) + 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}/${MY_P} + +LICENSE="GPL-2" +KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~riscv ~x86" +IUSE="debug hardened pic static +hostfs +iomem" +REQUIRED_USE="arm? ( savedconfig ) + hppa? ( savedconfig ) + riscv? ( savedconfig )" + +RDEPEND=" + sys-apps/usermode-utilities +" +BDEPEND=" + debug? ( dev-util/pahole ) +" + +QA_FLAGS_IGNORED=" + usr/src/linux-.*/scripts/gcc-plugins/.*.so + usr/src/linux-.*/vmlinux + usr/src/linux-.*/arch/powerpc/kernel/vdso.*/vdso.*.so.dbg +" + +src_prepare() { + local PATCHES=( + # meh, genpatches have no directory + "${WORKDIR}"/*.patch + ) + default + + local biendian=false + + # prepare the default config + case ${ARCH} in + amd64) + cp "${DISTDIR}/kernel-x86_64-fedora.config.${CONFIG_VER}" .config || die + ;; + arm) + return + ;; + arm64) + cp "${DISTDIR}/kernel-aarch64-fedora.config.${CONFIG_VER}" .config || die + biendian=true + ;; + hppa) + return + ;; + ppc) + # assume powermac/powerbook defconfig + # we still package.use.force savedconfig + cp "${WORKDIR}/${MY_P}/arch/powerpc/configs/pmac32_defconfig" .config || die + ;; + ppc64) + cp "${DISTDIR}/kernel-ppc64le-fedora.config.${CONFIG_VER}" .config || die + biendian=true + ;; + riscv) + return + ;; + x86) + cp "${DISTDIR}/kernel-i686-fedora.config.${CONFIG_VER}" .config || die + ;; + *) + die "Unsupported arch ${ARCH}" + ;; + esac + + local myversion="-usermode-gentoo" + 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 + ) + 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 + + kernel-build_merge_configs "${merge_configs[@]}" +} + +src_configure() { + default + + MAKEARGS+=( ARCH="um" ) + + if use pic; then + MAKEARGS+=( KCFLAGS="-fPIC" ) + fi + + restore_config .config + emake O="${WORKDIR}"/modprep "${MAKEARGS[@]}" mrproper + mv .config "${WORKDIR}"/modprep/.config || die + + # UML + if use static; then + echo "CONFIG_STATIC_LINK=y" >> "${WORKDIR}"/modprep/.config || die + fi + if use hostfs; then + echo "CONFIG_HOSTFS=y" >> "${WORKDIR}"/modprep/.config || die + fi + if use iomem; then + echo "CONFIG_MMAPPER=y" >> "${WORKDIR}"/modprep/.config || die + fi + echo "CONFIG_UML_TIME_TRAVEL_SUPPORT=y" >> "${WORKDIR}"/modprep/.config || die + + # Character Devices + echo "CONFIG_STDERR_CONSOLE=y" >> "${WORKDIR}"/modprep/.config || die + echo "CONFIG_SSL=y" >> "${WORKDIR}"/modprep/.config || die + echo "CONFIG_NULL_CHAN=y" >> "${WORKDIR}"/modprep/.config || die + echo "CONFIG_PORT_CHAN=y" >> "${WORKDIR}"/modprep/.config || die + echo "CONFIG_PTY_CHAN=y" >> "${WORKDIR}"/modprep/.config || die + echo "CONFIG_TTY_CHAN=y" >> "${WORKDIR}"/modprep/.config || die + echo "CONFIG_XTERM_CHAN=y" >> "${WORKDIR}"/modprep/.config || die + echo "CONFIG_UML_SOUND=y" >> "${WORKDIR}"/modprep/.config || die + + # Network Devices + echo "CONFIG_UML_NET=y" >> "${WORKDIR}"/modprep/.config || die + echo "CONFIG_UML_NET_VECTOR=y" >> "${WORKDIR}"/modprep/.config || die + + # Kernel + echo "CONFIG_VIRTIO_UML=y" >> "${WORKDIR}"/modprep/.config || die + echo "CONFIG_UML_RTC=y" >> "${WORKDIR}"/modprep/.config || die + + # Block Devices + echo "CONFIG_BLK_DEV_UBD=y" >> "${WORKDIR}"/modprep/.config || die + echo "CONFIG_BLK_DEV_UBD_SYNC=y" >> "${WORKDIR}"/modprep/.config || die + + # Watchdog Timer + echo "CONFIG_UML_WATCHDOG=y" >> "${WORKDIR}"/modprep/.config || die + + # Character Devices + echo "CONFIG_UML_RANDOM=y" >> "${WORKDIR}"/modprep/.config || die + + emake O="${WORKDIR}"/modprep "${MAKEARGS[@]}" olddefconfig + emake O="${WORKDIR}"/modprep "${MAKEARGS[@]}" modules_prepare + cp -pR "${WORKDIR}"/modprep "${WORKDIR}"/build || die +} + +src_compile() { + emake O="${WORKDIR}"/build "${MAKEARGS[@]}" all +} + +src_install() { + # do not use 'make install' as it behaves differently based + # on what kind of installkernel is installed + local targets=( modules_install ) + + emake O="${WORKDIR}"/build "${MAKEARGS[@]}" \ + INSTALL_MOD_PATH="${ED}" INSTALL_PATH="${ED}/boot" "${targets[@]}" + + # note: we're using mv rather than doins to save space and time + # install main and arch-specific headers first, and scripts + local kern_arch="um" + local mods_arch="x86" # hardcoded! + local dir_ver=${PV}${KV_LOCALVERSION} + local kernel_dir=/usr/src/linux-${dir_ver} + dodir "${kernel_dir}/arch/${kern_arch}" + dodir "${kernel_dir}/arch/${mods_arch}" + mv include scripts "${ED}${kernel_dir}/" || die + mv "arch/${kern_arch}/include" \ + "${ED}${kernel_dir}/arch/${kern_arch}/" || die + mv "arch/${mods_arch}/include" \ + "${ED}${kernel_dir}/arch/${mods_arch}/" || die + + # remove everything but Makefile* and Kconfig* + find -type f '!' '(' -name 'Makefile*' -o -name 'Kconfig*' ')' \ + -delete || die + find -type l -delete || die + cp -p -R * "${ED}${kernel_dir}/" || die + + cd "${WORKDIR}" || die + # strip out-of-source build stuffs from modprep + # and then copy built files as well + find modprep -type f '(' \ + -name Makefile -o \ + -name '*.[ao]' -o \ + '(' -name '.*' -a -not -name '.config' ')' \ + ')' -delete || die + rm modprep/source || die + cp -p -R modprep/. "${ED}${kernel_dir}"/ || die + + # install the kernel and files needed for module builds + insinto "${kernel_dir}" + doins build/{System.map,Module.symvers} + local image_path="linux" + cp -p "build/${image_path}" "${ED}${kernel_dir}/${image_path}" || die + + # building modules fails with 'vmlinux has no symtab?' if stripped + use ppc64 && dostrip -x "${kernel_dir}/${image_path}" + + # Install vmlinux with debuginfo when requested + if use debug; then + if [[ "${image_path}" != "linux" ]]; then + mv "build/linux" "${ED}${kernel_dir}/linux" || die + fi + dostrip -x "${kernel_dir}/linux" + fi + dobin "${kernel_dir}/linux" + + # strip empty directories + find "${D}" -type d -empty -exec rmdir {} + || die + + local relfile=${ED}${kernel_dir}/include/config/kernel.release + local module_ver + module_ver=$(<"${relfile}") || die + + # fix source tree and build dir symlinks + dosym "../../../${kernel_dir}" "/lib/modules/${module_ver}/build" + dosym "../../../${kernel_dir}" "/lib/modules/${module_ver}/source" + + save_config build/.config +} + +pkg_postinst() { + # disable kernel-install_pkg_postinst + setcap cap_net_admin+ep "/usr/bin/linux" || die +} + +pkg_prerm() { + # disable kernel-install_pkg_prerm + true +} + +pkg_postrm() { + # disable kernel-install_pkg_postrm + true +}