diff mbox series

configs/qemu_aarch64_ebbr: new defconfig

Message ID 20220914140821.3158921-1-vincent.stehle@arm.com
State Superseded
Headers show
Series configs/qemu_aarch64_ebbr: new defconfig | expand

Commit Message

Vincent Stehlé Sept. 14, 2022, 2:08 p.m. UTC
Add a defconfig to build an AArch64 U-Boot based firmware implementing the
subset of UEFI defined by EBBR[1], as well as a Linux OS disk image booting
with UEFI, to run on Qemu.

The generated firmware binary can also be used to install or run another OS
supporting the EBBR specification.

[1]: https://github.com/ARM-software/ebbr

Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
Cc: Romain Naour <romain.naour@gmail.com>
---


Hi,

I would prefer to add my work e-mail in DEVELOPERS for this defconfig.
Please let me know if this is ok or if I should keep a single e-mail
address.
Thanks!

Best regards,
Vincent.


 DEVELOPERS                            |   3 +
 board/qemu/aarch64-ebbr/genimage.cfg  |  31 ++++++++
 board/qemu/aarch64-ebbr/grub.cfg      |   6 ++
 board/qemu/aarch64-ebbr/post-image.sh |  11 +++
 board/qemu/aarch64-ebbr/readme.txt    | 103 ++++++++++++++++++++++++++
 board/qemu/aarch64-ebbr/u-boot.config |  34 +++++++++
 configs/qemu_aarch64_ebbr_defconfig   |  53 +++++++++++++
 7 files changed, 241 insertions(+)
 create mode 100644 board/qemu/aarch64-ebbr/genimage.cfg
 create mode 100644 board/qemu/aarch64-ebbr/grub.cfg
 create mode 100755 board/qemu/aarch64-ebbr/post-image.sh
 create mode 100644 board/qemu/aarch64-ebbr/readme.txt
 create mode 100644 board/qemu/aarch64-ebbr/u-boot.config
 create mode 100644 configs/qemu_aarch64_ebbr_defconfig

Comments

Giulio Benetti Sept. 14, 2022, 8:25 p.m. UTC | #1
Hi Vincent,

On 14/09/22 16:08, Vincent Stehlé wrote:
> Add a defconfig to build an AArch64 U-Boot based firmware implementing the
> subset of UEFI defined by EBBR[1], as well as a Linux OS disk image booting
> with UEFI, to run on Qemu.
> 
> The generated firmware binary can also be used to install or run another OS
> supporting the EBBR specification.
> 
> [1]: https://github.com/ARM-software/ebbr
> 
> Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
> Cc: Romain Naour <romain.naour@gmail.com>
> ---
> 
> 
> Hi,
> 
> I would prefer to add my work e-mail in DEVELOPERS for this defconfig.
> Please let me know if this is ok or if I should keep a single e-mail
> address.

It is possible, there is a pending patch exactly for this:
https://patchwork.ozlabs.org/project/buildroot/patch/7149_1663079883_632095CB_7149_153_1_84f14454278c823f23654b20e44af7dc646b6fdd.1663079879.git.yann.morin@orange.com/
and comes from one of the maintainers.

> Thanks!
> 
> Best regards,
> Vincent.
> 
> 
>   DEVELOPERS                            |   3 +
>   board/qemu/aarch64-ebbr/genimage.cfg  |  31 ++++++++
>   board/qemu/aarch64-ebbr/grub.cfg      |   6 ++
>   board/qemu/aarch64-ebbr/post-image.sh |  11 +++
>   board/qemu/aarch64-ebbr/readme.txt    | 103 ++++++++++++++++++++++++++
>   board/qemu/aarch64-ebbr/u-boot.config |  34 +++++++++
>   configs/qemu_aarch64_ebbr_defconfig   |  53 +++++++++++++
>   7 files changed, 241 insertions(+)
>   create mode 100644 board/qemu/aarch64-ebbr/genimage.cfg
>   create mode 100644 board/qemu/aarch64-ebbr/grub.cfg
>   create mode 100755 board/qemu/aarch64-ebbr/post-image.sh
>   create mode 100644 board/qemu/aarch64-ebbr/readme.txt
>   create mode 100644 board/qemu/aarch64-ebbr/u-boot.config
>   create mode 100644 configs/qemu_aarch64_ebbr_defconfig
> 
> diff --git a/DEVELOPERS b/DEVELOPERS
> index a707b0e5e1..ea856b5a7a 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -2999,6 +2999,9 @@ N:	Vincent Prince <vincent.prince.fr@gmail.com>
>   F:	package/nss-myhostname/
>   F:	package/utp_com/
>   
> +N:	Vincent Stehlé <vincent.stehle@arm.com>
> +F:	configs/qemu_aarch64_ebbr_defconfig
> +
>   N:	Vincent Stehlé <vincent.stehle@laposte.net>
>   F:	board/bananapi/bananapi-m2-zero/
>   F:	configs/bananapi_m2_zero_defconfig
> diff --git a/board/qemu/aarch64-ebbr/genimage.cfg b/board/qemu/aarch64-ebbr/genimage.cfg
> new file mode 100644
> index 0000000000..9a49e072f5
> --- /dev/null
> +++ b/board/qemu/aarch64-ebbr/genimage.cfg
> @@ -0,0 +1,31 @@
> +image efi-part.vfat {
> +	vfat {
> +		file EFI {
> +			image = "efi-part/EFI"
> +		}
> +
> +		file Image {
> +			image = "Image"
> +		}
> +	}
> +
> +	size = 128M
> +}
> +
> +image disk.img {
> +	hdimage {
> +		partition-table-type = "gpt"
> +	}
> +
> +	partition boot {
> +		image = "efi-part.vfat"
> +		partition-type-uuid = c12a7328-f81f-11d2-ba4b-00a0c93ec93b

Here ^^^ it's been decided to use genimage shortcut letters, in this 
case U since it's EFI.

> +		offset = 32K
> +		bootable = true
> +	}
> +
> +	partition root {
> +		partition-type-uuid = b921b045-1df0-41c3-af44-4c6f280d3fae

Here ^^^ instead is correct according to Buildroot manual.
You can check it on following link:
https://buildroot.org/downloads/manual/manual.html#writing-genimage-cfg

> +		image = "rootfs.ext2"
> +	}
> +}
> diff --git a/board/qemu/aarch64-ebbr/grub.cfg b/board/qemu/aarch64-ebbr/grub.cfg
> new file mode 100644
> index 0000000000..d99e19c4cd
> --- /dev/null
> +++ b/board/qemu/aarch64-ebbr/grub.cfg
> @@ -0,0 +1,6 @@
> +set default="0"
> +set timeout="5"
> +
> +menuentry "Buildroot" {
> +	linux /Image root=PARTLABEL=root rootwait
> +}
> diff --git a/board/qemu/aarch64-ebbr/post-image.sh b/board/qemu/aarch64-ebbr/post-image.sh
> new file mode 100755
> index 0000000000..c884a8b6f6
> --- /dev/null
> +++ b/board/qemu/aarch64-ebbr/post-image.sh
> @@ -0,0 +1,11 @@
> +#!/bin/sh
> +set -eu
> +
> +BOARD_DIR=$(dirname "$0")
> +
> +# Create flash.bin TF-A FIP image from bl1.bin and fip.bin
> +dd if="${BINARIES_DIR}/bl1.bin" of="${BINARIES_DIR}/flash.bin" bs=1M
> +dd if="${BINARIES_DIR}/fip.bin" of="${BINARIES_DIR}/flash.bin" seek=64 bs=4096 conv=notrunc
> +
> +# Override the default GRUB configuration file with our own.
> +cp -f "${BOARD_DIR}/grub.cfg" "${BINARIES_DIR}/efi-part/EFI/BOOT/grub.cfg"
> diff --git a/board/qemu/aarch64-ebbr/readme.txt b/board/qemu/aarch64-ebbr/readme.txt
> new file mode 100644
> index 0000000000..a2027dad44
> --- /dev/null
> +++ b/board/qemu/aarch64-ebbr/readme.txt
> @@ -0,0 +1,103 @@
> +Introduction
> +============
> +
> +The qemu_aarch64_ebbr_defconfig is meant to illustrate some aspects of the Arm
> +EBBR specification[1] and the Arm SystemReady IR[2] compliance program.
> +It allows building an AArch64 U-Boot based firmware implementing the subset of
> +UEFI defined by EBBR, as well as a Linux OS disk image booting with UEFI, to run
> +on Qemu.
> +
> +Building
> +========
> +
> +  $ make qemu_aarch64_ebbr_defconfig
> +  $ make
> +
> +Generated files under output/images:
> +
> +* flash.bin: A firmware image comprising TF-A, OP-TEE and the U-Boot bootloader.
> +
> +* disk.img: An OS disk image comprising the GRUB bootloader, the Linux kernel
> +  and the root filesystem.
> +
> +Running under Qemu
> +==================
> +
> +Run the emulation with:
> +
> +  qemu-system-aarch64 \
> +      -M virt,secure=on \
> +      -bios output/images/flash.bin \
> +      -cpu cortex-a53 \
> +      -device virtio-blk-device,drive=hd0 \
> +      -device virtio-net-device,netdev=eth0 \
> +      -device virtio-rng-device,rng=rng0 \
> +      -drive file=output/images/disk.img,if=none,format=raw,id=hd0 \
> +      -m 1024 \
> +      -netdev user,id=eth0 \
> +      -no-acpi \
> +      -nographic \
> +      -object rng-random,filename=/dev/urandom,id=rng0 \
> +      -rtc base=utc,clock=host \
> +      -smp 2 # qemu_aarch64_ebbr_defconfig
> +
> +The login prompt will appear in the terminal that started Qemu.
> +
> +Using the EBBR firmware to run another OS under Qemu
> +----------------------------------------------------
> +
> +It is possible to use the generated firmware binary to install or run another OS
> +supporting the EBBR specification.
> +
> +To run another OS on emulation using a live or pre-installed image, use the same
> +Qemu command line as for the generated OS but adapt the OS image path in the
> +-drive stanza.
> +The image generated by the aarch64_efi_defconfig or the Arm ACS-IR images[3] are
> +examples of pre-installed OS images.
> +
> +To install another OS using an installer iso image, prepare a destination disk
> +image first with:
> +
> +  qemu-img create -f qcow2 disk.qcow2 10G
> +
> +Then run the OS installer iso image on emulation with:
> +
> +  qemu-system-aarch64 \
> +      -M virt,secure=on \
> +      -bios output/images/flash.bin \
> +      -cpu cortex-a53 \
> +      -device virtio-blk-device,drive=hd1 \
> +      -device virtio-blk-device,drive=hd0 \
> +      -device virtio-net-device,netdev=eth0 \
> +      -device virtio-rng-device,rng=rng0 \
> +      -drive file=<iso>,if=none,format=raw,readonly=on,id=hd0 \
> +      -drive file=disk.qcow2,if=none,id=hd1 \
> +      -m 1024 \
> +      -netdev user,id=eth0 \
> +      -no-acpi \
> +      -nographic \
> +      -object rng-random,filename=/dev/urandom,id=rng0 \
> +      -rtc base=utc,clock=host \
> +      -smp 2
> +
> +The installation medium will show up under the Linux OS installer as /dev/vda
> +and the destination disk as /dev/vdb.
> +To reboot into the installed OS, use the same Qemu command line as for the
> +installation, but without the two stanzas
> +referring to hd0.
> +Linux distributions such as Debian, Fedora, openSUSE or Ubuntu provide an OS
> +installer iso image.
> +
> +Miscellaneous
> +=============
> +
> +This configuration is inspired by the qemu_aarch64_virt_defconfig, the
> +aarch64_efi_defconfig and the Arm SystemReady IR IoT Integration, Test, and
> +Certification Guide[4].
> +
> +Firmware update is currently not supported.
> +
> +[1]: https://github.com/ARM-software/ebbr
> +[2]: https://developer.arm.com/Architectures/Arm%20SystemReady%20IR
> +[3]: https://github.com/ARM-software/arm-systemready/tree/main/IR/prebuilt_images
> +[4]: https://developer.arm.com/documentation/DUI1101/1-1/?lang=en
> diff --git a/board/qemu/aarch64-ebbr/u-boot.config b/board/qemu/aarch64-ebbr/u-boot.config
> new file mode 100644
> index 0000000000..94aae9d2aa
> --- /dev/null
> +++ b/board/qemu/aarch64-ebbr/u-boot.config
> @@ -0,0 +1,34 @@
> +CONFIG_BOOTM_EFI=y
> +CONFIG_CMD_BOOTEFI=y
> +CONFIG_CMD_BOOTEFI_HELLO=y
> +CONFIG_CMD_BOOTEFI_HELLO_COMPILE=y
> +CONFIG_CMD_BOOTEFI_SELFTEST=y
> +CONFIG_CMD_EFIDEBUG=y
> +CONFIG_CMD_EFI_VARIABLE_FILE_STORE=y
> +CONFIG_CMD_GPT=y
> +CONFIG_CMD_NVEDIT_EFI=y
> +CONFIG_CMD_RNG=y
> +CONFIG_CMD_RTC=y
> +CONFIG_DM_RTC=y
> +CONFIG_EFI_DEVICE_PATH_TO_TEXT=y
> +CONFIG_EFI_GET_TIME=y
> +CONFIG_EFI_HAVE_RUNTIME_RESET=y
> +CONFIG_EFI_LOADER=y
> +CONFIG_EFI_LOADER_HII=y
> +CONFIG_EFI_MM_COMM_TEE=y
> +CONFIG_EFI_PARTITION=y
> +CONFIG_EFI_SECURE_BOOT=y
> +CONFIG_EFI_SET_TIME=y
> +CONFIG_EFI_UNICODE_CAPITALIZATION=y
> +CONFIG_EFI_UNICODE_COLLATION_PROTOCOL2=y
> +CONFIG_EFI_VARIABLE_FILE_STORE=y
> +CONFIG_FAT_WRITE=y
> +CONFIG_FIT=y
> +CONFIG_FS_FAT=y
> +CONFIG_OF_LIBFDT=y
> +CONFIG_OPTEE=y
> +CONFIG_PARTITION_TYPE_GUID=y
> +CONFIG_RNG_OPTEE=y
> +CONFIG_RTC_EMULATION=y
> +CONFIG_SCMI_FIRMWARE=y
> +CONFIG_TEE=y
> diff --git a/configs/qemu_aarch64_ebbr_defconfig b/configs/qemu_aarch64_ebbr_defconfig
> new file mode 100644
> index 0000000000..c8a516ddaa
> --- /dev/null
> +++ b/configs/qemu_aarch64_ebbr_defconfig
> @@ -0,0 +1,53 @@
> +# Architecture
> +BR2_aarch64=y
> +
> +# Toolchain, required for GRUB
> +BR2_TOOLCHAIN_BUILDROOT_WCHAR=y

This ^^^ is only needed for uclibc, but the default libc now is glibc,
so you don't need to specify it.

> +
> +# Image
> +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh board/qemu/aarch64-ebbr/post-image.sh support/scripts/genimage.sh"
> +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG) -c board/qemu/aarch64-ebbr/genimage.cfg"
> +
> +# Linux headers
> +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_17=y

For this ^^^ please specify in commit log that at the moment we don't
have 5.19 headers available and so we rely on 5.17.

> +
> +# Kernel
> +BR2_LINUX_KERNEL=y
> +BR2_LINUX_KERNEL_CUSTOM_VERSION=y
> +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.19.8"
> +BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
> +BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
> +
> +# Packages
> +BR2_PACKAGE_OPTEE_CLIENT=y
> +
> +# Filesystem
> +BR2_TARGET_ROOTFS_EXT2=y
> +BR2_TARGET_ROOTFS_EXT2_4=y
> +BR2_TARGET_ROOTFS_EXT2_SIZE="200M"
> +# BR2_TARGET_ROOTFS_TAR is not set
> +
> +# Firmware and bootloader
> +BR2_TARGET_ARM_TRUSTED_FIRMWARE=y
> +BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION=y
> +BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION_VALUE="v2.7"
> +BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="qemu"
> +BR2_TARGET_ARM_TRUSTED_FIRMWARE_FIP=y
> +BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL32_OPTEE=y
> +BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_AS_BL33=y
> +BR2_TARGET_GRUB2=y
> +BR2_TARGET_OPTEE_OS=y
> +BR2_TARGET_OPTEE_OS_NEEDS_DTC=y
> +BR2_TARGET_OPTEE_OS_PLATFORM="vexpress-qemu_armv8a"
> +BR2_TARGET_UBOOT=y
> +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
> +BR2_TARGET_UBOOT_CUSTOM_VERSION=y
> +BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2022.07"
> +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="qemu_arm64"
> +BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="board/qemu/aarch64-ebbr/u-boot.config"
> +BR2_TARGET_UBOOT_NEEDS_OPENSSL=y
> +
> +# Host tools
> +BR2_PACKAGE_HOST_DOSFSTOOLS=y
> +BR2_PACKAGE_HOST_GENIMAGE=y
> +BR2_PACKAGE_HOST_MTOOLS=y

It builds fine using utils/docker-run and I've run it successfully with
qemu.

So I wait for V2.

Thank you!

Best regards
Romain Naour Sept. 14, 2022, 8:49 p.m. UTC | #2
Hello Vincent,

Le 14/09/2022 à 16:08, Vincent Stehlé a écrit :
> Add a defconfig to build an AArch64 U-Boot based firmware implementing the
> subset of UEFI defined by EBBR[1], as well as a Linux OS disk image booting
> with UEFI, to run on Qemu.
> 
> The generated firmware binary can also be used to install or run another OS
> supporting the EBBR specification.
> 
> [1]: https://github.com/ARM-software/ebbr
> 
> Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
> Cc: Romain Naour <romain.naour@gmail.com>
> ---
> 
> 
> Hi,
> 
> I would prefer to add my work e-mail in DEVELOPERS for this defconfig.
> Please let me know if this is ok or if I should keep a single e-mail
> address.
> Thanks!

I'm ok with that.

