diff mbox series

[kirkstone] Rework jailhouse recipe to support different image build

Message ID 20240221112218.321332-1-p-bhagat@ti.com
State Accepted
Delegated to: Ryan Eatmon
Headers show
Series [kirkstone] Rework jailhouse recipe to support different image build | expand

Commit Message

Paresh Bhagat Feb. 21, 2024, 11:22 a.m. UTC
This patch moves the jailhouse recipe general variables to a
ti-jailhouse.inc file along with fetch and compile task.
Jailhouse repo also contains some demo applications which can
be packaged alone in filesytem and does not require packaging
jailhouse module, firmware and tool.

So add a new recipe jailhouse-inmate which can be used to only
package those demos. The existing jailhouse recipe will contain
variables and other dependencies needed for do_install task for
jailhouse module, tools, demos etc. The do_install of jailhouse
inmate recipe will only package demo applications.

This new recipe(jailhouse-inmate) will be added to a new image
in meta-arago. The new image will be used for jailhouse second
linux instance or cell.

Signed-off-by: Paresh Bhagat <p-bhagat@ti.com>
---
 .../recipes-ti/jailhouse/jailhouse-arch.inc   | 22 -----
 .../recipes-ti/jailhouse/jailhouse-inmate.bb  | 12 +++
 .../recipes-ti/jailhouse/jailhouse_git.bb     | 78 ++---------------
 .../recipes-ti/jailhouse/ti-jailhouse.inc     | 87 +++++++++++++++++++
 4 files changed, 104 insertions(+), 95 deletions(-)
 delete mode 100644 meta-ti-extras/recipes-ti/jailhouse/jailhouse-arch.inc
 create mode 100644 meta-ti-extras/recipes-ti/jailhouse/jailhouse-inmate.bb
 create mode 100644 meta-ti-extras/recipes-ti/jailhouse/ti-jailhouse.inc
diff mbox series

Patch

diff --git a/meta-ti-extras/recipes-ti/jailhouse/jailhouse-arch.inc b/meta-ti-extras/recipes-ti/jailhouse/jailhouse-arch.inc
deleted file mode 100644
index 498b25ed..00000000
--- a/meta-ti-extras/recipes-ti/jailhouse/jailhouse-arch.inc
+++ /dev/null
@@ -1,22 +0,0 @@ 
-# 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)}"
-
-COMPATIBLE_HOST = "(i.86|x86_64|arm|aarch64).*-linux"
diff --git a/meta-ti-extras/recipes-ti/jailhouse/jailhouse-inmate.bb b/meta-ti-extras/recipes-ti/jailhouse/jailhouse-inmate.bb
new file mode 100644
index 00000000..39654a53
--- /dev/null
+++ b/meta-ti-extras/recipes-ti/jailhouse/jailhouse-inmate.bb
@@ -0,0 +1,12 @@ 
+require ti-jailhouse.inc
+
+do_install() {
+
+	install -d ${D}${bindir}
+	install -m 0755 ${TOOLS_SRC_DIR}/demos/ivshmem-demo ${D}${bindir}
+
+}
+
+FILES:${PN} = " \
+    ${bindir}/ivshmem-demo \
+"
diff --git a/meta-ti-extras/recipes-ti/jailhouse/jailhouse_git.bb b/meta-ti-extras/recipes-ti/jailhouse/jailhouse_git.bb
index 70d6a0b6..98ec0e9e 100644
--- a/meta-ti-extras/recipes-ti/jailhouse/jailhouse_git.bb
+++ b/meta-ti-extras/recipes-ti/jailhouse/jailhouse_git.bb
@@ -1,49 +1,11 @@ 
-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-only & BSD-2-Clause"
-
-LIC_FILES_CHKSUM = " \
-    file://COPYING;md5=9fa7f895f96bde2d47fd5b7d95b6ba4d \
-"
-
-COMPATIBLE_MACHINE = "am62xx|am62pxx"
-
-TARGET_CC_ARCH += "${LDFLAGS}"
-
-PV = "0.12+git${SRCPV}"
-SRCREV = "0b29ad90f6f54105b98d6bbf35cc47fb244f7799"
-BRANCH = "master"
-
-SRC_URI = " \
-    git://git.ti.com/git/jailhouse/ti-jailhouse.git;protocol=https;branch=${BRANCH} \
-"
+require ti-jailhouse.inc
 
-DEPENDS = "virtual/kernel dtc-native python3-mako-native python3-mako make-native"
 RDEPENDS:${PN} += "\
-	python3-curses\
-	python3-datetime\
-	python3-mmap\
+        python3-curses\
+        python3-datetime\
+        python3-mmap\
 "
 
-require jailhouse-arch.inc
-inherit module python3native bash-completion deploy setuptools3
-
-S = "${WORKDIR}/git"
-B = "${S}"
-
-PACKAGE_ARCH = "${MACHINE_ARCH}"
-COMPATIBLE_MACHINE = "(ti-soc)"
-
-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_CELL_FILES ?= "*.cell"
 JH_CELL_FILES:k3 ?= "k3-*.cell"
 JH_CELL_FILES:am62xx ?= "k3-am625-*.cell"
@@ -63,13 +25,6 @@  JH_LINUX_DEMO_CELL:am62pxx ?= "k3-am62p5-sk-linux-demo.cell"
 JH_LINUX_DEMO_CELL:j7 ?= "k3-j721e-evm-linux-demo.cell"
 JH_LINUX_DEMO_CELL:j7200-evm ?= "k3-j7200-evm-linux-demo.cell"
 
