From patchwork Wed May 12 18:36:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "D. Olsson" X-Patchwork-Id: 1477772 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=2605:bc80:3010::136; helo=smtp3.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=C0+dQrcZ; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (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 4FgNp06bvdz9sRN for ; Thu, 13 May 2021 04:38:00 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id C87AB60DFB; Wed, 12 May 2021 18:37:58 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JsvPxlaqqlD8; Wed, 12 May 2021 18:37:57 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 9D84D60DF9; Wed, 12 May 2021 18:37:56 +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 8A54D1BF2E3 for ; Wed, 12 May 2021 18:37:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 7AC2440F66 for ; Wed, 12 May 2021 18:37:04 +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 fvYKcboTqTfZ for ; Wed, 12 May 2021 18:37:03 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0 Received: from mail1.protonmail.ch (mail1.protonmail.ch [185.70.40.18]) by smtp4.osuosl.org (Postfix) with ESMTPS id 1623340F6F for ; Wed, 12 May 2021 18:37:02 +0000 (UTC) Date: Wed, 12 May 2021 18:36:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=senzilla.io; s=protonmail3; t=1620844620; bh=vVz/76gSzOiVS2gwUDOFpqUcdz1nycOLVQx1SV6fKZk=; h=Date:To:From:Cc:Reply-To:Subject:From; b=C0+dQrcZ+QGdLgpDi9itYXzo1Tvr5K/zhur0kbvnDsa+PDrnm/cyewGia+tQ9vFCc PVlA3UTlOMJQlagC1XiKFwTBt6uz8Wiu2UBvKpkZEP9mE7v5Rp6ppF5aJE1myTMA6f TuoNr4UL0ZYZNhfa0hCAo/VNJC3N7WsiixwUVhPPI8/P+9XNMgyFLnhW5GQj4WUEM3 /EXI7vyKBzKDtARoOxGbNDlsOjemIH4W2hXQSLEY7gOl+MCBTuSxv6dL13O12XNdxd QPpj3wGPG58e0Cykp758Mh6JWkSipyZb05x/x7JjyIjB/LJEeW38f6W3Qw++WG0/Ig aO+aG9mz/b4fQ== To: buildroot@buildroot.org Message-ID: MIME-Version: 1.0 Subject: [Buildroot] [PATCH v5 08/10] configs/solidrun_macchiatobin_efi_defconfig: EFI config for MacchiatoBin 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 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This introduces an alternative board build for the MacchiatoBin based on EDK2 (UEFI) firmware loaded as BL33 by ARM Trusted Firmware. Signed-off-by: Dick Olsson --- Revision 5: * Fixed incorrect Linux version statement in readme.txt * Replaced kernel EFI stub mode with GRUB2 for more convenience * The GRUB2 package handles the efi-part image * Simplified the post script * Removed the startup.nsh in favour of that provided by GRUB2 * Re-exported the defconfig Revision 4: * Renamed post-image.sh to assemble-flash-images * Updated to Linux LTS kernel 5.10 * Added startup.nsh for auto-booting from the EFI shell --- .../macchiatobin-efi/assemble-flash-images | 7 ++ board/solidrun/macchiatobin-efi/genimage.cfg | 30 +++++++ board/solidrun/macchiatobin-efi/grub.cfg | 6 ++ .../solidrun/macchiatobin-efi/linux.fragment | 3 + board/solidrun/macchiatobin-efi/readme.txt | 90 +++++++++++++++++++ configs/solidrun_macchiatobin_efi_defconfig | 28 ++++++ 6 files changed, 164 insertions(+) create mode 100755 board/solidrun/macchiatobin-efi/assemble-flash-images create mode 100644 board/solidrun/macchiatobin-efi/genimage.cfg create mode 100644 board/solidrun/macchiatobin-efi/grub.cfg create mode 100644 board/solidrun/macchiatobin-efi/linux.fragment create mode 100644 board/solidrun/macchiatobin-efi/readme.txt create mode 100644 configs/solidrun_macchiatobin_efi_defconfig diff --git a/board/solidrun/macchiatobin-efi/assemble-flash-images b/board/solidrun/macchiatobin-efi/assemble-flash-images new file mode 100755 index 0000000000..51e4e33458 --- /dev/null +++ b/board/solidrun/macchiatobin-efi/assemble-flash-images @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e + +BOARD_DIR="$(dirname $0)" + +cp -f ${BOARD_DIR}/grub.cfg ${BINARIES_DIR}/efi-part/EFI/BOOT/grub.cfg diff --git a/board/solidrun/macchiatobin-efi/genimage.cfg b/board/solidrun/macchiatobin-efi/genimage.cfg new file mode 100644 index 0000000000..f1e72c0f32 --- /dev/null +++ b/board/solidrun/macchiatobin-efi/genimage.cfg @@ -0,0 +1,30 @@ +image efi-part.vfat { + vfat { + file startup.nsh { + image = "efi-part/startup.nsh" + } + file EFI { + image = "efi-part/EFI" + } + file Image { + image = "Image" + } + } + size = 32M +} + +image sdcard.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/solidrun/macchiatobin-efi/grub.cfg b/board/solidrun/macchiatobin-efi/grub.cfg new file mode 100644 index 0000000000..ab88da91b9 --- /dev/null +++ b/board/solidrun/macchiatobin-efi/grub.cfg @@ -0,0 +1,6 @@ +set default="0" +set timeout="5" + +menuentry "Buildroot" { + linux /Image root=/dev/vda2 rootwait console=ttyAMA0 +} diff --git a/board/solidrun/macchiatobin-efi/linux.fragment b/board/solidrun/macchiatobin-efi/linux.fragment new file mode 100644 index 0000000000..29fd630626 --- /dev/null +++ b/board/solidrun/macchiatobin-efi/linux.fragment @@ -0,0 +1,3 @@ +CONFIG_MARVELL_PHY=y +CONFIG_MARVELL_10G_PHY=y +CONFIG_SFP=y diff --git a/board/solidrun/macchiatobin-efi/readme.txt b/board/solidrun/macchiatobin-efi/readme.txt new file mode 100644 index 0000000000..26d1bb37c1 --- /dev/null +++ b/board/solidrun/macchiatobin-efi/readme.txt @@ -0,0 +1,90 @@ +Intro +===== + +This is the board support for MacchiatoBin with a more modern firmware stack +compared to the original build with board/solidrun/macchiatobin. + +The goal with this default configuration is to provide a build as close to +ARM Server Base Boot Requirement (SBBR) as possible. This gives us the +following benefits: + + - The firmware is built and flashed separately from the OS image + - Therefore, the board will boot with any standard Aarch64 distribution image + - UEFI provides a more standardized firmware interface + +How to build +============ + +The default configuration provides the following stack: + + - ARM Trusted Firmware (mainline) + - EDK2 UEFI firmware (mainline) + - Linux 5.10 (mainline) + + $ make solidrun_macchiatobin_efi_defconfig + $ make + +The next step will depend on whether you have U-Boot or UEFI flashed on the +board. + +How to flash the firmware from U-Boot +===================================== + +In this example we will assume that the board has U-Boot flashed on it. We will +flash the new UEFI firmware from the U-Boot console to the SPI flash, using +the "bubt" (Burn ATF) command. + +Once the build process is finished you will have an image called +"flash-image.bin" in the output/images/ directory. + +First, format a USB drive with an EXT4 partition and copy the "flash-image.bin" +file onto the USB drive. + +Second, attach to the serial console[1], insert the USB drive into the board, +boot the board and enter the U-Boot console. On the U-Boot console enter the +following commands: + + usb start + bubt flash-image.bin spi usb + +Lastly, unplug the USB drive and reboot the board. The board will now +boot with the newly flashed UEFI firmware. + +How to flash the firmware from UEFI +=================================== + +In this example we will assume that the board has UEFI flashed on it. We will +flash the new UEFI firmware from the old UEFI console to the SPI flash, using +the "fupdate" command. + +First, format a USB drive with an FAT partition and copy the "flash-image.bin" +file onto the USB drive. + +Second, attach to the serial console[1], insert the USB drive into the board, +boot the board and enter the UEFI shell. In the UEFI shell, find what file +system your USB drive got mapped to by using the "map" and "ls" commands. +Then enter this command (assuming your USB drive is on "FS0"): + + fupdate FS0:\flash-image.bin spi + +Lastly, unplug the USB drive and reboot the board. The board will now +boot with the newly flashed UEFI firmware. + +How to write the SD card +======================== + +Once the build process is finished you will have an image called "sdcard.img" +in the output/images/ directory. This image only contains the Linux kernel and +the rest of the operating system. + +Copy the bootable "sdcard.img" onto an SD card with "dd": + + $ sudo dd if=output/images/sdcard.img of=/dev/sdX bs=1M conv=fsync + $ sudo sync + +Plug in the SD card into the board and boot. + +Note that because the board is now using UEFI firmware, the board will also +boot any other standard Aarch64 distribution image. + +[1]: http://wiki.espressobin.net/tiki-index.php?page=Quick+User+Guide diff --git a/configs/solidrun_macchiatobin_efi_defconfig b/configs/solidrun_macchiatobin_efi_defconfig new file mode 100644 index 0000000000..9ed9237d65 --- /dev/null +++ b/configs/solidrun_macchiatobin_efi_defconfig @@ -0,0 +1,28 @@ +BR2_aarch64=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_10=y +BR2_TOOLCHAIN_BUILDROOT_WCHAR=y +BR2_ROOTFS_POST_IMAGE_SCRIPT="board/solidrun/macchiatobin-efi/assemble-flash-images support/scripts/genimage.sh" +BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/solidrun/macchiatobin-efi/genimage.cfg" +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_CUSTOM_VERSION=y +BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.10.34" +BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y +BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/solidrun/macchiatobin-efi/linux.fragment" +BR2_TARGET_ROOTFS_EXT2=y +BR2_TARGET_ROOTFS_EXT2_4=y +BR2_TARGET_ROOTFS_EXT2_SIZE="120M" +# BR2_TARGET_ROOTFS_TAR is not set +BR2_TARGET_ARM_TRUSTED_FIRMWARE=y +BR2_TARGET_ARM_TRUSTED_FIRMWARE_PLATFORM="a80x0_mcbin" +BR2_TARGET_ARM_TRUSTED_FIRMWARE_FIP=y +BR2_TARGET_ARM_TRUSTED_FIRMWARE_EDK2_AS_BL33=y +BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_TARGETS="mrvl_flash" +BR2_TARGET_ARM_TRUSTED_FIRMWARE_ADDITIONAL_VARIABLES="USE_COHERENT_MEM=0" +BR2_TARGET_BINARIES_MARVELL=y +BR2_TARGET_EDK2=y +BR2_TARGET_EDK2_PLATFORM_SOLIDRUN_ARMADA80X0MCBIN=y +BR2_TARGET_GRUB2=y +BR2_TARGET_MV_DDR_MARVELL=y +BR2_PACKAGE_HOST_DOSFSTOOLS=y +BR2_PACKAGE_HOST_GENIMAGE=y +BR2_PACKAGE_HOST_MTOOLS=y