> 
> Best regards,
> Vincent.
> 
> 
>  DEVELOPERS                            |   3 +
>  board/qemu/aarch64-ebbr/genimage.cfg  |  31 ++++++++
>  board/qemu/aarch64-ebbr/grub.cfg      |   6 ++
>  board/qemu/aarch64-ebbr/post-image.sh |  11 +++
>  board/qemu/aarch64-ebbr/readme.txt    | 103 ++++++++++++++++++++++++++
>  board/qemu/aarch64-ebbr/u-boot.config |  34 +++++++++
>  configs/qemu_aarch64_ebbr_defconfig   |  53 +++++++++++++
>  7 files changed, 241 insertions(+)
>  create mode 100644 board/qemu/aarch64-ebbr/genimage.cfg
>  create mode 100644 board/qemu/aarch64-ebbr/grub.cfg
>  create mode 100755 board/qemu/aarch64-ebbr/post-image.sh
>  create mode 100644 board/qemu/aarch64-ebbr/readme.txt
>  create mode 100644 board/qemu/aarch64-ebbr/u-boot.config
>  create mode 100644 configs/qemu_aarch64_ebbr_defconfig
> 
> diff --git a/DEVELOPERS b/DEVELOPERS
> index a707b0e5e1..ea856b5a7a 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -2999,6 +2999,9 @@ N:	Vincent Prince <vincent.prince.fr@gmail.com>
>  F:	package/nss-myhostname/
>  F:	package/utp_com/
>  
> +N:	Vincent Stehlé <vincent.stehle@arm.com>
> +F:	configs/qemu_aarch64_ebbr_defconfig
> +
>  N:	Vincent Stehlé <vincent.stehle@laposte.net>
>  F:	board/bananapi/bananapi-m2-zero/
>  F:	configs/bananapi_m2_zero_defconfig
> diff --git a/board/qemu/aarch64-ebbr/genimage.cfg b/board/qemu/aarch64-ebbr/genimage.cfg
> new file mode 100644
> index 0000000000..9a49e072f5
> --- /dev/null
> +++ b/board/qemu/aarch64-ebbr/genimage.cfg
> @@ -0,0 +1,31 @@
> +image efi-part.vfat {
> +	vfat {
> +		file EFI {
> +			image = "efi-part/EFI"
> +		}
> +
> +		file Image {
> +			image = "Image"
> +		}
> +	}
> +
> +	size = 128M
> +}
> +
> +image disk.img {
> +	hdimage {
> +		partition-table-type = "gpt"
> +	}
> +
> +	partition boot {
> +		image = "efi-part.vfat"
> +		partition-type-uuid = c12a7328-f81f-11d2-ba4b-00a0c93ec93b

You can replace this line by:
  partition-type-uuid = U

See:
https://git.buildroot.net/buildroot/commit/?id=025d8ac80d06ad46ec3042c4af85ddd6a5e09b80

> +		offset = 32K
> +		bootable = true
> +	}
> +
> +	partition root {
> +		partition-type-uuid = b921b045-1df0-41c3-af44-4c6f280d3fae
> +		image = "rootfs.ext2"
> +	}
> +}
> diff --git a/board/qemu/aarch64-ebbr/grub.cfg b/board/qemu/aarch64-ebbr/grub.cfg
> new file mode 100644
> index 0000000000..d99e19c4cd
> --- /dev/null
> +++ b/board/qemu/aarch64-ebbr/grub.cfg
> @@ -0,0 +1,6 @@
> +set default="0"
> +set timeout="5"
> +
> +menuentry "Buildroot" {
> +	linux /Image root=PARTLABEL=root rootwait
> +}
> diff --git a/board/qemu/aarch64-ebbr/post-image.sh b/board/qemu/aarch64-ebbr/post-image.sh
> new file mode 100755
> index 0000000000..c884a8b6f6
> --- /dev/null
> +++ b/board/qemu/aarch64-ebbr/post-image.sh
> @@ -0,0 +1,11 @@
> +#!/bin/sh
> +set -eu
> +
> +BOARD_DIR=$(dirname "$0")
> +
> +# Create flash.bin TF-A FIP image from bl1.bin and fip.bin
> +dd if="${BINARIES_DIR}/bl1.bin" of="${BINARIES_DIR}/flash.bin" bs=1M
> +dd if="${BINARIES_DIR}/fip.bin" of="${BINARIES_DIR}/flash.bin" seek=64 bs=4096 conv=notrunc
> +
> +# Override the default GRUB configuration file with our own.
> +cp -f "${BOARD_DIR}/grub.cfg" "${BINARIES_DIR}/efi-part/EFI/BOOT/grub.cfg"
> diff --git a/board/qemu/aarch64-ebbr/readme.txt b/board/qemu/aarch64-ebbr/readme.txt
> new file mode 100644
> index 0000000000..a2027dad44
> --- /dev/null
> +++ b/board/qemu/aarch64-ebbr/readme.txt
> @@ -0,0 +1,103 @@
> +Introduction
> +============
> +
> +The qemu_aarch64_ebbr_defconfig is meant to illustrate some aspects of the Arm
> +EBBR specification[1] and the Arm SystemReady IR[2] compliance program.
> +It allows building an AArch64 U-Boot based firmware implementing the subset of
> +UEFI defined by EBBR, as well as a Linux OS disk image booting with UEFI, to run
> +on Qemu.
> +
> +Building
> +========
> +
> +  $ make qemu_aarch64_ebbr_defconfig
> +  $ make
> +
> +Generated files under output/images:
> +
> +* flash.bin: A firmware image comprising TF-A, OP-TEE and the U-Boot bootloader.
> +
> +* disk.img: An OS disk image comprising the GRUB bootloader, the Linux kernel
> +  and the root filesystem.
> +
> +Running under Qemu
> +==================
> +
> +Run the emulation with:
> +
> +  qemu-system-aarch64 \
> +      -M virt,secure=on \
> +      -bios output/images/flash.bin \
> +      -cpu cortex-a53 \
> +      -device virtio-blk-device,drive=hd0 \
> +      -device virtio-net-device,netdev=eth0 \
> +      -device virtio-rng-device,rng=rng0 \
> +      -drive file=output/images/disk.img,if=none,format=raw,id=hd0 \
> +      -m 1024 \
> +      -netdev user,id=eth0 \
> +      -no-acpi \
> +      -nographic \
> +      -object rng-random,filename=/dev/urandom,id=rng0 \
> +      -rtc base=utc,clock=host \
> +      -smp 2 # qemu_aarch64_ebbr_defconfig
> +
> +The login prompt will appear in the terminal that started Qemu.
> +
> +Using the EBBR firmware to run another OS under Qemu
> +----------------------------------------------------
> +
> +It is possible to use the generated firmware binary to install or run another OS
> +supporting the EBBR specification.
> +
> +To run another OS on emulation using a live or pre-installed image, use the same
> +Qemu command line as for the generated OS but adapt the OS image path in the
> +-drive stanza.
> +The image generated by the aarch64_efi_defconfig or the Arm ACS-IR images[3] are
> +examples of pre-installed OS images.
> +
> +To install another OS using an installer iso image, prepare a destination disk
> +image first with:
> +
> +  qemu-img create -f qcow2 disk.qcow2 10G
> +
> +Then run the OS installer iso image on emulation with:
> +
> +  qemu-system-aarch64 \
> +      -M virt,secure=on \
> +      -bios output/images/flash.bin \
> +      -cpu cortex-a53 \
> +      -device virtio-blk-device,drive=hd1 \
> +      -device virtio-blk-device,drive=hd0 \
> +      -device virtio-net-device,netdev=eth0 \
> +      -device virtio-rng-device,rng=rng0 \
> +      -drive file=<iso>,if=none,format=raw,readonly=on,id=hd0 \
> +      -drive file=disk.qcow2,if=none,id=hd1 \
> +      -m 1024 \
> +      -netdev user,id=eth0 \
> +      -no-acpi \
> +      -nographic \
> +      -object rng-random,filename=/dev/urandom,id=rng0 \
> +      -rtc base=utc,clock=host \
> +      -smp 2
> +
> +The installation medium will show up under the Linux OS installer as /dev/vda
> +and the destination disk as /dev/vdb.
> +To reboot into the installed OS, use the same Qemu command line as for the
> +installation, but without the two stanzas
> +referring to hd0.
> +Linux distributions such as Debian, Fedora, openSUSE or Ubuntu provide an OS
> +installer iso image.
> +
> +Miscellaneous
> +=============
> +
> +This configuration is inspired by the qemu_aarch64_virt_defconfig, the
> +aarch64_efi_defconfig and the Arm SystemReady IR IoT Integration, Test, and
> +Certification Guide[4].
> +
> +Firmware update is currently not supported.
> +
> +[1]: https://github.com/ARM-software/ebbr
> +[2]: https://developer.arm.com/Architectures/Arm%20SystemReady%20IR
> +[3]: https://github.com/ARM-software/arm-systemready/tree/main/IR/prebuilt_images
> +[4]: https://developer.arm.com/documentation/DUI1101/1-1/?lang=en
> diff --git a/board/qemu/aarch64-ebbr/u-boot.config b/board/qemu/aarch64-ebbr/u-boot.config
> new file mode 100644
> index 0000000000..94aae9d2aa
> --- /dev/null
> +++ b/board/qemu/aarch64-ebbr/u-boot.config
> @@ -0,0 +1,34 @@
> +CONFIG_BOOTM_EFI=y
> +CONFIG_CMD_BOOTEFI=y
> +CONFIG_CMD_BOOTEFI_HELLO=y
> +CONFIG_CMD_BOOTEFI_HELLO_COMPILE=y
> +CONFIG_CMD_BOOTEFI_SELFTEST=y
> +CONFIG_CMD_EFIDEBUG=y
> +CONFIG_CMD_EFI_VARIABLE_FILE_STORE=y
> +CONFIG_CMD_GPT=y
> +CONFIG_CMD_NVEDIT_EFI=y
> +CONFIG_CMD_RNG=y
> +CONFIG_CMD_RTC=y
> +CONFIG_DM_RTC=y
> +CONFIG_EFI_DEVICE_PATH_TO_TEXT=y
> +CONFIG_EFI_GET_TIME=y
> +CONFIG_EFI_HAVE_RUNTIME_RESET=y
> +CONFIG_EFI_LOADER=y
> +CONFIG_EFI_LOADER_HII=y
> +CONFIG_EFI_MM_COMM_TEE=y
> +CONFIG_EFI_PARTITION=y
> +CONFIG_EFI_SECURE_BOOT=y
> +CONFIG_EFI_SET_TIME=y
> +CONFIG_EFI_UNICODE_CAPITALIZATION=y
> +CONFIG_EFI_UNICODE_COLLATION_PROTOCOL2=y
> +CONFIG_EFI_VARIABLE_FILE_STORE=y
> +CONFIG_FAT_WRITE=y
> +CONFIG_FIT=y
> +CONFIG_FS_FAT=y
> +CONFIG_OF_LIBFDT=y
> +CONFIG_OPTEE=y
> +CONFIG_PARTITION_TYPE_GUID=y
> +CONFIG_RNG_OPTEE=y
> +CONFIG_RTC_EMULATION=y
> +CONFIG_SCMI_FIRMWARE=y
> +CONFIG_TEE=y
> diff --git a/configs/qemu_aarch64_ebbr_defconfig b/configs/qemu_aarch64_ebbr_defconfig
> new file mode 100644
> index 0000000000..c8a516ddaa
> --- /dev/null
> +++ b/configs/qemu_aarch64_ebbr_defconfig
> @@ -0,0 +1,53 @@
> +# Architecture
> +BR2_aarch64=y
> +
> +# Toolchain, required for GRUB
> +BR2_TOOLCHAIN_BUILDROOT_WCHAR=y

