aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-kernel
diff options
context:
space:
mode:
authorDenys Dmytriyenko <denys@ti.com>2019-07-05 21:03:20 +0000
committerDenys Dmytriyenko <denys@ti.com>2019-07-09 02:24:24 +0000
commitebef50ab00e9ef1bac435a30d7cfc3102541c0c6 (patch)
treefad147446c11715d42bf0a291c93a66453be7a5c /recipes-kernel
parent22146d3620528404c686c1cdce9443db4abd0c0e (diff)
downloadmeta-ti-ebef50ab00e9ef1bac435a30d7cfc3102541c0c6.tar.gz
meta-ti-ebef50ab00e9ef1bac435a30d7cfc3102541c0c6.tar.bz2
meta-ti-ebef50ab00e9ef1bac435a30d7cfc3102541c0c6.zip
jailhouse: add recipe for Jailhouse module, FW, cells, inmates and basic demo
Builds the Jailhouse kernel module, hypervisor binaries and all the cell configs for root cell and other demos. Generate the linux-demo loader script without initramfs. Supports am65x and j7-evm machines [nikhil.nd@ti.com: Update for public trees] Signed-off-by: Denys Dmytriyenko <denys@ti.com> Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com> Reviewed-by: Subhajit Paul <subhajit_paul@ti..com> Tested-by: Subhajit Paul <subhajit_paul@ti..com> Signed-off-by: Denys Dmytriyenko <denys@ti.com>
Diffstat (limited to 'recipes-kernel')
-rw-r--r--recipes-kernel/jailhouse/jailhouse-arch.inc20
-rw-r--r--recipes-kernel/jailhouse/jailhouse_git.bb141
2 files changed, 161 insertions, 0 deletions
diff --git a/recipes-kernel/jailhouse/jailhouse-arch.inc b/recipes-kernel/jailhouse/jailhouse-arch.inc
new file mode 100644
index 00000000..e06ec231
--- /dev/null
+++ b/recipes-kernel/jailhouse/jailhouse-arch.inc
@@ -0,0 +1,20 @@
+# Set jailhouse architecture JH_ARCH variable
+#
+# return value must match one of architectures supported by jailhouse
+#
+valid_jh_archs = "x86 arm"
+
+def map_jh_arch(a, d):
+ import re
+
+ valid_jh_archs = d.getVar('valid_jh_archs', True).split()
+
+ if re.match('(i.86|athlon|x86.64)$', a): return 'x86'
+ elif re.match('armeb$', a): return 'arm'
+ elif re.match('aarch64$', a): return 'arm64'
+ elif re.match('aarch64_be$', a): return 'arm64'
+ elif a in valid_jh_archs: return a
+ else:
+ bb.error("cannot map '%s' to a jailhouse supported architecture" % a)
+
+export JH_ARCH = "${@map_jh_arch(d.getVar('TARGET_ARCH', True), d)}"
diff --git a/recipes-kernel/jailhouse/jailhouse_git.bb b/recipes-kernel/jailhouse/jailhouse_git.bb
new file mode 100644
index 00000000..18b984f3
--- /dev/null
+++ b/recipes-kernel/jailhouse/jailhouse_git.bb
@@ -0,0 +1,141 @@
+SUMMARY = "Linux-based partitioning hypervisor"
+DESCRIPTION = "Jailhouse is a partitioning Hypervisor based on Linux. It is able to run bare-metal applications or (adapted) \
+operating systems besides Linux. For this purpose, it configures CPU and device virtualization features of the hardware \
+platform in a way that none of these domains, called 'cells' here, can interfere with each other in an unacceptable way."
+HOMEPAGE = "https://github.com/siemens/jailhouse"
+SECTION = "jailhouse"
+LICENSE = "GPL-2.0 & BSD-2-Clause"
+
+LIC_FILES_CHKSUM = " \
+ file://COPYING;md5=9fa7f895f96bde2d47fd5b7d95b6ba4d \
+"
+
+PV = "0.10+git${SRCPV}"
+SRCREV = "5c6aa2b78c6485e9455d9d1441df3d695e1a8b4e"
+BRANCH = "ti-jailhouse-0.10"
+
+SRC_URI = " \
+ git://git.ti.com/jailhouse/ti-jailhouse.git;protocol=git;branch=${BRANCH} \
+"
+
+DEPENDS = "virtual/kernel dtc-native python-mako-native python-mako make-native"
+RDEPENDS_${PN} += "\
+ python-curses\
+ python-datetime\
+ python-argparse\
+ python-mmap\
+"
+
+S = "${WORKDIR}/git"
+
+require jailhouse-arch.inc
+inherit module pythonnative bash-completion deploy
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+JH_DATADIR ?= "${datadir}/jailhouse"
+JH_EXEC_DIR ?= "${libexecdir}/jailhouse"
+CELL_DIR ?= "${JH_DATADIR}/cells"
+CELLCONF_DIR ?= "${JH_DATADIR}/configs"
+INMATES_DIR ?= "${JH_DATADIR}/inmates"
+
+JH_CONFIG ?= "${S}/ci/jailhouse-config-x86.h"
+JH_CONFIG_k3 ?= "${S}/ci/jailhouse-config-k3.h"
+
+JH_CELL_FILES ?= "*.cell"
+JH_CELL_FILES_k3 ?= "k3-*.cell"
+
+JH_INMATE_DTB ?= ""
+JH_INMATE_DTB_am65xx-evm ?= "inmate-k3-am654.dtb"
+JH_INMATE_DTB_j7-evm ?= "inmate-k3-j721e-evm.dtb"
+
+JH_LINUX_DEMO_CELL ?= ""
+JH_LINUX_DEMO_CELL_am65xx-evm ?= "k3-am654-linux-demo.cell"
+JH_LINUX_DEMO_CELL_j7-evm ?= "k3-j721e-evm-linux-demo.cell"
+
+JH_SYSCONFIG_CELL ?= ""
+JH_SYSCONFIG_CELL_am65xx-evm ?= "k3-am654.cell"
+JH_SYSCONFIG_CELL_j7-evm ?= "k3-j721e-evm.cell"
+
+JH_CMDLINE ?= ""
+JH_CMDLINE_k3 ?= "console=ttyS1,115200n8 root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait earlycon=ns16550a,mmio32,0x2810000"
+
+do_configure() {
+ if [ -d ${STAGING_DIR_HOST}/${CELLCONF_DIR} ];
+ then
+ cp ${STAGING_DIR_HOST}/${CELLCONF_DIR}/*.c ${S}/configs/
+ fi
+
+ cp -av ${JH_CONFIG} ${S}/include/jailhouse/config.h
+}
+
+USER_SPACE_CFLAGS = '${CFLAGS} -DLIBEXECDIR=\\\"${libexecdir}\\\" \
+ -DJAILHOUSE_VERSION=\\\"$JAILHOUSE_VERSION\\\" \
+ -Wall -Wextra -Wmissing-declarations -Wmissing-prototypes -Werror \
+ -I../driver'
+
+TOOLS_SRC_DIR = "${S}/tools"
+TOOLS_OBJ_DIR = "${S}/tools"
+
+do_compile() {
+ oe_runmake V=1 ARCH=${JH_ARCH} CROSS_COMPILE=${TARGET_PREFIX} KDIR=${STAGING_KERNEL_BUILDDIR}
+}
+
+python __anonymous () {
+ d.appendVarFlag('do_install', 'depends', ' virtual/kernel:do_deploy')
+ initrd = d.getVar('INITRAMFS_IMAGE', True)
+ if initrd:
+ d.appendVarFlag('do_install', 'depends', ' ${INITRAMFS_IMAGE}:do_image_complete')
+}
+
+do_install() {
+ oe_runmake ARCH=${JH_ARCH} CROSS_COMPILE=${TARGET_PREFIX} KDIR=${STAGING_KERNEL_BUILDDIR} DESTDIR=${D} install
+
+ install -d ${D}${CELL_DIR}
+ install -m 0644 ${B}/configs/${JH_ARCH}/${JH_CELL_FILES} ${D}${CELL_DIR}/
+
+ install -d ${D}${INMATES_DIR}
+ install -m 0644 ${B}/inmates/demos/${JH_ARCH}/*.bin ${D}${INMATES_DIR}
+
+ install -d ${D}/boot
+
+ if [ -n "${JH_INMATE_DTB}" -a -n "${JH_LINUX_DEMO_CELL}" ]; then
+ cd ${TOOLS_SRC_DIR}
+
+ echo "#! /bin/sh" > ${D}${JH_DATADIR}/linux-demo.sh
+ echo "jailhouse enable ${CELL_DIR}/${JH_SYSCONFIG_CELL}" >> ${D}${JH_DATADIR}/linux-demo.sh
+ ./jailhouse-cell-linux -w ${D}${JH_DATADIR}/${JH_INMATE_DTB} \
+ -a ${JH_ARCH} -c "${JH_CMDLINE}" \
+ -d ../configs/${JH_ARCH}/dts/${JH_INMATE_DTB} \
+ ${D}${CELL_DIR}/${JH_LINUX_DEMO_CELL} \
+ ${DEPLOY_DIR_IMAGE}/Image \
+ | tr -cd '\11\12\15\40-\176' \
+ >> ${D}${JH_DATADIR}/linux-demo.sh
+
+ sed -i -e 's,^Modified device tree written.*,,g' ${D}${JH_DATADIR}/linux-demo.sh
+ sed -i -e 's,\${D},,g' ${D}${JH_DATADIR}/linux-demo.sh
+ sed -i -e 's, linux-loader.bin, ${JH_EXEC_DIR}/linux-loader.bin,g' ${D}${JH_DATADIR}/linux-demo.sh
+ sed -i -e 's,\${DEPLOY_DIR_IMAGE},/boot,g' ${D}${JH_DATADIR}/linux-demo.sh
+ sed -i -e '/^\s*$/d' ${D}${JH_DATADIR}/linux-demo.sh
+ chmod +x ${D}${JH_DATADIR}/linux-demo.sh
+ fi
+}
+
+
+PACKAGE_BEFORE_PN = "kernel-module-jailhouse"
+FILES_${PN} = "${base_libdir}/firmware ${libexecdir} ${sbindir} ${JH_DATADIR} /boot"
+
+INSANE_SKIP_${PN} = "ldflags"
+
+KERNEL_MODULE_AUTOLOAD += "jailhouse"
+
+# Any extra cells/inmates from external recipes/packages
+CELLS = ""
+
+python __anonymous () {
+ # Setup DEPENDS and RDEPENDS to included cells"
+ cells = d.getVar('CELLS', True) or ""
+ for cell in cells.split():
+ d.appendVar('DEPENDS', ' ' + cell)
+ d.appendVar('RDEPENDS_${PN}', ' ' + cell)
+}