diff options
author | Paresh Bhagat <p-bhagat@ti.com> | 2024-02-21 16:52:18 +0530 |
---|---|---|
committer | Ryan Eatmon <reatmon@ti.com> | 2024-02-21 14:33:19 -0600 |
commit | cb1db5e822625bcae3c7104248af1f3d54842842 (patch) | |
tree | 1731e78672f34dd61cf1a13be6b7a127ff4515ea | |
parent | e8a8a90ac4aa04ecd20bb0041f77bc7384bd9b07 (diff) | |
download | meta-ti-cb1db5e822625bcae3c7104248af1f3d54842842.tar.gz |
Rework jailhouse recipe to support different image build
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>
Signed-off-by: Ryan Eatmon <reatmon@ti.com>
4 files changed, 104 insertions, 95 deletions
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 @@ | |||
1 | # Set jailhouse architecture JH_ARCH variable | ||
2 | # | ||
3 | # return value must match one of architectures supported by jailhouse | ||
4 | # | ||
5 | valid_jh_archs = "x86 arm" | ||
6 | |||
7 | def map_jh_arch(a, d): | ||
8 | import re | ||
9 | |||
10 | valid_jh_archs = d.getVar('valid_jh_archs', True).split() | ||
11 | |||
12 | if re.match('(i.86|athlon|x86.64)$', a): return 'x86' | ||
13 | elif re.match('armeb$', a): return 'arm' | ||
14 | elif re.match('aarch64$', a): return 'arm64' | ||
15 | elif re.match('aarch64_be$', a): return 'arm64' | ||
16 | elif a in valid_jh_archs: return a | ||
17 | else: | ||
18 | bb.error("cannot map '%s' to a jailhouse supported architecture" % a) | ||
19 | |||
20 | export JH_ARCH = "${@map_jh_arch(d.getVar('TARGET_ARCH', True), d)}" | ||
21 | |||
22 | 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 @@ | |||
1 | require ti-jailhouse.inc | ||
2 | |||
3 | do_install() { | ||
4 | |||
5 | install -d ${D}${bindir} | ||
6 | install -m 0755 ${TOOLS_SRC_DIR}/demos/ivshmem-demo ${D}${bindir} | ||
7 | |||
8 | } | ||
9 | |||
10 | FILES:${PN} = " \ | ||
11 | ${bindir}/ivshmem-demo \ | ||
12 | " | ||
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 @@ | |||
1 | SUMMARY = "Linux-based partitioning hypervisor" | 1 | require ti-jailhouse.inc |
2 | DESCRIPTION = "Jailhouse is a partitioning Hypervisor based on Linux. It is able to run bare-metal applications or (adapted) \ | ||
3 | operating systems besides Linux. For this purpose, it configures CPU and device virtualization features of the hardware \ | ||
4 | platform in a way that none of these domains, called 'cells' here, can interfere with each other in an unacceptable way." | ||
5 | HOMEPAGE = "https://github.com/siemens/jailhouse" | ||
6 | SECTION = "jailhouse" | ||
7 | LICENSE = "GPL-2.0-only & BSD-2-Clause" | ||
8 | |||
9 | LIC_FILES_CHKSUM = " \ | ||
10 | file://COPYING;md5=9fa7f895f96bde2d47fd5b7d95b6ba4d \ | ||
11 | " | ||
12 | |||
13 | COMPATIBLE_MACHINE = "am62xx|am62pxx" | ||
14 | |||
15 | TARGET_CC_ARCH += "${LDFLAGS}" | ||
16 | |||
17 | PV = "0.12+git${SRCPV}" | ||
18 | SRCREV = "0b29ad90f6f54105b98d6bbf35cc47fb244f7799" | ||
19 | BRANCH = "master" | ||
20 | |||
21 | SRC_URI = " \ | ||
22 | git://git.ti.com/git/jailhouse/ti-jailhouse.git;protocol=https;branch=${BRANCH} \ | ||
23 | " | ||
24 | 2 | ||
25 | DEPENDS = "virtual/kernel dtc-native python3-mako-native python3-mako make-native" | ||
26 | RDEPENDS:${PN} += "\ | 3 | RDEPENDS:${PN} += "\ |
27 | python3-curses\ | 4 | python3-curses\ |
28 | python3-datetime\ | 5 | python3-datetime\ |
29 | python3-mmap\ | 6 | python3-mmap\ |
30 | " | 7 | " |
31 | 8 | ||
32 | require jailhouse-arch.inc | ||
33 | inherit module python3native bash-completion deploy setuptools3 | ||
34 | |||
35 | S = "${WORKDIR}/git" | ||
36 | B = "${S}" | ||
37 | |||
38 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
39 | COMPATIBLE_MACHINE = "(ti-soc)" | ||
40 | |||
41 | JH_DATADIR ?= "${datadir}/jailhouse" | ||
42 | JH_EXEC_DIR ?= "${libexecdir}/jailhouse" | ||
43 | CELL_DIR ?= "${JH_DATADIR}/cells" | ||
44 | CELLCONF_DIR ?= "${JH_DATADIR}/configs" | ||
45 | INMATES_DIR ?= "${JH_DATADIR}/inmates" | ||
46 | |||
47 | JH_CELL_FILES ?= "*.cell" | 9 | JH_CELL_FILES ?= "*.cell" |
48 | JH_CELL_FILES:k3 ?= "k3-*.cell" | 10 | JH_CELL_FILES:k3 ?= "k3-*.cell" |
49 | JH_CELL_FILES:am62xx ?= "k3-am625-*.cell" | 11 | JH_CELL_FILES:am62xx ?= "k3-am625-*.cell" |
@@ -63,13 +25,6 @@ JH_LINUX_DEMO_CELL:am62pxx ?= "k3-am62p5-sk-linux-demo.cell" | |||
63 | JH_LINUX_DEMO_CELL:j7 ?= "k3-j721e-evm-linux-demo.cell" | 25 | JH_LINUX_DEMO_CELL:j7 ?= "k3-j721e-evm-linux-demo.cell" |
64 | JH_LINUX_DEMO_CELL:j7200-evm ?= "k3-j7200-evm-linux-demo.cell" | 26 | JH_LINUX_DEMO_CELL:j7200-evm ?= "k3-j7200-evm-linux-demo.cell" |
65 | 27 | ||
66 | JH_SYSCONFIG_CELL ?= "" | ||
67 | JH_SYSCONFIG_CELL:am62xx ?= "k3-am625-sk.cell" | ||
68 | JH_SYSCONFIG_CELL:am65xx ?= "k3-am654-idk.cell" | ||
69 | JH_SYSCONFIG_CELL:am62pxx ?= "k3-am62p5-sk.cell" | ||
70 | JH_SYSCONFIG_CELL:j7 ?= "k3-j721e-evm.cell" | ||
71 | JH_SYSCONFIG_CELL:j7200-evm ?= "k3-j7200-evm.cell" | ||
72 | |||
73 | INITRAMFS_IMAGE ?= "" | 28 | INITRAMFS_IMAGE ?= "" |
74 | JH_RAMFS_IMAGE ?= "${INITRAMFS_IMAGE}" | 29 | JH_RAMFS_IMAGE ?= "${INITRAMFS_IMAGE}" |
75 | 30 | ||
@@ -80,29 +35,7 @@ JH_CMDLINE:am65xx ?= "console=ttyS1,115200n8" | |||
80 | JH_CMDLINE:j7 ?= "console=ttyS3,115200n8" | 35 | JH_CMDLINE:j7 ?= "console=ttyS3,115200n8" |
81 | JH_CMDLINE:j7200-evm ?= "console=ttyS3,115200n8" | 36 | JH_CMDLINE:j7200-evm ?= "console=ttyS3,115200n8" |
82 | 37 | ||
83 | do_configure() { | ||
84 | if [ -d ${STAGING_DIR_HOST}/${CELLCONF_DIR} ]; | ||
85 | then | ||
86 | cp ${STAGING_DIR_HOST}/${CELLCONF_DIR}/*.c ${S}/configs/ | ||
87 | fi | ||
88 | } | ||
89 | |||
90 | USER_SPACE_CFLAGS = '${CFLAGS} -DLIBEXECDIR=\\\"${libexecdir}\\\" \ | ||
91 | -DJAILHOUSE_VERSION=\\\"$JAILHOUSE_VERSION\\\" \ | ||
92 | -Wall -Wextra -Wmissing-declarations -Wmissing-prototypes -Werror \ | ||
93 | -I../driver' | ||
94 | |||
95 | TOOLS_SRC_DIR = "${S}/tools" | ||
96 | |||
97 | EXTRA_OEMAKE = "ARCH=${JH_ARCH} CROSS_COMPILE=${TARGET_PREFIX} CC="${CC}" KDIR=${STAGING_KERNEL_BUILDDIR}" | ||
98 | |||
99 | do_compile() { | ||
100 | oe_runmake V=1 | ||
101 | } | ||
102 | |||
103 | do_install() { | 38 | do_install() { |
104 | # Install pyjailhouse python modules needed by the tools | ||
105 | # distutils3_do_install | ||
106 | 39 | ||
107 | # We want to install the python tools, but we do not want to use pip... | 40 | # We want to install the python tools, but we do not want to use pip... |
108 | # At least with v0.10, we can work around this with | 41 | # At least with v0.10, we can work around this with |
@@ -154,7 +87,7 @@ do_install() { | |||
154 | } | 87 | } |
155 | 88 | ||
156 | PACKAGE_BEFORE_PN = "kernel-module-jailhouse pyjailhouse ${PN}-tools" | 89 | PACKAGE_BEFORE_PN = "kernel-module-jailhouse pyjailhouse ${PN}-tools" |
157 | FILES:${PN} = "${base_libdir}/firmware ${libexecdir} ${sbindir} ${JH_DATADIR} /boot" | 90 | |
158 | FILES:pyjailhouse = "${PYTHON_SITEPACKAGES_DIR}" | 91 | FILES:pyjailhouse = "${PYTHON_SITEPACKAGES_DIR}" |
159 | FILES:${PN}-tools = "${libexecdir}/${BPN}/${BPN}-*" | 92 | FILES:${PN}-tools = "${libexecdir}/${BPN}/${BPN}-*" |
160 | 93 | ||
@@ -183,7 +116,6 @@ python __anonymous () { | |||
183 | d.appendVar('RDEPENDS_${PN}', ' ' + cell) | 116 | d.appendVar('RDEPENDS_${PN}', ' ' + cell) |
184 | } | 117 | } |
185 | 118 | ||
186 | |||
187 | FILES:${PN} = " \ | 119 | FILES:${PN} = " \ |
188 | /boot/* \ | 120 | /boot/* \ |
189 | /usr/libexec \ | 121 | /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 @@ | |||
1 | SUMMARY = "Linux-based partitioning hypervisor" | ||
2 | DESCRIPTION = "Jailhouse is a partitioning Hypervisor based on Linux. It is able to run bare-metal applications or (adapted) \ | ||
3 | operating systems besides Linux. For this purpose, it configures CPU and device virtualization features of the hardware \ | ||
4 | platform in a way that none of these domains, called 'cells' here, can interfere with each other in an unacceptable way." | ||
5 | HOMEPAGE = "https://github.com/siemens/jailhouse" | ||
6 | SECTION = "jailhouse" | ||
7 | |||
8 | LICENSE = "GPL-2.0-only & BSD-2-Clause" | ||
9 | |||
10 | LIC_FILES_CHKSUM = " \ | ||
11 | file://COPYING;md5=9fa7f895f96bde2d47fd5b7d95b6ba4d \ | ||
12 | " | ||
13 | |||
14 | COMPATIBLE_MACHINE = "am62xx|am62pxx" | ||
15 | TARGET_CC_ARCH += "${LDFLAGS}" | ||
16 | PV = "0.12+git${SRCPV}" | ||
17 | SRCREV = "0b29ad90f6f54105b98d6bbf35cc47fb244f7799" | ||
18 | BRANCH = "master" | ||
19 | SRC_URI = " \ | ||
20 | git://git.ti.com/git/jailhouse/ti-jailhouse.git;protocol=https;branch=${BRANCH} \ | ||
21 | " | ||
22 | |||
23 | # Set jailhouse architecture JH_ARCH variable | ||
24 | # | ||
25 | # return value must match one of architectures supported by jailhouse | ||
26 | # | ||
27 | valid_jh_archs = "x86 arm" | ||
28 | |||
29 | def map_jh_arch(a, d): | ||
30 | import re | ||
31 | |||
32 | valid_jh_archs = d.getVar('valid_jh_archs', True).split() | ||
33 | |||
34 | if re.match('(i.86|athlon|x86.64)$', a): return 'x86' | ||
35 | elif re.match('armeb$', a): return 'arm' | ||
36 | elif re.match('aarch64$', a): return 'arm64' | ||
37 | elif re.match('aarch64_be$', a): return 'arm64' | ||
38 | elif a in valid_jh_archs: return a | ||
39 | else: | ||
40 | bb.error("cannot map '%s' to a jailhouse supported architecture" % a) | ||
41 | |||
42 | export JH_ARCH = "${@map_jh_arch(d.getVar('TARGET_ARCH', True), d)}" | ||
43 | |||
44 | COMPATIBLE_HOST = "(i.86|x86_64|arm|aarch64).*-linux" | ||
45 | |||
46 | S = "${WORKDIR}/git" | ||
47 | B = "${S}" | ||
48 | |||
49 | DEPENDS = "virtual/kernel dtc-native python3-mako-native python3-mako make-native" | ||
50 | |||
51 | inherit module python3native bash-completion deploy setuptools3 | ||
52 | |||
53 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
54 | COMPATIBLE_MACHINE = "(ti-soc)" | ||
55 | |||
56 | JH_DATADIR ?= "${datadir}/jailhouse" | ||
57 | JH_EXEC_DIR ?= "${libexecdir}/jailhouse" | ||
58 | CELL_DIR ?= "${JH_DATADIR}/cells" | ||
59 | CELLCONF_DIR ?= "${JH_DATADIR}/configs" | ||
60 | INMATES_DIR ?= "${JH_DATADIR}/inmates" | ||
61 | |||
62 | JH_SYSCONFIG_CELL ?= "" | ||
63 | JH_SYSCONFIG_CELL:am62xx ?= "k3-am625-sk.cell" | ||
64 | JH_SYSCONFIG_CELL:am65xx ?= "k3-am654-idk.cell" | ||
65 | JH_SYSCONFIG_CELL:am62pxx ?= "k3-am62p5-sk.cell" | ||
66 | JH_SYSCONFIG_CELL:j7 ?= "k3-j721e-evm.cell" | ||
67 | JH_SYSCONFIG_CELL:j7200-evm ?= "k3-j7200-evm.cell" | ||
68 | |||
69 | do_configure() { | ||
70 | if [ -d ${STAGING_DIR_HOST}/${CELLCONF_DIR} ]; | ||
71 | then | ||
72 | cp ${STAGING_DIR_HOST}/${CELLCONF_DIR}/*.c ${S}/configs/ | ||
73 | fi | ||
74 | } | ||
75 | |||
76 | USER_SPACE_CFLAGS = '${CFLAGS} -DLIBEXECDIR=\\\"${libexecdir}\\\" \ | ||
77 | -DJAILHOUSE_VERSION=\\\"$JAILHOUSE_VERSION\\\" \ | ||
78 | -Wall -Wextra -Wmissing-declarations -Wmissing-prototypes -Werror \ | ||
79 | -I../driver' | ||
80 | |||
81 | TOOLS_SRC_DIR = "${S}/tools" | ||
82 | |||
83 | EXTRA_OEMAKE = "ARCH=${JH_ARCH} CROSS_COMPILE=${TARGET_PREFIX} CC="${CC}" KDIR=${STAGING_KERNEL_BUILDDIR}" | ||
84 | |||
85 | do_compile() { | ||
86 | oe_runmake V=1 | ||
87 | } | ||