The new default libc is now glibc on the current master branch, so you can drop
BR2_TOOLCHAIN_BUILDROOT_WCHAR=y

Otherwise:
Reviewed-by: Romain Naour <romain.naour@gmail.com>

Best regards,
Romain


> +
> +# Image
> +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh board/qemu/aarch64-ebbr/post-image.sh support/scripts/genimage.sh"
> +BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG) -c board/qemu/aarch64-ebbr/genimage.cfg"
> +
> +# Linux headers
> +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_17=y
> +
> +# Kernel
> +BR2_LINUX_KERNEL=y
> +BR2_LINUX_KERNEL_CUSTOM_VERSION=y
> +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.19.8"
> +BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
> +BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
> +
> +# Packages
> +BR2_PACKAGE_OPTEE_CLIENT=y
> +
> +# Filesystem
> +BR2_TARGET_ROOTFS_EXT2=y
> +BR2_TARGET_ROOTFS_EXT2_4=y
> +BR2_TARGET_ROOTFS_EXT2_SIZE="200M"
> +# BR2_TARGET_ROOTFS_TAR is not set
> +
> +# Firmware and bootloader
> +BR2_TARGET_ARM_TRUSTED_FIRMWARE=y
> +BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION=y
> +BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION_VALUE="v2.7"
> +BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="qemu"
> +BR2_TARGET_ARM_TRUSTED_FIRMWARE_FIP=y
> +BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL32_OPTEE=y
> +BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_AS_BL33=y
> +BR2_TARGET_GRUB2=y
> +BR2_TARGET_OPTEE_OS=y
> +BR2_TARGET_OPTEE_OS_NEEDS_DTC=y
> +BR2_TARGET_OPTEE_OS_PLATFORM="vexpress-qemu_armv8a"
> +BR2_TARGET_UBOOT=y
> +BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
> +BR2_TARGET_UBOOT_CUSTOM_VERSION=y
> +BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2022.07"
> +BR2_TARGET_UBOOT_BOARD_DEFCONFIG="qemu_arm64"
> +BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="board/qemu/aarch64-ebbr/u-boot.config"
> +BR2_TARGET_UBOOT_NEEDS_OPENSSL=y
> +
> +# Host tools
> +BR2_PACKAGE_HOST_DOSFSTOOLS=y
> +BR2_PACKAGE_HOST_GENIMAGE=y
> +BR2_PACKAGE_HOST_MTOOLS=y
Vincent Stehlé Sept. 15, 2022, 3:03 p.m. UTC | #3
On Wed, Sep 14, 2022 at 10:25:15PM +0200, Giulio Benetti wrote:
> Hi Vincent,

