Skip to end of banner
Go to start of banner

Build Xen for rockpi4b

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 3 Current »

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

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. Then you can increase the 2nd partition of USB-disk and create /home/leoy to hold android images as page https://linaro.atlassian.net/wiki/spaces/AUT/pages/28960981135/Xen+maintenance+Xen+and+QEMU+repos+for+TRS#Flash-TRS-images-on-AVA-platform . 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:

# 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']

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.

  • No labels