Files
linamh/sys-kernel/gentoo-kernel/gentoo-kernel-2.6.39.4.ebuild
2026-06-29 14:48:02 +02:00

115 lines
2.5 KiB
Bash

# 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 Gentoo legacy patches 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="-* ~amd64 ~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"
)
QA_FLAGS_IGNORED="
usr/src/linux-.*/scripts/.*
usr/src/linux-.*/vmlinux
"
_kernel_make() {
emake ARCH="$(tc-arch-kernel)" "$@"
}
_default_config() {
case "$(tc-arch)" in
amd64)
cp "${FILESDIR}/default-amd64.config" .config || die
;;
x86)
cp "${FILESDIR}/default-x86.config" .config || die
;;
*)
die "${PN} only supports amd64 and x86"
;;
esac
}
_force_config() {
scripts/config \
--set-str LOCALVERSION "-gentoo" \
--disable LOCALVERSION_AUTO \
--enable MODULES \
--enable MODULE_UNLOAD \
--enable SECCOMP \
--enable SECCOMP_FILTER \
--enable IKCONFIG \
--enable IKCONFIG_PROC \
--enable DEVTMPFS \
--enable TMPFS || 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}-gentoo"
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}"
}