-JH_SYSCONFIG_CELL ?= ""
-JH_SYSCONFIG_CELL:am62xx ?= "k3-am625-sk.cell"
-JH_SYSCONFIG_CELL:am65xx ?= "k3-am654-idk.cell"
-JH_SYSCONFIG_CELL:am62pxx ?= "k3-am62p5-sk.cell"
-JH_SYSCONFIG_CELL:j7 ?= "k3-j721e-evm.cell"
-JH_SYSCONFIG_CELL:j7200-evm ?= "k3-j7200-evm.cell"
-
 INITRAMFS_IMAGE ?= ""
 JH_RAMFS_IMAGE ?= "${INITRAMFS_IMAGE}"
 
@@ -80,29 +35,7 @@  JH_CMDLINE:am65xx ?= "console=ttyS1,115200n8"
 JH_CMDLINE:j7 ?= "console=ttyS3,115200n8"
 JH_CMDLINE:j7200-evm ?= "console=ttyS3,115200n8"
 
-do_configure() {
-	if [ -d ${STAGING_DIR_HOST}/${CELLCONF_DIR} ];
-	then
-		cp ${STAGING_DIR_HOST}/${CELLCONF_DIR}/*.c ${S}/configs/
-	fi
-}
-
-USER_SPACE_CFLAGS = '${CFLAGS} -DLIBEXECDIR=\\\"${libexecdir}\\\" \
-                    -DJAILHOUSE_VERSION=\\\"$JAILHOUSE_VERSION\\\" \
-                    -Wall -Wextra -Wmissing-declarations -Wmissing-prototypes -Werror \
-                    -I../driver'
-
-TOOLS_SRC_DIR = "${S}/tools"
-
-EXTRA_OEMAKE = "ARCH=${JH_ARCH} CROSS_COMPILE=${TARGET_PREFIX} CC="${CC}" KDIR=${STAGING_KERNEL_BUILDDIR}"
-
-do_compile() {
-	oe_runmake V=1
-}
-
 do_install() {
-	# Install pyjailhouse python modules needed by the tools
-	# distutils3_do_install
 
 	# We want to install the python tools, but we do not want to use pip...
 	# At least with v0.10, we can work around this with
@@ -154,7 +87,7 @@  do_install() {
 }
 
 PACKAGE_BEFORE_PN = "kernel-module-jailhouse pyjailhouse ${PN}-tools"
-FILES:${PN} = "${base_libdir}/firmware ${libexecdir} ${sbindir} ${JH_DATADIR} /boot"
+
 FILES:pyjailhouse = "${PYTHON_SITEPACKAGES_DIR}"
 FILES:${PN}-tools = "${libexecdir}/${BPN}/${BPN}-*"
 
@@ -183,7 +116,6 @@  python __anonymous () {
         d.appendVar('RDEPENDS_${PN}', ' ' + cell)
 }
 
-
 FILES:${PN} = " \
     /boot/* \
     /usr/libexec \
diff --git a/meta-ti-extras/recipes-ti/jailhouse/ti-jailhouse.inc b/meta-ti-extras/recipes-ti/jailhouse/ti-jailhouse.inc
new file mode 100644
index 00000000..a63891bf
--- /dev/null
+++ b/meta-ti-extras/recipes-ti/jailhouse/ti-jailhouse.inc
@@ -0,0 +1,87 @@ 
+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-only & BSD-2-Clause"
+
+LIC_FILES_CHKSUM = " \
+    file://COPYING;md5=9fa7f895f96bde2d47fd5b7d95b6ba4d \
+"
+
+COMPATIBLE_MACHINE = "am62xx|am62pxx"
+TARGET_CC_ARCH += "${LDFLAGS}"
+PV = "0.12+git${SRCPV}"
+SRCREV = "0b29ad90f6f54105b98d6bbf35cc47fb244f7799"
+BRANCH = "master"
+SRC_URI = " \
+    git://git.ti.com/git/jailhouse/ti-jailhouse.git;protocol=https;branch=${BRANCH} \
+"
+
+# 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)}"
+
+COMPATIBLE_HOST = "(i.86|x86_64|arm|aarch64).*-linux"
+
+S = "${WORKDIR}/git"
+B = "${S}"
+
+DEPENDS = "virtual/kernel dtc-native python3-mako-native python3-mako make-native"
+
+inherit module python3native bash-completion deploy setuptools3
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+COMPATIBLE_MACHINE = "(ti-soc)"
+
+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_SYSCONFIG_CELL ?= ""
+JH_SYSCONFIG_CELL:am62xx ?= "k3-am625-sk.cell"
+JH_SYSCONFIG_CELL:am65xx ?= "k3-am654-idk.cell"
+JH_SYSCONFIG_CELL:am62pxx ?= "k3-am62p5-sk.cell"
+JH_SYSCONFIG_CELL:j7 ?= "k3-j721e-evm.cell"
+JH_SYSCONFIG_CELL:j7200-evm ?= "k3-j7200-evm.cell"
+
+do_configure() {
+        if [ -d ${STAGING_DIR_HOST}/${CELLCONF_DIR} ];
+        then
+            cp ${STAGING_DIR_HOST}/${CELLCONF_DIR}/*.c ${S}/configs/
+        fi
+}
+
+USER_SPACE_CFLAGS = '${CFLAGS} -DLIBEXECDIR=\\\"${libexecdir}\\\" \
+                    -DJAILHOUSE_VERSION=\\\"$JAILHOUSE_VERSION\\\" \
+                    -Wall -Wextra -Wmissing-declarations -Wmissing-prototypes -Werror \
+                    -I../driver'
+
+TOOLS_SRC_DIR = "${S}/tools"
+
+EXTRA_OEMAKE = "ARCH=${JH_ARCH} CROSS_COMPILE=${TARGET_PREFIX} CC="${CC}" KDIR=${STAGING_KERNEL_BUILDDIR}"
+
+do_compile() {
+        oe_runmake V=1
+}