Build Xen for rockpi4b

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:

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 branches for rockpi4b

$ 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

Flash TRS images on Rockpi4b platform

Prepare Android imageand run on Xen virtual machine

By following up the steps described in , 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. Then you can increase the 2nd partition of USB-disk and create /home/leoy to hold android images as page . Or create the 3rd partition and copy the android images into it, you need to mount it to /home/leoy on rockpi4b in runtime in this way.

With below Xen configuration file saved on rockpi4b, you can launch Xen virtual machine with command xl -vvv create aaos_vm.cfg -c:

 

Issues on rockpi4b

  • The USB disk read speed in U-boot is very slow. It takes about 2 or 3 minutes to load Linux and ramfs binary.

  • The CPU/memory performance in Dom0 and DomU is only about 1/3 of native Linux. It takes about 1 hour to run into Android UI.