summaryrefslogtreecommitdiff
path: root/test/README.arm_fvp.md
blob: 47ef715a63cc5b314f31cdeaf998ca59ea122cc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# Build and Run ART tests on ARM FVP

This document describes how to build and run an Android system image targeting
the ARM Fixed Virtual Platform and to use it as a target platform for running
ART tests via ADB.

This instruction was checked to be working for the AOSP master tree on
2021-01-13; the up-to-date instruction on how to build the kernel and firmware
could be found here: device/generic/goldfish/fvpbase/README.md.

## Configuring and Building AOSP

First, an AOSP image should be configured and built, including the kernel and
firmware.

### Generating build system configs

```
cd $AOSP

. build/envsetup.sh
# fvp_mini target is used as we don't need a GUI for ART tests.
lunch fvp_mini-eng

# This is expected to fail; it generates all the build rules files.
m
```

### Building the kernel

```
cd $SOME_DIRECTORY_OUTSIDE_AOSP

mkdir android-kernel-mainline
cd android-kernel-mainline
repo init -u https://android.googlesource.com/kernel/manifest -b common-android-mainline
repo sync
BUILD_CONFIG=common/build.config.gki.aarch64 build/build.sh
BUILD_CONFIG=common-modules/virtual-device/build.config.fvp build/build.sh
```

The resulting kernel image and DTB (Device Tree Binary) must then be copied into
the product output directory:

```
cp out/android-mainline/dist/Image $ANDROID_PRODUCT_OUT/kernel
cp out/android-mainline/dist/fvp-base-revc.dtb out/android-mainline/dist/initramfs.img $ANDROID_PRODUCT_OUT/
```

### Building the firmware (ARM Trusted Firmware and U-Boot)

First, install ``dtc``, the device tree compiler. On Debian, this is in the
``device-tree-compiler`` package.

```
sudo apt-get install device-tree-compiler
```

Then run:

```
mkdir platform
cd platform
repo init -u https://git.linaro.org/landing-teams/working/arm/manifest.git -m pinned-uboot.xml -b 20.01
repo sync

# The included copy of U-Boot is incompatible with this version of AOSP, switch to a recent upstream checkout.
cd u-boot
git fetch https://gitlab.denx.de/u-boot/u-boot.git/ master
git checkout 18b9c98024ec89e00a57707f07ff6ada06089d26
cd ..

mkdir -p tools/gcc
cd tools/gcc
wget 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
tar -xJf gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu.tar.xz
cd ../..

build-scripts/build-test-uboot.sh -p fvp all
```

These components must then be copied into the product output directory:

```
cp output/fvp/fvp-uboot/uboot/{bl1,fip}.bin $ANDROID_PRODUCT_OUT/
```

## Setting up the FVP model

### Obtaining the model

The public Arm FVP could be obtained from https://developer.arm.com/; one would
need to create an account there and accept EULA to download and install it.
A link for the latest version:

https://developer.arm.com/tools-and-software/simulation-models/fixed-virtual-platforms/arm-ecosystem-models: "Armv8-A Base RevC AEM FVP"

The AEMv8-A Base Platform FVP is a free of charge Fixed Virtual Platform of the
latest Arm v8-A architecture features and has been validated with compatible
Open Source software, which can be found on the reference open source software
stacks page along with instructions for running the software

### Running the model

From a lunched environment:

```
export MODEL_PATH=/path/to/model/dir
export MODEL_BIN=${MODEL_PATH}/models/Linux64_GCC-6.4/FVP_Base_RevC-2xAEMv8A
./device/generic/goldfish/fvpbase/run_model
```

If any extra parameters are needed for the model (e.g. specifying plugins) they
should be specified as cmdline options for 'run_model'. E.g. to run a model
which support SVE:

```
export SVE_PLUGIN=${MODEL_PATH}/plugins/Linux64_GCC-6.4/ScalableVectorExtension.so
$ ./device/generic/goldfish/fvpbase/run_model --plugin ${SVE_PLUGIN} -C SVE.ScalableVectorExtension.veclen=2
```

Note: SVE vector length is passed in units of 64-bit blocks. So "2" would stand
for 128-bit vector length.

The model will start and will have fully booted to shell in around 20 minutes
(you will see "sys.boot_completed=1" in the log). It can be accessed as a
regular device with adb:

```
adb connect localhost:5555
```

To terminate the model, press ``Ctrl-] Ctrl-D`` to terminate the telnet
connection.

## Running ART test on FVP

The model behaves as a regular adb device so running ART tests could be done using
the standard chroot method described in test/README.chroot.md; the steps are
also described below. A separate AOSP tree (not the one used for the model
itself), should be used - full or minimal.

Then the regular ART testing routine could be performed; the regular "lunch"
target ("armv8" and other targets, not "fvp-eng").


```
export ART_TEST_CHROOT=/data/local/art-test-chroot
export OVERRIDE_TARGET_FLATTEN_APEX=true
export SOONG_ALLOW_MISSING_DEPENDENCIES=true
export TARGET_BUILD_UNBUNDLED=true
export ART_TEST_RUN_ON_ARM_FVP=true

. ./build/envsetup.sh
lunch armv8-userdebug
art/tools/buildbot-build.sh --target

art/tools/buildbot-teardown-device.sh
art/tools/buildbot-cleanup-device.sh
art/tools/buildbot-setup-device.sh
art/tools/buildbot-sync.sh

art/test/testrunner/testrunner.py --target --64 --optimizing -j1

```