From patchwork Sun Jul 26 10:06:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "D. Olsson" X-Patchwork-Id: 1336453 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=senzilla.io Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=senzilla.io header.i=@senzilla.io header.a=rsa-sha256 header.s=protonmail2 header.b=RXA/bW/L; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BDz9w0GLMz9sRK for ; Sun, 26 Jul 2020 20:06:44 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 301D5860F2; Sun, 26 Jul 2020 10:06:41 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rMvbE3O_WzIM; Sun, 26 Jul 2020 10:06:39 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id E688C860C1; Sun, 26 Jul 2020 10:06:38 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id F1A631BF4DD for ; Sun, 26 Jul 2020 10:06:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id E719421532 for ; Sun, 26 Jul 2020 10:06:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id h1dW79d+5sBU for ; Sun, 26 Jul 2020 10:06:36 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-40136.protonmail.ch (mail-40136.protonmail.ch [185.70.40.136]) by silver.osuosl.org (Postfix) with ESMTPS id B5C8920030 for ; Sun, 26 Jul 2020 10:06:35 +0000 (UTC) Date: Sun, 26 Jul 2020 10:06:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=senzilla.io; s=protonmail2; t=1595757992; bh=zkFRYS3ecBp6WpFv11hy3N66QPmikm7t1Mx+irlE1nA=; h=Date:To:From:Cc:Reply-To:Subject:From; b=RXA/bW/LdyM43vwi7eNdMNB9yxBN4rhDi7f3frDFtkZ4Gupt8NNUBVlrU5ExMovil BADVo3KTmEE62yW581NnuiZ4NbfpX0nCdCcE360z9HW90wsaMWkqdnA8tu7WFx9YJ0 Lpm7luJeO9O/MO7D5kGFOOjV6wVPS33dJhiDDeGi10rupremPsAqEw5ufXDyet9AAc fWwu1Cmk04COIlB3m8QI6oYMN9bGTeDKtTh9ysxBUYJLRI0w9JNQVmwDxsbSk0aHpy o0u5p4wqJ4P1+rHAeTh2YV4BhXvoincj16etz06PbNg6X8tvhlkFire1w4n4hrQRv8 KOtppP7k+ddVQ== To: buildroot@buildroot.org From: "D. Olsson" Message-ID: <20200726100541.7710-2-hi@senzilla.io> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v2 1/6] package/edk2-platforms: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: "D. Olsson" Cc: Dick Olsson Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Dick Olsson 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. Signed-off-by: Dick Olsson --- Revision 2: * Now installs all description files into HOST_DIR so other packages do not have to compile from its BUILD_DIR (suggested by Thomas Petazzoni) --- 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 | 12 ++++++++++++ 4 files changed, 23 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 diff --git a/package/Config.in.host b/package/Config.in.host index 647fc24841..5efe824199 100644 --- a/package/Config.in.host +++ b/package/Config.in.host @@ -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" diff --git a/package/edk2-platforms/Config.in.host b/package/edk2-platforms/Config.in.host new file mode 100644 index 0000000000..d1e2deb1d1 --- /dev/null +++ b/package/edk2-platforms/Config.in.host @@ -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 diff --git a/package/edk2-platforms/edk2-platforms.hash b/package/edk2-platforms/edk2-platforms.hash new file mode 100644 index 0000000000..a6c6e652b4 --- /dev/null +++ b/package/edk2-platforms/edk2-platforms.hash @@ -0,0 +1,2 @@ +# Locally calculated +sha256 b1ce41b6fb5d1ad5a0877c9cee7751d85aafda3a81cd54898254b07a9a42c5e7 edk2-platforms-608d71ec939692eace78e6b4b2a44ea7b6e75927.tar.gz diff --git a/package/edk2-platforms/edk2-platforms.mk b/package/edk2-platforms/edk2-platforms.mk new file mode 100644 index 0000000000..279afb16e7 --- /dev/null +++ b/package/edk2-platforms/edk2-platforms.mk @@ -0,0 +1,12 @@ +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 + +# There is nothing to build for edk2-platforms. All we need to do is to copy +# all description files to the host directory for other packages to build with. +define HOST_EDK2_PLATFORMS_INSTALL_CMDS + cp -rf $(@D) $(HOST_DIR)/share/edk2-platforms +endef + +$(eval $(host-generic-package)) From patchwork Sun Jul 26 10:06:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "D. Olsson" X-Patchwork-Id: 1336454 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=senzilla.io Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=senzilla.io header.i=@senzilla.io header.a=rsa-sha256 header.s=protonmail2 header.b=bmGHM5rQ; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BDzBJ06QFz9sRK for ; Sun, 26 Jul 2020 20:07:03 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id F15E62154A; Sun, 26 Jul 2020 10:07:01 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id X+9eE3O10Gfj; Sun, 26 Jul 2020 10:07:00 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 1EF6421539; Sun, 26 Jul 2020 10:07:00 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 339B71BF4DD for ; Sun, 26 Jul 2020 10:06:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 30251860D1 for ; Sun, 26 Jul 2020 10:06:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EaX8fdLI62_v for ; Sun, 26 Jul 2020 10:06:57 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-40136.protonmail.ch (mail-40136.protonmail.ch [185.70.40.136]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 786D4860C6 for ; Sun, 26 Jul 2020 10:06:57 +0000 (UTC) Date: Sun, 26 Jul 2020 10:06:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=senzilla.io; s=protonmail2; t=1595758014; bh=aD/VrGBdPXufDOjmRQ+/2Je2jnzBfaWiQIN2iMTo0Yw=; h=Date:To:From:Cc:Reply-To:Subject:From; b=bmGHM5rQ0jqeTHsJFAA+4t+tZdQ5duZQbauXQETKyzPoptMhiDl5T6L61IUKFkbs2 YC3yIat1r97n+LIoJhgOgV2xDn6l8E0iZd2/dPUFD+TYeZenSGS2OAzba9mZSvLPQ1 Al1S8qOCpFdMkOmIyBU/vdKWpFs7NwSzs0V8MWoHsWJAkdyqX/biJ5Bshokcx94tBs WGKiz/2dJcNt+pPinJMIFNfvLCZJ34Z8kU6Liw4g+GoYxoNLdLbsMv4e4pT9OjKHDz StfYyY+GOx+tXZnAV1j3Jn/FTkq8Jc6RPhH22yFFvbLQXLHfABn30mzX+ZlXEamigQ jlAlrPMyCOK5w== To: buildroot@buildroot.org From: "D. Olsson" Message-ID: <20200726100541.7710-3-hi@senzilla.io> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v2 2/6] boot/edk2: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: "D. Olsson" Cc: Sergey Matyukevich , Dick Olsson Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Dick Olsson 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. Signed-off-by: Dick Olsson --- 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 diff --git a/boot/Config.in b/boot/Config.in index b3adbfc8bc..5684517d93 100644 --- a/boot/Config.in +++ b/boot/Config.in @@ -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" diff --git a/boot/arm-trusted-firmware/Config.in b/boot/arm-trusted-firmware/Config.in index e505dee9d0..7d0f6aa4e0 100644 --- a/boot/arm-trusted-firmware/Config.in +++ b/boot/arm-trusted-firmware/Config.in @@ -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. diff --git a/boot/edk2/Config.in b/boot/edk2/Config.in new file mode 100644 index 0000000000..ccba277e40 --- /dev/null +++ b/boot/edk2/Config.in @@ -0,0 +1,68 @@ +config BR2_TARGET_EDK2 + bool "EDK2" + depends on BR2_TOOLCHAIN_GCC_AT_LEAST_5 + depends on BR2_x86_64 || BR2_aarch64 + 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 + +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_OVMF_X64 if BR2_x86_64 + default BR2_TARGET_EDK2_PLATFORM_ARM_VIRT_QEMU if BR2_aarch64 + +config BR2_TARGET_EDK2_PLATFORM_OVMF_X64 + bool "x86-64" + help + Configuration for x86-64. + This platform will boot from flash address 0x0. + It should therefore be used as the first bootloader. + +config BR2_TARGET_EDK2_PLATFORM_ARM_VIRT_QEMU + bool "ARM Virt Qemu (flash)" + help + Configuration for QEMU targeting the Virt machine. + This platform will only boot from flash address 0x0. + It should therefore be used as the first bootloader. + +config BR2_TARGET_EDK2_PLATFORM_ARM_VIRT_QEMU_KERNEL + bool "ARM Virt Qemu (kernel)" + help + Configuration for QEMU targeting the Virt machine. + This platform can boot from either flash address 0x0 or via + the Linux boot protocol. It can therefore be loaded by a + previous bootloader like ARM Trusted Firmware or OP-TEE. + +config BR2_TARGET_EDK2_PLATFORM_ARM_VEXPRESS_FVP_AARCH64 + bool "ARM VExpress FVP Aarch64" + select BR2_PACKAGE_HOST_EDK2_PLATFORMS + help + Configuration for ARM Versatile Express targeting the + Fixed Virtual Platform (FVP) AArch64 platform. + +config BR2_TARGET_EDK2_PLATFORM_QEMU_SBSA + bool "QEMU SBSA" + select BR2_PACKAGE_HOST_EDK2_PLATFORMS + select BR2_TARGET_ARM_TRUSTED_FIRMWARE + help + Configuration for QEMU targeting the SBSA platform. + + Note that if you are building for the QEMU SBSA platform you + should not configure EDK2 as the BL33 payload for ATF. + The EDK2 build system itself will package the ATF binaries. + +endchoice + +endif + +comment "EDK2 needs a toolchain w/ gcc >= 5" + depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_5 diff --git a/boot/edk2/edk2.hash b/boot/edk2/edk2.hash new file mode 100644 index 0000000000..b9cfe37cd2 --- /dev/null +++ b/boot/edk2/edk2.hash @@ -0,0 +1,3 @@ +# Locally calculated +sha256 251520730b53ec7d686fb07aabf0bdec0d8721ac3ca59fd3e6df5dde64f1d715 edk2-edk2-stable202005.tar.gz +sha256 50ce20c9cfdb0e19ee34fe0a51fc0afe961f743697b068359ab2f862b494df80 License.txt diff --git a/boot/edk2/edk2.mk b/boot/edk2/edk2.mk new file mode 100644 index 0000000000..e889070d0c --- /dev/null +++ b/boot/edk2/edk2.mk @@ -0,0 +1,117 @@ +EDK2_VERSION = edk2-stable202005 +EDK2_SITE = https://github.com/tianocore/edk2 +EDK2_SITE_METHOD = git +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 + +EDK2_INSTALL_IMAGES = YES + +ifeq ($(BR2_x86_64),y) +EDK2_ARCH = X64 +else ifeq ($(BR2_aarch64),y) +EDK2_ARCH = AARCH64 +endif + +ifeq ($(BR2_TARGET_EDK2_DEBUG),y) +EDK2_BUILD_TYPE = DEBUG +else +EDK2_BUILD_TYPE = RELEASE +endif + +# 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):$(HOST_DIR)/share/edk2-platforms +else +EDK2_PACKAGES_PATH = $(@D):$(EDK2_OUTPUT_BASE) +endif + +# 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 +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 + +# Build commands. +# +# Due to the uniquely scripted build system for EDK2 we need to export all +# build environment variables so that they are available across edksetup.sh, +# make, the build command, and other subordinate build scripts within EDK2. + +EDK2_BUILD_ENV += \ +WORKSPACE=$(@D) \ +PACKAGES_PATH=$(EDK2_PACKAGES_PATH) \ +PYTHON_COMMAND=$(HOST_DIR)/bin/python3 \ +IASL_PREFIX=$(HOST_DIR)/bin/ \ +NASM_PREFIX=$(HOST_DIR)/bin/ \ +GCC5_$(EDK2_ARCH)_PREFIX=$(TARGET_CROSS) + +EDK2_BUILD_OPTS += -a $(EDK2_ARCH) -t GCC5 -b $(EDK2_BUILD_TYPE) -p $(EDK2_PACKAGE_NAME)/$(EDK2_PLATFORM_NAME).dsc +EDK2_BUILD_TARGETS += all + +define EDK2_BUILD_CMDS + mkdir -p $(EDK2_OUTPUT_BASE) + export $(EDK2_BUILD_ENV) && \ + source $(@D)/edksetup.sh && \ + $(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/BaseTools && \ + build $(EDK2_BUILD_OPTS) $(EDK2_BUILD_TARGETS) +endef + +define EDK2_INSTALL_IMAGES_CMDS + cp -f $(@D)/Build/$(EDK2_BUILD_DIR)/$(EDK2_BUILD_TYPE)_GCC5/FV/*.fd $(BINARIES_DIR) +endef + +$(eval $(generic-package)) From patchwork Sun Jul 26 10:07:02 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "D. Olsson" X-Patchwork-Id: 1336455 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=senzilla.io Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=senzilla.io header.i=@senzilla.io header.a=rsa-sha256 header.s=protonmail2 header.b=ApfakA5B; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BDzBZ2HPwz9sRK for ; Sun, 26 Jul 2020 20:07:18 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 9823121551; Sun, 26 Jul 2020 10:07:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id I8yvgfC81HDI; Sun, 26 Jul 2020 10:07:15 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id EBF3321539; Sun, 26 Jul 2020 10:07:14 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 4BE251BF4DD for ; Sun, 26 Jul 2020 10:07:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 488948790E for ; Sun, 26 Jul 2020 10:07:14 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7u7FN4Mc3d0q for ; Sun, 26 Jul 2020 10:07:12 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-40134.protonmail.ch (mail-40134.protonmail.ch [185.70.40.134]) by whitealder.osuosl.org (Postfix) with ESMTPS id 4701E86D08 for ; Sun, 26 Jul 2020 10:07:12 +0000 (UTC) Date: Sun, 26 Jul 2020 10:07:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=senzilla.io; s=protonmail2; t=1595758029; bh=5v6YP4VlUAFR7J65BZlL+k4mCQMHbZ4sQ0ZmO0bdku8=; h=Date:To:From:Cc:Reply-To:Subject:From; b=ApfakA5BCRLyWp5YkPmjHnupF5yH7nqN/AxfGshTZjuTsfF5kbvpK5zSNtzfoHuZD /c/OzD73IA2YlKa8zoEit/5gS9AnZlCMRIM9NvTAlh6au86ntUqb+iWwVxwLS6glcJ bviJp/hWM29Izo8mixKF/9eVtYB/W0qcKcjWWtRmGOxUspmYHavTDtUNbXfgJWHB2v fKRcF1cFmRwKlLIrP8zYzzfV3S2JBa18la2tBoofq3klc7ECLZF6EhiHOas5OIWOR1 r27LY9oFKRPoXSyuoES9q+N0yxjQBQb0jFwfEdj0f55VjlhAGn09mAVrtMb8u/O63p uhyTy7R77bOTQ== To: buildroot@buildroot.org From: "D. Olsson" Message-ID: <20200726100541.7710-4-hi@senzilla.io> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v2 3/6] configs/aarch64_efi_defconfig: build the EDK2 firmware from source X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: "D. Olsson" Cc: Dick Olsson Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Dick Olsson Prior to this, you had to manually download a pre-built EDK2 flash device image (QEMU_EFI.fd) in order to boot this configuration with QEMU. Now, the configuration is building EDK2 from source. Signed-off-by: Dick Olsson --- Revision 2: * Explicitly added the default EDK2 platform to defconfig --- board/aarch64-efi/readme.txt | 8 +++----- configs/aarch64_efi_defconfig | 2 ++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/board/aarch64-efi/readme.txt b/board/aarch64-efi/readme.txt index 65a6345b6c..08747027e1 100644 --- a/board/aarch64-efi/readme.txt +++ b/board/aarch64-efi/readme.txt @@ -22,13 +22,11 @@ qemu-system-aarch64 \ -cpu cortex-a57 \ -m 512 \ -nographic \ - -bios \ + -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 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. diff --git a/configs/aarch64_efi_defconfig b/configs/aarch64_efi_defconfig index 2aab6e9699..3da6542ea0 100644 --- a/configs/aarch64_efi_defconfig +++ b/configs/aarch64_efi_defconfig @@ -12,6 +12,8 @@ BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y BR2_PACKAGE_HOST_GENIMAGE=y # Bootloader +BR2_TARGET_EDK2=y +BR2_TARGET_EDK2_PLATFORM_ARM_VIRT_QEMU=y BR2_TARGET_GRUB2=y BR2_TARGET_GRUB2_ARM64_EFI=y From patchwork Sun Jul 26 10:07:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "D. Olsson" X-Patchwork-Id: 1336456 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=senzilla.io Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=senzilla.io header.i=@senzilla.io header.a=rsa-sha256 header.s=protonmail2 header.b=ZpLH4ZH8; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BDzBn2ZQqz9sRK for ; Sun, 26 Jul 2020 20:07:29 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id AB1EC8844E; Sun, 26 Jul 2020 10:07:27 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AAdgE5r2htEJ; Sun, 26 Jul 2020 10:07:26 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 80C4D8843A; Sun, 26 Jul 2020 10:07:26 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 83B6F1BF4DD for ; Sun, 26 Jul 2020 10:07:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 7FB8D878FE for ; Sun, 26 Jul 2020 10:07:25 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LefiGMgFejwq for ; Sun, 26 Jul 2020 10:07:24 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail2.protonmail.ch (mail2.protonmail.ch [185.70.40.22]) by whitealder.osuosl.org (Postfix) with ESMTPS id 82D5C86D08 for ; Sun, 26 Jul 2020 10:07:24 +0000 (UTC) Date: Sun, 26 Jul 2020 10:07:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=senzilla.io; s=protonmail2; t=1595758042; bh=KtWFUzOSPDNSTn/mU55bz9B7eSUJaNasq0UqxFlB2+E=; h=Date:To:From:Cc:Reply-To:Subject:From; b=ZpLH4ZH8QkJLGldrhEgRaSVsRFnesk8m8vrsVZ6elRNuTvG3zCJzv5+QduFKfsxMk tiFM9Jvf1C/fPHlGhVYavijEKBHHnvrl80kXvPWZfYllPzAkZL9W42HfxpGRnNDuT+ 86bA5wP+0wcuHhl2WJ7pBKSK/jobz+QsEcr+1FSg5cLC6LdpxdppejRy5y0VRJn2B+ aJRQBW0pZg+vVfJZ5waooWTxu/qhdn1Tp91DEoLcyUMz3LRX1LocDLTirE6Reypvy8 jNpGz6O22mmdfJEG4B+C6AadT6ZVEtMoXT8jOF77gFgeuQSXUQ8EdQ8GfINWwCkK0f XTHtj+OTLdPEA== To: buildroot@buildroot.org From: "D. Olsson" Message-ID: <20200726100541.7710-5-hi@senzilla.io> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v2 4/6] configs/pc_x86_64_defconfig: build the EDK2 firmware from source X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: "D. Olsson" Cc: Dick Olsson Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Dick Olsson Prior to this, you had to manually download a pre-built EDK2 flash device image (OVMF_CODE.fd) in order to boot this configuration with QEMU. Now, the configuration is building EDK2 from source. Signed-off-by: Dick Olsson --- board/pc/readme.txt | 9 ++++----- configs/pc_x86_64_efi_defconfig | 2 ++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/board/pc/readme.txt b/board/pc/readme.txt index 41aec50d36..c06ffb0a51 100644 --- a/board/pc/readme.txt +++ b/board/pc/readme.txt @@ -61,12 +61,11 @@ Run the emulation with: qemu-system-x86_64 \ -M pc \ - -bios \ + -drive file=output/images/OVMF_CODE.fd,if=pflash,format=raw \ + -drive file=output/images/OVMF_VARS.fd,if=pflash,format=raw \ -drive file=output/images/disk.img,if=virtio,format=raw \ -net nic,model=virtio \ -net user -Note that needs to point to a valid x86_64 UEFI -firmware image for qemu. It may be provided by your distribution as a -edk2 or OVMF package, in path such as -/usr/share/edk2/ovmf/OVMF_CODE.fd . +Note that output/images/OVMF_*.fd are the flash device files built by +the EDK2 package. diff --git a/configs/pc_x86_64_efi_defconfig b/configs/pc_x86_64_efi_defconfig index 984fc8f92f..1680cda9bb 100644 --- a/configs/pc_x86_64_efi_defconfig +++ b/configs/pc_x86_64_efi_defconfig @@ -14,6 +14,8 @@ BR2_PACKAGE_HOST_GENIMAGE=y BR2_PACKAGE_HOST_MTOOLS=y # Bootloader +BR2_TARGET_EDK2=y +BR2_TARGET_EDK2_PLATFORM_OVMF_X64=y BR2_TARGET_GRUB2=y BR2_TARGET_GRUB2_X86_64_EFI=y From patchwork Sun Jul 26 10:07:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "D. Olsson" X-Patchwork-Id: 1336457 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=senzilla.io Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=senzilla.io header.i=@senzilla.io header.a=rsa-sha256 header.s=protonmail2 header.b=BkQQxOXk; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BDzC00vcfz9sRK for ; Sun, 26 Jul 2020 20:07:40 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 8949720030; Sun, 26 Jul 2020 10:07:38 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Mw6fXuaJCrlV; Sun, 26 Jul 2020 10:07:37 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id EBE7C21539; Sun, 26 Jul 2020 10:07:36 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 996061BF4DD for ; Sun, 26 Jul 2020 10:07:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 7C3FF21539 for ; Sun, 26 Jul 2020 10:07:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qGUhgA95wXmN for ; Sun, 26 Jul 2020 10:07:34 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-40136.protonmail.ch (mail-40136.protonmail.ch [185.70.40.136]) by silver.osuosl.org (Postfix) with ESMTPS id 6FF2220030 for ; Sun, 26 Jul 2020 10:07:34 +0000 (UTC) Date: Sun, 26 Jul 2020 10:07:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=senzilla.io; s=protonmail2; t=1595758052; bh=PiXnTgjllOsK9z6o7BAc/zDva0XvbKgIPzCCOWvAQ2c=; h=Date:To:From:Cc:Reply-To:Subject:From; b=BkQQxOXk1bx0nnIxfyjucV55LodQNXjYzPqGXt2yOUD6y+u8cCVS32ywkJGjst5mD Sr0ywR7wrrDnoHI4N8Xmw84IZ0gjv05AlWavDjpdY0ZfHkTIYju0fehYADcm8k8FTv hXMQaQPfgpPEMwsK3TBjC9SGy8TA5nFDUqWwTIIwZtKLOchiki9EgdjFL6VdNv/kpI l+IIttD4HwLAPljp+q3qZQ7w2KbizM5SogHGurtAgAOg/sqYzeDy3hU3DfSavIQO/m O7GCw7deeD6V+NJlaIznr7tZ0641BqU+59mofuHzZD4+Vcm5x/QaXWJt4k6R0OIP30 JpWRh9NwkRIeA== To: buildroot@buildroot.org From: "D. Olsson" Message-ID: <20200726100541.7710-6-hi@senzilla.io> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v2 5/6] boot/arm-trusted-firmware: add EDK2 as BL33 option X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: "D. Olsson" Cc: Sergey Matyukevich , Dick Olsson Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Dick Olsson ARM Trusted Firmware (ATF) has the ability to load EDK2 UEFI when dropping into EL2. This is done via a new configuration option that build the BL33 payload with EDK2 images that will run in the EL2 context. Signed-off-by: Dick Olsson --- Revision 2: * It was concluded that relying on variables from EDK2 is ok since they are expanded inside _BUILD_CMDS * Now relying on the more specific variable EDK2_EL2_NAME for BL33 --- boot/arm-trusted-firmware/Config.in | 15 ++++++++++++++- boot/arm-trusted-firmware/arm-trusted-firmware.mk | 8 ++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/boot/arm-trusted-firmware/Config.in b/boot/arm-trusted-firmware/Config.in index 7d0f6aa4e0..f24813f8e6 100644 --- a/boot/arm-trusted-firmware/Config.in +++ b/boot/arm-trusted-firmware/Config.in @@ -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 diff --git a/boot/arm-trusted-firmware/arm-trusted-firmware.mk b/boot/arm-trusted-firmware/arm-trusted-firmware.mk index a3553e36cf..51a5877ba1 100644 --- a/boot/arm-trusted-firmware/arm-trusted-firmware.mk +++ b/boot/arm-trusted-firmware/arm-trusted-firmware.mk @@ -79,6 +79,14 @@ 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 name vary between platforms, we use the variable +# provided by the EDK2 package for this. Using this variable here is OK +# as it will expand after all dependencies are resolved, inside _BUILD_CMDS. +ARM_TRUSTED_FIRMWARE_MAKE_OPTS += BL33=$(BINARIES_DIR)/$(EDK2_EL2_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) From patchwork Sun Jul 26 10:07:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "D. Olsson" X-Patchwork-Id: 1336458 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=reject dis=none) header.from=senzilla.io Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=senzilla.io header.i=@senzilla.io header.a=rsa-sha256 header.s=protonmail2 header.b=CkU8XJwT; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BDzCK1WCmz9sRN for ; Sun, 26 Jul 2020 20:07:56 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id EB2CD878FE; Sun, 26 Jul 2020 10:07:54 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sfXScgOASOC9; Sun, 26 Jul 2020 10:07:53 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 3C4F48790E; Sun, 26 Jul 2020 10:07:53 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id CE5861BF4DD for ; Sun, 26 Jul 2020 10:07:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id C816B88456 for ; Sun, 26 Jul 2020 10:07:51 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Zm+aLrTbEoEs for ; Sun, 26 Jul 2020 10:07:50 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-40134.protonmail.ch (mail-40134.protonmail.ch [185.70.40.134]) by hemlock.osuosl.org (Postfix) with ESMTPS id B1AE68844C for ; Sun, 26 Jul 2020 10:07:49 +0000 (UTC) Date: Sun, 26 Jul 2020 10:07:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=senzilla.io; s=protonmail2; t=1595758066; bh=GpYkzs7xXtgTlYo9ZNkCbHpEKStp3fqVRY+6WantoYI=; h=Date:To:From:Cc:Reply-To:Subject:From; b=CkU8XJwTuBI/Ax7WZdVrrDxKZS1pKJX1Qyomuvcz/uJbYC+5BzBYg0sQY/SIveg3J w4pLrbH0WJ7w22NFx7GO9VHQRIQ22jQLNweseoF2DQDCFqjlDi4Ip1S/PS9lwFDm30 wApAypAoUnBNSOTSdSjYxn8+d86LZLqjidcq2FpdglgK9x9odgkqSFoL4OklQoE8Kh zXDZ4IQ/maUxUhDpOePBRG9i0co1vop6sU4DAA/1UFTPEt64ColTkm0MtuF3jc1eIo OF+WvPg/Q/+R5u/9qIAqyhTKRO5BZFrhNpKk8+26UC43T5j/EJ03DH9VI0pbevuB8j PKOlldJhQd1OQ== To: buildroot@buildroot.org From: "D. Olsson" Message-ID: <20200726100541.7710-7-hi@senzilla.io> MIME-Version: 1.0 Subject: [Buildroot] [PATCH v2 6/6] configs/qemu_aarch64_sbsa_defconfig: new config for QEMU sbsa-ref X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: "D. Olsson" Cc: Gerome Burlats , Romain Naour , Dick Olsson Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Dick Olsson This introduces a configuration for the SBSA reference machine under QEMU that is intended for developing and testing firmware. It consists of ATF that load EDK2 as BL33 which in turn will load the kernel in EFI stub mode with ACPI. Signed-off-by: Dick Olsson --- Revision 2: * This board was renamed/moved to be specific for QEMU sbsa-ref * General simplification * Using set -e in the post-images.sh script --- board/qemu/aarch64-sbsa/genimage.cfg | 25 ++++++++++++++++ board/qemu/aarch64-sbsa/linux.fragment | 1 + board/qemu/aarch64-sbsa/post-image.sh | 18 ++++++++++++ board/qemu/aarch64-sbsa/readme.txt | 34 ++++++++++++++++++++++ configs/qemu_aarch64_sbsa_defconfig | 40 ++++++++++++++++++++++++++ 5 files changed, 118 insertions(+) create mode 100644 board/qemu/aarch64-sbsa/genimage.cfg create mode 100644 board/qemu/aarch64-sbsa/linux.fragment create mode 100755 board/qemu/aarch64-sbsa/post-image.sh create mode 100644 board/qemu/aarch64-sbsa/readme.txt create mode 100644 configs/qemu_aarch64_sbsa_defconfig diff --git a/board/qemu/aarch64-sbsa/genimage.cfg b/board/qemu/aarch64-sbsa/genimage.cfg new file mode 100644 index 0000000000..23280c39a0 --- /dev/null +++ b/board/qemu/aarch64-sbsa/genimage.cfg @@ -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" + } +} diff --git a/board/qemu/aarch64-sbsa/linux.fragment b/board/qemu/aarch64-sbsa/linux.fragment new file mode 100644 index 0000000000..03d553a18d --- /dev/null +++ b/board/qemu/aarch64-sbsa/linux.fragment @@ -0,0 +1 @@ +CONFIG_CMDLINE="root=/dev/vda2 rootwait console=ttyAMA0" diff --git a/board/qemu/aarch64-sbsa/post-image.sh b/board/qemu/aarch64-sbsa/post-image.sh new file mode 100755 index 0000000000..e69e2c9943 --- /dev/null +++ b/board/qemu/aarch64-sbsa/post-image.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set -e + +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_flash { + dd if=/dev/zero of="${BINARIES_DIR}/${2}" bs=1M count=256 + dd if="${BINARIES_DIR}/${1}" of="${BINARIES_DIR}/${2}" conv=notrunc +} + +resize_flash "SBSA_FLASH0.fd" "SBSA_FLASH0_RESIZED.fd" +resize_flash "SBSA_FLASH1.fd" "SBSA_FLASH1_RESIZED.fd" diff --git a/board/qemu/aarch64-sbsa/readme.txt b/board/qemu/aarch64-sbsa/readme.txt new file mode 100644 index 0000000000..27558ef77a --- /dev/null +++ b/board/qemu/aarch64-sbsa/readme.txt @@ -0,0 +1,34 @@ +Intro +===== + +The QEMU sbsa-ref machine is primarily meant for firmware development and +testing. Thus, the Linux kernel is not necessarily meant to boot to userland. + +A successful boot should be considered: + +1. ARM Trusted Firmware (ATF) boots until BL31 +2. ATF loads EDK2 (UEFI) as BL33 +3. EDK2 loads the Linux kernel in EFI stub mode +4. Linux begins to boot, exits boot services, begins loading the address map +5. Freez + +Build +===== + + $ make qemu_aarch64_sbsa_defconfig + $ make + +Emulation +========= + +Run the emulation with: + + qemu-system-aarch64 \ + -M sbsa-ref \ + -cpu cortex-a57 \ + -smp 4 \ + -m 1024 \ + -nographic \ + -drive file=output/images/SBSA_FLASH0_RESIZED.fd,if=pflash,format=raw \ + -drive file=output/images/SBSA_FLASH1_RESIZED.fd,if=pflash,format=raw \ + -hda output/images/disk.img diff --git a/configs/qemu_aarch64_sbsa_defconfig b/configs/qemu_aarch64_sbsa_defconfig new file mode 100644 index 0000000000..9e0e3eb76e --- /dev/null +++ b/configs/qemu_aarch64_sbsa_defconfig @@ -0,0 +1,40 @@ +# Architecture +BR2_aarch64=y + +# Toolchain +BR2_TOOLCHAIN_BUILDROOT=y + +# System +BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0" + +# 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 +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/aarch64-sbsa/post-image.sh support/scripts/genimage.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/qemu/aarch64-sbsa/genimage.cfg" + +# Kernel +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.4.53" +BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/qemu/aarch64-sbsa/linux.fragment" + +# Linux headers same as kernel, a 5.4 series +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_4=y + +# UEFI firmware +BR2_TARGET_EDK2=y +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_GENIMAGE=y +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_MTOOLS=y