[U-Boot] [PATCH v2] arm64: allow space reservation for boot header

Hans de Goede hdegoede at redhat.com
Wed May 25 10:48:19 CEST 2016


Hi,

On 25-05-16 10:40, Andre Przywara wrote:
> 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 <andre.przywara at arm.com>
>
> [1] https://github.com/apritzel/pine64/tree/master/tools

v2 looks good to me:

Acked-by: Hans de Goede <hdegoede at redhat.com>

Tom, can you pick this one up please (I'm asking you since it is
touching some non sunxi files) ?

Regards,

Hans


> ---
>  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
>   */
>


More information about the U-Boot mailing list