diff --git a/eclass/dchkernel.eclass b/eclass/dchkernel.eclass new file mode 100644 index 0000000..fe2c821 --- /dev/null +++ b/eclass/dchkernel.eclass @@ -0,0 +1,53 @@ +# Copyright 1999-2017 Dustin C. Hatch +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: dchkernel.eclass +# @MAINTAINER: +# Dustin C. Hatch +# @AUTHOR: +# Dustin C. Hatch +# @BLURB: Build dustin's kernels + +inherit multilib + +DEPEND="=sys-kernel/gentoo-sources-${PVR}" + +EXPORT_FUNCTIONS src_unpack src_configure src_install + + +KSRC_DIR=/usr/src/linux-${PV}-gentoo +if [ ${PR} != r0 ]; then + KSRC_DIR=${KSRC_DIR}-${PR} +fi + +# @FUNCTION: dchkernel-src_unpack +# @USAGE: +# @DESCRIPTION: +# Creates ${S} +dchkernel_src_unpack() { + mkdir -p "${S}" || die +} + +# @FUNCTION: dchkernel-src_configure +# @USAGE: +# @DESCRIPTION: +# Copies the kernel configuration from ${FILESDIR} and runs make oldconfig +dchkernel_src_configure() { + cp "${FILESDIR}"/${P}.kconfig .config || die + unset ARCH + make -C "${KSRC_DIR}" O="${S}" oldnoconfig || die +} + +# @FUNCTION: dchkernel-src_install +# @USAGE: +# @DESCRIPTION: +# Installs the kernel image, configuration file, and System.map into +# /usr/${libdir}/kernels/${PF} +dchkernel_src_install() { + local installpath="/usr/$(get_libdir)"/kernels/"${PF}" + dodir "${installpath}" + make install INSTALL_PATH="${D%/}${installpath}" || die + if in_iuse modules && use modules; then + make modules_install INSTALL_MOD_PATH="${D%/}" || die + fi +}