From patchwork Thu Mar 18 15:43:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "D. Olsson" X-Patchwork-Id: 1455339 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=smtp1.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) 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=protonmail3 header.b=wWFsXCAo; dkim-atps=neutral Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4F1Wjm1ltPz9sS8 for ; Fri, 19 Mar 2021 02:51:56 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id B3CD2842B3; Thu, 18 Mar 2021 15:51:54 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ntlmA8XIir2l; Thu, 18 Mar 2021 15:51:53 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp1.osuosl.org (Postfix) with ESMTP id C1EDF842B9; Thu, 18 Mar 2021 15:51:52 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id B1C481BF341 for ; Thu, 18 Mar 2021 15:51:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id CBF0D4EE33 for ; Thu, 18 Mar 2021 15:51:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp4.osuosl.org (amavisd-new); dkim=pass (2048-bit key) header.d=senzilla.io Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sTnkbc_1lrUM for ; Thu, 18 Mar 2021 15:51:12 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0 Received: from mail-41103.protonmail.ch (mail-41103.protonmail.ch [185.70.41.103]) by smtp4.osuosl.org (Postfix) with ESMTPS id 9EB174EE34 for ; Thu, 18 Mar 2021 15:51:11 +0000 (UTC) Received: from mail-02.mail-europe.com (mail-02.mail-europe.com [51.89.119.103]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by mail-41103.protonmail.ch (Postfix) with ESMTPS id 4F1WWz6Mbfz4wxT9 for ; Thu, 18 Mar 2021 15:43:27 +0000 (UTC) Authentication-Results: mail-41103.protonmail.ch; dkim=pass (2048-bit key) header.d=senzilla.io header.i=@senzilla.io header.b="wWFsXCAo" Date: Thu, 18 Mar 2021 15:43:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=senzilla.io; s=protonmail3; t=1616082198; bh=+lGjPRePwjYwAaM52vRjoWoJHtuHZwhUl0CazJkKfao=; h=Date:To:From:Cc:Reply-To:Subject:From; b=wWFsXCAox0QeTNEohz+ClOBqeUAFJgs0LsIBy0HnQRjoaODCrP3+B/6RHD1pvgSth emO15UDiDbyaRx3i/+1WdNLI7lTRav6rkI1CLeMFiwdhPpvLvlrcYOukk35ZC3DtXE fztpArBwUBgyihkwwo11BRHSAe4q07IxbVO16KHUauhaghrzp5/A/v7ePgo4r/4mpJ JecyPwav1jkP2W201lfcKJWSiEea2CapDWiOTvna4L1Io32U9R3TQiNpRjn+Ru5aEj 2fHPv2EJBK+F+y+lfG1xIj5NZecv6BUEtMDYbWgA8YkQSFhOG0vXfcNxTfTNYoNV4W 24wtrEDQmdNqw== To: buildroot@buildroot.org Message-ID: MIME-Version: 1.0 Subject: [Buildroot] [PATCH v4 06/10] 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: , From: Dick Olsson via buildroot Reply-To: Dick Olsson Cc: Gerome Burlats , Romain Naour , Dick Olsson Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" 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 4: * The qemu-sbsa-ref machine is now able to boot the kernel. Adjusted readme.txt accordingly * Updated to Linux LTS kernel 5.10 * Renamed post-image.sh to assemble-flash-images * Added startup.nsh for auto-booting from the EFI shell * Simplified resizing of the flash images with the truncate command Revision 3: * post-image.sh cleanup * Added host-qemu to config for testing 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 Signed-off-by: Dick Olsson --- board/qemu/aarch64-sbsa/assemble-flash-images | 18 ++++++++ board/qemu/aarch64-sbsa/genimage.cfg | 27 ++++++++++++ board/qemu/aarch64-sbsa/readme.txt | 26 +++++++++++ board/qemu/aarch64-sbsa/startup.nsh | 1 + configs/qemu_aarch64_sbsa_defconfig | 43 +++++++++++++++++++ 5 files changed, 115 insertions(+) create mode 100755 board/qemu/aarch64-sbsa/assemble-flash-images create mode 100644 board/qemu/aarch64-sbsa/genimage.cfg create mode 100644 board/qemu/aarch64-sbsa/readme.txt create mode 100644 board/qemu/aarch64-sbsa/startup.nsh create mode 100644 configs/qemu_aarch64_sbsa_defconfig diff --git a/board/qemu/aarch64-sbsa/assemble-flash-images b/board/qemu/aarch64-sbsa/assemble-flash-images new file mode 100755 index 0000000000..6060a835dc --- /dev/null +++ b/board/qemu/aarch64-sbsa/assemble-flash-images @@ -0,0 +1,18 @@ +#!/bin/bash + +set -e + +BOARD_DIR="$(dirname $0)" +EFI_PART=${BINARIES_DIR}/efi-part +EFI_DIR=${EFI_PART}/EFI/BOOT + +# Create the EFI system partition with startup script and kernel +# executable according to the UEFI standard. +rm -rf ${EFI_DIR} +mkdir -p ${EFI_DIR} +cp ${BOARD_DIR}/startup.nsh ${EFI_PART}/ +ln -sf ${BINARIES_DIR}/Image ${EFI_DIR}/bootaa64.efi + +# The QEMU sbsa machine expects flash devices to be 256M. +truncate -s 256M ${BINARIES_DIR}/SBSA_FLASH0.fd +truncate -s 256M ${BINARIES_DIR}/SBSA_FLASH1.fd diff --git a/board/qemu/aarch64-sbsa/genimage.cfg b/board/qemu/aarch64-sbsa/genimage.cfg new file mode 100644 index 0000000000..7c37d6a7dd --- /dev/null +++ b/board/qemu/aarch64-sbsa/genimage.cfg @@ -0,0 +1,27 @@ +image efi-part.vfat { + vfat { + file EFI { + image = "efi-part/EFI" + } + file startup.nsh { + image = "efi-part/startup.nsh" + } + } + 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/readme.txt b/board/qemu/aarch64-sbsa/readme.txt new file mode 100644 index 0000000000..cb5679ccde --- /dev/null +++ b/board/qemu/aarch64-sbsa/readme.txt @@ -0,0 +1,26 @@ +Intro +===== + +The QEMU sbsa-ref machine is primarily meant for firmware development +and testing according to ARM's SBSA and SBBR standards. + +Build +===== + + $ make qemu_aarch64_sbsa_defconfig + $ make + +Emulation +========= + +Run the emulation with: + + output/host/bin/qemu-system-aarch64 \ + -M sbsa-ref \ + -cpu cortex-a57 \ + -smp 4 \ + -m 1024 \ + -nographic \ + -pflash output/images/SBSA_FLASH0.fd \ + -pflash output/images/SBSA_FLASH1.fd \ + -hda output/images/disk.img diff --git a/board/qemu/aarch64-sbsa/startup.nsh b/board/qemu/aarch64-sbsa/startup.nsh new file mode 100644 index 0000000000..1e8f81f9ef --- /dev/null +++ b/board/qemu/aarch64-sbsa/startup.nsh @@ -0,0 +1 @@ +FS0:\EFI\BOOT\bootaa64.efi root=/dev/sda2 console=ttyAMA0 diff --git a/configs/qemu_aarch64_sbsa_defconfig b/configs/qemu_aarch64_sbsa_defconfig new file mode 100644 index 0000000000..eb9aa13be7 --- /dev/null +++ b/configs/qemu_aarch64_sbsa_defconfig @@ -0,0 +1,43 @@ +# 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/assemble-flash-images 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.10.2" +BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y + +# Linux headers same as kernel, a 5.10 series +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=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 + +# host-qemu for testing +BR2_PACKAGE_HOST_QEMU=y +BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y