Skip to end of banner
Go to start of banner

Building the Orko Demo

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Current »

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

./flash_trs.sh /dev/nvme1n1 ./orko-demo/build/tmp_trs-qemuarm64/deploy/images/trs-qemuarm64/trs-image-trs-*rootfs*.wic

Output:

manos@ava:~$ ./flash_trs.sh /dev/nvme1n1 ./orko-demo/build/tmp_trs-qemuarm64/deploy/images/trs-qemuarm64/trs-image-trs-*rootfs*.wic
Will flash file
        /home/manos/orko-demo/build/tmp_trs-qemuarm64/deploy/images/trs-qemuarm64/trs-image-trs-qemuarm64.rootfs-20231221174701.wic
to block device
        /dev/nvme1n1

Model: TS128GMTE652T (nvme)
Disk /dev/nvme1n1: 128GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End    Size   File system  Name    Flags
 1      20.5kB  268MB  268MB  fat16        ESP     boot, legacy_boot, esp
 2      268MB   128GB  128GB  ext4         rootfs

Please confirm if the device is right? Enter 'y' to continue or any other input to exit.
y

Continuing with /dev/nvme1n1.
Copying ORKO TRS image to device /dev/nvme1n1.
2747269120 bytes (2.7 GB, 2.6 GiB) copied, 4 s, 686 MB/s
704+1 records in
704+1 records out
2952827904 bytes (3.0 GB, 2.8 GiB) copied, 18.9124 s, 156 MB/s
CHANGED: partition=2 start=524328 old: size=5242880 end=5767207 new: size=249545319 end=250069646
e2fsck 1.47.0 (5-Feb-2023)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
rootfs: 38256/327680 files (0.1% non-contiguous), 536316/655360 blocks
resize2fs 1.47.0 (5-Feb-2023)
Resizing the filesystem on /dev/nvme1n1p2 to 31193164 (4k) blocks.
The filesystem on /dev/nvme1n1p2 is now 31193164 (4k) blocks long.

Model: TS128GMTE652T (nvme)
Disk /dev/nvme1n1: 128GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End    Size   File system  Name    Flags
 1      20.5kB  268MB  268MB  fat16        ESP     boot, legacy_boot, esp
 2      268MB   128GB  128GB  ext4         rootfs

manos@ava:~$ 

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.

  • No labels