# Copyright 1999-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 inherit savedconfig toolchain-funcs DESCRIPTION="Locally built Linux 2.6.39.4 kernel with Win4Lin MKI and seccomp filter" HOMEPAGE="https://www.kernel.org" SRC_URI="https://www.kernel.org/pub/linux/kernel/v2.6/linux-${PV}.tar.xz" S="${WORKDIR}/linux-${PV}" LICENSE="GPL-2" SLOT="${PV}" KEYWORDS="-* ~x86" BDEPEND=" app-alternatives/bc app-alternatives/lex app-alternatives/yacc dev-lang/perl " PATCHES=( "${FILESDIR}/linux-2.6.39.4-seccomp-filter-backport.patch" "${FILESDIR}/linux-2.6.39.4-gcc15-build-fixes.patch" "${FILESDIR}/linux-2.6.39.4-gentoo-3.2-compat.patch" "${FILESDIR}/${P}-win4lin-mki.patch" "${FILESDIR}/${P}-mki-adapter26.patch" ) QA_FLAGS_IGNORED=" usr/src/linux-.*/scripts/.* usr/src/linux-.*/vmlinux " _kernel_make() { emake ARCH="$(tc-arch-kernel)" "$@" } _default_config() { [[ $(tc-arch-kernel) == x86 ]] || die "${PN} only supports x86-compatible kernel targets" [[ $(tc-arch) == x86 ]] || die "${PN} requires a 32-bit x86 target because MKI depends on X86_32" cp "${FILESDIR}/default-x86.config" .config || die } _force_config() { scripts/config \ --set-str LOCALVERSION "-win4lin" \ --disable LOCALVERSION_AUTO \ --enable MODULES \ --enable MODULE_UNLOAD \ --enable SECCOMP \ --enable SECCOMP_FILTER \ --enable IKCONFIG \ --enable IKCONFIG_PROC \ --enable DEVTMPFS \ --enable TMPFS \ --enable MKI || die } src_prepare() { default eapply_user } src_configure() { _default_config restore_config .config _force_config _kernel_make oldnoconfig } src_compile() { _kernel_make bzImage modules } src_install() { local kv_full kv_full="$(_kernel_make -s kernelrelease)" || die _kernel_make INSTALL_MOD_PATH="${D}" modules_install rm -f "${D}/lib/modules/${kv_full}"/{build,source} || die dosym "../../../usr/src/linux-${kv_full}" "/lib/modules/${kv_full}/build" dosym "../../../usr/src/linux-${kv_full}" "/lib/modules/${kv_full}/source" insinto /boot newins arch/x86/boot/bzImage "vmlinuz-${kv_full}" newins System.map "System.map-${kv_full}" newins .config "config-${kv_full}" dodir /usr/src cp -a "${S}" "${D}/usr/src/linux-${kv_full}" || die echo "${CATEGORY}/${PF}:${SLOT}" > "${D}/usr/src/linux-${kv_full}/dist-kernel" || die use savedconfig && save_config .config } pkg_postinst() { local kv_full="${PV}-win4lin" if type -P depmod >/dev/null; then depmod -a "${kv_full}" || ewarn "depmod failed for ${kv_full}" fi elog "Installed kernel image: /boot/vmlinuz-${kv_full}" elog "Installed build tree: /usr/src/linux-${kv_full}" elog "MKI is enabled in this 32-bit x86 kernel." }