From patchwork Wed May 25 08:40:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 626065 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3rF5Lv3KF7z9sXR for ; Wed, 25 May 2016 18:40:07 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1E435A7519; Wed, 25 May 2016 10:40:05 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4KXfCjzQRWv4; Wed, 25 May 2016 10:40:04 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 41D53A74E3; Wed, 25 May 2016 10:40:04 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id F2BFCA74E3 for ; Wed, 25 May 2016 10:39:59 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nqBixYgDgHwA for ; Wed, 25 May 2016 10:39:59 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by theia.denx.de (Postfix) with ESMTP id 9A626A74C5 for ; Wed, 25 May 2016 10:39:55 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DE1C034; Wed, 25 May 2016 01:40:17 -0700 (PDT) Received: from e104803-lin.lan (unknown [10.1.203.153]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6EFB63F21A; Wed, 25 May 2016 01:39:53 -0700 (PDT) From: Andre Przywara To: albert.u.boot@aribaud.net, Hans de Goede Date: Wed, 25 May 2016 09:40:26 +0100 Message-Id: <1464165626-16564-1-git-send-email-andre.przywara@arm.com> X-Mailer: git-send-email 2.8.2 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH v2] arm64: allow space reservation for boot header X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Some SPL loaders (like Allwinner's boot0) require a header before the actual U-Boot binary to both check its validity and to find other data to load. Introduce a config option to reserve some space at the beginning of the binary to later hold the header if needed. Please note that the current arm64 start.S jumps over some portion of data already, so this option bascially just increases this region to allow post-processing tools to insert more data there. This also means that both filling the header is optional and also having some extra space in there does not hurt apart from enlarging the binary. For the use with Allwinner's boot0 blob there is a tool called boot0img[1], which fills the header to allow booting A64 based boards. For the Pine64 we need a 1536 Byte header (including the branch instruction) at the moment, so we add this to the defconfig. Signed-off-by: Andre Przywara [1] https://github.com/apritzel/pine64/tree/master/tools Acked-by: Hans de Goede --- arch/arm/cpu/armv8/start.S | 3 +++ board/sunxi/Kconfig | 7 +++++++ configs/pine64_plus_defconfig | 1 + include/configs/sun50i.h | 4 ++++ 4 files changed, 15 insertions(+) diff --git a/arch/arm/cpu/armv8/start.S b/arch/arm/cpu/armv8/start.S index e933021..a9cd7e9 100644 --- a/arch/arm/cpu/armv8/start.S +++ b/arch/arm/cpu/armv8/start.S @@ -21,6 +21,9 @@ _start: b reset +#ifdef CONFIG_START_HEADER_SPACE + .space CONFIG_START_HEADER_SPACE /* can be filled with a boot0 header */ +#endif .align 3 .globl _TEXT_BASE diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index fa78720..9f2e17e 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -15,6 +15,13 @@ config SUNXI_GEN_SUN6I separate ahb reset control registers, custom pmic bus, new style watchdog, etc. +config SUNXI_BOOT0 + bool "prepare for boot0 header" + ---help--- + If U-Boot is loaded from the Allwinner provided boot0 blob, it + expects a header area filled with magic values. + This option will add some space at the beginning of the image to + let a tool later on fill in this header with sensible data. choice prompt "Sunxi SoC Variant" diff --git a/configs/pine64_plus_defconfig b/configs/pine64_plus_defconfig index 0977334..b93e4da 100644 --- a/configs/pine64_plus_defconfig +++ b/configs/pine64_plus_defconfig @@ -18,3 +18,4 @@ CONFIG_CMD_EXT2=y CONFIG_CMD_EXT4=y CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y +CONFIG_SUNXI_BOOT0=y diff --git a/include/configs/sun50i.h b/include/configs/sun50i.h index 0fdb4c7..6923b60 100644 --- a/include/configs/sun50i.h +++ b/include/configs/sun50i.h @@ -17,6 +17,10 @@ #define GICD_BASE 0x1c81000 #define GICC_BASE 0x1c82000 +#ifdef CONFIG_SUNXI_BOOT0 +#define CONFIG_START_HEADER_SPACE 1532 +#endif + /* * Include common sunxi configuration where most the settings are */