blob: e8317b7b42fa092156153c83b053fa25855d50a3 [file] [log] [blame]
inherit kernel
require recipes-kernel/linux/linux-yocto.inc
require recipes-bsp/gbmc-bsp-common/gbmc-bsp-common.inc
DEFAULT_PREFERENCE = "-1"
PROVIDES += "virtual/kernel linux-gbmc"
KCONFIG_MODE = "--allnoconfig"
PV = "${LINUX_VERSION}+git${SRCPV}"
# We do not want kernel images installed into /boot
RRECOMMENDS:${KERNEL_PACKAGE_NAME}-base = ""
SRC_URI += " \
git://gbmc.googlesource.com/linux;protocol=https;branch=${KBRANCH} \
file://DOWNSTREAM_0001-gBMC-Splice.patch \
file://linux-gbmc \
file://gbmc-trim-kconfig.sh \
file://gbmc-verify-pins.sh \
file://DOWNSTREAM_0001-misc-Add-gBMC-subfolder.patch \
${@bb.utils.contains('PACKAGECONFIG', 'emmc', 'file://emmc.cfg', '', d)} \
${@bb.utils.contains('PACKAGECONFIG', 'usb-host', 'file://usb-host.cfg', '', d)} \
${@bb.utils.contains('PACKAGECONFIG', 'usb-host-net', 'file://usb-host-net.cfg', '', d)} \
"
PACKAGECONFIG[diorite_c0] = ""
DIORITE_C0_SUPPORTED = "0"
DIORITE_C0_SUPPORTED:npcm7xx = "1"
PACKAGECONFIG[emmc] = ""
EMMC_SUPPORTED = "0"
EMMC_SUPPORTED:npcm7xx = "1"
EMMC_SUPPORTED:npcm8xx = "1"
PACKAGECONFIG[usb-host] = ""
USB_HOST_SUPPORTED = "0"
USB_HOST_SUPPORTED:npcm7xx = "1"
PACKAGECONFIG[usb-host-net] = ""
python __anonymous () {
if bb.utils.contains('PACKAGECONFIG', 'diorite_c0', True, False, d) and d.getVar('DIORITE_C0_SUPPORTED') != "1":
bb.fatal("Diorite C0 workaround not supported for this platform")
if bb.utils.contains('PACKAGECONFIG', 'emmc', True, False, d) and d.getVar('USB_HOST_SUPPORTED') != "1":
bb.fatal("EMMC not supported for this platform")
if bb.utils.contains('PACKAGECONFIG', 'usb-host', True, False, d) and d.getVar('USB_HOST_SUPPORTED') != "1":
bb.fatal("USB Host not supported for this platform")
if bb.utils.contains('PACKAGECONFIG', 'usb-host-net', True, False, d) and bb.utils.contains('PACKAGECONFIG', 'usb-host', False, True, d):
bb.fatal("USB Host Networking requires usb-host")
}
USB_HOST_STATUS = "${@bb.utils.contains('PACKAGECONFIG', 'usb-host', '"okay"', '"disabled"', d)}"
EMMC_STATUS = "${@bb.utils.contains('PACKAGECONFIG', 'emmc', '"okay"', '"disabled"', d)}"
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
SRC_URI += "file://defconfig"
SRC_URI:append:dev = " file://dev.cfg"
LINUX_PLATFORMS = ""
LINUX_PLATFORMS:npcm7xx = "arm armv7 npcm npcm7xx"
LINUX_PLATFORMS:npcm8xx = "arm armv8 npcm npcm8xx"
LINUX_PLATFORMS:aspeed-g6 = "arm armv7 ast ast26xx"
SRC_URI:append:npcm7xx = " \
${@bb.utils.contains('PACKAGECONFIG', 'diorite_c0', 'file://DOWNSTREAM_0001-Diorite-workaround-for-c0-card.patch', '', d)} \
"
do_ksrc_splice() {
cp -r ${WORKDIR}/linux-gbmc/* ${S}/
# Fill in PACKAGECONFIG defines
sed -e 's,@USB_HOST_STATUS@,${USB_HOST_STATUS},g' \
-e 's,@EMMC_STATUS@,${EMMC_STATUS},g' \
-i ${S}/arch/arm/boot/dts/nuvoton/npcm7xx-gbmc.dtsi
# Compatability symlinks for the DTS move from `nuvoton-*` to `nuvoton/nuvoton-*`
for file in ${S}/arch/arm/boot/dts/nuvoton/*.dtsi; do
[ ! -L "$file" ] || continue
ln -fsrv "$file" ${S}/arch/arm/boot/dts/
done
}
do_ksrc_splice:prepend:npcm7xx() {
mkdir -p ${S}/arch/arm/boot/dts/nuvoton
cp ${WORKDIR}/npcm7xx-gbmc-common.dtsi ${S}/arch/arm/boot/dts/nuvoton/
}
do_compile:prepend:npcm7xx() {
# We need the file after running the preprocessor so we get the macro expanded struct values
oe_runmake -C ${S} O=${B} drivers/pinctrl/nuvoton/pinctrl-npcm7xx.i
# Compare the struct values to the values in the dtsi
bash ${WORKDIR}/gbmc-verify-pins.sh ${B}/drivers/pinctrl/nuvoton/pinctrl-npcm7xx.i ${S}/arch/arm/boot/dts/nuvoton/npcm7xx-gbmc-common.dtsi
}
# Rewrite the splice patch to include all of the dropped-in files
do_ksrc_splice_post() {
if [ -z "$(git -C ${S} config user.email || true)" ]; then
git -C ${S} config user.email 'gbmc-core@google.com'
git -C ${S} config user.name 'gBMC Core'
fi
git -C ${S} add arch drivers
git -C ${S} commit -n -m "gBMC: Splice contents into source tree"
patch="$(git -C ${S} format-patch 'HEAD^')"
git -C ${S} reset --hard 'HEAD^'
mv "${S}/$patch" ${WORKDIR}/DOWNSTREAM_0001-gBMC-Splice.patch
}
do_kernel_checkout[postfuncs] =+ "do_ksrc_splice do_ksrc_splice_post"
# We need to make sure the subsequent fetch gets overridden by our modified patch
do_kernel_metadata:append() {
test -e ${S}/.kernel-meta/patches/DOWNSTREAM_0001-gBMC-Splice.patch
cp ${WORKDIR}/DOWNSTREAM_0001-gBMC-Splice.patch ${S}/.kernel-meta/patches/
if [ -e "${S}/.kernel-meta/configs" ]; then
bash ${WORKDIR}/gbmc-trim-kconfig.sh ${LINUX_VERSION} "${LINUX_PLATFORMS}" ${S}/.kernel-meta/configs/*
fi
}
do_compile_headers() {
oe_runmake -C ${S} O=${B} headers
}
do_shared_headers() {
mkdir -p ${STAGING_KERNEL_BUILDDIR}/usr
cp -r ${B}/usr/include/ ${STAGING_KERNEL_BUILDDIR}/usr/
}
addtask do_compile_headers after do_configure
addtask do_shared_headers after do_shared_workdir do_compile_headers