[U-Boot] [PATCH v2 17/18] board: Add Qualcomm Dragonboard 410C support

Daniel Glöckner dg at emlix.com
Sat Mar 12 00:58:23 CET 2016


On Sun, Feb 07, 2016 at 09:57:37PM +0100, Mateusz Kulikowski wrote:
> U-Boot boots chained with fastboot in 64-bit mode.

> --- /dev/null
> +++ b/board/qualcomm/dragonboard410c/head.S
> @@ -0,0 +1,28 @@
> +/*
> + * Little-Kernel/Fastboot header for proper chain-loading
> + *
> + * (C) Copyright 2015 Mateusz Kulikowski <mateusz.kulikowski at gmail.com>
> + *
> + * SPDX-License-Identifier:	GPL-2.0+
> + */
> +
> +#include <config.h>
> +
> +.global _fastboot_header
> +_fastboot_header:
> +	b _start
> +	add     x13, x18, #0x16
> +	/* Image load offset from start of RAM, little-endian */
> +	.quad   CONFIG_SYS_TEXT_BASE-PHYS_SDRAM_1
> +	/* Effective size of kernel image, little-endian */
> +	.quad   0 /* 0x60000 */
> +	/* Informative flags, little-endian */
> +	.quad   0
> +	.quad   0                               /* reserved */
> +	.quad   0                               /* reserved */
> +	.quad   0                               /* reserved */
> +	.byte   0x41                            /* Magic number, "ARM\x64" */
> +	.byte   0x52
> +	.byte   0x4d
> +	.byte   0x64
> +	.word   0                               /* reserved */

I don't think fastboot is the correct term to use here. The structure in
head.S is the ARM64 Linux kernel header described in section 4 of this
document: https://www.kernel.org/doc/Documentation/arm64/booting.txt
Fastboot is AFAIK a USB protocol spoken by bootloaders used on Android
devices. Little Kernel can do fastboot, but it doesn't do it to run this
image.

It is also confusing to have the "add" instruction in there without an
explanation, especially because having it at offset 4 instead of 0 defeats
its original purpose (MZ EXE signature for EFI).

> +6) generate qualcomm device tree, use dtbTool to generate it
> +$ dtbTool -o dt.img arch/arm/dts
> +
> +7) generate image with mkbootimg:
> +$ mkbootimg --kernel=u-boot-dtb.bin --output=u-boot.img --dt=dt.img  --pagesize 2048 --base 0x80000000 --ramdisk=rd --cmdline=""

I would have liked a bit more text about what is done with the device
trees here. Little Kernel refuses to run the "kernel" unless it can
find a device tree matching the hardware it is running on. It adds some
information to the device tree and passes it to the kernel in the x0
register. U-Boot discards the contents of the x0 register and uses the
device tree appended to its image. So there is no need to point dtbTool
to the same dtb file used by U-Boot. A smaller one containing only the
IDs checked by Little Kernel would be enough. And dtbTool does not 
generate a device tree, it generates the Qualcomm device tree table
containing all dtb files in the directory.

I know the goal is to eventually replace Little Kernel, but how about
using the device tree passed by it? We could add some code to head.S that
saves x0 in sp_el0 and abuse CONFIG_OF_HOSTFILE to retrieve it.

Best regards,

  Daniel


-- 
Dipl.-Math. Daniel Glöckner, emlix GmbH, http://www.emlix.com
Fon +49 551 30664-0, Fax +49 551 30664-11,
Bertha-von-Suttner-Straße 9, 37085 Göttingen, Germany
Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160
Geschäftsführung: Dr. Uwe Kracke, Ust-IdNr.: DE 205 198 055

emlix - your embedded linux partner


More information about the U-Boot mailing list