meta-agl-jailhouse: Enable jailhouse on qemu-x86_64 through runqemu
[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 DEPENDS = "virtual/kernel dtc-native python3-mako-native make-native"
23
24 require jailhouse-arch.inc
25 inherit module python3native bash-completion setuptools3
26
27 S = "${WORKDIR}/git"
28 B = "${S}"
29
30 JH_DATADIR ?= "${datadir}/jailhouse"
31 JH_EXEC_DIR ?= "${libexecdir}/jailhouse"
32 CELL_DIR ?= "${JH_DATADIR}/cells"
33 INMATES_DIR ?= "${JH_DATADIR}/inmates"
34 DTS_DIR ?= "${JH_DATADIR}/cells/dts"
35
36 JH_CELL_FILES ?= "*.cell"
37
38 EXTRA_OEMAKE = "ARCH=${JH_ARCH} CROSS_COMPILE=${TARGET_PREFIX} CC="${CC}" KDIR=${STAGING_KERNEL_BUILDDIR}"
39
40 do_configure() {
41                 
42         # copy ${WORKDIR}/qemu-agl.c ${S}/configs/x86/ <--- folder where the cells are defined in the source tree to be compiled
43         cp ${WORKDIR}/qemu-agl.c ${S}/configs/${JH_ARCH}
44         
45         sed -i '1s|^#!/usr/bin/env python$|#!/usr/bin/env python3|' ${B}/tools/${BPN}-*
46 }
47
48 do_compile() {
49         oe_runmake
50 }
51
52 do_install() {
53         # Install pyjailhouse python modules needed by the tools
54         distutils3_do_install
55
56         # We want to install the python tools, but we do not want to use pip...
57         # At least with v0.10, we can work around this with
58         # 'PIP=":" PYTHON_PIP_USEABLE=yes'
59         oe_runmake PIP=: PYTHON=python3 PYTHON_PIP_USEABLE=yes DESTDIR=${D} install
60
61         install -d ${D}${CELL_DIR}
62
63         
64         install -m 0644 ${B}/configs/${JH_ARCH}/${JH_CELL_FILES} ${D}${CELL_DIR}/
65
66         install -d ${D}${INMATES_DIR}
67         install -m 0644 ${B}/inmates/demos/${JH_ARCH}/*.bin ${D}${INMATES_DIR}
68
69         if [ ${JH_ARCH}  != "x86" ]; then
70                 install -d ${D}${DTS_DIR}
71                 install -m 0644 ${B}/configs/${JH_ARCH}/dts/*.dtb ${D}${DTS_DIR}
72         fi
73 }
74
75 PACKAGE_BEFORE_PN = "kernel-module-jailhouse pyjailhouse ${PN}-tools ${PN}-demos"
76 FILES_${PN} = "${base_libdir}/firmware ${libexecdir} ${sbindir} ${JH_DATADIR}"
77 FILES_pyjailhouse = "${PYTHON_SITEPACKAGES_DIR}"
78 FILES_${PN}-tools = "${libexecdir}/${BPN}/${BPN}-* ${JH_DATADIR}/*.tmpl"
79 FILES_${PN}-demos = "${JH_DATADIR}/ ${sbindir}/ivshmem-demo"
80
81 RDEPENDS_${PN}-tools = "pyjailhouse python3-mmap python3-math python3-datetime python3-curses python3-compression python3-mako"
82 RDEPENDS_pyjailhouse = "python3-core python3-ctypes python3-fcntl"
83 RDEPENDS_${PN}-demos = "jailhouse"
84
85 RRECOMMENDS_${PN} = "${PN}-tools"
86
87 KERNEL_MODULE_AUTOLOAD += "jailhouse"