Skip to contentSkip to conversation

boot/edk2: new package

PATCH Superseded D. Olsson 2 participants 3 messages Jul 26, 2020 – Jul 31, 2020

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

D. Olsson

author
#0 lore raw

PATCH v2 2/6 boot/edk2: new package

From: Dick Olsson <[email protected]>

EDK2 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 firmware for the following five configurations:

* QEMU x86-64 pc machine
* QEMU aarch64 virt machine, booting directly from flash
* QEMU aarch64 virt machine, booting via kernel protocol
* QEMU aarch64 sbsa-ref machine
* ARM FVP vexpress machine

When building for QEMU sbsa-ref and ARM FVP there is a dependency on package/edk2-platforms for additional platform description files.

---

Revision 2:

Review items from Thomas Petazzoni:

* Fixed alphabetical inclusion of Config.in
* Removed spurious change in ATF
* Added architecture dependencies
* Added hash for license file
* Using host dir (instead of build dir) from edk2-platforms
* Simplified _BUILD_CMDS
* Simplified _INSTALL_IMAGES_CMDS

Other improvements:

* Added support for x86-64 and OVMF
* General cleanup and simplification
* Improved code comments
* Renamed variable EDK2_FD_NAME to EDK2_EL2_NAME to be more specific. This variable is only meaningful for platforms that build images intended to be used by other bootloaders in EL2 context (e.g. ATF).

---
 boot/Config.in                      |   1 +
 boot/arm-trusted-firmware/Config.in |   2 +-
 boot/edk2/Config.in                 |  68 ++++++++++++++++
 boot/edk2/edk2.hash                 |   3 +
 boot/edk2/edk2.mk                   | 117 ++++++++++++++++++++++++++++
 5 files changed, 190 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
index b3adbfc8bc..5684517d93 100644
@@ -8,6 +8,7 @@ source "boot/arm-trusted-firmware/Config.in"
 source "boot/barebox/Config.in"
 source "boot/binaries-marvell/Config.in"
 source "boot/boot-wrapper-aarch64/Config.in"
+source "boot/edk2/Config.in"
 source "boot/grub2/Config.in"
 source "boot/gummiboot/Config.in"
 source "boot/lpc32xxcdl/Config.in"
boot/arm-trusted-firmware/Config.in +1 -1
index e505dee9d0..7d0f6aa4e0 100644
@@ -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 +68 -0

68 lines not on this page · raw message

boot/edk2/edk2.hash new file +3 -0
new file mode 100644
index 0000000000..b9cfe37cd2
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256 251520730b53ec7d686fb07aabf0bdec0d8721ac3ca59fd3e6df5dde64f1d715  edk2-edk2-stable202005.tar.gz
+sha256 50ce20c9cfdb0e19ee34fe0a51fc0afe961f743697b068359ab2f862b494df80  License.txt
boot/edk2/edk2.mk new file +117 -0

117 lines not on this page · raw message

Signature · 1 line
2.20.1
#1 lore raw

PATCH v2 2/6 boot/edk2: new package

Hi,

Quoted 16 lines

EDK2 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 firmware for the following five configurations:

* QEMU x86-64 pc machine
* QEMU aarch64 virt machine, booting directly from flash
* QEMU aarch64 virt machine, booting via kernel protocol
* QEMU aarch64 sbsa-ref machine
* ARM FVP vexpress machine

When building for QEMU sbsa-ref and ARM FVP there is a dependency on package/edk2-platforms for additional platform description files.

...

boot/arm-trusted-firmware/Config.in line 4

Quoted 8 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

Just a nit: this spurious whitespace change should go to the 5th patch in the series.

Quoted 3 lines
boot/arm-trusted-firmware/Config.in +0 -0
 	help
 	  Enable this option if you want to build the ATF for your ARM
 	  based embedded device.

...

Quoted 5 lines
boot/edk2/edk2.mk new file +0 -0
new file mode 100644
index 0000000000..e889070d0c

...

Quoted 38 lines
boot/edk2/edk2.mk new file +38 -0
+# Platform configuration.
+#
+# We set the variable EDK_EL2_NAME for platforms that may load EDK2 as part of
+# the EL2 processor context, like ARM Trusted Firmware (ATF). This way, other
+# bootloaders know what binary to include in their firmware package.
+#
+# However, the QEMU SBSA platform is a bit unique as there are different
+# implicit assumptions on how this firmware should be packaged and run.
+# The EDK2 build system itself will package the ATF binaries.
+
+ifeq ($(BR2_TARGET_EDK2_PLATFORM_OVMF_X64),y)
+EDK2_DEPENDENCIES += host-nasm
+EDK2_PACKAGE_NAME = OvmfPkg
+EDK2_PLATFORM_NAME = OvmfPkgX64
+EDK2_BUILD_DIR = OvmfX64
+
+else ifeq ($(BR2_TARGET_EDK2_PLATFORM_ARM_VIRT_QEMU),y)
+EDK2_PACKAGE_NAME = ArmVirtPkg
+EDK2_PLATFORM_NAME = ArmVirtQemu
+EDK2_BUILD_DIR = $(EDK2_PLATFORM_NAME)-$(EDK2_ARCH)
+
+else ifeq ($(BR2_TARGET_EDK2_PLATFORM_ARM_VIRT_QEMU_KERNEL),y)
+EDK2_PACKAGE_NAME = ArmVirtPkg
+EDK2_PLATFORM_NAME = ArmVirtQemuKernel
+EDK2_BUILD_DIR = $(EDK2_PLATFORM_NAME)-$(EDK2_ARCH)
+EDK2_EL2_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_BUILD_DIR = $(EDK2_PLATFORM_NAME)
+EDK2_EL2_NAME = FVP_AARCH64_EFI
+
+else ifeq ($(BR2_TARGET_EDK2_PLATFORM_QEMU_SBSA),y)
+EDK2_DEPENDENCIES += host-edk2-platforms arm-trusted-firmware
+EDK2_PACKAGE_NAME = Platform/Qemu/SbsaQemu
+EDK2_PLATFORM_NAME = SbsaQemu

boot/edk2/edk2.mk line 86

Quoted 10 lines
boot/edk2/edk2.mk new file +10 -0
+EDK2_BUILD_DIR = $(EDK2_PLATFORM_NAME)
+EDK2_PRE_CONFIGURE_HOOKS += EDK2_OUTPUT_QEMU_SBSA
+endif
+
+# For QEMU SBSA we use EDK2_OUTPUT_BASE (which is already in the EDK2 path) to
+# build the package structure that EDK2 expects for this specific platform.
+define EDK2_OUTPUT_QEMU_SBSA
+	mkdir -p $(EDK2_OUTPUT_BASE)/Platform/Qemu/Sbsa
+	ln -srf $(BINARIES_DIR)/{bl1.bin,fip.bin} $(EDK2_OUTPUT_BASE)/Platform/Qemu/Sbsa/
+endef

Am I correct assuming that bl1.bin and fip.bin are the ATF binaries for qemu_sbsa platform config ?

Regards,
Sergey

author
#2 lore raw

PATCH v2 2/6 boot/edk2: new package

Hi Sergey,

Quoted 2 lines · Sergey Matyukevich

Just a nit: this spurious whitespace change should go to the 5th patch in the series.

Thanks for catching that!

Quoted 2 lines

Am I correct assuming that bl1.bin and fip.bin are the ATF binaries for qemu_sbsa platform config ?

Yes, that's correct. I'll clarify that with a short inline comment.

Cheers

D. Olsson
PGP: 8204A8CD