summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOla Redell <ola.redell@retotech.se>2017-12-15 15:39:29 +0100
committerOla Redell <ola.redell@retotech.se>2017-12-15 15:39:29 +0100
commite0a1fea1252e26f95f5a6302f0079d4e7649ffc2 (patch)
treeb9f45fb0e96a17d6e3257bba0e7c4f510ba335a0
parentdee3ee44ae32ffe92d1628b2ad52402bf491a692 (diff)
downloadmeta-jailhouse-e0a1fea1252e26f95f5a6302f0079d4e7649ffc2.tar.gz
Added example cell recipe with freertos-cell
-rw-r--r--README.md23
-rw-r--r--recipes-jailhouse/freertos-cell/freertos-cell/Bananapi-config-fix-for-Jailhouse-0.6.patch30
-rw-r--r--recipes-jailhouse/freertos-cell/freertos-cell/Fix-Makefile.patch22
-rw-r--r--recipes-jailhouse/freertos-cell/freertos-cell/Remove-check-of-interrupt-mask.patch60
-rw-r--r--recipes-jailhouse/freertos-cell/freertos-cell_1.0.bb28
5 files changed, 160 insertions, 3 deletions
diff --git a/README.md b/README.md
index e5d21a1..29a9edc 100644
--- a/README.md
+++ b/README.md
@@ -69,8 +69,8 @@ The jailhouse inmates and cells are by default
69placed under `/usr/share/jailhouse/{inmates,cells}`. These locations 69placed under `/usr/share/jailhouse/{inmates,cells}`. These locations
70can be adjusted using the variables in **jailhouse-defs.inc**. 70can be adjusted using the variables in **jailhouse-defs.inc**.
71 71
72The jailhouse build system builds binary cell configuration (*.cell) files 72The jailhouse build system builds binary cell configuration (.cell) files
73from cell configuration sources (*.c). To allow cell configurations to be 73from cell configuration sources (.c). To allow cell configurations to be
74defined in cell recipes and imported into the jailhouse build, the jailhouse 74defined in cell recipes and imported into the jailhouse build, the jailhouse
75recipe defines a CELLS variable that lists all recipes that provide cells (and 75recipe defines a CELLS variable that lists all recipes that provide cells (and
76inmates) for the jailhouse build. Adapt the CELLS variable according to your 76inmates) for the jailhouse build. Adapt the CELLS variable according to your
@@ -78,6 +78,7 @@ needs, e.g.
78 78
79 CELLS_append = " freertos-cell" 79 CELLS_append = " freertos-cell"
80 80
81in `local.conf`.
81With this declaration, freertos-cell entries will be added both to the 82With this declaration, freertos-cell entries will be added both to the
82DEPENDS and the RDEPENDS_jailhouse variables, and the jailhouse recipe will 83DEPENDS and the RDEPENDS_jailhouse variables, and the jailhouse recipe will
83pull cell descriptions from the staging directory before building. 84pull cell descriptions from the staging directory before building.
@@ -87,7 +88,7 @@ Packages produced by a jailhouse.inc based recipe
87------------------------------------------------- 88-------------------------------------------------
88 89
89The Jailhouse recipes based on the file jailhouse.inc produce 90The Jailhouse recipes based on the file jailhouse.inc produce
90the follwing packages: 91the following packages:
91 92
92* **jailhouse**, with the `jailhouse.bin` firmware, the `jailhouse` user 93* **jailhouse**, with the `jailhouse.bin` firmware, the `jailhouse` user
93space application, along with all inmate binaries that come with the jailhouse 94space application, along with all inmate binaries that come with the jailhouse
@@ -113,6 +114,22 @@ Using this class and variables ensures that the file designated by the
113`CELLCONFIG` variable is pulled into the jailhouse build such that 114`CELLCONFIG` variable is pulled into the jailhouse build such that
114a corresponding *.cell file is created. 115a corresponding *.cell file is created.
115 116
117Example cell
118------------
119
120An example cell recipe for the freertos-cell from Siemens is available
121under `recipes-jailhouse/freertos-cell`. To use this, set the
122`CELLS` variable accordingly as described above.
123
124Test the cell by executing the following sequence once booted.
125
126 export JAILHOUSE_DIR=/usr/share/jailhouse
127 jailhouse enable ${JAILHOUSE_DIR}/cells/plamics-bpi-root.cell
128 jailhouse cell create ${JAILHOUSE_DIR}/cells/freertos-cell.cell
129 jailhouse cell load FreeRTOS ${JAILHOUSE_DIR}/inmates/freertos-demo.bin
130 jailhouse cell start FreeRTOS
131
132You should see output on the serial port used by the FreeRTOS inmate.
116 133
117Important Variables 134Important Variables
118=================== 135===================
diff --git a/recipes-jailhouse/freertos-cell/freertos-cell/Bananapi-config-fix-for-Jailhouse-0.6.patch b/recipes-jailhouse/freertos-cell/freertos-cell/Bananapi-config-fix-for-Jailhouse-0.6.patch
new file mode 100644
index 0000000..2421d8a
--- /dev/null
+++ b/recipes-jailhouse/freertos-cell/freertos-cell/Bananapi-config-fix-for-Jailhouse-0.6.patch
@@ -0,0 +1,30 @@
1From 6b55388a1b2375f4deca7dbf1a974d9ce22add86 Mon Sep 17 00:00:00 2001
2From: Ola Redell <ola.redell@retotech.se>
3Date: Sat, 28 Jan 2017 23:16:06 +0100
4Subject: [PATCH 2/2] bananapi: fix for newer versions of Jailhouse
5
6---
7 jailhouse-configs/bananapi-freertos-demo.c | 3 ++-
8 1 file changed, 2 insertions(+), 1 deletion(-)
9
10diff --git a/jailhouse-configs/bananapi-freertos-demo.c b/jailhouse-configs/bananapi-freertos-demo.c
11index f9488c5..094c387 100644
12--- a/jailhouse-configs/bananapi-freertos-demo.c
13+++ b/jailhouse-configs/bananapi-freertos-demo.c
14@@ -1,4 +1,4 @@
15-#include <linux/types.h>
16+#include <jailhouse/types.h>
17 #include <jailhouse/cell-config.h>
18
19 #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
20@@ -15,6 +15,7 @@ struct {
21 } __attribute__((packed)) config = {
22 .cell = {
23 .signature = JAILHOUSE_CELL_DESC_SIGNATURE,
24+ .revision = JAILHOUSE_CONFIG_REVISION,
25 .name = "FreeRTOS",
26 .flags = JAILHOUSE_CELL_PASSIVE_COMMREG,
27
28--
291.9.1
30
diff --git a/recipes-jailhouse/freertos-cell/freertos-cell/Fix-Makefile.patch b/recipes-jailhouse/freertos-cell/freertos-cell/Fix-Makefile.patch
new file mode 100644
index 0000000..c680b03
--- /dev/null
+++ b/recipes-jailhouse/freertos-cell/freertos-cell/Fix-Makefile.patch
@@ -0,0 +1,22 @@
1diff --git a/Makefile b/Makefile
2index d49c25f..f9d295a 100644
3--- a/Makefile
4+++ b/Makefile
5@@ -4,12 +4,12 @@ src = $(CURDIR)
6
7 CROSS_COMPILE ?= arm-linux-gnueabihf-
8
9-CC = $(CROSS_COMPILE)gcc
10-LD = $(CROSS_COMPILE)ld
11-AR = $(CROSS_COMPILE)ar
12-OBJCOPY = $(CROSS_COMPILE)objcopy
13+#CC = $(CROSS_COMPILE)gcc
14+#LD = $(CROSS_COMPILE)ld
15+#AR = $(CROSS_COMPILE)ar
16+#OBJCOPY = $(CROSS_COMPILE)objcopy
17
18-CFLAGS += -mcpu=cortex-a7 -mtune=cortex-a7 -mfpu=vfpv4-d16 -mfloat-abi=hard -O2
19+CFLAGS += -mcpu=cortex-a7 -mtune=cortex-a7 -mfpu=vfpv4-d16 -mfloat-abi=hard -O0
20 CFLAGS += -DCONFIG_MACH_SUN7I=1
21 CFLAGS += -Wall -MMD -pipe
22 CFLAGS += -I $(src) -I $(src)/freertos/Source/include -I $(src)/freertos-runtime -I $(src)/freertos/Source/portable/GCC/ARM_A7jailhouse
diff --git a/recipes-jailhouse/freertos-cell/freertos-cell/Remove-check-of-interrupt-mask.patch b/recipes-jailhouse/freertos-cell/freertos-cell/Remove-check-of-interrupt-mask.patch
new file mode 100644
index 0000000..a343eff
--- /dev/null
+++ b/recipes-jailhouse/freertos-cell/freertos-cell/Remove-check-of-interrupt-mask.patch
@@ -0,0 +1,60 @@
1From 1b1d05fa9e086e7161f8ef2df43874a3712ff8e0 Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Anders=20T=C3=B6rnqvist?= <anders.tornqvist@retotech.se>
3Date: Fri, 27 Jan 2017 16:20:29 +0100
4Subject: [PATCH 1/2] Remove check of interrupt mask check that probably is not
5 needed in recent versions of Jailhouse. This check causes FreeRTOS to hang
6 for ever in the while loop. The commit in Jailhouse that is close to this is
7 902ee9cfd32652f6926da709b259d46a68bdebf4
8
9---
10 .../Source/portable/GCC/ARM_A7jailhouse/port.c | 34 ----------------------
11 1 file changed, 34 deletions(-)
12
13diff --git a/freertos/Source/portable/GCC/ARM_A7jailhouse/port.c b/freertos/Source/portable/GCC/ARM_A7jailhouse/port.c
14index dd739c3..6084939 100644
15--- a/freertos/Source/portable/GCC/ARM_A7jailhouse/port.c
16+++ b/freertos/Source/portable/GCC/ARM_A7jailhouse/port.c
17@@ -323,40 +323,6 @@ BaseType_t xPortStartScheduler( void )
18 {
19 uint32_t ulAPSR;
20
21- #if( configASSERT_DEFINED == 1 )
22- {
23- volatile uint32_t ulOriginalPriority;
24- volatile uint8_t * const pucFirstUserPriorityRegister = ( volatile uint8_t * const ) ( gic_v2_gicd_get_address() + portINTERRUPT_PRIORITY_REGISTER_OFFSET );
25- volatile uint8_t ucMaxPriorityValue;
26-
27- /* Determine how many priority bits are implemented in the GIC.
28-
29- Save the interrupt priority value that is about to be clobbered. */
30- ulOriginalPriority = *pucFirstUserPriorityRegister;
31-
32- /* Determine the number of priority bits available. First write to
33- all possible bits. */
34- *pucFirstUserPriorityRegister = portMAX_8_BIT_VALUE;
35-
36- /* Read the value back to see how many bits stuck. */
37- ucMaxPriorityValue = *pucFirstUserPriorityRegister;
38-
39- /* Shift to the least significant bits. */
40- while( ( ucMaxPriorityValue & portBIT_0_SET ) != portBIT_0_SET )
41- {
42- ucMaxPriorityValue >>= ( uint8_t ) 0x01;
43- }
44-
45- /* Sanity check configUNIQUE_INTERRUPT_PRIORITIES matches the read
46- value. */
47- configASSERT( ucMaxPriorityValue == portLOWEST_INTERRUPT_PRIORITY );
48-
49- /* Restore the clobbered interrupt priority register to its original
50- value. */
51- *pucFirstUserPriorityRegister = ulOriginalPriority;
52- }
53- #endif /* conifgASSERT_DEFINED */
54-
55 ulICCIAR = ulICCEOIR = ulICCPMR = (uint32_t) gic_v2_gicc_get_address();
56 ulICCIAR += portICCIAR_INTERRUPT_ACKNOWLEDGE_OFFSET;
57 ulICCEOIR += portICCEOIR_END_OF_INTERRUPT_OFFSET;
58--
591.9.1
60
diff --git a/recipes-jailhouse/freertos-cell/freertos-cell_1.0.bb b/recipes-jailhouse/freertos-cell/freertos-cell_1.0.bb
new file mode 100644
index 0000000..a61dd80
--- /dev/null
+++ b/recipes-jailhouse/freertos-cell/freertos-cell_1.0.bb
@@ -0,0 +1,28 @@
1SUMMARY = "FreeRTOS for Jailhouse"
2HOMEPAGE = "https://github.com/siemens/freertos-cell"
3
4LICENSE = "GPLv2"
5LIC_FILES_CHKSUM = "file://freertos/License/license.txt;md5=ff3ee34806c13760712131849e183a35\
6 file://LICENSE;md5=494a529748a63071fbdf44f61db2391c"
7
8DEPENDS = "virtual/kernel make-native"
9
10SRC_URI = "git://github.com/siemens/freertos-cell.git;protocol=https;branch=master; \
11 file://Fix-Makefile.patch \
12 file://Remove-check-of-interrupt-mask.patch \
13 file://Bananapi-config-fix-for-Jailhouse-0.6.patch"
14
15SRCREV = "6ad80637be066d196d81c1640bc1bd5b66e0ec45"
16
17S ="${WORKDIR}/git"
18
19inherit jailhouse-cell
20
21INMATE = "${S}/freertos-demo.bin"
22CELLCONFIG = "${S}/jailhouse-configs/bananapi-freertos-demo.c"
23CELLCONFIG_TARGET = "freertos-cell.c"
24
25
26do_compile() {
27 LDFLAGS="" oe_runmake
28}