Introduction
This page is to describe how to download the related source code and build TRS for launching Android Cuttlefish images on Xen virtual machine on rockpi4b. It is based on Leo Yan’s change for AVA: Xen: maintenance Xen and QEMU repos for TRS
Download TRS offical repository
We can refer the TRS documenation Developer setup to download TRS repository and Getting the host packages to install dependencies on the PC.
Checkout the maintenance branches
$ cd /path/to/trs-workspace/meta-ledge-secure $ git remote add trs-rockpi https://gitlab.com/jun.nie/meta-ledge-secure $ git fetch trs-rockpi $ git checkout trs-rockpi/rockpi4b $ cd /path/to/trs-workspace/meta-virtualization/ $ git remote add trs-maintenance https://gitlab.com/leo.yan/meta-virtualization $ git fetch trs-maintenance $ git checkout trs-maintenance/xen_qemu_maintenance_20230707 $ cd /path/to/trs-workspace/trs/ $ git remote add trs-rockpi https://gitlab.com/jun.nie/trs $ git fetch trs-rockpi $ git checkout trs-rockpi/rockpi4b
Build boot image for rockpi4b target
TARGET=rockpi4b make meta-ts
Flash boot image for Rockpi4b
We need to decompress image under build/tmp_rockpi4b/deploy/images/rockpi4b/
and write it to micro-SD card.
sudo dd if=build/tmp_rockpi4b/deploy/images/rockpi4b/ts-firmware-rockpi4b.rootfs-20230925010832.wic of=/dev/<mmc-dev> conv=fdatasync,notrunc
Build TRS image for qemuarm64 target
make trs
Flash TRS images on Rockpi4b platform
We need to copy TRS wic image trs-image-trs-qemuarm64.wic
on AVA with Ubuntu system, then we can execuate below shell script to flash TRS images onto a USB disk with command ./flash_ewaol_image.sh /dev/nvmeXnY
(you might need to change the nvme block device name nvmeXnY
based on your local environment).
Below is the source code for flash_ewaol_image.sh
. Note, the script executes commands e2fsck
and resize2fs
to enlarge the partition size, when you use older version’s binary for e2fsck
and resize2fs
, it will fail and report errors. In this case, you need to download e2fsprogs
package (version 1.47.0 is verified) and build these two binaries.
sudo dd if=deploy-trs-qemuarm64/trs-image-trs-qemuarm64.rootfs-20231030085931.wic of=/dev/<usb dev> bs=8M conv=fdatasync,notrunc
Prepare Android imageand run on Xen virtual machine
By following up the steps described in Xen: porting Android Cuttlefish on Xen Virtual Machine, we can get the Android Cuttlefish images, then we need to copy the U-boot binary and Cuttlefish images into to /home/leoy of USB-disk on PC. You can increase the 2nd partition of USB-disk and create /home/leoy to hold android images as page Xen: maintenance Xen and QEMU repos for TRS . Or create the 3rd partition and mount it to /home/leoy
Then we can use below Xen configuration file to launch Xen virtual machine with command xl -vvv create aaos_vm.cfg -c
:
# Copyright (c) 2022, Arm Limited. # # SPDX-License-Identifier: MIT name = "aaos-vm" memory = 2048 vcpus = 4 extra = " earlyprintk=xenboot console=hvc0 rw androidboot.console=hvc0 androidboot.serialconsole=1" root = "/dev/xvda2" kernel = "/home/leoy/u-boot.bin" disk = ['format=qcow2, vdev=xvda, access=rw, target=/home/leoy/android-cf-mainline/cf/cuttlefish/instances/cvd-1/overlay.img', 'format=raw, vdev=xvdb, access =rw, target=/home/leoy/android-cf-mainline/cf/cuttlefish/instances/cvd-1/persistent_composite.img', 'format=raw, vdev=xvdc, access=rw, target=/home/leoy/andr oid-cf-mainline/cf/cuttlefish/instances/cvd-1/sdcard.img'] vif = ['mac=00:16:3E:74:34:32', 'mac=00:16:3e:5f:48:e4', 'mac=00:16:3E:74:34:32,script=vif-bridge,bridge=xenbr0'] virtio = ['transport=pci, backend_type=qemu, bdf=00:00.0']