All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew F. Davis <afd@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC PATCH 00/11] extend FIT loading support (plus Pine64/ATF support)
Date: Mon, 6 Feb 2017 10:17:40 -0600	[thread overview]
Message-ID: <ce189e74-9bef-a05b-8513-c9c5aa2c7d02@ti.com> (raw)
In-Reply-To: <CAPnjgZ0MRADsT0Y4Du2LAEimnt716zqV=ssq_dYNj6bTnLjczg@mail.gmail.com>

On 02/06/2017 09:33 AM, Simon Glass wrote:
> Hi Andre,
> 
> On 27 January 2017 at 17:47, Andr? Przywara <andre.przywara@arm.com> wrote:
>> On 27/01/17 21:29, Simon Glass wrote:
>>
>> Hi Simon,
>>
>>> On 19 January 2017 at 18:53, Andre Przywara <andre.przywara@arm.com> wrote:
>>>> Currently the FIT format is not used to its full potential in the SPL:
>>>> It only loads the first image from the /images node and appends the
>>>> proper FDT.
>>>> Some boards and platforms would benefit from loading more images before
>>>> starting U-Boot proper, notably Allwinner A64 and ARMv8 Rockchip boards,
>>>> which use an ARM Trusted Firmware (ATF) image to be executed before U-Boot.
>>>>
>>>> This series tries to solve this in a board agnostic and generic way:
>>>> We extend the SPL FIT loading scheme to allow loading multiple images.
>>>> So apart from loading the image which is referenced by the "firmware"
>>>> property in the respective configuration node and placing the DTB right
>>>> behind it, we iterate over all strings in the "loadable" property.
>>>> Each image referenced there will be loaded to its specified load address.
>>>> The entry point U-Boot eventually branches to will be taken from the
>>>> first image to explicitly provide the "entry" property, or, if none
>>>> of them does so, from the load address of the "firmware" image.
>>>> This keeps the scheme compatible with the FIT images our Makefile creates
>>>> automatically at the moment.
>>>>
>>>> Apart from the already mentioned ATF scenario this opens up more usage
>>>> scenarios, of which the commit message of patch 04/11 lists some.
>>>>
>>>> The first three patches rework the SPL FIT support to be more flexible
>>>> and to allow easier usage in the fourth patch, which introduces the
>>>> multiple-image loading facility.
>>>> The remaining patches enable that support for the Pine64 board to make
>>>> its SPL support finally useful and to demonstrate usage of this scheme:
>>>> patches 5-7 extend the usable SPL size by about 4 KB to allow AArch64
>>>> compilation of the SPL with FIT support enabled. Patch 8 implements the
>>>> board selector routine, which selects either the Pine64 or Pine64+ DTB
>>>> depending on the detected DRAM size. Patch 9 enables SPL FIT support in
>>>> the Pine64 defconfig.
>>>> To demonstrate the usage, patch 10 provides a FIT source file, which
>>>> loads and executes ATF before the U-Boot proper. Users are expected to
>>>> compile this with "mkimage -f boards/sunxi/pine64_atf.its -E pine64.itb",
>>>> then write the resulting file behind the SPL on an SD card (or any other
>>>> U-Boot supported boot media, for that matter).
>>>> Patch 11 then adds FIT support to the sunxi SPL SPI loading routine,
>>>> which allows to load ATF on boards with SPI flash as well.
>>>>
>>>> Questions:
>>>> 1) Is this scheme the right one (usage of "firmware" and "loadables",
>>>>    determination of entry point)? Shall we make use of the "setup"
>>>>    property?
>>>
>>> Seems reasonable to me.
>>>
>>>> 2) Shall we extend mkimage to allow supplying "loadable" files on the
>>>>    command line, which would allow to build the .itb file automatically?
>>>
>>> Yes.
>>
>> I was thinking about this a bit more, as Andrew pointed out before it
>> may become hairy to add tons of options to mkimage.
>> I came up with a simple shell script, mostly using here documents
>> (cat << _EOF) to generate the .its file on the fly, adding all DTs given
>> on the command line. It's pretty easy, yet readable and adaptable. So
>> each platform could provide one, if needed, and could hard code things
>> like ATF in here.
> 
> That sounds reasonable. But I do think it is valuable to support the
> basic case without needing a script, so long as you can do it with
> only a few mkimage options?
> 

We already have a few mkimage option for auto-generating FIT for basic
cases (Executable and DTBs). I've seen internally confusion caused by
having mkimage accept dtb's on the command-line while we work to add
more complex FIT schemes. I think our time is best spent working on
simplifying generating custom .its files during build, and less on
patching mkimage to support increasingly complex build configurations.

How about we have template .its files for platforms and for simple build
cases, then simply define a way to fill in these using mkimage:

> / {
>         description = "U-Boot fitImage for PlatformX";
>         #address-cells = <1>;
> 
>         images {
>                 u-boot at 1 {
>                         description = "U-Boot";
>                         data = /incbin/("u-boot.bin");
>                         arch = "arm";
>                         load = <[u_boot_load]>;
>                 };
>                 [dtb_name] {
>                         description = "Flattened Device Tree blob";
>                         data = /incbin/("arch/arm/boot/dts/[dtb_name].dtb");
>                         type = "flat_dt";
>                         arch = "arm";
>                 };
>                 firmware at 1 {
>                         data = /incbin/("[firmware_name]");
>                         arch = "arm";
>                         compression = "none";
>                 };
>         };
> };