Hi Giulio,

Thank you for the review. More comments below, but I would like to ask already:
shall I add your "reviewed-by" when I send a v2, please?

> On 14/09/22 16:08, Vincent Stehlé wrote:
..
> > I would prefer to add my work e-mail in DEVELOPERS for this defconfig.
> > Please let me know if this is ok or if I should keep a single e-mail
> > address.
> 
> It is possible, there is a pending patch exactly for this:
> https://patchwork.ozlabs.org/project/buildroot/patch/7149_1663079883_632095CB_7149_153_1_84f14454278c823f23654b20e44af7dc646b6fdd.1663079879.git.yann.morin@orange.com/
> and comes from one of the maintainers.

Thanks for the confirmation.

..
> > +	partition boot {
> > +		image = "efi-part.vfat"
> > +		partition-type-uuid = c12a7328-f81f-11d2-ba4b-00a0c93ec93b
> 
> Here ^^^ it's been decided to use genimage shortcut letters, in this case U
> since it's EFI.

Ok, will do.

> > +		offset = 32K
> > +		bootable = true
> > +	}
> > +
> > +	partition root {
> > +		partition-type-uuid = b921b045-1df0-41c3-af44-4c6f280d3fae
> 
> Here ^^^ instead is correct according to Buildroot manual.
> You can check it on following link:
> https://buildroot.org/downloads/manual/manual.html#writing-genimage-cfg

On second thought I think I might as well not specify the uuid at all and rely
on the default being 'L'.

..
> > +# Toolchain, required for GRUB
> > +BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
> 
> This ^^^ is only needed for uclibc, but the default libc now is glibc,
> so you don't need to specify it.

Ok, will remove.

..
> > +# Linux headers
> > +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_17=y
> 
> For this ^^^ please specify in commit log that at the moment we don't
> have 5.19 headers available and so we rely on 5.17.

Ok, will do.

..
> It builds fine using utils/docker-run and I've run it successfully with
> qemu.

Thank you for testing!

Best regards,
Vincent.

> So I wait for V2.
> 
> Thank you!
> 
> Best regards
> -- 
> Giulio Benetti
> Benetti Engineering sas
Vincent Stehlé Sept. 15, 2022, 3:06 p.m. UTC | #4
On Wed, Sep 14, 2022 at 10:49:36PM +0200, Romain Naour wrote:
> Hello Vincent,
> 
> Le 14/09/2022 à 16:08, Vincent Stehlé a écrit :
..
> > I would prefer to add my work e-mail in DEVELOPERS for this defconfig.
> > Please let me know if this is ok or if I should keep a single e-mail
> > address.
> > Thanks!
> 
> I'm ok with that.

Hi Romain,

Thank you for the confirmation.

..
> > +	partition boot {
> > +		image = "efi-part.vfat"
> > +		partition-type-uuid = c12a7328-f81f-11d2-ba4b-00a0c93ec93b
> 
> You can replace this line by:
>   partition-type-uuid = U
> 
> See:
> https://git.buildroot.net/buildroot/commit/?id=025d8ac80d06ad46ec3042c4af85ddd6a5e09b80

Ok, will do.

..
> > +# Toolchain, required for GRUB
> > +BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
> 
> The new default libc is now glibc on the current master branch, so you can drop
> BR2_TOOLCHAIN_BUILDROOT_WCHAR=y

Ok, will do.

> 
> Otherwise:
> Reviewed-by: Romain Naour <romain.naour@gmail.com>

Thank you!

I will send a v2.

Best regards,
Vincent.

> 
> Best regards,
> Romain
Giulio Benetti Sept. 15, 2022, 7:07 p.m. UTC | #5
Hi Vincent,

On 15/09/22 17:03, Vincent Stehlé wrote:
> On Wed, Sep 14, 2022 at 10:25:15PM +0200, Giulio Benetti wrote:
>> Hi Vincent,
> 
> Hi Giulio,
> 
> Thank you for the review. More comments below, but I would like to ask already:
> shall I add your "reviewed-by" when I send a v2, please?

With everything listed from and me Romain(that are basically the same
:-)) yes, but you should usually wait for the reviewer to write it
explicitly.

>> On 14/09/22 16:08, Vincent Stehlé wrote:
> ..
>>> I would prefer to add my work e-mail in DEVELOPERS for this defconfig.
>>> Please let me know if this is ok or if I should keep a single e-mail
>>> address.
>>
>> It is possible, there is a pending patch exactly for this:
>> https://patchwork.ozlabs.org/project/buildroot/patch/7149_1663079883_632095CB_7149_153_1_84f14454278c823f23654b20e44af7dc646b6fdd.1663079879.git.yann.morin@orange.com/
>> and comes from one of the maintainers.
> 
> Thanks for the confirmation.
> 
> ..
>>> +	partition boot {
>>> +		image = "efi-part.vfat"
>>> +		partition-type-uuid = c12a7328-f81f-11d2-ba4b-00a0c93ec93b
>>
>> Here ^^^ it's been decided to use genimage shortcut letters, in this case U
>> since it's EFI.
> 
> Ok, will do.
> 
>>> +		offset = 32K
>>> +		bootable = true
>>> +	}
>>> +
>>> +	partition root {
>>> +		partition-type-uuid = b921b045-1df0-41c3-af44-4c6f280d3fae
>>
>> Here ^^^ instead is correct according to Buildroot manual.
>> You can check it on following link:
>> https://buildroot.org/downloads/manual/manual.html#writing-genimage-cfg
> 
> On second thought I think I might as well not specify the uuid at all and rely
> on the default being 'L'.

No, as stated in Buildroot manual[0]:
"Even though L is the default value of genimage, we prefer to have it 
explicitly specified in our genimage.cfg files"
So you should specify the partition-type-uuid = 
b921b045-1df0-41c3-af44-4c6f280d3fae as it is now.

[0]: https://buildroot.org/downloads/manual/manual.html#writing-genimage-cfg

> ..
>>> +# Toolchain, required for GRUB
>>> +BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
>>
>> This ^^^ is only needed for uclibc, but the default libc now is glibc,
>> so you don't need to specify it.
> 
> Ok, will remove.
> 
> ..
>>> +# Linux headers
>>> +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_17=y
>>
>> For this ^^^ please specify in commit log that at the moment we don't
>> have 5.19 headers available and so we rely on 5.17.
> 
> Ok, will do.
> 
> ..
>> It builds fine using utils/docker-run and I've run it successfully with
>> qemu.
> 
> Thank you for testing!

You're welcome and so with all the corrected points:
Reviewed-by: Giulio Benetti <giulio.benetti@benettiengineering.com>>

Best regards!
Vincent Stehlé Sept. 16, 2022, 7:29 a.m. UTC | #6
On Thu, Sep 15, 2022 at 09:07:19PM +0200, Giulio Benetti wrote:
..
> > > > +	partition root {
> > > > +		partition-type-uuid = b921b045-1df0-41c3-af44-4c6f280d3fae
> > > 
> > > Here ^^^ instead is correct according to Buildroot manual.
> > > You can check it on following link:
> > > https://buildroot.org/downloads/manual/manual.html#writing-genimage-cfg
> > 
> > On second thought I think I might as well not specify the uuid at all and rely
> > on the default being 'L'.
> 
> No, as stated in Buildroot manual[0]:
> "Even though L is the default value of genimage, we prefer to have it
> explicitly specified in our genimage.cfg files"
> So you should specify the partition-type-uuid =
> b921b045-1df0-41c3-af44-4c6f280d3fae as it is now.

Hi Giulio,

Ok, I will leave it "as is".

..
> > Thank you for testing!
> 
> You're welcome and so with all the corrected points:
> Reviewed-by: Giulio Benetti <giulio.benetti@benettiengineering.com>>

Thank you!

Best regards,
Vincent.

> Best regards!
> -- 
> Giulio Benetti
> Benetti Engineering sas
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
diff mbox series

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index a707b0e5e1..ea856b5a7a 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2999,6 +2999,9 @@  N:	Vincent Prince <vincent.prince.fr@gmail.com>
 F:	package/nss-myhostname/
 F:	package/utp_com/
 
+N:	Vincent Stehlé <vincent.stehle@arm.com>
+F:	configs/qemu_aarch64_ebbr_defconfig
+
 N:	Vincent Stehlé <vincent.stehle@laposte.net>
 F:	board/bananapi/bananapi-m2-zero/
 F:	configs/bananapi_m2_zero_defconfig
diff --git a/board/qemu/aarch64-ebbr/genimage.cfg b/board/qemu/aarch64-ebbr/genimage.cfg
new file mode 100644
index 0000000000..9a49e072f5
--- /dev/null
+++ b/board/qemu/aarch64-ebbr/genimage.cfg
@@ -0,0 +1,31 @@ 
+image efi-part.vfat {
+	vfat {
+		file EFI {
+			image = "efi-part/EFI"
+		}
+
+		file Image {
+			image = "Image"
+		}
+	}
+
+	size = 128M
+}
+
+image disk.img {
+	hdimage {
+		partition-table-type = "gpt"
+	}
+
+	partition boot {
+		image = "efi-part.vfat"
+		partition-type-uuid = c12a7328-f81f-11d2-ba4b-00a0c93ec93b
+		offset = 32K
+		bootable = true
+	}
+
+	partition root {
+		partition-type-uuid = b921b045-1df0-41c3-af44-4c6f280d3fae
+		image = "rootfs.ext2"
+	}
+}
diff --git a/board/qemu/aarch64-ebbr/grub.cfg b/board/qemu/aarch64-ebbr/grub.cfg
new file mode 100644
index 0000000000..d99e19c4cd
--- /dev/null
+++ b/board/qemu/aarch64-ebbr/grub.cfg
@@ -0,0 +1,6 @@ 
+set default="0"
+set timeout="5"
+
+menuentry "Buildroot" {
+	linux /Image root=PARTLABEL=root rootwait
+}
diff --git a/board/qemu/aarch64-ebbr/post-image.sh b/board/qemu/aarch64-ebbr/post-image.sh
new file mode 100755
index 0000000000..c884a8b6f6
--- /dev/null
+++ b/board/qemu/aarch64-ebbr/post-image.sh
@@ -0,0 +1,11 @@ 
+#!/bin/sh
+set -eu
+
+BOARD_DIR=$(dirname "$0")
+
+# Create flash.bin TF-A FIP image from bl1.bin and fip.bin
+dd if="${BINARIES_DIR}/bl1.bin" of="${BINARIES_DIR}/flash.bin" bs=1M
+dd if="${BINARIES_DIR}/fip.bin" of="${BINARIES_DIR}/flash.bin" seek=64 bs=4096 conv=notrunc
+
+# Override the default GRUB configuration file with our own.
+cp -f "${BOARD_DIR}/grub.cfg" "${BINARIES_DIR}/efi-part/EFI/BOOT/grub.cfg"
diff --git a/board/qemu/aarch64-ebbr/readme.txt b/board/qemu/aarch64-ebbr/readme.txt
new file mode 100644
index 0000000000..a2027dad44
--- /dev/null
+++ b/board/qemu/aarch64-ebbr/readme.txt
@@ -0,0 +1,103 @@ 
+Introduction
+============
+
+The qemu_aarch64_ebbr_defconfig is meant to illustrate some aspects of the Arm
+EBBR specification[1] and the Arm SystemReady IR[2] compliance program.
+It allows building an AArch64 U-Boot based firmware implementing the subset of
+UEFI defined by EBBR, as well as a Linux OS disk image booting with UEFI, to run
+on Qemu.
+
+Building
+========
+
+  $ make qemu_aarch64_ebbr_defconfig
+  $ make
+
+Generated files under output/images:
+
+* flash.bin: A firmware image comprising TF-A, OP-TEE and the U-Boot bootloader.
+
+* disk.img: An OS disk image comprising the GRUB bootloader, the Linux kernel
+  and the root filesystem.
+
+Running under Qemu
+==================
+
+Run the emulation with:
+
+  qemu-system-aarch64 \
+      -M virt,secure=on \
+      -bios output/images/flash.bin \
+      -cpu cortex-a53 \
+      -device virtio-blk-device,drive=hd0 \
+      -device virtio-net-device,netdev=eth0 \
+      -device virtio-rng-device,rng=rng0 \
+      -drive file=output/images/disk.img,if=none,format=raw,id=hd0 \
+      -m 1024 \
+      -netdev user,id=eth0 \
+      -no-acpi \
+      -nographic \
+      -object rng-random,filename=/dev/urandom,id=rng0 \
+      -rtc base=utc,clock=host \
+      -smp 2 # qemu_aarch64_ebbr_defconfig
+
+The login prompt will appear in the terminal that started Qemu.
+
+Using the EBBR firmware to run another OS under Qemu
+----------------------------------------------------
+
+It is possible to use the generated firmware binary to install or run another OS
+supporting the EBBR specification.
+
+To run another OS on emulation using a live or pre-installed image, use the same
+Qemu command line as for the generated OS but adapt the OS image path in the
+-drive stanza.
+The image generated by the aarch64_efi_defconfig or the Arm ACS-IR images[3] are
+examples of pre-installed OS images.
+
+To install another OS using an installer iso image, prepare a destination disk
+image first with:
+
+  qemu-img create -f qcow2 disk.qcow2 10G
+
+Then run the OS installer iso image on emulation with:
+
+  qemu-system-aarch64 \
+      -M virt,secure=on \
+      -bios output/images/flash.bin \
+      -cpu cortex-a53 \
+      -device virtio-blk-device,drive=hd1 \
+      -device virtio-blk-device,drive=hd0 \
+      -device virtio-net-device,netdev=eth0 \
+      -device virtio-rng-device,rng=rng0 \
+      -drive file=<iso>,if=none,format=raw,readonly=on,id=hd0 \
+      -drive file=disk.qcow2,if=none,id=hd1 \
+      -m 1024 \
+      -netdev user,id=eth0 \
+      -no-acpi \
+      -nographic \
+      -object rng-random,filename=/dev/urandom,id=rng0 \
+      -rtc base=utc,clock=host \
+      -smp 2
+
+The installation medium will show up under the Linux OS installer as /dev/vda
+and the destination disk as /dev/vdb.
+To reboot into the installed OS, use the same Qemu command line as for the
+installation, but without the two stanzas
+referring to hd0.
+Linux distributions such as Debian, Fedora, openSUSE or Ubuntu provide an OS
+installer iso image.
+
+Miscellaneous
+=============
+
+This configuration is inspired by the qemu_aarch64_virt_defconfig, the
+aarch64_efi_defconfig and the Arm SystemReady IR IoT Integration, Test, and
+Certification Guide[4].
+
+Firmware update is currently not supported.
+
+[1]: https://github.com/ARM-software/ebbr
+[2]: https://developer.arm.com/Architectures/Arm%20SystemReady%20IR
+[3]: https://github.com/ARM-software/arm-systemready/tree/main/IR/prebuilt_images
+[4]: https://developer.arm.com/documentation/DUI1101/1-1/?lang=en
diff --git a/board/qemu/aarch64-ebbr/u-boot.config b/board/qemu/aarch64-ebbr/u-boot.config
new file mode 100644
index 0000000000..94aae9d2aa
--- /dev/null
+++ b/board/qemu/aarch64-ebbr/u-boot.config
@@ -0,0 +1,34 @@ 
+CONFIG_BOOTM_EFI=y
+CONFIG_CMD_BOOTEFI=y
+CONFIG_CMD_BOOTEFI_HELLO=y
+CONFIG_CMD_BOOTEFI_HELLO_COMPILE=y
+CONFIG_CMD_BOOTEFI_SELFTEST=y
+CONFIG_CMD_EFIDEBUG=y
+CONFIG_CMD_EFI_VARIABLE_FILE_STORE=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_NVEDIT_EFI=y
+CONFIG_CMD_RNG=y
+CONFIG_CMD_RTC=y
+CONFIG_DM_RTC=y
+CONFIG_EFI_DEVICE_PATH_TO_TEXT=y
+CONFIG_EFI_GET_TIME=y
+CONFIG_EFI_HAVE_RUNTIME_RESET=y
+CONFIG_EFI_LOADER=y
+CONFIG_EFI_LOADER_HII=y
+CONFIG_EFI_MM_COMM_TEE=y
+CONFIG_EFI_PARTITION=y
+CONFIG_EFI_SECURE_BOOT=y
+CONFIG_EFI_SET_TIME=y
+CONFIG_EFI_UNICODE_CAPITALIZATION=y
+CONFIG_EFI_UNICODE_COLLATION_PROTOCOL2=y
+CONFIG_EFI_VARIABLE_FILE_STORE=y
+CONFIG_FAT_WRITE=y
+CONFIG_FIT=y
+CONFIG_FS_FAT=y
+CONFIG_OF_LIBFDT=y
+CONFIG_OPTEE=y
+CONFIG_PARTITION_TYPE_GUID=y
+CONFIG_RNG_OPTEE=y
+CONFIG_RTC_EMULATION=y
+CONFIG_SCMI_FIRMWARE=y
+CONFIG_TEE=y
diff --git a/configs/qemu_aarch64_ebbr_defconfig b/configs/qemu_aarch64_ebbr_defconfig
new file mode 100644
index 0000000000..c8a516ddaa
--- /dev/null
+++ b/configs/qemu_aarch64_ebbr_defconfig
@@ -0,0 +1,53 @@ 
+# Architecture
+BR2_aarch64=y
+
+# Toolchain, required for GRUB
+BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
+
+# Image
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh board/qemu/aarch64-ebbr/post-image.sh support/scripts/genimage.sh"
+BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG) -c board/qemu/aarch64-ebbr/genimage.cfg"
+
+# Linux headers
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_17=y
+
+# Kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.19.8"
+BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
+BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
+
+# Packages
+BR2_PACKAGE_OPTEE_CLIENT=y
+
+# Filesystem
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
+BR2_TARGET_ROOTFS_EXT2_SIZE="200M"
+# BR2_TARGET_ROOTFS_TAR is not set
+
+# Firmware and bootloader
+BR2_TARGET_ARM_TRUSTED_FIRMWARE=y
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION=y
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION_VALUE="v2.7"
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="qemu"
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_FIP=y
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL32_OPTEE=y
+BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_AS_BL33=y
+BR2_TARGET_GRUB2=y
+BR2_TARGET_OPTEE_OS=y
+BR2_TARGET_OPTEE_OS_NEEDS_DTC=y
+BR2_TARGET_OPTEE_OS_PLATFORM="vexpress-qemu_armv8a"
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG=y
+BR2_TARGET_UBOOT_CUSTOM_VERSION=y
+BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2022.07"
+BR2_TARGET_UBOOT_BOARD_DEFCONFIG="qemu_arm64"
+BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES="board/qemu/aarch64-ebbr/u-boot.config"
+BR2_TARGET_UBOOT_NEEDS_OPENSSL=y
+
+# Host tools
+BR2_PACKAGE_HOST_DOSFSTOOLS=y
+BR2_PACKAGE_HOST_GENIMAGE=y
+BR2_PACKAGE_HOST_MTOOLS=y