Difference between revisions of "Nvidia Jetson TX1 and TX2"

From ERIKA WIKI
Jump to: navigation, search
(x86 host platform setup)
(x86 host platform setup)
Line 22: Line 22:
 
A cross-compiler for aarch64 is needed. On Ubuntu (tested on version 16.04), this can be installed by typing
 
A cross-compiler for aarch64 is needed. On Ubuntu (tested on version 16.04), this can be installed by typing
 
<pre>
 
<pre>
sudo apt install g++-4.8-aarch64-linux-gnu
+
sudo apt install gcc-aarch64-linux-gnu
 
</pre>
 
</pre>
  

Revision as of 14:03, 13 March 2018

Introduction

The ERIKA3 RTOS can be run as a guest OS of the Jailhouse hypervisor on the Nvidia Tegra Jetson TX1 board.
Such support has been developed in the context of the HERCULES European project. It has been also shown through a YouTube video.

This section explains how to build and install Jailhouse on the TX1 target and how to create an ERIKA3 guest (AKA Jailhouse inmate) running a simple application.

The Eclipse-based RT-Druid tool (for generating the RTOS configuration) requires an x86 platform with a fair amount of resources (in terms of both processing and memory). This requirement, therefore, implies a cross-compilation of ERIKA3. Additionally, since the build process of ERIKA3 needs a compiled copy of Jailhouse which, in turn, needs a compiled copy of the Linux kernel, we suggest proceeding by cross-compiling all software components (i.e., Linux kernel, Jailhouse and ERIKA3 RTOS) on a host x86 machine.

TX1 platform setup

Use Nvidia Jetpack 3.1 to flash the Linux distribution by Nvidia onto the TX1 platform. JetPack is a tool that runs on an Ubuntu host machine and installs Linux on the TX1 platform. Note that the host machine and the platform must be connected through an OTG USB cable during flashing.

Once the Linux distribution has been correctly flashed on the device, it is important to configure Linux to reserve the memory to the hypervisor, and to not use the serial interface (that will be used by the ERIKA3 guest). The instructions for this set-up can be found on the README file of our Jailhouse tree on GitHub. The README also explains how to set a static IP address (strongly encouraged).

x86 host platform setup

A cross-compiler for aarch64 is needed. On Ubuntu (tested on version 16.04), this can be installed by typing

sudo apt install gcc-aarch64-linux-gnu

Jailhouse cross-compiling

The README available on the Jailhouse tree on our GitHub explains how to cross-compile and install Jailhouse. Note that the information is provided for the default Linux kernel by Nvidia (not Vanilla). You can refer to the original Jailhouse page in case you run a Vanilla Linux kernel.

RT-Druid set-up

Once Jailhouse has been successfully built, transferred and installed onto the TX1 platform, you have to set-up the RT-Druid development environment to compile the ERIKA3 RTOS.

Follow the next instructions for installing RT-Druid on the host platform used for cross-compiling:

  1. Download the RT-Druid package from the download section of the ERIKA3 website
  2. Extract the downloaded archive
  3. Open a shell and type
    export JAILHOUSE_VERSION=0.7
    export JAILHOUSE_DIR=/path/to/compiled/jailhouse
    export  JAILHOUSE_AARCH64_GCCPREFIX=aarch64-linux-gnu-
    
  4. Then, using the same shell, enter the extracted archive and run
    ./eclipse

Simple application

We now show a simple "helloworld" application consisting of two tasks printing on the serial interface.

  1. Run the RT-Druid tool as explained above
  2. Create a new project by clicking on NewRT-Druid v3 Oil and C/C++ Project as shown in the next Figure:
    Figure 1: Create a new RT-Druid project.
  3. Name the new project (e.g., mytest) and select the Cross-GCC as shown in the next Figure:
    Figure 2: Naming the new RT-Druid project.
  4. Check the box for using an existing template and select aarch64JailhouseHelloworld OSEK demo on Jailhouseas shown in the next Figure:
    Figure 3: Selecting the Helloworld template.
  5. Eclipse will then show the new project, and RT-Druid will generate the configuration files, as shown in the next Figure:
    Figure 4: New Helloworld project created.
  6. Click with the right mouse key on the project and select Build project as shown in the next Figure:
    Figure 5: Building the Helloworld project.
  7. Open a shell, enter the workspace and transfer the erika_inmate.bin binary to the TX1 platform (e.g. using scp)
  8. Then, on the TX1 platform:
    1. Install the Jailhouse driver:
      sudo modprobe jailhouse
      
    2. Enable Jailhouse:
      sudo jailhouse enable jetson-tx1.cell 
      
    3. Create the cell for ERIKA3:
      sudo jailhouse cell create jetson-tx1-demo.cell
      
    4. Load the ERIKA3 application:
      sudo jailhouse cell load jetson-tx1-demo erika3_inmate.bin 
      
    5. Start the ERIKA3 application:
      sudo jailhouse cell start jetson-tx1-demo 
      
  9. Then, on the TX1 platform, you will see the two tasks printing alternatively on the serial interface, as shown in the next figure:
    Figure 6: Output of the helloworld example.