dchkernel.eclass: Add eclass for kernel building
Rather than duplicate the src_* functions in every kernel package, the `dchkernel` eclass can be inherited to automatically define the necessary functions to build a kernel using the configuration file in an ebuild's $FILESDIRmaster
parent
12eeb6bdda
commit
38df05b151
|
@ -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 <dustin@hatch.name>
|
||||
# @AUTHOR:
|
||||
# Dustin C. Hatch <dustin@hatch.name>
|
||||
# @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
|
||||
}
|
Reference in New Issue