Difference between revisions of "ERIKA3 on the Jailhouse hypervisor"

From ERIKA WIKI
Jump to: navigation, search
(Building ERIKA3 for Jailhouse)
(Libc support)
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
=== Introduction ===
+
== Introduction ==
  
 
[https://github.com/siemens/jailhouse Jailhouse] is a type-1 hypervisor developed by Siemens and released as Open-Source software.
 
[https://github.com/siemens/jailhouse Jailhouse] is a type-1 hypervisor developed by Siemens and released as Open-Source software.
  
 
The ERIKA3 RTOS currently supports Jailhouse on the following platforms:
 
The ERIKA3 RTOS currently supports Jailhouse on the following platforms:
* [[Nvidia Jetson TX1]]
+
* [[Nvidia Jetson TX1 and TX2]]
 +
* [[x86-64]]
 
* [[Xilinx ZCU102]]
 
* [[Xilinx ZCU102]]
  
  
=== Building ERIKA3 for Jailhouse ===
+
== Building ERIKA3 for Jailhouse ==
  
 
To build ERIKA3 for Jailhouse, you need to export the following environment variables:
 
To build ERIKA3 for Jailhouse, you need to export the following environment variables:
 
<ul>
 
<ul>
 
<li> <code>JAILHOUSE_DIR</code> equal to the path of the directory containing the Jailhouse built objects
 
<li> <code>JAILHOUSE_DIR</code> equal to the path of the directory containing the Jailhouse built objects
<li> <code>JAILHOUSE_VERSION</code> equal to the Jailhouse versione (e.g., <code>0.7</code>)
+
<li> <code>JAILHOUSE_VERSION</code> equal to the Jailhouse versione (e.g., <code>0.8</code>)
 
</ul>
 
</ul>
  
 
Additionally, in case of cross-compilation, you also need to put the cross-compiler in the <code>PATH</code> and set the <code>JAILHOUSE_AARCH64_GCCPREFIX</code> environment variable equal to the cross-compiler prefix (e.g., <code>aarch64-linux-gnu-</code>).<br>
 
Additionally, in case of cross-compilation, you also need to put the cross-compiler in the <code>PATH</code> and set the <code>JAILHOUSE_AARCH64_GCCPREFIX</code> environment variable equal to the cross-compiler prefix (e.g., <code>aarch64-linux-gnu-</code>).<br>
Note that RT-Druid allows to set these variables also from within Eclipse. Just press the right mouse button on the Eclipse project and select Proprerties as shown in the following figure.  
+
Note that RT-Druid allows to set these variables also from within Eclipse. Just press the right mouse button on the Eclipse project and select Properties as shown in the following figure.  
 +
[[File:Eclipse_project_properties.png|thumb|center|Figure 1: Eclipse project properties.]]
  
 
Then, select Generator properties, enable project specific settings (as shown in the next figure), and set the desired values.
 
Then, select Generator properties, enable project specific settings (as shown in the next figure), and set the desired values.
 +
[[File:Generator_properties.jpg|thumb|center|Figure 2: Generator properties.]]
  
 
The build process (started by the <code>make</code> command within the generated <code>out</code> directory) will link the ERIKA3 object file to the Jailhouse inmate library, and will create a <code>.bin</code> file.
 
The build process (started by the <code>make</code> command within the generated <code>out</code> directory) will link the ERIKA3 object file to the Jailhouse inmate library, and will create a <code>.bin</code> file.
Line 29: Line 32:
  
 
Please, refer to the platform-specific pages for detailed building instructions.
 
Please, refer to the platform-specific pages for detailed building instructions.
 +
 +
== Libc support ==
 +
 +
Most toolchains available in Ubuntu's repositories (e.g.
 +
<code>gcc-aarch64-linux-gnu</code>) are suitable for cross-compiling all the various
 +
components: the Linux kernel, Jailhouse's firmware, Jailhouse's kernel driver,
 +
the inmate library and the inmate containing ERIKA.
 +
However, they usually rely on libc libraries meant to be used on top of the Linux OS.
 +
This means that, if the application on ERIKA needs to use the services provided
 +
by the libc (e.g. <code>memcpy()</code>), then the inmate library and ERIKA need to be
 +
compiled using a bare-metal toolchain different than the one used for building
 +
the other components of the Jailhouse hypervisor.
 +
 +
Unfortunately, Jailhouse does not (yet) allow to select different toolchains
 +
for compiling the inmate library and the rest of the hypervisor.
 +
 +
To compile only the Jailhouse's inmate library using a different toolchain
 +
than the one used for building the rest of the hypervisor, edit Jailhouse's
 +
<code>inmates/Makefile</code> file and set the <code>CC</code> and <code>LD</code>
 +
environment variables to the right compiler.
 +
 +
Additionally, to link the ERIKA application agains the libc library, you will need to set the following variables in the OIL file:
 +
<ul>
 +
<li><code>LIBS = "-lc";</code>
 +
<li><code>LDFLAGS = "-L /path/containing/libc/";</code>
 +
<li><code>CFLAGS = "-mstrict-align";</code> for accessing fields in data structures.
 +
</ul>
 +
  
 
[[Category:Hypervisors]]
 
[[Category:Hypervisors]]

Latest revision as of 11:56, 21 May 2018

Introduction

Jailhouse is a type-1 hypervisor developed by Siemens and released as Open-Source software.

The ERIKA3 RTOS currently supports Jailhouse on the following platforms:


Building ERIKA3 for Jailhouse

To build ERIKA3 for Jailhouse, you need to export the following environment variables:

  • JAILHOUSE_DIR equal to the path of the directory containing the Jailhouse built objects
  • JAILHOUSE_VERSION equal to the Jailhouse versione (e.g., 0.8)

Additionally, in case of cross-compilation, you also need to put the cross-compiler in the PATH and set the JAILHOUSE_AARCH64_GCCPREFIX environment variable equal to the cross-compiler prefix (e.g., aarch64-linux-gnu-).
Note that RT-Druid allows to set these variables also from within Eclipse. Just press the right mouse button on the Eclipse project and select Properties as shown in the following figure.

Figure 1: Eclipse project properties.

Then, select Generator properties, enable project specific settings (as shown in the next figure), and set the desired values.

Figure 2: Generator properties.

The build process (started by the make command within the generated out directory) will link the ERIKA3 object file to the Jailhouse inmate library, and will create a .bin file.

Once Jailhouse has been started, you can:

  1. Create the jailhouse cell for ERIKA3:
    sudo jailhouse cell create <cell_file>
  2. Load the ERIKA binary file in the cell:
    sudo jailhouse cell load <cell_name> <binary_file>
  3. Start ERIKA:
    sudo jailhouse cell start <cell_name>

Please, refer to the platform-specific pages for detailed building instructions.

Libc support

Most toolchains available in Ubuntu's repositories (e.g. gcc-aarch64-linux-gnu) are suitable for cross-compiling all the various components: the Linux kernel, Jailhouse's firmware, Jailhouse's kernel driver, the inmate library and the inmate containing ERIKA. However, they usually rely on libc libraries meant to be used on top of the Linux OS. This means that, if the application on ERIKA needs to use the services provided by the libc (e.g. memcpy()), then the inmate library and ERIKA need to be compiled using a bare-metal toolchain different than the one used for building the other components of the Jailhouse hypervisor.

Unfortunately, Jailhouse does not (yet) allow to select different toolchains for compiling the inmate library and the rest of the hypervisor.

To compile only the Jailhouse's inmate library using a different toolchain than the one used for building the rest of the hypervisor, edit Jailhouse's inmates/Makefile file and set the CC and LD environment variables to the right compiler.

Additionally, to link the ERIKA application agains the libc library, you will need to set the following variables in the OIL file:

  • LIBS = "-lc";
  • LDFLAGS = "-L /path/containing/libc/";
  • CFLAGS = "-mstrict-align"; for accessing fields in data structures.