Difference between revisions of "Xilinx ZCU102"
Line 8: | Line 8: | ||
Zynq UltraScale+™ MPSoC device has a quad-core ARM® Cortex-A53, dual-core Cortex-R5 real-time processors, and a Mali-400 MP2 graphics processing unit based on Xilinx's 16nm FinFET+ programmable logic fabric. The ZCU102 supports all major peripherals and interfaces enabling development for a wide range of applications. | Zynq UltraScale+™ MPSoC device has a quad-core ARM® Cortex-A53, dual-core Cortex-R5 real-time processors, and a Mali-400 MP2 graphics processing unit based on Xilinx's 16nm FinFET+ programmable logic fabric. The ZCU102 supports all major peripherals and interfaces enabling development for a wide range of applications. | ||
+ | |||
+ | '''[TODO] IMMAGINE''' | ||
Xilinx provides the tools in order to customize, build and deploy embedded Linux solutions on Xilinx processing systems. Such tools consists a set of pre-configured binary bootable images, fully customizable Linux for the Xilinx devices, and PetaLinux/Xilinx Vivado SDK. | Xilinx provides the tools in order to customize, build and deploy embedded Linux solutions on Xilinx processing systems. Such tools consists a set of pre-configured binary bootable images, fully customizable Linux for the Xilinx devices, and PetaLinux/Xilinx Vivado SDK. | ||
Line 14: | Line 16: | ||
=== The compilation environment: Petalinux tool === | === The compilation environment: Petalinux tool === | ||
− | The PetaLinux Tools aim to configure, build and deploy a booting image for the Xilinx board on the basis of the hardware design file (.hdf). PetaLinux installation is very straight-forward | + | The PetaLinux Tools aim to configure, build and deploy a booting image for the Xilinx board on the basis of the hardware design file (.hdf). PetaLinux installation is very straight-forward. Without any options, PetaLinux tools will be installed into a subdirectory of the current working directory. Alternatively, an installation path may be specified. |
− | Example of PetaLinux Tools installation in the /opt/pkg directory: | + | Example of PetaLinux Tools 2017.2 installation in the /opt/pkg directory: |
$ mkdir /opt/pkg | $ mkdir /opt/pkg | ||
$ ./petalinux-v2017.2-final-installer.run /opt/pkg | $ ./petalinux-v2017.2-final-installer.run /opt/pkg | ||
In order to setup the PetaLinux working environment, it is required to source the appropriate settings script (e.g., from a bash shell): | In order to setup the PetaLinux working environment, it is required to source the appropriate settings script (e.g., from a bash shell): | ||
− | source /opt/pkg/2017.2/settings.sh | + | $ source /opt/pkg/2017.2/settings.sh |
In the following part of the section, we detail how to create a new PetaLinux project and build the system image for the referred board. A detailed instruction of the Petalinux tools is in the reference user guide ([https://www.xilinx.com/support/documentation/sw_manuals/xilinx2016_4/ug1144-petalinux-tools-reference-guide.pdf link to manual]). | In the following part of the section, we detail how to create a new PetaLinux project and build the system image for the referred board. A detailed instruction of the Petalinux tools is in the reference user guide ([https://www.xilinx.com/support/documentation/sw_manuals/xilinx2016_4/ug1144-petalinux-tools-reference-guide.pdf link to manual]). | ||
Line 50: | Line 52: | ||
Finally, the <tt>petalinux-package</tt> command is used to build various image format, firmware, prebuilt and bsps. | Finally, the <tt>petalinux-package</tt> command is used to build various image format, firmware, prebuilt and bsps. | ||
$ petalinux-package --boot|--bsp|--firmware|--image|--prebuilt [options] | $ petalinux-package --boot|--bsp|--firmware|--image|--prebuilt [options] | ||
+ | |||
For creating a BOOT.BIN image for the ZynqMP, the command line is the following: | For creating a BOOT.BIN image for the ZynqMP, the command line is the following: | ||
− | $ petalinux-package --boot | + | $ petalinux-package --boot --u-boot <path of the u-boot elf file> --fpga <path of the bitstream file> |
+ | Note that the default path for images, including the u-boot elf file and the bitstream file, is <tt><project_folder>/images/linux</tt>. | ||
+ | |||
For creating a uImage of the Linux kernel, the command line is the following: | For creating a uImage of the Linux kernel, the command line is the following: | ||
$ petalinux-package --image -c kernel --format uImage | $ petalinux-package --image -c kernel --format uImage | ||
− | |||
− | == Jailhouse | + | === Linux kernel and modules === |
+ | Petalinux 2017.2 refers to Linux v4.9 | ||
+ | |||
+ | |||
+ | |||
+ | == Jailhouse for Xilinx ZCU102== | ||
+ | |||
+ | The hypervisor requires a contiguous piece of RAM for itself and each additional cell. This currently has to be pre-allocated during boot-up. On ARM platforms this is usually achieved by reducing the amount of memory seen by the Linux kernel. You therefore need to modify the kernel boot arguments by resizing the kernel memory. | ||
+ | |||
+ | === Jailhouse setup === | ||
+ | |||
+ | $ git clone https://github.com/siemens/jailhouse | ||
+ | |||
+ | As for jailhouse installation on Xilinx ZCU102, we refer to Jailhouse v0.7. | ||
+ | The commands to checkout at such version are the following: | ||
+ | $ cd jailhouse | ||
+ | $ git checkout v0.7 -b xilinx_jailhouse | ||
+ | |||
+ | Jailhouse directory contains the following subdirectories: | ||
+ | <ul> | ||
+ | <li>Documentation | ||
+ | <li>ci - configuration files for different platforms.</li> | ||
+ | <li>configs - cell configuration files.</li> | ||
+ | <li>driver - jailhouse.ko kernel module code.</li> | ||
+ | <li>hypervisor - hypervisor code.</li> | ||
+ | <li>inmates - inmates demos. It also contains code for ti_app inmate example.</li> | ||
+ | <li>scripts </li> | ||
+ | <li>tools - jailhouse management utility.</li> | ||
+ | </ul> | ||
+ | |||
+ | === Jailhouse build and installation === | ||
+ | |||
+ | For building and installing Jailhouse, first setup the environment by simply setting the PetaLinux working environment: | ||
+ | $ source /opt/pkg/2017.2/settings.sh | ||
+ | |||
+ | |||
+ | Copy the jailhouse-config-am57xx-evm.h file into hypervisor/include/jailhouse directory and rename it to config.h | ||
+ | Then | ||
+ | a copy of the compiled Linux kernel with all object files is needed, to be able of building the kernel module. | ||
+ | sudo make KDIR=/path/to/compiled/kernel/ | ||
+ | |||
+ | |||
+ | #Compiling jailhouse | ||
+ | cd ~/Jailhouse/xilinx-demo-jailhouse/jailhouse | ||
+ | make clean | ||
+ | make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- KDIR=$XPROJECT/build/linux/kernel/linux-v4.9.52/ DESTDIR=$DESTINATION/jailhouse_rootfs/ install | ||
+ | |||
+ | === Jailhouse run === | ||
+ | |||
+ | Since the hypervisor requires a contiguous piece of RAM for itself and each additional cell, the amount of memory seen by the Linux kernel has to be reduced. This can be achieved by modifying the kernel boot arguments adding mem=<new value> as follows: | ||
+ | <ul type="circle"> | ||
+ | <li>Reboot the board and stop the execution at the u-boot prompt (typically by pressing any key at the boot)</li> | ||
+ | <li>Change the bootargs<br> | ||
+ | <tt> u-boot prompt> setenv bootargs '<previous values> mem=1536M </tt> | ||
+ | </li> | ||
+ | <li>Save the environment for the next reboots<br> | ||
+ | <tt> u-boot prompt> saveenv </tt> | ||
+ | </li> | ||
+ | <li>Restart the execution<br> | ||
+ | <tt> u-boot prompt> run bootcmd </tt> | ||
+ | </li> | ||
+ | </ul> | ||
− | + | Insert <tt>jailhouse.ko</tt> kernel module | |
+ | $ sudo depmod -a | ||
+ | $ sudo modprobe jailhouse | ||
+ | $ sudo jailhouse enable <zcu102-root-cell>.cell | ||
− | |||
== ERIKA3 on Jailhouse == | == ERIKA3 on Jailhouse == | ||
+ | |||
+ | === ERIKA3 setup === | ||
+ | |||
+ | In order to build and install jailhouse, setup the environment by setting the following environmental variables: | ||
+ | $ export JAILHOUSE_DIR=<path of the jailhouse directory> | ||
+ | $ export JAILHOUSE_AARCH64_GCCPREFIX=aarch64-linux-gnu- | ||
+ | |||
+ | === ERIKA3 build and installation === | ||
+ | |||
+ | |||
Revision as of 15:13, 27 February 2018
Introduction
The ERIKA3 RTOS can be run as a guest OS of the Jailhouse hypervisor on the Xilinx ZCU102.
The following sections give an overview of the board and the Xilinx compilation environment with particular attention on how to build and install Linux kernel on the Xilinx ZCU102. Furthermore, they explain how to build and install Jailhouse and create an ERIKA3 guest (AKA Jailhouse inmate).
Platform description
Zynq UltraScale+™ MPSoC device has a quad-core ARM® Cortex-A53, dual-core Cortex-R5 real-time processors, and a Mali-400 MP2 graphics processing unit based on Xilinx's 16nm FinFET+ programmable logic fabric. The ZCU102 supports all major peripherals and interfaces enabling development for a wide range of applications.
[TODO] IMMAGINE
Xilinx provides the tools in order to customize, build and deploy embedded Linux solutions on Xilinx processing systems. Such tools consists a set of pre-configured binary bootable images, fully customizable Linux for the Xilinx devices, and PetaLinux/Xilinx Vivado SDK.
The PetaLinux SDK includes tools and utilities to automate complex tasks across configuration, build, and deployment, whereas the Xilinx Vivado (with SDK) is used to define the hardware design of the related board.
The compilation environment: Petalinux tool
The PetaLinux Tools aim to configure, build and deploy a booting image for the Xilinx board on the basis of the hardware design file (.hdf). PetaLinux installation is very straight-forward. Without any options, PetaLinux tools will be installed into a subdirectory of the current working directory. Alternatively, an installation path may be specified.
Example of PetaLinux Tools 2017.2 installation in the /opt/pkg directory:
$ mkdir /opt/pkg $ ./petalinux-v2017.2-final-installer.run /opt/pkg
In order to setup the PetaLinux working environment, it is required to source the appropriate settings script (e.g., from a bash shell):
$ source /opt/pkg/2017.2/settings.sh
In the following part of the section, we detail how to create a new PetaLinux project and build the system image for the referred board. A detailed instruction of the Petalinux tools is in the reference user guide (link to manual).
Create a New PetaLinux Project
In order to create a new PetaLinux project for the referred board, run the following command from the command console (e.g. bash):
$ petalinux-create -t project -n <name> --template zynqMP
where name is used the project name.
After creating the project, the hardware configuration should be imported in order to build a Linux system for a customized hardware platform. Example of hardware design file can be found in the Petalinux installation path (e.g.,/opt/pkg/2017.2/tools/hsm/data/embeddedsw/lib/hwplatform_templates/ZCU102_hw_platform/system.hdf) or in the Xilinx repository (zcu102 hdf example), whereas customized hardware design file can be created by means of Xilinx Vivado SDK. Run the following command to import the hardware description:
$ petalinux-config --get-hw-description=<path to directory which contains hardware description file>
Such command will import the hardware description of the .hdf file given as input. Then, it will launch the top system configuration menu when it runs first time for the PetaLinux project or the tool detects there is a change in the system primary hardware candidates.
In order to allows the configuration of the system by launching the top system configuration menu, run the following command:
$ petalinux-config
More in detail, it defines the sets of components (e.g., u-boot, arm-trusted-firmware, kernel and rootfs). For each component, it defines the configuration settings and whether the configuration files will be auto updated (i.e., Auto Config Settings). Furthermore, the command allows to configure the hardware settings (e.g., system processor, memory, Serial port, Ethernet and so forth). Furthermore , the petalinux-config command allows to configure a single component (e.g., u-boot, kernel or rootfs).
$ petalinux-config -c kernel
Build PetaLinux System Image
In order to build and create, the Petalinux 2017.2 tool provides the following commands:
$ petalinux-build
The petalinux-build command is used to build the system image. As for the petalinux-config command, it is possible to rebuild a single component instead of the entire system with the -c <component> option.
Finally, the petalinux-package command is used to build various image format, firmware, prebuilt and bsps.
$ petalinux-package --boot|--bsp|--firmware|--image|--prebuilt [options]
For creating a BOOT.BIN image for the ZynqMP, the command line is the following:
$ petalinux-package --boot --u-boot <path of the u-boot elf file> --fpga <path of the bitstream file>
Note that the default path for images, including the u-boot elf file and the bitstream file, is <project_folder>/images/linux.
For creating a uImage of the Linux kernel, the command line is the following:
$ petalinux-package --image -c kernel --format uImage
Linux kernel and modules
Petalinux 2017.2 refers to Linux v4.9
Jailhouse for Xilinx ZCU102
The hypervisor requires a contiguous piece of RAM for itself and each additional cell. This currently has to be pre-allocated during boot-up. On ARM platforms this is usually achieved by reducing the amount of memory seen by the Linux kernel. You therefore need to modify the kernel boot arguments by resizing the kernel memory.
Jailhouse setup
$ git clone https://github.com/siemens/jailhouse
As for jailhouse installation on Xilinx ZCU102, we refer to Jailhouse v0.7. The commands to checkout at such version are the following:
$ cd jailhouse $ git checkout v0.7 -b xilinx_jailhouse
Jailhouse directory contains the following subdirectories:
- Documentation
- ci - configuration files for different platforms.
- configs - cell configuration files.
- driver - jailhouse.ko kernel module code.
- hypervisor - hypervisor code.
- inmates - inmates demos. It also contains code for ti_app inmate example.
- scripts
- tools - jailhouse management utility.
Jailhouse build and installation
For building and installing Jailhouse, first setup the environment by simply setting the PetaLinux working environment:
$ source /opt/pkg/2017.2/settings.sh
Copy the jailhouse-config-am57xx-evm.h file into hypervisor/include/jailhouse directory and rename it to config.h
Then
a copy of the compiled Linux kernel with all object files is needed, to be able of building the kernel module.
sudo make KDIR=/path/to/compiled/kernel/
- Compiling jailhouse
cd ~/Jailhouse/xilinx-demo-jailhouse/jailhouse make clean make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- KDIR=$XPROJECT/build/linux/kernel/linux-v4.9.52/ DESTDIR=$DESTINATION/jailhouse_rootfs/ install
Jailhouse run
Since the hypervisor requires a contiguous piece of RAM for itself and each additional cell, the amount of memory seen by the Linux kernel has to be reduced. This can be achieved by modifying the kernel boot arguments adding mem=<new value> as follows:
- Reboot the board and stop the execution at the u-boot prompt (typically by pressing any key at the boot)
- Change the bootargs
u-boot prompt> setenv bootargs '<previous values> mem=1536M - Save the environment for the next reboots
u-boot prompt> saveenv - Restart the execution
u-boot prompt> run bootcmd
Insert jailhouse.ko kernel module
$ sudo depmod -a $ sudo modprobe jailhouse $ sudo jailhouse enable <zcu102-root-cell>.cell
ERIKA3 on Jailhouse
ERIKA3 setup
In order to build and install jailhouse, setup the environment by setting the following environmental variables:
$ export JAILHOUSE_DIR=<path of the jailhouse directory> $ export JAILHOUSE_AARCH64_GCCPREFIX=aarch64-linux-gnu-
ERIKA3 build and installation
Please, refer to the following documents: