From: Denys Dmytriyenko <denys@ti.com>
To: Nikhil Devshatwar <nikhil.nd@ti.com>
Cc: meta-ti@yoctoproject.org, karthik.ramanan@ti.com
Subject: Re: [ thud PATCH v2] jailhouse: add recipe for Jailhouse module, FW, cells, inmates and basic demo
Date: Mon, 8 Jul 2019 13:08:59 -0400 [thread overview]
Message-ID: <20190708170859.GE26050@beryl> (raw)
In-Reply-To: <1562339000-19082-1-git-send-email-nikhil.nd@ti.com>
On Fri, Jul 05, 2019 at 08:33:20PM +0530, Nikhil Devshatwar wrote:
> From: Denys Dmytriyenko <denys@ti.com>
>
> 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>
> ---
> Changes from v1:
> * Fix issues with building tools
> * Remove the makefile patch
>
> recipes-bsp/jailhouse/jailhouse-arch.inc | 20 +++++
> recipes-bsp/jailhouse/jailhouse_git.bb | 141 +++++++++++++++++++++++++++++++
Why was this moved? This should reside in recipes-kernel, not recipes-bsp.
> 2 files changed, 161 insertions(+)
> create mode 100644 recipes-bsp/jailhouse/jailhouse-arch.inc
> create mode 100644 recipes-bsp/jailhouse/jailhouse_git.bb
>
> diff --git a/recipes-bsp/jailhouse/jailhouse-arch.inc b/recipes-bsp/jailhouse/jailhouse-arch.inc
> new file mode 100644
> index 0000000..e06ec23
> --- /dev/null
> +++ b/recipes-bsp/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-bsp/jailhouse/jailhouse_git.bb b/recipes-bsp/jailhouse/jailhouse_git.bb
> new file mode 100644
> index 0000000..18b984f
> --- /dev/null
> +++ b/recipes-bsp/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)
> +}
> --
> 1.9.1
>
next prev parent reply other threads:[~2019-07-08 17:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-05 15:03 [ thud PATCH v2] jailhouse: add recipe for Jailhouse module, FW, cells, inmates and basic demo Nikhil Devshatwar
2019-07-07 9:34 ` [EXTERNAL] " Subhajit Paul
2019-07-07 14:00 ` Devshatwar, Nikhil
2019-07-08 16:08 ` Paul, Subhajit
2019-07-08 17:08 ` Denys Dmytriyenko [this message]
2019-07-08 18:36 ` Devshatwar, Nikhil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190708170859.GE26050@beryl \
--to=denys@ti.com \
--cc=karthik.ramanan@ti.com \
--cc=meta-ti@yoctoproject.org \
--cc=nikhil.nd@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.