Then:

> $ mkimage --template "default.dtb" -x "u_boot_load=0x800000,dtb_name=dra7xx_evm.dtb,firmware_name=atf.bin"

Or better yet, use an existing template engine as a pre-processing step
in the Makefile to generate the needed .its files.

Andrew

> 
> Regards,
> Simon
> 

  parent reply	other threads:[~2017-02-06 16:17 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-20  1:53 [U-Boot] [RFC PATCH 00/11] extend FIT loading support (plus Pine64/ATF support) Andre Przywara
2017-01-20  1:53 ` [U-Boot] [RFC PATCH 01/11] SPL: FIT: refactor FDT loading Andre Przywara
2017-01-23  8:56   ` Lokesh Vutla
2017-01-27 21:29   ` Simon Glass
2017-01-28  0:38     ` André Przywara
2017-01-20  1:53 ` [U-Boot] [RFC PATCH 02/11] SPL: FIT: rework U-Boot image loading Andre Przywara
2017-01-23  8:56   ` Lokesh Vutla
2017-01-27 21:29   ` Simon Glass
2017-01-20  1:53 ` [U-Boot] [RFC PATCH 03/11] SPL: FIT: factor out spl_load_fit_image() Andre Przywara
2017-01-22  7:16   ` Kever Yang
2017-01-22 10:42     ` André Przywara
2017-01-23  2:37       ` Kever Yang
2017-01-23  8:53   ` Lokesh Vutla
2017-01-23 12:58     ` Tom Rini
2017-01-23 13:31       ` Lokesh Vutla
2017-01-23 13:50         ` Tom Rini
2017-01-23 23:07     ` André Przywara
2017-01-20  1:53 ` [U-Boot] [RFC PATCH 04/11] SPL: FIT: allow loading multiple images Andre Przywara
2017-01-22  7:08   ` Kever Yang
2017-01-22 10:58     ` André Przywara
2017-01-23  2:49       ` Kever Yang
2017-01-23 12:47         ` Michal Simek
2017-01-23 23:52         ` André Przywara
2017-01-23  8:57   ` Lokesh Vutla
2017-01-20  1:53 ` [U-Boot] [RFC PATCH 05/11] tools: mksunxiboot: allow larger SPL binaries Andre Przywara
2017-01-21  4:24   ` Siarhei Siamashka
2017-01-21 11:17     ` André Przywara
2017-01-20  1:53 ` [U-Boot] [RFC PATCH 06/11] sunxi: A64: SPL: allow large SPL binary Andre Przywara
2017-01-20  1:53 ` [U-Boot] [RFC PATCH 07/11] sunxi: A64: move SPL stack to end of SRAM A2 Andre Przywara
2017-01-20  1:53 ` [U-Boot] [RFC PATCH 08/11] sunxi: SPL: add FIT config selector for Pine64 boards Andre Przywara
2017-01-20 21:35   ` Maxime Ripard
2017-01-20 21:55     ` André Przywara
2017-01-21  2:16       ` [U-Boot] [linux-sunxi] " Icenowy Zheng
2017-01-21  2:16       ` Icenowy Zheng
2017-01-21  4:05       ` [U-Boot] " Siarhei Siamashka
2017-01-21 15:15         ` André Przywara
2017-01-23 17:29           ` Maxime Ripard
2017-01-23 22:55             ` André Przywara
2017-01-26 10:55               ` Maxime Ripard
2017-01-20  1:53 ` [U-Boot] [RFC PATCH 09/11] sunxi: Pine64: defconfig: enable SPL FIT support Andre Przywara
2017-01-20 21:36   ` Maxime Ripard
2017-01-20 21:55     ` André Przywara
2017-01-20  1:53 ` [U-Boot] [RFC PATCH 10/11] sunxi: Pine64: add FIT image source Andre Przywara
2017-01-20  1:53 ` [U-Boot] [RFC PATCH 11/11] SPL: SPI: sunxi: add SPL FIT image support Andre Przywara
2017-01-20 21:37   ` Maxime Ripard
2017-01-20 21:58     ` André Przywara
2017-01-20 17:02 ` [U-Boot] [RFC PATCH 00/11] extend FIT loading support (plus Pine64/ATF support) Andrew F. Davis
2017-01-20 17:17   ` Andre Przywara
2017-01-20 17:35     ` Andrew F. Davis
2017-01-20 17:48       ` Andre Przywara
2017-01-20 19:07         ` [U-Boot] [linux-sunxi] " Icenowy Zheng
2017-01-20 22:21       ` [U-Boot] " André Przywara
2017-01-27 21:29 ` Simon Glass
2017-01-28  1:47   ` André Przywara
2017-02-06 15:33     ` Simon Glass
2017-02-06 16:09       ` Andre Przywara
2017-02-06 16:17       ` Andrew F. Davis [this message]
2017-02-06 16:32         ` Andre Przywara
2017-02-06 16:37           ` Andrew F. Davis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ce189e74-9bef-a05b-8513-c9c5aa2c7d02@ti.com \
    --to=afd@ti.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.