Introduce EDK2 firmware builds
cover Introduce EDK2 firmware builds
This series is introducing the EDK2 bootloader package with four different configurations, initially targeting AArch64.
One of the main reasons one would use EDK2 and UEFI on a AArch64 is for different standards compliance scenarios. The most prevalent standards in this space are:
* Server Base System Architecture (SBSA) for hardware platforms
* Server Base Boot Requirement (SBBR) for bootloader firmware
This series introduces a new generic SBSA board called aarch64-sbsa which can be used by any configuration providing SBBR firmware.
Three of the four configurations in this series implement SBBR firmware:
1. aarch_efi_defconfig: EDK2 as stand-alone flash device for QEMU Virt
2. qemu_aarch64_virt_sbbr_defconfig: EDK2 as ATF BL33 for QEMU Virt
3. qemu_aarch64_sbsa_sbbr_defconfig: EDK2 as ATF BL33 for QEMU SBSA
4. arm_foundationv8_sbbr_defconfig: EDK2 as ATF BL33 for ARM FVP
In the first config, the kernel will boot with ACPI enabled but will still opt to using device tree information for some hardware details. This is a more traditional EFI setup but not necessarily SBBR compliant.
The other configs implement SBBR and used the new aarch64-sbsa board.
Dick Olsson (8):
package/edk2-platforms: new package
boot/edk2: new package
boot/arm-trusted-firmware: bump to version 2.2 boot/arm-trusted-firmware: add EDK2 as BL33 option configs/aarch64_efi_defconfig: build the EDK2 firmware from source configs/qemu_aarch64_sbsa_sbbr_defconfig: new config for SBBR on QEMU
SBSA
configs/qemu_aarch64_virt_sbbr_defconfig: new config for SBBR on Virt configs/arm_foundationv8_sbbr_defconfig: new config for SBBR on FVP
board/aarch64-efi/readme.txt | 8 +- board/aarch64-sbsa/genimage-sbsa.cfg | 25 ++++ board/aarch64-sbsa/linux.config | 1 + board/aarch64-sbsa/post-image.sh | 30 +++++ board/aarch64-sbsa/readme.txt | 62 ++++++++++ boot/Config.in | 1 + boot/arm-trusted-firmware/Config.in | 19 ++- .../arm-trusted-firmware.hash | 1 + .../arm-trusted-firmware.mk | 7 ++ boot/edk2/Config.in | 59 ++++++++++ boot/edk2/edk2.hash | 2 + boot/edk2/edk2.mk | 111 ++++++++++++++++++ configs/aarch64_efi_defconfig | 3 + configs/arm_foundationv8_sbbr_defconfig | 46 ++++++++ configs/qemu_aarch64_sbsa_sbbr_defconfig | 44 +++++++ configs/qemu_aarch64_virt_sbbr_defconfig | 46 ++++++++ package/Config.in.host | 1 + package/edk2-platforms/Config.in.host | 8 ++ package/edk2-platforms/edk2-platforms.hash | 2 + package/edk2-platforms/edk2-platforms.mk | 6 + 20 files changed, 474 insertions(+), 8 deletions(-) create mode 100644 board/aarch64-sbsa/genimage-sbsa.cfg create mode 100644 board/aarch64-sbsa/linux.config create mode 100755 board/aarch64-sbsa/post-image.sh create mode 100644 board/aarch64-sbsa/readme.txt create mode 100644 boot/edk2/Config.in create mode 100644 boot/edk2/edk2.hash create mode 100644 boot/edk2/edk2.mk create mode 100644 configs/arm_foundationv8_sbbr_defconfig create mode 100644 configs/qemu_aarch64_sbsa_sbbr_defconfig create mode 100644 configs/qemu_aarch64_virt_sbbr_defconfig create mode 100644 package/edk2-platforms/Config.in.host create mode 100644 package/edk2-platforms/edk2-platforms.hash create mode 100644 package/edk2-platforms/edk2-platforms.mk
Signature · 1 line
2.20.1
PATCH 1/8 package/edk2-platforms: new package
EDK2 firmware is usually built from two sources; the core EDK2 environment, and additional platform description files maintained separately. This host package adds the latter set of description files that the core EDK2 package will depend on for certain platforms during the building process.
--- package/Config.in.host | 1 + package/edk2-platforms/Config.in.host | 8 ++++++++ package/edk2-platforms/edk2-platforms.hash | 2 ++ package/edk2-platforms/edk2-platforms.mk | 6 ++++++ 4 files changed, 17 insertions(+) create mode 100644 package/edk2-platforms/Config.in.host create mode 100644 package/edk2-platforms/edk2-platforms.hash create mode 100644 package/edk2-platforms/edk2-platforms.mk
package/Config.in.host +1 -0
@@ -18,6 +18,7 @@ menu "Host utilities" source "package/dtc/Config.in.host" source "package/e2fsprogs/Config.in.host" source "package/e2tools/Config.in.host" + source "package/edk2-platforms/Config.in.host" source "package/erofs-utils/Config.in.host" source "package/eudev/Config.in.host" source "package/exfatprogs/Config.in.host"
package/edk2-platforms/Config.in.host new file +8 -0
@@ -0,0 +1,8 @@ +config BR2_PACKAGE_HOST_EDK2_PLATFORMS + bool "host edk2-platforms" + help + EDK II description files for all supported platforms. The main EDK2 + bootloader package will depend on these description files while building + firmware for certain platforms. + + https://github.com/tianocore/edk2-platforms
package/edk2-platforms/edk2-platforms.hash new file +2 -0
@@ -0,0 +1,2 @@ +# Locally calculated +sha256 b1ce41b6fb5d1ad5a0877c9cee7751d85aafda3a81cd54898254b07a9a42c5e7 edk2-platforms-608d71ec939692eace78e6b4b2a44ea7b6e75927.tar.gz
package/edk2-platforms/edk2-platforms.mk new file +6 -0
@@ -0,0 +1,6 @@ +EDK2_PLATFORMS_VERSION = 608d71ec939692eace78e6b4b2a44ea7b6e75927 +EDK2_PLATFORMS_SITE = $(call github,tianocore,edk2-platforms,$(EDK2_PLATFORMS_VERSION)) +EDK2_PLATFORMS_LICENSE = BSD-2-Clause +EDK2_PLATFORMS_LICENSE_FILE = License.txt + +$(eval $(host-generic-package))
Signature · 1 line
2.20.1
PATCH 1/8 package/edk2-platforms: new package
Hello Dick,
For this contribution!
Quoted 6 lines · On Sun, 19 Jul 2020 18:08:26 +0000 Dick Olsson <[email protected]> wrote:
package/edk2-platforms/Config.in.host new file +0
-0
package/edk2-platforms/Config.in.host line 8
Quoted 8 lines
package/edk2-platforms/Config.in.host new file +8
-0@@ -0,0 +1,8 @@ +config BR2_PACKAGE_HOST_EDK2_PLATFORMS + bool "host edk2-platforms" + help + EDK II description files for all supported platforms. The main EDK2 + bootloader package will depend on these description files while building + firmware for certain platforms. + + https://github.com/tianocore/edk2-platforms
Since this is only used as a build dependency for the edk2 package, I don't think it warrants a visible Config.in.host option, you can just drop this Config.in.host file.
package/edk2-platforms/edk2-platforms.hash line 2
Quoted 8 lines
package/edk2-platforms/edk2-platforms.hash new file +2
-0@@ -0,0 +1,2 @@ +# Locally calculated +sha256 b1ce41b6fb5d1ad5a0877c9cee7751d85aafda3a81cd54898254b07a9a42c5e7 edk2-platforms-608d71ec939692eace78e6b4b2a44ea7b6e75927.tar.gz
Could you add a hash for the license file.
package/edk2-platforms/edk2-platforms.mk
Quoted 6 lines
package/edk2-platforms/edk2-platforms.mk new file +0
-0@@ -0,0 +1,6 @@
I know it's pretty silly, but could you add the same comment header we have in all other packages ?
package/edk2-platforms/edk2-platforms.mk line 6
Quoted 6 lines
package/edk2-platforms/edk2-platforms.mk new file +6
-0+EDK2_PLATFORMS_VERSION = 608d71ec939692eace78e6b4b2a44ea7b6e75927 +EDK2_PLATFORMS_SITE = $(call github,tianocore,edk2-platforms,$(EDK2_PLATFORMS_VERSION)) +EDK2_PLATFORMS_LICENSE = BSD-2-Clause +EDK2_PLATFORMS_LICENSE_FILE = License.txt + +$(eval $(host-generic-package))
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 2/8 boot/edk2: new package
In reply to Dick OlssonEDK2 is a modern, feature-rich, cross-platform firmware development environment for the UEFI and PI specifications.
The initial version of this bootloader package makes it possible to build flash device images for QEMU and ARM Fixed Virtual Platforms (FVP) in different configurations targeting AArch64.
When building for ARM FVP there is a dependency on package/edk2-platforms for additional platform description files.
--- boot/Config.in | 1 + boot/arm-trusted-firmware/Config.in | 2 +- boot/edk2/Config.in | 59 +++++++++++++++ boot/edk2/edk2.hash | 2 + boot/edk2/edk2.mk | 111 ++++++++++++++++++++++++++++ 5 files changed, 174 insertions(+), 1 deletion(-) create mode 100644 boot/edk2/Config.in create mode 100644 boot/edk2/edk2.hash create mode 100644 boot/edk2/edk2.mk
boot/Config.in +1 -0
@@ -5,6 +5,7 @@ source "boot/at91bootstrap/Config.in" source "boot/at91bootstrap3/Config.in" source "boot/at91dataflashboot/Config.in" source "boot/arm-trusted-firmware/Config.in" +source "boot/edk2/Config.in" source "boot/barebox/Config.in" source "boot/binaries-marvell/Config.in" source "boot/boot-wrapper-aarch64/Config.in"
boot/arm-trusted-firmware/Config.in +1 -1
@@ -1,7 +1,7 @@ config BR2_TARGET_ARM_TRUSTED_FIRMWARE bool "ARM Trusted Firmware (ATF)" depends on (BR2_ARM_CPU_ARMV8A || BR2_ARM_CPU_ARMV7A) && \ - BR2_TARGET_UBOOT + BR2_TARGET_UBOOT help Enable this option if you want to build the ATF for your ARM based embedded device.
boot/edk2/Config.in new file +59 -0
59 lines not on this page · raw message
boot/edk2/edk2.hash new file +2 -0
@@ -0,0 +1,2 @@ +# Locally calculated +sha256 251520730b53ec7d686fb07aabf0bdec0d8721ac3ca59fd3e6df5dde64f1d715 edk2-edk2-stable202005.tar.gz
boot/edk2/edk2.mk new file +111 -0
111 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH 2/8 boot/edk2: new package
Hello Dick,
Against, thanks for your contribution, glad to see EDK2 being packaged in Buildroot.
boot/Config.in source "boot/at91bootstrap/Config.in" · line 11
Quoted 12 lines · On Sun, 19 Jul 2020 18:09:25 +0000 Dick Olsson <[email protected]> wrote:
boot/Config.in +1
-0@@ -5,6 +5,7 @@ source "boot/at91bootstrap/Config.in" source "boot/at91bootstrap3/Config.in" source "boot/at91dataflashboot/Config.in" source "boot/arm-trusted-firmware/Config.in" +source "boot/edk2/Config.in" source "boot/barebox/Config.in" source "boot/binaries-marvell/Config.in" source "boot/boot-wrapper-aarch64/Config.in"
Alphabetic ordering is not correct here.
boot/arm-trusted-firmware/Config.in line 4
Quoted 10 lines
boot/arm-trusted-firmware/Config.in +1
-1@@ -1,7 +1,7 @@ config BR2_TARGET_ARM_TRUSTED_FIRMWARE bool "ARM Trusted Firmware (ATF)" depends on (BR2_ARM_CPU_ARMV8A || BR2_ARM_CPU_ARMV7A) && \ - BR2_TARGET_UBOOT + BR2_TARGET_UBOOT
This is a spurious change, should not be part of this patch.
boot/edk2/Config.in line 2
Quoted 11 lines
boot/arm-trusted-firmware/Config.in +0
-0help Enable this option if you want to build the ATF for your ARM based embedded device.boot/edk2/Config.in new file +2
-0@@ -0,0 +1,59 @@ +config BR2_TARGET_EDK2 + bool "EDK2"
bool "edk2"
boot/edk2/Config.in line 3
Quoted 1 line
boot/edk2/Config.in new file +1
-0+ depends on BR2_TOOLCHAIN_GCC_AT_LEAST_5
Should there be some architecture dependency here ?
Quoted 6 lines
boot/edk2/Config.in new file +6
-0+ help + EDK II is a modern, feature-rich, cross-platform firmware + development environment for the UEFI and PI specifications. + + https://github.com/tianocore/tianocore.github.io/wiki/EDK-II +
boot/edk2/Config.in line 19
Quoted 10 lines
boot/edk2/Config.in new file +10
-0+if BR2_TARGET_EDK2 + +config BR2_TARGET_EDK2_DEBUG + bool "Debug build" + help + Use the debug build type. + +choice + prompt "Platform" + default BR2_TARGET_EDK2_PLATFORM_ARM_VIRT_QEMU
Do we really need an explicit list of platforms here? How many platforms can there be? For example in U-Boot or ATF, we have a free-form string to indicate the platform to build for.
Of course, if the number of platforms is always going to be strictly limited to a finite set, having an explicit "choice" is fine, but if not, we want this to be a free-form string.
boot/edk2/edk2.hash line 2
Quoted 8 lines
boot/edk2/edk2.hash new file +2
-0@@ -0,0 +1,2 @@ +# Locally calculated +sha256 251520730b53ec7d686fb07aabf0bdec0d8721ac3ca59fd3e6df5dde64f1d715 edk2-edk2-stable202005.tar.gz
We want the hash of the license file as well.
boot/edk2/edk2.mk line 3
Quoted 9 lines
boot/edk2/edk2.mk new file +3
-0@@ -0,0 +1,111 @@ +EDK2_VERSION = edk2-stable202005 +EDK2_SITE = https://github.com/tianocore/edk2 +EDK2_SITE_METHOD = git
Could you make this:
EDK2_VERSION = 202005EDK2_SITE = $(call github,tianocore,edk2,edk2-stable$(EDK2_VERSION))
Two changes:
- Use our "github" macro instead of fetching from Git
- Have a <pkg>_VERSION variable that really only contains the version. Indeed, even if release-monitoring.org doesn't yet track edk2, if it does in the future, it will track its version to be just YYYYMM.
boot/edk2/edk2.mk line 10
Quoted 7 lines
boot/edk2/edk2.mk new file +7
-0+EDK2_LICENSE = BSD-2-Clause +EDK2_LICENSE_FILE = License.txt +EDK2_DEPENDENCIES = host-python3 host-acpica + +# The EDK2 build system is rather special, so we're resorting to using its +# own Git submodules in order to include certain build dependencies. +EDK2_GIT_SUBMODULES = YES
Gaaah, so you can't use the "github" macro above in fact :-/ Just curious, what are those submodules ?
boot/edk2/edk2.mk line 16
Quoted 6 lines
boot/edk2/edk2.mk new file +6
-0+ +EDK2_INSTALL_IMAGES = YES + +ifeq ($(BR2_aarch64),y) +EDK2_ARCH = AARCH64 +endif
So it's only supported on AArch64 ?
boot/edk2/edk2.mk line 26
Quoted 9 lines
boot/edk2/edk2.mk new file +9
-0+ifeq ($(BR2_TARGET_EDK2_DEBUG),y) +EDK2_BUILD_TYPE = DEBUG +else +EDK2_BUILD_TYPE = RELEASE +endif + +# EDk2 can be built with CLANG or GCC >= 5. But since Buildroot currently +# only support GCC toolchains this option is assumed for now. +EDK2_TOOLCHAIN_TYPE = GCC5
So it can be hardcoded in the build command line, no need for a separate variable.
boot/edk2/edk2.mk line 36
Quoted 10 lines
boot/edk2/edk2.mk new file +10
-0+ +# Packages path. +# +# The EDK2 build system will, for some platforms, depend on binary outputs +# from other bootloader packages. Those dependencies need to be in the path +# for the EDK2 build system, so we define this special directory here. +EDK2_OUTPUT_BASE = $(BINARIES_DIR)/edk2 + +ifeq ($(BR2_PACKAGE_HOST_EDK2_PLATFORMS),y) +EDK2_PACKAGES_PATH = $(@D):$(EDK2_OUTPUT_BASE):$(BUILD_DIR)/host-edk2-platforms-$(EDK2_PLATFORMS_VERSION)
We don't really like having one package use the BUILD_DIR of another package. Can you make host-edk2-platforms install its platform definitions in $(HOST_DIR)/usr/share/edk2-platforms/ instead, and use it from there ?
boot/edk2/edk2.mk line 44
Quoted 8 lines
boot/edk2/edk2.mk new file +8
-0+else +EDK2_PACKAGES_PATH = $(@D):$(EDK2_OUTPUT_BASE) +endif + +# Platform name configuration. +# +# Defining EDK2_FD_NAME is important. This variable may be used by other +# bootloaders (e.g. ATF) as they build firmware packages based on this file.
Be careful, using variables defined by one package in another package is sometimes problematic.
Quoted 22 lines
boot/edk2/edk2.mk new file +22
-0+# +# However, the case of the QEMU SBSA platform is a bit unique as there are +# different implicit assumptions on how this firmware should be packaged +# and executed with ATF and the SBSA reference machine for QEMU. + +ifeq ($(BR2_TARGET_EDK2_PLATFORM_ARM_VIRT_QEMU),y) +EDK2_PACKAGE_NAME = ArmVirtPkg +EDK2_PLATFORM_NAME = ArmVirtQemu +EDK2_FD_NAME = QEMU_EFI + +else ifeq ($(BR2_TARGET_EDK2_PLATFORM_ARM_VIRT_QEMU_KERNEL),y) +EDK2_PACKAGE_NAME = ArmVirtPkg +EDK2_PLATFORM_NAME = ArmVirtQemuKernel +EDK2_FD_NAME = QEMU_EFI + +else ifeq ($(BR2_TARGET_EDK2_PLATFORM_ARM_VEXPRESS_FVP_AARCH64),y) +EDK2_DEPENDENCIES += host-edk2-platforms +EDK2_PACKAGE_NAME = Platform/ARM/VExpressPkg +EDK2_PLATFORM_NAME = ArmVExpress-FVP-AArch64 +EDK2_FD_NAME = FVP_AARCH64_EFI + +else ifeq ($(BR2_TARGET_EDK2_PLATFORM_QEMU_SBSA),y)
boot/edk2/edk2.mk line 76
Quoted 10 lines
boot/edk2/edk2.mk new file +10
-0+EDK2_DEPENDENCIES += host-edk2-platforms arm-trusted-firmware +EDK2_PACKAGE_NAME = Platform/Qemu/SbsaQemu +EDK2_PLATFORM_NAME = SbsaQemu +EDK2_PRE_CONFIGURE_HOOKS += EDK2_OUTPUT_QEMU_SBSA +endif + +# This will create the package path structure that EDK2 expect when building +# flash devices for QEMU SBSA. +define EDK2_OUTPUT_QEMU_SBSA + mkdir -p $(EDK2_OUTPUT_BASE)/Platform/Qemu/Sbsa && \
No need for the &&, just two separate commands will do fine.
boot/edk2/edk2.mk line 85
Quoted 9 lines
boot/edk2/edk2.mk new file +9
-0+ ln -srf $(BINARIES_DIR)/{bl1.bin,fip.bin} $(EDK2_OUTPUT_BASE)/Platform/Qemu/Sbsa/ +endef + +# Make build variables. +EDK2_MAKE_OPTS += -C $(@D)/BaseTools +EDK2_MAKE_TARGETS += \ +$(EDK2_TOOLCHAIN_TYPE)_$(EDK2_ARCH)_PREFIX="$(TARGET_CROSS)" \ +build -a $(EDK2_ARCH) -t $(EDK2_TOOLCHAIN_TYPE) -b $(EDK2_BUILD_TYPE) \ +-p $(EDK2_PACKAGE_NAME)/$(EDK2_PLATFORM_NAME).dsc $(EDK2_BUILD_OPTS) all
This is difficult to read and is not a list of make targets.
boot/edk2/edk2.mk line 91
Quoted 6 lines
boot/edk2/edk2.mk new file +6
-0+ +define EDK2_BUILD_CMDS + export WORKSPACE=$(@D) && \ + export PACKAGES_PATH=$(EDK2_PACKAGES_PATH) && \ + export PYTHON_COMMAND=$(HOST_DIR)/bin/python3 && \ + export IASL_PREFIX=$(BUILD_DIR)/host-acpica-$(ACPICA_VERSION)/generate/unix/bin/ && \
Are you sure you need to export all those variables ?
Again, we don't like to point to the build directory of other packages:
acpica should have been installed to $(HOST_DIR).
boot/edk2/edk2.mk line 95
Quoted 4 lines
boot/edk2/edk2.mk new file +4
-0+ mkdir -p $(EDK2_OUTPUT_BASE) && \ + source $(@D)/edksetup.sh && \ + $(TARGET_MAKE_ENV) $(MAKE) $(EDK2_MAKE_OPTS) && $(EDK2_MAKE_TARGETS) +endef
Perhaps:
define EDK2_BUILD_CMDS
mkdir -p $(EDK2_OUTPUT_BASE) WORKSPACE=$(@D) \ PACKAGE_PATH=$(EDK2_PACKAGES_PATH) \ PYTHON_COMMAND=$(HOST_DIR)/bin/python3 \ IASL_PREFIX=$(HOST_DIR)/bin \ source $(@D)/edksetup.sh && \ $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/BaseTools \ GCC5_$(EDK2_ARCH)_PREFIX="$(TARGET_CROSS)" \ build \ -a $(EDK2_ARCH) \ -t GCC5 \ -b $(EDK2_BUILD_TYPE) \ -p $(EDK2_PACKAGE_NAME)/$(EDK2_PLATFORM_NAME).dsc \ all
endef
boot/edk2/edk2.mk line 109
Quoted 13 lines
boot/edk2/edk2.mk new file +13
-0+# Location of the compiled flash device files is not consistent between +# platform descriptions. So this install command have to test for the two +# different locations. +EDK2_FV1 = $(@D)/Build/$(EDK2_PLATFORM_NAME)/$(EDK2_BUILD_TYPE)_$(EDK2_TOOLCHAIN_TYPE)/FV +EDK2_FV2 = $(@D)/Build/$(EDK2_PLATFORM_NAME)-$(EDK2_ARCH)/$(EDK2_BUILD_TYPE)_$(EDK2_TOOLCHAIN_TYPE)/FV + +define EDK2_INSTALL_IMAGES_CMDS + if test -d $(EDK2_FV1); then \ + cp $(EDK2_FV1)/*.fd $(BINARIES_DIR)/; \ + elif test -d $(EDK2_FV2); then \ + cp $(EDK2_FV2)/*.fd $(BINARIES_DIR)/; \ + fi +endef
Perhaps:
EDK2_INSTALL_PATHS = \ $(@D)/Build/$(EDK2_PLATFORM_NAME)/$(EDK2_BUILD_TYPE)_$(EDK2_TOOLCHAIN_TYPE)/FV \ $(@D)/Build/$(EDK2_PLATFORM_NAME)-$(EDK2_ARCH)/$(EDK2_BUILD_TYPE)_$(EDK2_TOOLCHAIN_TYPE)/FV
define EDK2_INSTALL_IMAGES_CMDS
$(foreach dir,$(wildcard $(EDK2_INSTALL_PATHS),\ cp $(dir)/* $(BINARIES_DIR) )
endef
or something along those lines (I haven't tested the above code).
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 3/8 boot/arm-trusted-firmware: bump to version 2.2
In reply to Dick OlssonRelease notes: https://trustedfirmware-a.readthedocs.io/en/latest/change-log.html#version-2-2
Note that Buildroot testing has not yet been done with the latest version 2.3.
--- boot/arm-trusted-firmware/Config.in | 4 ++-- boot/arm-trusted-firmware/arm-trusted-firmware.hash | 1 + 2 files changed, 3 insertions(+), 2 deletions(-)
boot/arm-trusted-firmware/Config.in +2 -2
@@ -15,7 +15,7 @@ choice Select the specific ATF version you want to use config BR2_TARGET_ARM_TRUSTED_FIRMWARE_LATEST_VERSION - bool "v1.4" + bool "v2.2" config BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION bool "Custom version"
@@ -43,7 +43,7 @@ config BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_VERSION_VALUE config BR2_TARGET_ARM_TRUSTED_FIRMWARE_VERSION string - default "v1.4" if BR2_TARGET_ARM_TRUSTED_FIRMWARE_LATEST_VERSION + default "v2.2" if BR2_TARGET_ARM_TRUSTED_FIRMWARE_LATEST_VERSION default "custom" if BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_TARBALL default BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_REPO_VERSION \ if BR2_TARGET_ARM_TRUSTED_FIRMWARE_CUSTOM_GIT
boot/arm-trusted-firmware/arm-trusted-firmware.hash +1 -0
@@ -1,3 +1,4 @@ # Locally calculated sha256 6dae02acd85278394bfad6e2683e186e5332a711e4491ac4632ad6480f6e5494 arm-trusted-firmware-v1.4.tar.gz sha256 487795b8023df866259fa159bab94706b747fb0d623b7913f1c4955c0ab5f164 license.rst +sha256 07e3c058ae2d95c7d516a46fc93565b797e912c3271ddbf29df523b1ab1ee911 arm-trusted-firmware-v2.2.tar.gz
Signature · 1 line
2.20.1
PATCH 3/8 boot/arm-trusted-firmware: bump to version 2.2
Quoted 4 lines · On Sun, 19 Jul 2020 18:09:45 +0000 Dick Olsson <[email protected]> wrote:
Release notes: https://trustedfirmware-a.readthedocs.io/en/latest/change-log.html#version-2-2
Note that Buildroot testing has not yet been done with the latest version 2.3.Signed-off-by Dick Olsson <[email protected]>
Thanks, I've applied.
boot/arm-trusted-firmware/arm-trusted-firmware.hash line 2
Quoted 7 lines
boot/arm-trusted-firmware/arm-trusted-firmware.hash +0
-0@@ -1,3 +1,4 @@ # Locally calculated sha256 6dae02acd85278394bfad6e2683e186e5332a711e4491ac4632ad6480f6e5494 arm-trusted-firmware-v1.4.tar.gz
We don't keep the hashes of all versions, so I dropped this line, and kept the new v2.2 line before the license file hash. Also, I took this opportunity to fix the hash file spacing to follow our new convention.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 4/8 boot/arm-trusted-firmware: add EDK2 as BL33 option
In reply to Dick OlssonARM Trusted Firmware (ATF) has the ability to load EDK2 UEFI as the BL33 payload, instead of more commonly used U-Boot.
The platform description as configured by the EDK2 bootloader package will be included when ATF is configured to build the Firmware Image Package (fip) target.
--- boot/arm-trusted-firmware/Config.in | 15 ++++++++++++++- boot/arm-trusted-firmware/arm-trusted-firmware.mk | 7 +++++++ 2 files changed, 21 insertions(+), 1 deletion(-)
boot/arm-trusted-firmware/Config.in +14 -1
@@ -1,7 +1,7 @@ config BR2_TARGET_ARM_TRUSTED_FIRMWARE bool "ARM Trusted Firmware (ATF)" depends on (BR2_ARM_CPU_ARMV8A || BR2_ARM_CPU_ARMV7A) && \ - BR2_TARGET_UBOOT + (BR2_TARGET_UBOOT || BR2_TARGET_EDK2) help Enable this option if you want to build the ATF for your ARM based embedded device.
@@ -115,6 +115,19 @@ config BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL32_OPTEE endchoice +config BR2_TARGET_ARM_TRUSTED_FIRMWARE_EDK2_AS_BL33 + bool "Use EDK2 as BL33" + depends on BR2_TARGET_EDK2 + help + This option allows to embed EDK2 as the BL33 part of + the ARM Trusted Firmware. It ensures that the EDK2 package + gets built before ATF, and that the appropriate BL33 + variable pointing to the EDK2 is passed when building ATF. + + Do not choose this option if you intend to build ATF and EDK2 + for the 'qemu_sbsa' platform. In this case, due to the EDK2 + build system, the dependency between ATF and EDK is reversed. + config BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_AS_BL33 bool "Use U-Boot as BL33" depends on BR2_TARGET_UBOOT
boot/arm-trusted-firmware/arm-trusted-firmware.mk +7 -0
@@ -79,6 +79,13 @@ ARM_TRUSTED_FIRMWARE_MAKE_OPTS += AARCH32_SP=optee endif endif # BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL32_OPTEE +ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_EDK2_AS_BL33),y) +ARM_TRUSTED_FIRMWARE_DEPENDENCIES += edk2 +# Since the flash device names vary between platforms, we use the variable +# provided by the EDK2 package this. +ARM_TRUSTED_FIRMWARE_MAKE_OPTS += BL33=$(BINARIES_DIR)/$(EDK2_FD_NAME).fd +endif + ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_AS_BL33),y) ARM_TRUSTED_FIRMWARE_UBOOT_BIN = $(call qstrip,$(BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_BL33_IMAGE)) ARM_TRUSTED_FIRMWARE_MAKE_OPTS += BL33=$(BINARIES_DIR)/$(ARM_TRUSTED_FIRMWARE_UBOOT_BIN)
Signature · 1 line
2.20.1
PATCH 4/8 boot/arm-trusted-firmware: add EDK2 as BL33 option
Hello,
+Yann Morin, on variable reference between packages.
boot/arm-trusted-firmware/Config.in line 4
Quoted 10 lines · On Sun, 19 Jul 2020 18:10:03 +0000 Dick Olsson <[email protected]> wrote:
boot/arm-trusted-firmware/Config.in +1
-1@@ -1,7 +1,7 @@ config BR2_TARGET_ARM_TRUSTED_FIRMWARE bool "ARM Trusted Firmware (ATF)" depends on (BR2_ARM_CPU_ARMV8A || BR2_ARM_CPU_ARMV7A) && \ - BR2_TARGET_UBOOT + (BR2_TARGET_UBOOT || BR2_TARGET_EDK2)
Ah, this is why your previous patch has a spurious change in this file :-)
boot/arm-trusted-firmware/Config.in config BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL32_OPTEE · line 129
Quoted 12 lines
boot/arm-trusted-firmware/Config.in +12
-0+config BR2_TARGET_ARM_TRUSTED_FIRMWARE_EDK2_AS_BL33 + bool "Use EDK2 as BL33" + depends on BR2_TARGET_EDK2 + help + This option allows to embed EDK2 as the BL33 part of + the ARM Trusted Firmware. It ensures that the EDK2 package + gets built before ATF, and that the appropriate BL33 + variable pointing to the EDK2 is passed when building ATF. + + Do not choose this option if you intend to build ATF and EDK2 + for the 'qemu_sbsa' platform. In this case, due to the EDK2 + build system, the dependency between ATF and EDK is reversed.
So there are cases where ATF depends on EDK2, and other cases where EDK2 depends on ATF (BR2_TARGET_EDK2_PLATFORM_QEMU_SBSA situation). Correct ?
Note: this is OK, we already have this situation between U-Boot and ATF. On some platforms, ATF embeds U-Boot, on others, U-Boot embeds ATF.
Quoted 8 lines
config
BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_AS_BL33boot/arm-trusted-firmware/Config.in +0
-0bool "Use U-Boot as BL33" depends on BR2_TARGET_UBOOTboot/arm-trusted-firmware/arm-trusted-firmware.mk +0
-0
boot/arm-trusted-firmware/arm-trusted-firmware.mk ARM_TRUSTED_FIRMWARE_MAKE_OPTS += AARCH32_SP=optee · line 86
Quoted 8 lines
boot/arm-trusted-firmware/arm-trusted-firmware.mk +5
-0@@ -79,6 +79,13 @@ ARM_TRUSTED_FIRMWARE_MAKE_OPTS += AARCH32_SP=optee endif endif # BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL32_OPTEE +ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_EDK2_AS_BL33),y) +ARM_TRUSTED_FIRMWARE_DEPENDENCIES += edk2 +# Since the flash device names vary between platforms, we use the variable +# provided by the EDK2 package this. +ARM_TRUSTED_FIRMWARE_MAKE_OPTS += BL33=$(BINARIES_DIR)/$(EDK2_FD_NAME).fd
So there is this reference to a variable of another package, which I'm never sure if it works correctly. Yann, what is the rule again ? :-)
For the U-Boot case, we have an explicit BR2_TARGET_ARM_TRUSTED_FIRMWARE_UBOOT_BL33_IMAGE. If we drop the "platform choice" in EDK2, we would anyway have to specify somewhere a free form string that contains the final image name.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 4/8 boot/arm-trusted-firmware: add EDK2 as BL33 option
Thomas, Dick, All,
On 2020-07-20 22:59 +0200, Thomas Petazzoni spake thusly:
Quoted 1 line
+Yann Morin, on variable reference between packages.
TL;DR: don't use them but with great care!
(I know, that does not help. ;-] So, read on...)
Quoted 2 lines
On Sun, 19 Jul 2020 18:10:03 +0000
Dick Olsson <[email protected]> wrote:
[--SNIP--]
Quoted 8 lines
Quoted 8 lines
boot/arm-trusted-firmware/arm-trusted-firmware.mk +0
-0@@ -79,6 +79,13 @@ ARM_TRUSTED_FIRMWARE_MAKE_OPTS += AARCH32_SP=optee endif endif # BR2_TARGET_ARM_TRUSTED_FIRMWARE_BL32_OPTEE
Quoted 8 lines
boot/arm-trusted-firmware/arm-trusted-firmware.mk ARM_TRUSTED_FIRMWARE_MAKE_OPTS += AARCH32_SP=optee · line 86
Quoted 5 lines
boot/arm-trusted-firmware/arm-trusted-firmware.mk +5
-0+ifeq ($(BR2_TARGET_ARM_TRUSTED_FIRMWARE_EDK2_AS_BL33),y) +ARM_TRUSTED_FIRMWARE_DEPENDENCIES += edk2 +# Since the flash device names vary between platforms, we use the variable +# provided by the EDK2 package this. +ARM_TRUSTED_FIRMWARE_MAKE_OPTS += BL33=$(BINARIES_DIR)/$(EDK2_FD_NAME).fdSo there is this reference to a variable of another package, which I'm never sure if it works correctly. Yann, what is the rule again ? :-)
If a variable is expanded at the time of '$(eval $(foo-package))', then you can't share variables bewtween packages.
That is the case for _VERSION for example, as that serves to create a make-dependency in the form;
build-dir/foo-$(FOO_VERSION): some-dependencies
If however, avariable is expanded in the configure, build, install, etc... rules, then this is OK.
For example, cross-using a variable in a _CMDS or _HOOKS is OK.
Finally, if you can *ensure* the ordering, by defining the variable before the fiels that uses it are included, then that is also OK.
This is the case for exampe for the qt5 packages, or for barebox, where the include order *has been written* to ensure that.
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH 4/8 boot/arm-trusted-firmware: add EDK2 as BL33 option
Quoted 11 lines · On Mon, 20 Jul 2020 23:21:19 +0200 "Yann E. MORIN" <[email protected]>…
Quoted 4 lines
Quoted 1 line
+ARM_TRUSTED_FIRMWARE_MAKE_OPTS += BL33=$(BINARIES_DIR)/$(EDK2_FD_NAME).fd
So there is this reference to a variable of another package, which I'm never sure if it works correctly. Yann, what is the rule again ? :-)
If a variable is expanded at the time of '$(eval $(foo-package))', then you can't share variables bewtween packages.
That is the case for
_VERSIONfor example, as that serves to create a make-dependency in the form;
Quoted 6 lines
build-dir/foo-$(FOO_VERSION): some-dependenciesIf however, avariable is expanded in the configure, build, install, etc... rules, then this is OK.
For example, cross-using a variable in a
_CMDSor_HOOKSis OK.
OK, so the case of the EDK2_FD_NAME used by Dick in this patch series is OK I guess.
Quoted 5 lines
Finally, if you can *ensure* the ordering, by defining the variable before the fiels that uses it are included, then that is also OK.
This is the case for exampe for the qt5 packages, or for barebox, where the include order *has been written* to ensure that.
Yeah, that is the point I remember, it's the other one that is less clear to me, i.e when ordering is not guaranteed, what you can/cannot do.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 5/8 configs/aarch64_efi_defconfig: build the EDK2 firmware from source
In reply to Dick OlssonPrior to this patch, you had to manually download a pre-built EDK2 flash device image (QEMU_EFI.fd) in order to boot this configuration with QEMU. With this patch, the configuration is now building EDK2 from source as a stand-alone flash device file.
--- board/aarch64-efi/readme.txt | 8 +++----- configs/aarch64_efi_defconfig | 3 +++ 2 files changed, 6 insertions(+), 5 deletions(-)
board/aarch64-efi/readme.txt +3 -5
@@ -22,13 +22,11 @@ qemu-system-aarch64 \ -cpu cortex-a57 \ -m 512 \ -nographic \ - -bios </path/to/QEMU_EFI.fd> \ + -bios output/images/QEMU_EFI.fd \ -drive file=output/images/disk.img,if=none,format=raw,id=hd0 \ -device virtio-blk-device,drive=hd0 \ -netdev user,id=eth0 \ -device virtio-net-device,netdev=eth0 -Note that </path/to/QEMU_EFI.fd> needs to point to a valid aarch64 UEFI -firmware image for qemu. -It may be provided by your distribution as a edk2-aarch64 or AAVMF -package, in path such as /usr/share/edk2/aarch64/QEMU_EFI.fd . +Note that output/images/QEMU_EFI.fd is the flash device file built by +the EDK2 package.
configs/aarch64_efi_defconfig +3 -0
@@ -33,6 +33,9 @@ BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.18.10" BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y +# EDK2 firmware +BR2_TARGET_EDK2=y + # Host tools for genimage BR2_PACKAGE_HOST_DOSFSTOOLS=y BR2_PACKAGE_HOST_MTOOLS=y
Signature · 1 line
2.20.1
PATCH 5/8 configs/aarch64_efi_defconfig: build the EDK2 firmware from source
Hello,
+Erico in Cc.
Quoted 6 lines · On Sun, 19 Jul 2020 18:10:21 +0000 Dick Olsson <[email protected]> wrote:
Prior to this patch, you had to manually download a pre-built EDK2 flash device image (QEMU_EFI.fd) in order to boot this configuration with QEMU. With this patch, the configuration is now building EDK2 from source as a stand-alone flash device file.
Signed-off-by Dick Olsson <[email protected]>
Erico: since you are the maintainer for the aarch64_efi defconfig, it would be nice to have your review/feedback on this patch.
configs/aarch64_efi_defconfig BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.18.10" · line 37
Quoted 2 lines
configs/aarch64_efi_defconfig +2
-0+# EDK2 firmware +BR2_TARGET_EDK2=y
Which platform is selected then ? The default,BR2_TARGET_EDK2_PLATFORM_ARM_VIRT_QEMU ?
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 6/8 configs/qemu_aarch64_sbsa_sbbr_defconfig: new config for SBBR on QEMU SBSA
In reply to Dick OlssonThis introduces a configuration for the SBSA reference machine under QEMU that builds firmware that is close to SBBR compliance. It consists of ATF that load EDK2 as BL33 which in turn will load the kernel as EFI stub in ACPI mode.
This patch is also introducing a generic SBSA board called aarch64_sbsa that can be shared between SBSA platforms.
--- board/aarch64-sbsa/genimage-sbsa.cfg | 25 ++++++++++++++ board/aarch64-sbsa/linux.config | 1 + board/aarch64-sbsa/post-image.sh | 22 ++++++++++++ board/aarch64-sbsa/readme.txt | 28 +++++++++++++++ configs/qemu_aarch64_sbsa_sbbr_defconfig | 44 ++++++++++++++++++++++++ 5 files changed, 120 insertions(+) create mode 100644 board/aarch64-sbsa/genimage-sbsa.cfg create mode 100644 board/aarch64-sbsa/linux.config create mode 100755 board/aarch64-sbsa/post-image.sh create mode 100644 board/aarch64-sbsa/readme.txt create mode 100644 configs/qemu_aarch64_sbsa_sbbr_defconfig
board/aarch64-sbsa/genimage-sbsa.cfg new file +25 -0
@@ -0,0 +1,25 @@ +image efi-part.vfat { + vfat { + file EFI { + image = "efi-part/EFI" + } + } + size = 32M +} + +image disk.img { + + hdimage { + gpt = true + } + + partition boot { + partition-type = 0xEF + image = "efi-part.vfat" + } + + partition root { + partition-type = 0x83 + image = "rootfs.ext2" + } +}
board/aarch64-sbsa/linux.config new file +1 -0
@@ -0,0 +1 @@ +CONFIG_CMDLINE="root=/dev/vda2 rootwait console=ttyAMA0"
board/aarch64-sbsa/post-image.sh new file +22 -0
@@ -0,0 +1,22 @@ +#!/bin/bash + +BOARD_DIR="$(dirname $0)" +EFI_DIR=${BINARIES_DIR}/efi-part/EFI/BOOT + +# Set up the kernel executable according to the UEFI standard. +mkdir -p ${EFI_DIR} && \ +ln -sf ${BINARIES_DIR}/Image ${EFI_DIR}/bootaa64.efi + +function resize_or_link_flash { + if [ -n "${3}" ]; then + dd if=/dev/zero of="${BINARIES_DIR}/${2}" bs=1M count=${3} && \ + dd if="${BINARIES_DIR}/${1}" of="${BINARIES_DIR}/${2}" conv=notrunc || exit 1 + else + ln -srf "${BINARIES_DIR}/${1}" "${BINARIES_DIR}/${2}" || exit 1 + fi +} + +if grep -Eq "^BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM=\"qemu_sbsa\"$" ${BR2_CONFIG}; then + resize_or_link_flash "SBSA_FLASH0.fd" "secureflash.bin" "256" + resize_or_link_flash "SBSA_FLASH1.fd" "flash0.bin" "256" +fi
board/aarch64-sbsa/readme.txt new file +28 -0
@@ -0,0 +1,28 @@ +The aarch64-sbsa board is generic and will work for platforms that are +compliant with the Server Base System Architecture (SBSA) specification. +An SBSA platform will need configuration that build firmware compliant with +the Server Base Boot Requirement (SBBR) specification. + +This SBSA board expect SBBR firmware to be packaged in two binaries: + +1. secureflash.bin: The BL1 stage that will be loaded into secure memory +2. flash0.bin: Remaining firmware image packages loaded into non-secure memory + +The following configurations currently provide SBBR firmware: + +- qemu_aarch64_sbsa_sbbr_defconfig: An implementation of SBBR for QEMU SBSA + +Building and booting under QEMU SBSA +==================================== + +$ make qemu_aarch64_sbsa_sbbr_defconfig +$ make +$ qemu-system-aarch64 \ + -M sbsa-ref \ + -cpu cortex-a57 \ + -smp 4 \ + -m 1024 \ + -nographic \ + -drive file=output/images/secureflash.bin,if=pflash,format=raw \ + -drive file=output/images/flash0.bin,if=pflash,format=raw \ + -hda output/images/disk.img
configs/qemu_aarch64_sbsa_sbbr_defconfig new file +44 -0
44 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH 6/8 configs/qemu_aarch64_sbsa_sbbr_defconfig: new config for SBBR on QEMU SBSA
board/aarch64-sbsa/linux.config line 1
Quoted 7 lines · On Sun, 19 Jul 2020 18:10:40 +0000 Dick Olsson <[email protected]> wrote:
board/aarch64-sbsa/linux.config new file +1
-0@@ -0,0 +1 @@ +CONFIG_CMDLINE="root=/dev/vda2 rootwait console=ttyAMA0"
This is really a fragment, so it should be called "linux.fragment".
But why is hardcoding the kernel command line needed? EDK2 is a complex firmware, and it would not be capable of passing a Linux kernel command line?
board/aarch64-sbsa/post-image.sh line 7
Quoted 13 lines
board/aarch64-sbsa/post-image.sh new file +7
-0@@ -0,0 +1,22 @@ +#!/bin/bash + +BOARD_DIR="$(dirname $0)" +EFI_DIR=${BINARIES_DIR}/efi-part/EFI/BOOT + +# Set up the kernel executable according to the UEFI standard. +mkdir -p ${EFI_DIR} && \
No need for &&. Maybe a set -e at the beginning of the file would suffice.
board/aarch64-sbsa/post-image.sh line 10
Quoted 3 lines
board/aarch64-sbsa/post-image.sh new file +3
-0+ln -sf ${BINARIES_DIR}/Image ${EFI_DIR}/bootaa64.efi + +function resize_or_link_flash {
Perhaps a comment above this function to explain what is going would be nice.
board/aarch64-sbsa/post-image.sh line 12
Quoted 2 lines
board/aarch64-sbsa/post-image.sh new file +2
-0+ if [ -n "${3}" ]; then + dd if=/dev/zero of="${BINARIES_DIR}/${2}" bs=1M count=${3} && \
So this is going to create a 256MB file in the case of this platform ?
board/aarch64-sbsa/post-image.sh line 13
Quoted 1 line
board/aarch64-sbsa/post-image.sh new file +1
-0+ dd if="${BINARIES_DIR}/${1}" of="${BINARIES_DIR}/${2}" conv=notrunc || exit 1
Drop && and exit 1, rely on set -e.
board/aarch64-sbsa/post-image.sh line 15
Quoted 2 lines
board/aarch64-sbsa/post-image.sh new file +2
-0+ else + ln -srf "${BINARIES_DIR}/${1}" "${BINARIES_DIR}/${2}" || exit 1
Ditto.
Quoted 13 lines
board/aarch64-sbsa/post-image.sh new file +6
-0+ fi +} +if grep -Eq "^BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM=\"qemu_sbsa\"$" ${BR2_CONFIG}; then + resize_or_link_flash "SBSA_FLASH0.fd" "secureflash.bin" "256" + resize_or_link_flash "SBSA_FLASH1.fd" "flash0.bin" "256" +fiboard/aarch64-sbsa/readme.txt new file +0
-0
board/aarch64-sbsa/readme.txt line 1
Quoted 1 line
board/aarch64-sbsa/readme.txt new file +1
-0@@ -0,0 +1,28 @@ +The aarch64-sbsa board is generic and will work for platforms that are
As explained in my reply to the commit log, there is no such thing as an "aarch64-sbsa" board in Buildroot.
configs/qemu_aarch64_sbsa_sbbr_defconfig line 4
Quoted 10 lines
configs/qemu_aarch64_sbsa_sbbr_defconfig new file +4
-0@@ -0,0 +1,44 @@ +# Architecture +BR2_aarch64=y + +# Toolchain, required for eudev and grub
You don't use grub.
configs/qemu_aarch64_sbsa_sbbr_defconfig line 9
Quoted 5 lines
configs/qemu_aarch64_sbsa_sbbr_defconfig new file +5
-0+BR2_TOOLCHAIN_BUILDROOT_WCHAR=y + +# System +BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0" +BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
Any reason to need eudev ?
configs/qemu_aarch64_sbsa_sbbr_defconfig line 12
Quoted 3 lines
configs/qemu_aarch64_sbsa_sbbr_defconfig new file +3
-0+ +## Required tools to create bootable media +BR2_PACKAGE_HOST_GENIMAGE=y
Could probably move together with dosfstools and mtools.
Quoted 6 lines
configs/qemu_aarch64_sbsa_sbbr_defconfig new file +6
-0+ +# Filesystem / image +BR2_TARGET_ROOTFS_EXT2=y +BR2_TARGET_ROOTFS_EXT2_4=y +BR2_TARGET_ROOTFS_EXT2_SIZE="200M" +# BR2_TARGET_ROOTFS_TAR is not set
configs/qemu_aarch64_sbsa_sbbr_defconfig line 28
Quoted 10 lines
configs/qemu_aarch64_sbsa_sbbr_defconfig new file +10
-0+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/aarch64-sbsa/post-image.sh support/scripts/genimage.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/aarch64-sbsa/genimage-sbsa.cfg" + +# Linux headers same as kernel, a 4.18 series +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_18=y + +# Kernel +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="4.18.10"
That's a pretty old kernel and not even an LTS branch. What about using something more recent, such as at least 5.4, which is LTS ?
Quoted 6 lines
configs/qemu_aarch64_sbsa_sbbr_defconfig new file +6
-0+BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/aarch64-sbsa/linux.config" +BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y + +# UEFI firmware +BR2_TARGET_EDK2=y
configs/qemu_aarch64_sbsa_sbbr_defconfig line 44
Quoted 10 lines
configs/qemu_aarch64_sbsa_sbbr_defconfig new file +10
-0+BR2_TARGET_EDK2_PLATFORM_QEMU_SBSA=y + +# ARM Trusted Firmware +BR2_TARGET_ARM_TRUSTED_FIRMWARE=y +BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="qemu_sbsa" +BR2_TARGET_ARM_TRUSTED_FIRMWARE_FIP=y + +# Host tools for genimage +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_MTOOLS=y
Please note that most comments made on this patch apply to 7/8 and 8/8 as well.
Thanks for all this work!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 7/8 configs/qemu_aarch64_virt_sbbr_defconfig: new config for SBBR on Virt
In reply to Dick OlssonThis introduces a configuration for QEMU Virt set up similar to a SBSA machine that builds firmware that is close to SBBR compliance. It consists of ATF that load EDK2 as BL33 which in turn will load the kernel as EFI stub in ACPI mode.
--- board/aarch64-sbsa/post-image.sh | 4 +++ board/aarch64-sbsa/readme.txt | 17 +++++++++ configs/qemu_aarch64_virt_sbbr_defconfig | 46 ++++++++++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 configs/qemu_aarch64_virt_sbbr_defconfig
board/aarch64-sbsa/post-image.sh +4 -0
@@ -19,4 +19,8 @@ function resize_or_link_flash { if grep -Eq "^BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM=\"qemu_sbsa\"$" ${BR2_CONFIG}; then resize_or_link_flash "SBSA_FLASH0.fd" "secureflash.bin" "256" resize_or_link_flash "SBSA_FLASH1.fd" "flash0.bin" "256" + +elif grep -Eq "^BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM=\"qemu\"$" ${BR2_CONFIG}; then + resize_or_link_flash "bl1.bin" "secureflash.bin" "64" + resize_or_link_flash "fip.bin" "flash0.bin" "64" fi
board/aarch64-sbsa/readme.txt +17 -0
@@ -11,6 +11,7 @@ This SBSA board expect SBBR firmware to be packaged in two binaries: The following configurations currently provide SBBR firmware: - qemu_aarch64_sbsa_sbbr_defconfig: An implementation of SBBR for QEMU SBSA +- qemu_aarch64_virt_sbbr_defconfig: An implementation of SBBR for QEMU Virt Building and booting under QEMU SBSA ====================================
@@ -26,3 +27,19 @@ $ qemu-system-aarch64 \ -drive file=output/images/secureflash.bin,if=pflash,format=raw \ -drive file=output/images/flash0.bin,if=pflash,format=raw \ -hda output/images/disk.img + +Building and booting under QEMU Virt +==================================== + +$ make qemu_aarch64_virt_sbbr_defconfig +$ make +$ qemu-system-aarch64 \ + -M virt,secure=on,gic-version=3 \ + -cpu cortex-a57 \ + -smp 4 \ + -m 1024 \ + -nographic \ + -drive file=output/images/secureflash.bin,if=pflash,format=raw \ + -drive file=output/images/flash0.bin,if=pflash,format=raw \ + -drive file=output/images/disk.img,if=none,format=raw,id=hd0 \ + -device virtio-blk-device,drive=hd0
configs/qemu_aarch64_virt_sbbr_defconfig new file +46 -0
46 lines not on this page · raw message
Signature · 1 line
2.20.1
PATCH 8/8 configs/arm_foundationv8_sbbr_defconfig: new config for SBBR on FVP
In reply to Dick OlssonThis introduces a configuration for the ARM Foundation Platform that builds firmware that is close to SBBR compliance. It consists of ATF that load EDK2 as BL33 which in turn will load the kernel as EFI stub in ACPI mode.
--- board/aarch64-sbsa/post-image.sh | 4 +++ board/aarch64-sbsa/readme.txt | 17 +++++++++ configs/arm_foundationv8_sbbr_defconfig | 46 +++++++++++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 configs/arm_foundationv8_sbbr_defconfig
board/aarch64-sbsa/post-image.sh +4 -0
@@ -23,4 +23,8 @@ if grep -Eq "^BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM=\"qemu_sbsa\"$" ${BR2_CON elif grep -Eq "^BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM=\"qemu\"$" ${BR2_CONFIG}; then resize_or_link_flash "bl1.bin" "secureflash.bin" "64" resize_or_link_flash "fip.bin" "flash0.bin" "64" + +elif grep -Eq "^BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM=\"fvp\"$" ${BR2_CONFIG}; then + resize_or_link_flash "bl1.bin" "secureflash.bin" + resize_or_link_flash "fip.bin" "flash0.bin" fi
board/aarch64-sbsa/readme.txt +17 -0
@@ -12,6 +12,7 @@ The following configurations currently provide SBBR firmware: - qemu_aarch64_sbsa_sbbr_defconfig: An implementation of SBBR for QEMU SBSA - qemu_aarch64_virt_sbbr_defconfig: An implementation of SBBR for QEMU Virt +- arm_foundationv8_sbbr_defconfig: An implementation of SBBR for ARM Foundation Building and booting under QEMU SBSA ====================================
@@ -43,3 +44,19 @@ $ qemu-system-aarch64 \ -drive file=output/images/flash0.bin,if=pflash,format=raw \ -drive file=output/images/disk.img,if=none,format=raw,id=hd0 \ -device virtio-blk-device,drive=hd0 + +Bulding and booting under ARM Foundation +======================================== + +$ make arm_foundationv8_sbbr_defconfig +$ make +$ Foundation_Platform \ + --disable-analytics \ + --no-visualization \ + --arm-v8.0 \ + --secure-memory \ + --gicv3 \ + --cores=4 \ + --data=output/images/secureflash.bin at 0x0 \ + --nsdata=output/images/flash0.bin at 0x08000000 \ + --block-device=output/images/disk.img
configs/arm_foundationv8_sbbr_defconfig new file +46 -0
46 lines not on this page · raw message
Signature · 1 line
2.20.1
cover Introduce EDK2 firmware builds
In reply to Dick OlssonHello Dick,
Quoted 10 lines · On Sun, 19 Jul 2020 18:08:13 +0000 Dick Olsson <[email protected]> wrote:
One of the main reasons one would use EDK2 and UEFI on a AArch64 is for different standards compliance scenarios. The most prevalent standards in this space are:
* Server Base System Architecture (SBSA) for hardware platforms
* Server Base Boot Requirement (SBBR) for bootloader firmwareThis series introduces a new generic SBSA board called aarch64-sbsa which can be used by any configuration providing SBBR firmware.
Quoted 6 lines
Three of the four configurations in this series implement SBBR firmware:
1.
aarch_efi_defconfig: EDK2 as stand-alone flash device for QEMU Virt
2.qemu_aarch64_virt_sbbr_defconfig: EDK2 as ATF BL33 for QEMU Virt
3.qemu_aarch64_sbsa_sbbr_defconfig: EDK2 as ATF BL33 for QEMU SBSA
4.arm_foundationv8_sbbr_defconfig: EDK2 as ATF BL33 for ARM FVP
I must say my knowledge of SBBR/SBBA is very limited, but I'm confused by the addition of all those configurations.
First of all, Buildroot doesn't really have a concept of a "board" separated from a defconfig. It seems like you believe you have created the support for a board by creating board/aarch64-sbsa/, but really the support for a board in Buildroot is mainly a defconfig. So here, you have adjusted one board configuration and created 3 new ones.
What is the Qemu SBSA platform compared to the QEMU Virt one ? Why would we want qemu_aarch64_virt_sbbr_defconfig and qemu_aarch64_sbsa_sbbr_defconfig ?
What makes these platform Qemu specific ? The fact that we do build EDK2, which is the firmware, and therefore is obviously board/platform-specific ? If that's the case how is EDK2 useful on the aarch64_efi case, which is a cross-platform defconfig that should work on any EFI-capable AArch64 system ?
I know, lots of questions there. Just trying to figure out how things work, and what is the most relevant for Buildroot to handle this.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
cover Introduce EDK2 firmware builds
Hi Thomas,
Quoted 8 lines · Thomas Petazzoni
I must say my knowledge of SBBR/SBBA is very limited, but I'm confused by the addition of all those configurations.
First of all, Buildroot doesn't really have a concept of a "board" separated from a defconfig. It seems like you believe you have created the support for a board by creating board/aarch64-sbsa/, but really the support for a board in Buildroot is mainly a defconfig. So here, you have adjusted one board configuration and created 3 new ones.
Thanks for the feedback about the board, it makes sense. I was drawing inspiration from the generic-looking aarch64-efi board. But I hear you, about the intended use of boards in Buildroot.
I'm working on a simpler v2 revision of this series that does not introduce too many new concepts or this kind of "generic" board.
Quoted 3 lines
What is the Qemu SBSA platform compared to the QEMU Virt one ? Why would we want
qemu_aarch64_virt_sbbr_defconfigandqemu_aarch64_sbsa_sbbr_defconfig?
The QEMU SBSA machine is the reference implementation of a SBSA- compatible hardware. It's one of the two "ARM Server Ready" standards that ARM and Linaro are working on. The other standard is SBBR for bootloader firmware (which basically is ATF + EDK2 + ACPI).
Quoted 3 lines
What makes these platform Qemu specific ? The fact that we do build EDK2, which is the firmware, and therefore is obviously board/platform-specific ?
Part of what makes these platforms QEMU-specific are things like the flash device image layout, ACPI tables and other "hardware" features. And yes, you're right, these are indeed board specific.
Quoted 3 lines
If that's the case how is EDK2 useful on the
aarch64_eficase, which is a cross-platform defconfig that should work on any EFI-capable AArch64 system ?
For aarch64_efi I think it would make sense to build the QEMU flash version of UEFI. It's separate from anything else in the build, and would help people try the build using the instruction in board/aarch64-efi/readme.txt without having to install or download the UEFI blob from somewhere. If people want to use aarch64_efi with another platform they don't need to use the UEFI firmware that would be built. Would that make sense?
I've noted all the other feedback you provided in the series and will include it in v2.
Cheers
Dick Olsson