Building the Orko Demo

The Orko project demo is based on the Trusted Reference Stack. To stabilize development during the integration we have created a branch that pins down the development environment.

Hence, one has to use the following command to clone the repositories:

mkdir orko-demo cd orko-demo/ repo init -u https://gitlab.com/Linaro/trusted-reference-stack/trs-manifest.git -m default.xml -b orko-demo

One can run the same command on an existing TRS checkout to switch to the development branch.

Building is then identical to TRS itself. A detailed description can be found at: https://trs.readthedocs.io/en/latest/user_guide/prerequisites.html.

Assuming all prerequisites are installed, one can build the host image by running:

repo sync -j$(nproc) make

Final artifacts

The built image will be built to build/tmp_trs-qemuarm64/deploy/images/trs-qemuarm64/trs-image-trs-*rootfs*.wic

Installing the image on AVA

The image can be flashed on either an NVME or a USB stick. The below POSIX sh script flash_trs.sh shows the steps to flash the build artifact on a block device. It also extends the root file system partition to the end of the device to provide sufficient disk space for storing the Android Automotive OS image.

#!/bin/sh if [ "$#" -ne 3 ]; then printf "Usage: %s BLOCK_DEVICE_PATH TRS_IMAGE_PATH\n" "${0}" >&2 exit 1 fi if ! [ -e "${1}" ]; then printf "Block device path %s does not exist.\n" "${1}" >&2 exit 1 fi if ! [ -b "${1}" ]; then printf "%s is not a block device.\n" "${1}" >&2 exit 1 fi if ! [ -e "${2}" ]; then printf "Image %s does not exist.\n" "${2}" >&2 exit 1 fi if ! [ -f "${2}" ]; then printf "%s is not a regular file.\n" "${2}" >&2 exit 1 fi DEV="${1}" if [ -z "${DEV}" ]; then printf "Provide the absolute path to the block device as the only argument.\n" exit 1 fi DEV=$(realpath "${DEV}") IMAGE=$(realpath "${2}") printf "Will flash file\n\t%s\nto block device\n\t%s\n\n" "${IMAGE}" "${DEV}" sudo parted "${DEV}" print printf "Please confirm if the device is right? Enter 'y' to continue or any other input to exit.\n" while : ; do read -r k <&1 k=$(printf "%s" "${k}" | awk '{$1=$1};1') case "${k}" in "y") printf "\nContinuing with %s.\n" "${DEV}" break ;; *) printf "\nExit\n" exit 0 ;; esac done printf "Copying ORKO TRS image to device %s.\n" "${DEV}" sudo dd bs=4M if="${IMAGE}" of="${DEV}" status=progress && sync sudo growpart "${DEV}" 2 case "${DEV}" in *"nvme"*) # Flash NVMe block device sudo e2fsck -f "${DEV}p2" sudo resize2fs "${DEV}p2" ;; *) # Flash USB block device sudo e2fsck -f "${DEV}2" sudo resize2fs "${DEV}2" ;; esac sudo parted "${DEV}" print

Example of calling this script with the invocation

Output:

Note 1: The shell script requires the e2fsck and resize2fs utilities to be at least version 1.47.0 or newer. if not available, please download the e2fsprogs source and build it from source.

Note 2: This is @Leo Yan's script with some input validation, error checking and conversion to POSIX sh instead of bash. The following helped: