1This document describes how to build and run an Android system image targeting 2the ARM Fixed Virtual Platform. 3 4### Building userspace 5 6``` 7. build/envsetup.sh 8lunch fvp-eng # or fvp-userdebug 9m 10``` 11 12Note that running ``m`` requires that the kernel is built first following 13the instructions below. 14 15### Building the kernel 16 17``` 18mkdir android-kernel-mainline 19cd android-kernel-mainline 20repo init -u https://android.googlesource.com/kernel/manifest -b common-android-mainline 21repo sync 22repo start android-mainline common && repo download -c common 1145352 23BUILD_CONFIG=common/build.config.fvp build/build.sh 24``` 25 26The resulting kernel image and DTB must then be copied into the product output directory: 27 28``` 29cp out/android-mainline/dist/Image $ANDROID_PRODUCT_OUT/kernel 30cp out/android-mainline/dist/fvp-base-revc.dtb out/android-mainline/dist/initramfs.img $ANDROID_PRODUCT_OUT/ 31``` 32 33### Building the firmware (ARM Trusted Firmware and U-Boot) 34 35First, install ``dtc``, the device tree compiler. On Debian, this is in the 36``device-tree-compiler`` package. Then run: 37``` 38mkdir platform 39cd platform 40repo init -u https://git.linaro.org/landing-teams/working/arm/manifest.git -m pinned-uboot.xml -b 20.01 41repo sync 42 43# The included copy of U-Boot is incompatible with this version of AOSP, switch to a recent upstream checkout. 44cd u-boot 45git fetch https://gitlab.denx.de/u-boot/u-boot.git/ master 46git checkout 18b9c98024ec89e00a57707f07ff6ada06089d26 47cd .. 48 49mkdir -p tools/gcc 50cd tools/gcc 51wget https://releases.linaro.org/components/toolchain/binaries/6.2-2016.11/aarch64-linux-gnu/gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu.tar.xz 52tar -xJf gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu.tar.xz 53cd ../.. 54 55build-scripts/build-test-uboot.sh -p fvp all 56``` 57 58These components must then be copied into the product output directory: 59 60``` 61cp output/fvp/fvp-uboot/uboot/{bl1,fip}.bin $ANDROID_PRODUCT_OUT/ 62``` 63 64### Obtaining the model 65 66The model may be obtained from [ARM's 67website](https://developer.arm.com/tools-and-software/simulation-models/fixed-virtual-platforms) 68(under "Armv8-A Base Platform FVP"). 69 70### Running the model 71 72From a lunched environment, first set the value of the ``MODEL_BIN`` 73environment variable to the path to the model executable. Then run the 74following command to launch the model: 75``` 76device/generic/goldfish/fvpbase/run_model 77``` 78Additional model parameters may be passed by appending them to the 79``run_model`` command. 80 81To terminate the model, press ``Ctrl-] Ctrl-D`` to terminate the telnet 82connection. 83 84### MTE support 85 86**WARNING**: The kernel MTE support patches are experimental and the userspace 87interface is subject to change. 88 89To launch the model with MTE support, the following additional parameters 90must be used: 91``` 92-C cluster0.has_arm_v8-5=1 \ 93-C cluster0.memory_tagging_support_level=2 \ 94-C bp.dram_metadata.is_enabled=1 95``` 96MTE in userspace requires a patched common kernel with MTE support. To build 97the kernel, follow the kernel instructions above, but before running the 98``build.sh`` command, run: 99``` 100cd common 101git fetch https://github.com/pcc/linux android-experimental-mte 102git checkout FETCH_HEAD 103cd .. 104``` 105Then replace the prebuilt binutils with binutils 2.33.1: 106``` 107cd binutils-2.33.1 108./configure --prefix=$PWD/inst --target=aarch64-linux-gnu 109make 110make install 111for i in $PWD/inst/bin/*; do 112 ln -sf $i /path/to/android-kernel-mainline/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/$(basename $i) 113 ln -sf $i /path/to/android-kernel-mainline/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/$(basename $i | sed -e 's/gnu/android/g') 114done 115``` 116 117### Accessing the model via adb 118 119To connect to the model on the host: 120``` 121adb connect localhost:5555 122``` 123