meta-agl-jailhouse: Added inmates for jailhouse on agl
[AGL/meta-agl-devel.git] / meta-agl-jailhouse / recipes-extended / jailhouse / jailhouse_git.bb
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 LICENSE = "GPL-2.0 & BSD-2-Clause"
8
9 LIC_FILES_CHKSUM = " \
10     file://COPYING;md5=9fa7f895f96bde2d47fd5b7d95b6ba4d \
11 "
12
13 SRCREV = "4ce7658dddfd5a1682a379d5ac46657e93fe1ff0"
14 PV = "0.12+git${SRCPV}"
15
16 FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
17
18 SRC_URI = "git://github.com/siemens/jailhouse \
19            file://0001-configs-arm64-Add-support-for-RPi4-with-more-than-1G.patch \
20            "
21
22 SRC_URI += "file://qemu-agl.c \
23             file://agl-apic-demo.c \
24             file://agl-pci-demo.c \
25             file://agl-ivshmem-demo.c \
26             file://agl-linux-x86-demo.c \
27             "
28
29 DEPENDS = "virtual/kernel dtc-native python3-mako-native make-native"
30
31 require jailhouse-arch.inc
32 inherit module python3native bash-completion setuptools3
33
34 S = "${WORKDIR}/git"
35 B = "${S}"
36
37 JH_DATADIR ?= "${datadir}/jailhouse"
38 JH_EXEC_DIR ?= "${libexecdir}/jailhouse"
39 CELL_DIR ?= "${JH_DATADIR}/cells"
40 INMATES_DIR ?= "${JH_DATADIR}/inmates"
41 DTS_DIR ?= "${JH_DATADIR}/cells/dts"
42
43 JH_CELL_FILES ?= "*.cell"
44
45 EXTRA_OEMAKE = "ARCH=${JH_ARCH} CROSS_COMPILE=${TARGET_PREFIX} CC="${CC}" KDIR=${STAGING_KERNEL_BUILDDIR}"
46
47 do_configure() {
48                 
49         # copy ${WORKDIR}/qemu-agl.c ${S}/configs/x86/ <--- folder where the cells are defined in the source tree to be compiled
50         cp ${WORKDIR}/qemu-agl.c ${S}/configs/${JH_ARCH}
51         cp ${WORKDIR}/agl-apic-demo.c ${S}/configs/x86/
52         cp ${WORKDIR}/agl-pci-demo.c ${S}/configs/x86/
53         cp ${WORKDIR}/agl-linux-x86-demo.c ${S}/configs/x86/
54         cp ${WORKDIR}/agl-ivshmem-demo.c ${S}/configs/x86/
55
56         sed -i '1s|^#!/usr/bin/env python$|#!/usr/bin/env python3|' ${B}/tools/${BPN}-*
57 }
58
59 do_compile() {
60         oe_runmake
61 }
62
63 do_install() {
64         # Install pyjailhouse python modules needed by the tools
65         distutils3_do_install
66
67         # We want to install the python tools, but we do not want to use pip...
68         # At least with v0.10, we can work around this with
69         # 'PIP=":" PYTHON_PIP_USEABLE=yes'
70         oe_runmake PIP=: PYTHON=python3 PYTHON_PIP_USEABLE=yes DESTDIR=${D} install
71
72         install -d ${D}${CELL_DIR}
73
74         
75         install -m 0644 ${B}/configs/${JH_ARCH}/${JH_CELL_FILES} ${D}${CELL_DIR}/
76
77         install -d ${D}${INMATES_DIR}
78         install -m 0644 ${B}/inmates/demos/${JH_ARCH}/*.bin ${D}${INMATES_DIR}
79
80         if [ ${JH_ARCH}  != "x86" ]; then
81                 install -d ${D}${DTS_DIR}
82                 install -m 0644 ${B}/configs/${JH_ARCH}/dts/*.dtb ${D}${DTS_DIR}
83         fi
84 }
85
86 PACKAGE_BEFORE_PN = "kernel-module-jailhouse pyjailhouse ${PN}-tools ${PN}-demos"
87 FILES_${PN} = "${base_libdir}/firmware ${libexecdir} ${sbindir} ${JH_DATADIR}"
88 FILES_pyjailhouse = "${PYTHON_SITEPACKAGES_DIR}"
89 FILES_${PN}-tools = "${libexecdir}/${BPN}/${BPN}-* ${JH_DATADIR}/*.tmpl"
90 FILES_${PN}-demos = "${JH_DATADIR}/ ${sbindir}/ivshmem-demo"
91
92 RDEPENDS_${PN}-tools = "pyjailhouse python3-mmap python3-math python3-datetime python3-curses python3-compression python3-mako"
93 RDEPENDS_pyjailhouse = "python3-core python3-ctypes python3-fcntl"
94 RDEPENDS_${PN}-demos = "jailhouse"
95
96 RRECOMMENDS_${PN} = "${PN}-tools"
97
98 KERNEL_MODULE_AUTOLOAD += "jailhouse"