blob: ec1d53b4e07931ba3cd99bda4c71830eea90274d [file] [log] [blame]
#
# Copyright 2021 Google LLC
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# version 2 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
EAPI="7"
inherit linux-mod
DESCRIPTION="DPDK kernel modules"
HOMEPAGE="http://git.dpdk.org/dpdk-kmods/"
MY_TAR=dpdk-kmods-abc7e0ec4a0bfb45330e670f8a277f4780e6c71f.tar.xz
SRC_URI="gs://chromeos-localmirror/distfiles/${MY_TAR} -> ${P}.tar.xz"
LICENSE="BSD-Google"
SLOT="rt"
KEYWORDS="*"
IUSE=""
RESTRICT="mirror"
DEPEND="virtual/linux-sources"
RDEPEND="${DEPEND}"
S="${WORKDIR}/dpdk-kmods-main/linux/igb_uio"
MODULE_NAMES="igb_uio(kernel/drivers/uio:${S}:${S})"
pkg_setup() {
ls "${ROOT}/usr/src"
# We cannot rely on auto detection because we have two kernels installed.
KERNEL_DIR="$(find "${ROOT}/usr/src" -maxdepth 1 -name "lakitu-kernel-rt-[0-9]*")"
KBUILD_OUTPUT="${KERNEL_DIR}/build"
linux-mod_pkg_setup
}
src_compile() {
LIBELF="$("${CBUILD}-pkg-config" libelf --libs 2>/dev/null || echo -lelf)"
BUILD_PARAMS="HOST_LIBELF_LIBS=${LIBELF} CC=${CC}"
BUILD_PARAMS+=" -C ${KBUILD_OUTPUT} M=${S} LLVM=1 LLVM_IAS=1"
BUILD_TARGETS="modules"
linux-mod_src_compile
}
src_install() {
# Sign the module first.
MODULE_OBJECT=igb_uio.ko
cp ${MODULE_OBJECT} ${MODULE_OBJECT}.orig
"${KBUILD_OUTPUT}"/scripts/sign-file \
sha256 \
"${KBUILD_OUTPUT}"/certs/signing_key.pem \
"${KBUILD_OUTPUT}"/certs/signing_key.x509 \
${MODULE_OBJECT} || die "signing failed"
# Do not strip the module signature.
dostrip -x "/lib/modules/${KV_FULL}/kernel/drivers/uio/${MODULE_OBJECT}"
linux-mod_src_install
}