R-Car/Boards/S4SK/Xen-Hypervisor

Host PC
Ubuntu 20.04 LTS (64bit) is recommended as OS. 32bit version is not supported.

How to build
See also : https://github.com/renesas-rcar/meta-xt-prod-devel-rcar-gen4/blob/s4sk-mp-1.0/doc/building.md

Installation of required tools and libraries
Ubuntu is used as Linux Host PC since Yocto Project Quick Start specifies Ubuntu as one of the distributions. You need to install the required packages as follows.

Using build script

 * 1) Build script(build.sh)
 * 2) build
 * 1) build

Manual steps

 * 1) Install moulin
 * 2) Build
 * 3) Building image can take up to a few hours depending on your host system performance. After the build has been completed successfully, you should see the output similar to:
 * 1) Building image can take up to a few hours depending on your host system performance. After the build has been completed successfully, you should see the output similar to:
 * 1) Building image can take up to a few hours depending on your host system performance. After the build has been completed successfully, you should see the output similar to:

Generated images

 * Dom0: ${WORK_XEN}/yocto/build-dom0/tmp/deploy/images/generic-armv8-xt/
 * DomD: ${WORK_XEN}/yocto/build-domd/tmp/deploy/images/s4sk/
 * DomU: ${WORK_XEN}/yocto/build-domu/tmp/deploy/images/s4sk/
 * {| class="wikitable"

! Domain ! Expected output ! Description
 * rowspan="2" | Dom0
 * Image
 * Dom0 Linux kernel image
 * uInitramfs
 * Dom0 ramfs((Included DomD/U Images and device trees))
 * rowspan="6" | DomD
 * rcar-image-minimal-s4sk.tar.bz2
 * DomD rootfs
 * r8a779f0-s4sk -xen.dtb
 * Xen device trees
 * xenpolicy-s4sk xen-uImage
 * Xen image
 * u-boot-elf-s4sk.srec
 * U-Boot
 * bl31-s4sk.srec
 * Trusted Firmware-A (BL31)
 * tee-s4sk.srec
 * OP-TEE OS
 * rowspan="1" | DomU
 * rcar-image-minimal-s4sk.tar.bz2
 * DomU rootfs
 * }
 * Trusted Firmware-A (BL31)
 * tee-s4sk.srec
 * OP-TEE OS
 * rowspan="1" | DomU
 * rcar-image-minimal-s4sk.tar.bz2
 * DomU rootfs
 * }
 * DomU rootfs
 * }
 * }


 * Sample built Image is below.
 * https://hydrochoerus.com/rcar/s4sk-xen/build-xen/

How to flash/update the loader

 * Write the generated bl31-s4sk.srec, tee-s4sk.srec and u-boot-elf-s4sk.srec binaries to flash
 * See : R-Car/Boards/S4SK
 * See : R-Car/Boards/S4SK

Micro SD card(32GB or more) boot
WARNING! These steps will erase the SD card completely. In short, all files will be lost.

Follow these steps on the host machine: NOTE: probably you need to be a root user, hence use "sudo". And "mmcblk0" should be adapted to your environment (eg., sdb or sdc).
 * 1) Delete all the partitions in the SD card. Below is an example for one partition, repeat the process for all the remaining partitions in the SD card if exists.
 * 2) Divide the SD card into three partions and set ID=83(Linux) for each.
 * Repeat the above commands for the second and third partitions by changing the partition number to 2 and 3.
 * 1) Format each partition to ext4
 * 2) Write images to partitions of SD card
 * 1) Format each partition to ext4
 * 2) Write images to partitions of SD card
 * 1) Write images to partitions of SD card


 * 1) Set U-Boot environment variables
 * 1) Set U-Boot environment variables

Tips
Writing an image to Micro SD using the dd command This frees you from confusing Micro SD partitioning, formatting, and other procedures.
 * 1) build (See R-Car/Boards/S4SK/Xen-Hypervisor)
 * or
 * 1) Generated the "full.img" file
 * 2) Writing the "full.imge" to Micro SD
 * 3) Boot
 * 1) Writing the "full.imge" to Micro SD
 * 2) Boot
 * 1) Writing the "full.imge" to Micro SD
 * 2) Boot
 * 1) Boot

NFS boot

 * 1) Install some packages for NFS boot on Host PC (See R-Car/Boards/Yocto-Gen3/v5.9.0)
 * 2) Copy and decompress the some files and rootfs on Host PC
 * 3) Set U-Boot environment variables and boot
 * 1) Set U-Boot environment variables and boot

Dom0

 * Get information about Xen host (xl info)
 * List information about all/some domains (xl list)
 * Create a domain from config file (xl create )
 * Create a domain from config file (xl create )
 * Create a domain from config file (xl create )


 * Terminate a domain immediately (xl destroy DomU)
 * Attach to domain's console (xl console DomD)
 * Back to Dom0 : ctrl + ]
 * Back to Dom0 : ctrl + ]
 * Back to Dom0 : ctrl + ]


 * List the VCPUs for all/some domains (xl vcpu-list)


 * Set which CPUs a VCPU can use (xl vcpu-pin   )


 * Create multiple domains (xl create)

DomD / DomU

 * Attach to domain's console (xl console DomD)
 * Back to Dom0 : ctrl + ]
 * Back to Dom0 : ctrl + ]


 * Ethernet TSN (DomD)

Known issues & Restrictions

 * 1) HW offload feature may cause TSN1 hang
 * 2) "xl console DomU" is not available