diff options
author | Ola Redell <ola.redell@retotech.se> | 2017-11-15 13:37:10 +0100 |
---|---|---|
committer | Ola Redell <ola.redell@retotech.se> | 2017-11-15 13:37:10 +0100 |
commit | 0c23c22067355c0b3c3660e14507d79915edea7e (patch) | |
tree | 8d18ed05f5292f1d18a941170b05a6022c945b5f | |
download | meta-jailhouse-0c23c22067355c0b3c3660e14507d79915edea7e.tar.gz |
Initial commit
-rw-r--r-- | COPYING.MIT | 17 | ||||
-rw-r--r-- | README.md | 112 | ||||
-rw-r--r-- | classes/jailhouse-cell.bbclass | 24 | ||||
-rw-r--r-- | conf/layer.conf | 10 | ||||
-rw-r--r-- | recipes-jailhouse/jailhouse/files/0001-ldflags-for-tools.patch | 13 | ||||
-rw-r--r-- | recipes-jailhouse/jailhouse/files/0002-no-ldflags-in-tools.patch | 13 | ||||
-rw-r--r-- | recipes-jailhouse/jailhouse/files/0003-workaround-if-changed-problem-in-tools-makefile.patch | 18 | ||||
-rw-r--r-- | recipes-jailhouse/jailhouse/files/0004-no-kbuild-of-tools.patch | 13 | ||||
-rw-r--r-- | recipes-jailhouse/jailhouse/files/jailhouse-config-bpi.h | 9 | ||||
-rw-r--r-- | recipes-jailhouse/jailhouse/files/plamics-bpi-root.c | 221 | ||||
-rw-r--r-- | recipes-jailhouse/jailhouse/jailhouse-defs.inc | 25 | ||||
-rw-r--r-- | recipes-jailhouse/jailhouse/jailhouse.inc | 71 | ||||
-rw-r--r-- | recipes-jailhouse/jailhouse/jailhouse_0.6.bb | 11 |
13 files changed, 557 insertions, 0 deletions
diff --git a/COPYING.MIT b/COPYING.MIT new file mode 100644 index 0000000..89de354 --- /dev/null +++ b/COPYING.MIT | |||
@@ -0,0 +1,17 @@ | |||
1 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
2 | of this software and associated documentation files (the "Software"), to deal | ||
3 | in the Software without restriction, including without limitation the rights | ||
4 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
5 | copies of the Software, and to permit persons to whom the Software is | ||
6 | furnished to do so, subject to the following conditions: | ||
7 | |||
8 | The above copyright notice and this permission notice shall be included in | ||
9 | all copies or substantial portions of the Software. | ||
10 | |||
11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
12 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
14 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
15 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
16 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
17 | THE SOFTWARE. | ||
diff --git a/README.md b/README.md new file mode 100644 index 0000000..467a847 --- /dev/null +++ b/README.md | |||
@@ -0,0 +1,112 @@ | |||
1 | meta-jailhouse | ||
2 | ============== | ||
3 | |||
4 | This README file contains information on the contents of the | ||
5 | jailhouse layer. | ||
6 | |||
7 | |||
8 | Dependencies | ||
9 | ============ | ||
10 | |||
11 | This layer depends on: | ||
12 | |||
13 | URI: git://git.openembedded.org/bitbake | ||
14 | branch: master | ||
15 | |||
16 | URI: git://git.openembedded.org/openembedded-core | ||
17 | layers: meta | ||
18 | branch: master | ||
19 | |||
20 | |||
21 | Maintainers | ||
22 | =========== | ||
23 | |||
24 | * Ola Redell <ola@retotech.se> | ||
25 | * Anders Törnqvist <anders@retotech.se> | ||
26 | * Jonas Weståker <jonas@retotech.se> | ||
27 | |||
28 | Please submit any patches against this jailhouse layer to | ||
29 | meta-jailhouse@retotech.se | ||
30 | |||
31 | |||
32 | Tested with | ||
33 | =========== | ||
34 | |||
35 | This layer has been developed for and tested with Bananapi M1 as target. | ||
36 | No other targets have been used thus far. | ||
37 | |||
38 | |||
39 | Adding the jailhouse layer to your build | ||
40 | ======================================== | ||
41 | |||
42 | In order to use this layer, you need to make the build system aware of | ||
43 | it. | ||
44 | |||
45 | Assuming the jailhouse layer exists at the top-level of your | ||
46 | yocto build tree, you can add it to the build system by adding the | ||
47 | location of the jailhouse layer to bblayers.conf, along with any | ||
48 | other layers needed. e.g.: | ||
49 | |||
50 | BBLAYERS ?= " \ | ||
51 | /path/to/yocto/meta \ | ||
52 | /path/to/yocto/meta-poky \ | ||
53 | /path/to/yocto/meta-yocto-bsp \ | ||
54 | /path/to/yocto/meta-jailhouse \ | ||
55 | " | ||
56 | |||
57 | |||
58 | Build Jailhouse using this layer | ||
59 | ================================ | ||
60 | |||
61 | Include the following packages in your image: **jailhouse** and | ||
62 | **kernel-module-jailhouse**. For example, add the following | ||
63 | to your image recipe, or local.conf: | ||
64 | |||
65 | IMAGE_INSTALL_append = " jailhouse kernel-module-jailhouse" | ||
66 | |||
67 | The jailhouse inmates and cells are by default | ||
68 | placed under `/usr/share/jailhouse/{inmates,cells}`. These locations | ||
69 | can be adjusted using the variables in jailhouse-dirs.inc. | ||
70 | |||
71 | The jailhouse build system builds cell configuration (*.cell) files from the | ||
72 | cell descriptions (*.c). To enable cell descriptions being defined in | ||
73 | cell recipes and imported into the jailhouse build, the jailhouse recipe | ||
74 | defines a CELLS variable that lists all recipes that provide cells (and inmates) | ||
75 | for the jailhouse build. Adapt the CELLS variable according to your needs, e.g. | ||
76 | |||
77 | CELLS_append = " freertos-cell" | ||
78 | |||
79 | With this declaration, freertos-cell entries will be added both to the | ||
80 | DEPENDS and the RDEPENDS_jailhouse variables, and the jailhouse recipe will | ||
81 | pull cell descriptions from the staging directory before building. | ||
82 | |||
83 | |||
84 | Packages produced by a jailhouse.inc based recipe | ||
85 | ------------------------------------------------- | ||
86 | |||
87 | The Jailhouse recipes based on the file jailhouse.inc produce | ||
88 | the follwing packages: | ||
89 | |||
90 | * **jailhouse**, with the `jailhouse.bin` firmware, the `jailhouse` user | ||
91 | space application, along with all inmate binaries that come with the jailhouse | ||
92 | repo, and all cells for which jailhouse is given configuration att build time. | ||
93 | * **jailhouse-bash-completion**, with file(s) needed for bash completion. | ||
94 | * **jailhouse-dbg**, jailhouse cli sources | ||
95 | * **kernel-module-jailhouse**, with the jailhouse kernel module, jailhouse.ko | ||
96 | |||
97 | |||
98 | Build cells and inmates | ||
99 | ======================= | ||
100 | |||
101 | To build jailhouse cell definitions and inmates, inherit the class | ||
102 | `jailhouse-cell.bbclass` into your cell recipe and define your inmate binary, | ||
103 | and your cell configuration file using the variables `INMATE` and `CELLCONFIG` | ||
104 | as follows: | ||
105 | |||
106 | inherit jailhouse-cell | ||
107 | INMATE = "${S}/freertos-demo.bin" | ||
108 | CELLCONFIG = "${S}/jailhouse-configs/bananapi-freertos-demo.c" | ||
109 | |||
110 | Using this class and variables ensures that the file designated by the | ||
111 | `CELLCONFIG` variable is pulled into the jailhouse build such that | ||
112 | a corresponding *.cell file is created. | ||
diff --git a/classes/jailhouse-cell.bbclass b/classes/jailhouse-cell.bbclass new file mode 100644 index 0000000..ab7b9ce --- /dev/null +++ b/classes/jailhouse-cell.bbclass | |||
@@ -0,0 +1,24 @@ | |||
1 | require recipes-jailhouse/jailhouse/jailhouse-defs.inc | ||
2 | |||
3 | INMATE ?= "" | ||
4 | CELLCONFIG ?= "" | ||
5 | |||
6 | INMATE_TARGET ?= "${INMATE}" | ||
7 | CELLCONFIG_TARGET ?= "${CELLCONFIG}" | ||
8 | |||
9 | do_install() { | ||
10 | if [ -n "${CELLCONFIG}" ] | ||
11 | then | ||
12 | install -d ${D}${CELLCONF_DIR} | ||
13 | install ${CELLCONFIG} ${D}${CELLCONF_DIR}/$(basename ${CELLCONFIG_TARGET}) | ||
14 | fi | ||
15 | |||
16 | if [ -n "${INMATE}" ] | ||
17 | then | ||
18 | install -d ${D}${INMATES_DIR} | ||
19 | install ${INMATE} ${D}${INMATES_DIR}/$(basename ${INMATE_TARGET}) | ||
20 | fi | ||
21 | } | ||
22 | |||
23 | FILES_${PN}-dev += "${CELLCONF_DIR}" | ||
24 | FILES_${PN} += "${INMATES_DIR}" | ||
diff --git a/conf/layer.conf b/conf/layer.conf new file mode 100644 index 0000000..c81174e --- /dev/null +++ b/conf/layer.conf | |||
@@ -0,0 +1,10 @@ | |||
1 | # We have a conf and classes directory, add to BBPATH | ||
2 | BBPATH .= ":${LAYERDIR}" | ||
3 | |||
4 | # We have recipes-* directories, add to BBFILES | ||
5 | BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ | ||
6 | ${LAYERDIR}/recipes-*/*/*.bbappend" | ||
7 | |||
8 | BBFILE_COLLECTIONS += "jailhouse" | ||
9 | BBFILE_PATTERN_jailhouse = "^${LAYERDIR}/" | ||
10 | BBFILE_PRIORITY_jailhouse = "6" | ||
diff --git a/recipes-jailhouse/jailhouse/files/0001-ldflags-for-tools.patch b/recipes-jailhouse/jailhouse/files/0001-ldflags-for-tools.patch new file mode 100644 index 0000000..47b79ed --- /dev/null +++ b/recipes-jailhouse/jailhouse/files/0001-ldflags-for-tools.patch | |||
@@ -0,0 +1,13 @@ | |||
1 | diff --git a/tools/Makefile b/tools/Makefile | ||
2 | index 4d91e7a..ecc5503 100644 | ||
3 | --- a/tools/Makefile | ||
4 | +++ b/tools/Makefile | ||
5 | @@ -19,7 +19,7 @@ LINUXINCLUDE := -I$(src)/../driver | ||
6 | KBUILD_CFLAGS := -g -O3 -DLIBEXECDIR=\"$(libexecdir)\" \ | ||
7 | -Wall -Wextra -Wmissing-declarations -Wmissing-prototypes -Werror \ | ||
8 | -DJAILHOUSE_VERSION=\"$(shell cat $(src)/../VERSION)\" $(EXTRA_CFLAGS) | ||
9 | -LDFLAGS := | ||
10 | +LDFLAGS := $(EXTRA_LDLAGS) | ||
11 | |||
12 | BINARIES := jailhouse | ||
13 | HELPERS := \ | ||
diff --git a/recipes-jailhouse/jailhouse/files/0002-no-ldflags-in-tools.patch b/recipes-jailhouse/jailhouse/files/0002-no-ldflags-in-tools.patch new file mode 100644 index 0000000..e94f69d --- /dev/null +++ b/recipes-jailhouse/jailhouse/files/0002-no-ldflags-in-tools.patch | |||
@@ -0,0 +1,13 @@ | |||
1 | diff --git a/tools/Makefile b/tools/Makefile | ||
2 | index 4d91e7a..ecc5503 100644 | ||
3 | --- a/tools/Makefile | ||
4 | +++ b/tools/Makefile | ||
5 | @@ -19,7 +19,7 @@ LINUXINCLUDE := -I$(src)/../driver | ||
6 | KBUILD_CFLAGS := -g -O3 -DLIBEXECDIR=\"$(libexecdir)\" \ | ||
7 | -Wall -Wextra -Wmissing-declarations -Wmissing-prototypes -Werror \ | ||
8 | -DJAILHOUSE_VERSION=\"$(shell cat $(src)/../VERSION)\" $(EXTRA_CFLAGS) | ||
9 | -LDFLAGS := | ||
10 | +#LDFLAGS := $(EXTRA_LDLAGS) | ||
11 | |||
12 | BINARIES := jailhouse | ||
13 | HELPERS := \ | ||
diff --git a/recipes-jailhouse/jailhouse/files/0003-workaround-if-changed-problem-in-tools-makefile.patch b/recipes-jailhouse/jailhouse/files/0003-workaround-if-changed-problem-in-tools-makefile.patch new file mode 100644 index 0000000..7d02b55 --- /dev/null +++ b/recipes-jailhouse/jailhouse/files/0003-workaround-if-changed-problem-in-tools-makefile.patch | |||
@@ -0,0 +1,18 @@ | |||
1 | Index: git/tools/Makefile | ||
2 | =================================================================== | ||
3 | --- git.orig/tools/Makefile | ||
4 | +++ git/tools/Makefile | ||
5 | @@ -55,10 +55,11 @@ endef | ||
6 | targets += jailhouse.o | ||
7 | |||
8 | $(obj)/jailhouse: $(obj)/jailhouse.o | ||
9 | - $(call if_changed,ld) | ||
10 | + $(LD) $(LDFLAGS) -o $@ $^ | ||
11 | |||
12 | $(obj)/jailhouse-config-collect: $(src)/jailhouse-config-create $(src)/jailhouse-config-collect.tmpl | ||
13 | - $(call if_changed,gen_collect) | ||
14 | + $< -g $@; \ | ||
15 | + chmod +x $@ | ||
16 | |||
17 | install-bin: $(BINARIES) $(DESTDIR)$(sbindir) | ||
18 | $(INSTALL_PROGRAM) $^ | ||
diff --git a/recipes-jailhouse/jailhouse/files/0004-no-kbuild-of-tools.patch b/recipes-jailhouse/jailhouse/files/0004-no-kbuild-of-tools.patch new file mode 100644 index 0000000..4e0f337 --- /dev/null +++ b/recipes-jailhouse/jailhouse/files/0004-no-kbuild-of-tools.patch | |||
@@ -0,0 +1,13 @@ | |||
1 | Index: git/Kbuild | ||
2 | =================================================================== | ||
3 | --- git.orig/Kbuild | ||
4 | +++ git/Kbuild | ||
5 | @@ -11,7 +11,7 @@ | ||
6 | # the COPYING file in the top-level directory. | ||
7 | # | ||
8 | |||
9 | -subdir-y := driver hypervisor configs inmates tools | ||
10 | +subdir-y := driver hypervisor configs inmates | ||
11 | |||
12 | subdir-ccflags-y := -Werror | ||
13 | |||
diff --git a/recipes-jailhouse/jailhouse/files/jailhouse-config-bpi.h b/recipes-jailhouse/jailhouse/files/jailhouse-config-bpi.h new file mode 100644 index 0000000..91f651c --- /dev/null +++ b/recipes-jailhouse/jailhouse/files/jailhouse-config-bpi.h | |||
@@ -0,0 +1,9 @@ | |||
1 | #define CONFIG_ARM_GIC_V2 1 | ||
2 | #define CONFIG_MACH_SUN7I 1 | ||
3 | |||
4 | /* Enable error tracing, | ||
5 | * c.f. https://github.com/siemens/jailhouse/blob/master/FAQ.md | ||
6 | * (Redefine macro: | ||
7 | * jailhouse/hypervisor/include/jailhouse/printk.h:trace_error(code)). | ||
8 | */ | ||
9 | #define CONFIG_TRACE_ERROR | ||
diff --git a/recipes-jailhouse/jailhouse/files/plamics-bpi-root.c b/recipes-jailhouse/jailhouse/files/plamics-bpi-root.c new file mode 100644 index 0000000..3d7b79f --- /dev/null +++ b/recipes-jailhouse/jailhouse/files/plamics-bpi-root.c | |||
@@ -0,0 +1,221 @@ | |||
1 | /* | ||
2 | * Jailhouse, a Linux-based partitioning hypervisor | ||
3 | * | ||
4 | * Test configuration for Banana Pi board (A20 dual-core Cortex-A7, 1G RAM) | ||
5 | * | ||
6 | * Copyright (c) Siemens AG, 2014 | ||
7 | * | ||
8 | * Authors: | ||
9 | * Jan Kiszka <jan.kiszka@siemens.com> | ||
10 | * | ||
11 | * This work is licensed under the terms of the GNU GPL, version 2. See | ||
12 | * the COPYING file in the top-level directory. | ||
13 | */ | ||
14 | |||
15 | #include <jailhouse/types.h> | ||
16 | #include <jailhouse/cell-config.h> | ||
17 | |||
18 | #define ARRAY_SIZE(a) sizeof(a) / sizeof(a[0]) | ||
19 | |||
20 | struct { | ||
21 | struct jailhouse_system header; | ||
22 | __u64 cpus[1]; | ||
23 | struct jailhouse_memory mem_regions[18]; | ||
24 | struct jailhouse_irqchip irqchips[1]; | ||
25 | struct jailhouse_pci_device pci_devices[1]; | ||
26 | } __attribute__((packed)) config = { | ||
27 | .header = { | ||
28 | .signature = JAILHOUSE_SYSTEM_SIGNATURE, | ||
29 | .revision = JAILHOUSE_CONFIG_REVISION, | ||
30 | .hypervisor_memory = { | ||
31 | .phys_start = 0x7c000000, | ||
32 | .size = 0x4000000, | ||
33 | }, | ||
34 | .debug_console = { | ||
35 | .address = 0x01c28000, | ||
36 | .size = 0x1000, | ||
37 | /* .clock_reg = 0x01c2006c, */ | ||
38 | /* .gate_nr = 16 */ | ||
39 | /* .divider = 0x0d, */ | ||
40 | .flags = JAILHOUSE_CON_TYPE_8250 | | ||
41 | JAILHOUSE_CON_FLAG_MMIO, | ||
42 | }, | ||
43 | .platform_info = { | ||
44 | .pci_mmconfig_base = 0x2000000, | ||
45 | .pci_mmconfig_end_bus = 0, | ||
46 | .pci_is_virtual = 1, | ||
47 | .arm = { | ||
48 | .gicd_base = 0x01c81000, | ||
49 | .gicc_base = 0x01c82000, | ||
50 | .gich_base = 0x01c84000, | ||
51 | .gicv_base = 0x01c86000, | ||
52 | .maintenance_irq = 25, | ||
53 | }, | ||
54 | }, | ||
55 | .root_cell = { | ||
56 | .name = "Banana-Pi", | ||
57 | |||
58 | .cpu_set_size = sizeof(config.cpus), | ||
59 | .num_memory_regions = ARRAY_SIZE(config.mem_regions), | ||
60 | .num_irqchips = ARRAY_SIZE(config.irqchips), | ||
61 | .num_pci_devices = ARRAY_SIZE(config.pci_devices), | ||
62 | |||
63 | .vpci_irq_base = 108, | ||
64 | }, | ||
65 | }, | ||
66 | |||
67 | .cpus = { | ||
68 | 0x3, | ||
69 | }, | ||
70 | |||
71 | .mem_regions = { | ||
72 | /* SPI */ { | ||
73 | .phys_start = 0x01c05000, | ||
74 | .virt_start = 0x01c05000, | ||
75 | .size = 0x00001000, | ||
76 | .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | | ||
77 | JAILHOUSE_MEM_IO, | ||
78 | }, | ||
79 | /* MMC */ { | ||
80 | .phys_start = 0x01c0f000, | ||
81 | .virt_start = 0x01c0f000, | ||
82 | .size = 0x00001000, | ||
83 | .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | | ||
84 | JAILHOUSE_MEM_IO, | ||
85 | }, | ||
86 | /* USB + PMU1 */ { | ||
87 | .phys_start = 0x01c14000, | ||
88 | .virt_start = 0x01c14000, | ||
89 | .size = 0x00001000, | ||
90 | .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | | ||
91 | JAILHOUSE_MEM_IO, | ||
92 | }, | ||
93 | /* SATA */ { | ||
94 | .phys_start = 0x01c18000, | ||
95 | .virt_start = 0x01c18000, | ||
96 | .size = 0x00001000, | ||
97 | .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | | ||
98 | JAILHOUSE_MEM_IO, | ||
99 | }, | ||
100 | /* USB + PMU2 */ { | ||
101 | .phys_start = 0x01c1c000, | ||
102 | .virt_start = 0x01c1c000, | ||
103 | .size = 0x00001000, | ||
104 | .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | | ||
105 | JAILHOUSE_MEM_IO, | ||
106 | }, | ||
107 | /* CCU */ { | ||
108 | .phys_start = 0x01c20000, | ||
109 | .virt_start = 0x01c20000, | ||
110 | .size = 0x400, | ||
111 | .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | | ||
112 | JAILHOUSE_MEM_IO | JAILHOUSE_MEM_IO_32, | ||
113 | }, | ||
114 | /* Ints */ { | ||
115 | .phys_start = 0x01c20400, | ||
116 | .virt_start = 0x01c20400, | ||
117 | .size = 0x400, | ||
118 | .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | | ||
119 | JAILHOUSE_MEM_IO | JAILHOUSE_MEM_IO_32, | ||
120 | }, | ||
121 | /* GPIO: ports A-G */ { | ||
122 | .phys_start = 0x01c20800, | ||
123 | .virt_start = 0x01c20800, | ||
124 | .size = 0xfc, | ||
125 | .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | | ||
126 | JAILHOUSE_MEM_IO | JAILHOUSE_MEM_IO_32, | ||
127 | }, | ||
128 | /* GPIO: port H */ { | ||
129 | .phys_start = 0x01c208fc, | ||
130 | .virt_start = 0x01c208fc, | ||
131 | .size = 0x24, | ||
132 | .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | | ||
133 | JAILHOUSE_MEM_IO | JAILHOUSE_MEM_IO_32, | ||
134 | }, | ||
135 | /* GPIO: port I */ { | ||
136 | .phys_start = 0x01c20920, | ||
137 | .virt_start = 0x01c20920, | ||
138 | .size = 0x24, | ||
139 | .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | | ||
140 | JAILHOUSE_MEM_IO | JAILHOUSE_MEM_IO_32, | ||
141 | }, | ||
142 | /* GPIO: intr config */ { | ||
143 | .phys_start = 0x01c20a00, | ||
144 | .virt_start = 0x01c20a00, | ||
145 | .size = 0x1c, | ||
146 | .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | | ||
147 | JAILHOUSE_MEM_IO | JAILHOUSE_MEM_IO_32, | ||
148 | }, | ||
149 | /* Timer */ { | ||
150 | .phys_start = 0x01c20c00, | ||
151 | .virt_start = 0x01c20c00, | ||
152 | .size = 0x400, | ||
153 | .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | | ||
154 | JAILHOUSE_MEM_IO | JAILHOUSE_MEM_IO_32, | ||
155 | }, | ||
156 | /* UART0-3 */ { | ||
157 | .phys_start = 0x01c28000, | ||
158 | .virt_start = 0x01c28000, | ||
159 | .size = 0x1000, | ||
160 | .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | | ||
161 | JAILHOUSE_MEM_IO, | ||
162 | }, | ||
163 | /* GMAC */ { | ||
164 | .phys_start = 0x01c50000, | ||
165 | .virt_start = 0x01c50000, | ||
166 | .size = 0x00010000, | ||
167 | .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | | ||
168 | JAILHOUSE_MEM_IO, | ||
169 | }, | ||
170 | /* HSTIMER */ { | ||
171 | .phys_start = 0x01c60000, | ||
172 | .virt_start = 0x01c60000, | ||
173 | .size = 0x00001000, | ||
174 | .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | | ||
175 | JAILHOUSE_MEM_IO, | ||
176 | }, | ||
177 | /* RAM */ { | ||
178 | .phys_start = 0x40000000, | ||
179 | .virt_start = 0x40000000, | ||
180 | .size = 0x3bf00000, | ||
181 | .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | | ||
182 | JAILHOUSE_MEM_EXECUTE, | ||
183 | }, | ||
184 | /* IVSHMEM shared memory region */ { | ||
185 | .phys_start = 0x7bf00000, | ||
186 | .virt_start = 0x7bf00000, | ||
187 | .size = 0x100000, | ||
188 | .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE, | ||
189 | }, | ||
190 | /* Framebuffer */ { | ||
191 | .phys_start = 0x7f700000, | ||
192 | .virt_start = 0x7f700000, | ||
193 | .size = 9<<20, | ||
194 | .flags = JAILHOUSE_MEM_READ | JAILHOUSE_MEM_WRITE | | ||
195 | JAILHOUSE_MEM_IO, | ||
196 | }, | ||
197 | }, | ||
198 | |||
199 | .irqchips = { | ||
200 | /* GIC */ { | ||
201 | .address = 0x01c81000, | ||
202 | .pin_base = 32, | ||
203 | .pin_bitmap = { | ||
204 | 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff | ||
205 | }, | ||
206 | }, | ||
207 | }, | ||
208 | |||
209 | .pci_devices = { | ||
210 | { | ||
211 | .type = JAILHOUSE_PCI_TYPE_IVSHMEM, | ||
212 | .bdf = 0x00, | ||
213 | .bar_mask = { | ||
214 | 0xffffff00, 0xffffffff, 0x00000000, | ||
215 | 0x00000000, 0x00000000, 0x00000000, | ||
216 | }, | ||
217 | .shmem_region = 16, | ||
218 | .shmem_protocol = JAILHOUSE_SHMEM_PROTO_UNDEFINED, | ||
219 | }, | ||
220 | }, | ||
221 | }; | ||
diff --git a/recipes-jailhouse/jailhouse/jailhouse-defs.inc b/recipes-jailhouse/jailhouse/jailhouse-defs.inc new file mode 100644 index 0000000..8dd30e3 --- /dev/null +++ b/recipes-jailhouse/jailhouse/jailhouse-defs.inc | |||
@@ -0,0 +1,25 @@ | |||
1 | JH_DATADIR ?= "${datadir}/jailhouse" | ||
2 | CELL_DIR ?= "${JH_DATADIR}/cells" | ||
3 | CELLCONF_DIR ?= "${JH_DATADIR}/configs" | ||
4 | INMATES_DIR ?= "${JH_DATADIR}/inmates" | ||
5 | |||
6 | # Set jailhouse architecture JH_ARCH variable | ||
7 | # | ||
8 | # return value must match one of architectures supported by jailhouse | ||
9 | # | ||
10 | valid_jh_archs = "x86 arm" | ||
11 | |||
12 | def map_jh_arch(a, d): | ||
13 | import re | ||
14 | |||
15 | valid_jh_archs = d.getVar('valid_jh_archs', True).split() | ||
16 | |||
17 | if re.match('(i.86|athlon|x86.64)$', a): return 'x86' | ||
18 | elif re.match('armeb$', a): return 'arm' | ||
19 | elif re.match('aarch64$', a): return 'arm64' | ||
20 | elif re.match('aarch64_be$', a): return 'arm64' | ||
21 | elif a in valid_jh_archs: return a | ||
22 | else: | ||
23 | bb.error("cannot map '%s' to a jailhouse supported architecture" % a) | ||
24 | |||
25 | export JH_ARCH = "${@map_jh_arch(d.getVar('TARGET_ARCH', True), d)}" | ||
diff --git a/recipes-jailhouse/jailhouse/jailhouse.inc b/recipes-jailhouse/jailhouse/jailhouse.inc new file mode 100644 index 0000000..fb6b021 --- /dev/null +++ b/recipes-jailhouse/jailhouse/jailhouse.inc | |||
@@ -0,0 +1,71 @@ | |||
1 | SUMMARY = "Jailhouse" | ||
2 | HOMEPAGE = "https://github.com/siemens/jailhouse" | ||
3 | SECTION = "jailhouse" | ||
4 | LICENSE = "GPL-2.0 & BSD-2-Clause" | ||
5 | LIC_FILES_CHKSUM = "file://COPYING;md5=9fa7f895f96bde2d47fd5b7d95b6ba4d \ | ||
6 | file://tools/root-cell-config.c.tmpl;beginline=6;endline=33;md5=2825581c1666c44a17955dc574cfbfb3 \ | ||
7 | file://hypervisor/include/jailhouse/hypercall.h;beginline=9;endline=36;md5=2825581c1666c44a17955dc574cfbfb3 \ | ||
8 | file://hypervisor/include/jailhouse/cell-config.h;beginline=9;endline=36;md5=2825581c1666c44a17955dc574cfbfb3 \ | ||
9 | file://hypervisor/arch/arm/include/asm/jailhouse_hypercall.h;beginline=9;endline=36;md5=2825581c1666c44a17955dc574cfbfb3 \ | ||
10 | file://hypervisor/arch/x86/include/asm/jailhouse_hypercall.h;beginline=9;endline=36;md5=2825581c1666c44a17955dc574cfbfb3 \ | ||
11 | file://driver/jailhouse.h;beginline=9;endline=36;md5=2825581c1666c44a17955dc574cfbfb3" | ||
12 | |||
13 | DEPENDS = "virtual/kernel make-native python-mako-native dtc-native python-mako" | ||
14 | |||
15 | S ="${WORKDIR}/git" | ||
16 | |||
17 | require jailhouse-defs.inc | ||
18 | inherit module pythonnative bash-completion | ||
19 | |||
20 | do_configure() { | ||
21 | if [ -d ${STAGING_DIR_HOST}/${CELLCONF_DIR} ]; | ||
22 | then | ||
23 | cp "${STAGING_DIR_HOST}/${CELLCONF_DIR}/"*.c ${S}/configs/ | ||
24 | fi | ||
25 | } | ||
26 | |||
27 | USER_SPACE_CFLAGS = '${CFLAGS} -DLIBEXECDIR=\\\"${libexecdir}\\\" \ | ||
28 | -DJAILHOUSE_VERSION=\\\"$JAILHOUSE_VERSION\\\" \ | ||
29 | -Wall -Wextra -Wmissing-declarations -Wmissing-prototypes -Werror \ | ||
30 | -I../driver' | ||
31 | |||
32 | TOOLS_SRC_DIR = "${S}/tools" | ||
33 | TOOLS_OBJ_DIR = "${S}/tools" | ||
34 | |||
35 | do_compile() { | ||
36 | oe_runmake V=1 \ | ||
37 | ARCH=${TARGET_ARCH} CROSS_COMPILE=${TARGET_PREFIX} \ | ||
38 | KDIR=${STAGING_KERNEL_BUILDDIR} | ||
39 | |||
40 | cd ${TOOLS_SRC_DIR} | ||
41 | export JAILHOUSE_VERSION=$(cat ../VERSION) | ||
42 | oe_runmake V=1 \ | ||
43 | CFLAGS="${USER_SPACE_CFLAGS}" \ | ||
44 | src=${TOOLS_SRC_DIR} obj=${TOOLS_OBJ_DIR} \ | ||
45 | ${TOOLS_OBJ_DIR}/jailhouse-config-collect ${TOOLS_OBJ_DIR}/jailhouse | ||
46 | } | ||
47 | |||
48 | do_install() { | ||
49 | oe_runmake \ | ||
50 | ARCH=${TARGET_ARCH} \ | ||
51 | CROSS_COMPILE=${TARGET_PREFIX} \ | ||
52 | KDIR=${STAGING_KERNEL_BUILDDIR} \ | ||
53 | DESTDIR=${D} install | ||
54 | |||
55 | install -d ${D}${CELL_DIR} | ||
56 | install ${B}/configs/*.cell ${D}${CELL_DIR}/ | ||
57 | |||
58 | install -d ${D}${INMATES_DIR} | ||
59 | install ${B}/inmates/demos/${JH_ARCH}/*.bin ${D}${INMATES_DIR} | ||
60 | } | ||
61 | |||
62 | PACKAGE_BEFORE_PN = "kernel-module-jailhouse" | ||
63 | FILES_${PN} = "${base_libdir}/firmware ${libexecdir} ${sbindir} ${JH_DATADIR}" | ||
64 | |||
65 | python __anonymous () { | ||
66 | # Setup DEPENDS and RDEPENDS to included cells" | ||
67 | cells = d.getVar('CELLS', True) or "" | ||
68 | for cell in cells.split(): | ||
69 | d.appendVar('DEPENDS', ' ' + cell) | ||
70 | d.appendVar('RDEPENDS_${PN}', ' ' + cell) | ||
71 | } | ||
diff --git a/recipes-jailhouse/jailhouse/jailhouse_0.6.bb b/recipes-jailhouse/jailhouse/jailhouse_0.6.bb new file mode 100644 index 0000000..d0fc7f9 --- /dev/null +++ b/recipes-jailhouse/jailhouse/jailhouse_0.6.bb | |||
@@ -0,0 +1,11 @@ | |||
1 | require jailhouse.inc | ||
2 | |||
3 | SRC_URI = "git://github.com/siemens/jailhouse.git;protocol=git \ | ||
4 | file://0002-no-ldflags-in-tools.patch \ | ||
5 | file://0003-workaround-if-changed-problem-in-tools-makefile.patch \ | ||
6 | file://0004-no-kbuild-of-tools.patch \ | ||
7 | " | ||
8 | |||
9 | SRCREV = "81528e48763c8dfc10851c49968eb3d053d4b85c" | ||
10 | |||
11 | CELLS = "freertos-cell freertos-demo1-cell freertos-demo3-cell freertos-ivshmem-demo" | ||