Introduction
This article is to record the steps for running Android Automotive images on TRS. In this article, we will share the prebuilt images for easier reproducing this experiment. But in case if you are interested in how to build Android automotive images and build TRS images, you can refer to the documentations [1][2] for details.
Prebuilt images
The TRS prebuilt image is:
https://people.linaro.org/~leo.yan/arm_blueprint/aaos_on_xen/trs-image-trs-qemuarm64.wic.
The prebuilt Android automotive image is: https://people.linaro.org/~leo.yan/arm_blueprint/aaos_on_xen/cuttlefish.tgz.
Flash TRS image
We need to flash TRS image on NVME or USB stick. It’s recommended to use below shell script to flash TRS image, you can use below commands:
$ wget https://people.linaro.org/~leo.yan/arm_blueprint/aaos_on_xen/trs-image-trs-qemuarm64.wic $ sh flash_trs.sh /dev/nvmeXn1 # for flashing TRS on NVME block device $ sh flash_trs.sh /dev/sdX # for flashing TRS on USB stick
This script helps us to extend the root file system partition to the end of the disk device, thus we can get sufficient disk space for storing Android images.
#!/bin/bash DEV=$1 sudo parted ${DEV} print echo "Please confirm if the partition is right?" while : ; do read -n 1 k <&1 if [[ $k = y ]] ; then printf "\n" break else printf "\nExit\n" exit 0 fi done echo "Copy image to ${DEV}" sudo dd bs=4M if=./trs-image-trs-qemuarm64.wic of=$DEV status=progress && sync sudo growpart $DEV 2 sudo /home/leoy/Downloads/e2fsprogs-1.47.0/e2fsck/e2fsck -f "${DEV}p2" sudo /home/leoy/Downloads/e2fsprogs-1.47.0/resize/resize2fs "${DEV}p2" #sudo /home/leoy/Downloads/e2fsprogs-1.47.0/e2fsck/e2fsck -f "${DEV}2" #sudo /home/leoy/Downloads/e2fsprogs-1.47.0/resize/resize2fs "${DEV}2" sudo parted ${DEV} print
Note 1: It uses the commands e2fsck
and resize2fs
for resizing the second partition, if your working distro cannot provide e2fsck
and resize2fs
for the related new version (as tested they should be at least version 1.47.0 or newer versions), you need to download e2fsprogs
and build by yourself.
Note 2: Because USB stick and NVME device have different block naming, you need to comment out lines 23 and 24, and enable lines 25 and 26.
Run Android automotive on Xen virtual machine
After TRS system booted up, you need to download Android Cuttlefish image and uncompress it into a specific folder /home/leoy/android-cf-mainline/cf
due to the overlay images contains the absolute path. The commands are:
# wget https://people.linaro.org/~leo.yan/arm_blueprint/aaos_on_xen/cuttlefish.tgz # wget https://people.linaro.org/~leo.yan/arm_blueprint/aaos_on_xen/aaos_vm.cfg # wget https://people.linaro.org/~leo.yan/arm_blueprint/aaos_on_xen/u-boot.bin # mkdir -p /home/leoy/android-cf-mainline/cf/ # tar zxvf cuttlefish.tgz -C /home/leoy/android-cf-mainline/cf/
In the console, we need to firstly launch Xfce4 windows manager:
# startxfce &
Everything is ready, we can run Android automotive on Xen virtual machine:
# export DISPLAY=:0 # xl -vvv create aaos_vm.cfg -c
[1] Xen: maintenance Xen and QEMU repos for TRS
[2] Xen: porting Android Cuttlefish on Xen Virtual Machine