03 Feb 2015

Foundation model with ARM trusted firmware and UEFI

So, as I wrote in Foundation Model - a line in the sand?, a lot of things have changed in the underlying platform for the ARM Foundation Model for ARMv8. So I thought I would describe how to set one up ... on the right side of the line.

Installing the model

First of all, you need to download the ARMv8 Foundation Platform - which requires registering for an account on the ARM download portal. Extract the archive to a suitable location.

Building UEFI

The recent versions of Foundation Model are actually software compatible with the FVP Base model. The "Foundation_v8" image does not work on these, and since Linaro 2014.09, we have renamed that platform "foundation_legacy".

Secondly, the "fvp" UEFI build (like the Juno one) now expects to be loaded by ARM Trusted Firmware. So I've updated our build scripts to deal with this in a mostly automated fashion: uefi-build.sh has a new parameter -a to specify the location of an ARM Trusted Firmware checkout. It will then, based on configuration options in platforms.config, build UEFI, build ARM Trusted Firmware into a bl1.bin image, and then package the UEFI image with additional Trusted Firmware components into a fip.bin image.

Of course, you can also download our pre-built monthly release images, and skip the build instructions.

$ git clone git://git.linaro.org/uefi/uefi-tools.git
$ git clone https://github.com/ARM-software/arm-trusted-firmware.git
$ git clone git://git.linaro.org/uefi/linaro-edk2.git
$ cd linaro-edk2
$ ../uefi-tools/uefi-build.sh -a ../arm-trusted-firmware -b DEBUG fvp

Booting the system

Now grab the bl1.bin and fip.bin from Build/ArmVExpress-FVP-AArch64/DEBUG_GCC48/FV/ (or download them), and launch the foundation model.

$ Foundation_Platformpkg/models/Linux64_GCC-4.1/Foundation_Platform \
	--cores=2 \
	--gicv3 \
	--data=bl1.bin@0x0 \
	--data=fip.bin@0x08000000 \

disk.img is an optional parameter for adding a virtio block device image file, to use as a local filesystem. For very basic UEFI, GRUB or Linux kernel testing, it can be omitted.

We specify that bl1.bin (the Trusted Firmware system startup code) and fip.bin are loaded into RAM at predefined locations. We also specify that we use the GICv3 variant of the modelled system, which affects the memory map. Currently the EDK2 code still puts this GIC into legacy mode, but without --gicv3 it will look for the interrupt controller registers in the wrong location. --cores=2 is not necessary, but makes the model emulate just 2 cores rather than the default 8 - which makes the model run faster while still letting you have fun with software concurrency.

posted at: 23:46 | path: /drafts | permanent link to this entry