All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [RFC PATCH 00/11] extend FIT loading support (plus Pine64/ATF support)
@ 2017-01-20  1:53 Andre Przywara
  2017-01-20  1:53 ` [U-Boot] [RFC PATCH 01/11] SPL: FIT: refactor FDT loading Andre Przywara
                   ` (12 more replies)
  0 siblings, 13 replies; 61+ messages in thread
From: Andre Przywara @ 2017-01-20  1:53 UTC (permalink / raw)
  To: u-boot

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?
2) Shall we extend mkimage to allow supplying "loadable" files on the
   command line, which would allow to build the .itb file automatically?
3) Is providing the .its source file for a (family of) boards the right
   way?
4) Does this break any boards which already use SPL FIT loading?

And for the Pine64 part:
5) Is extending the usable SPL size like in patch 5-7 acceptable?

I have a more generic solution for the .dtb selection in mind: Based on
some patch from Siarhei we store the .dtb filename in the SPL header and
select the .dtb from the FIT image by simply matching the name. This would
allow _one_ build supporting multiple boards. The actual board name would
need to written into the SPL header or could be copied from there when
updating the image.
I can provide the patches once we agreed upon this series.

Please let me know what you think!

Cheers,
Andre.

Andre Przywara (11):
  SPL: FIT: refactor FDT loading
  SPL: FIT: rework U-Boot image loading
  SPL: FIT: factor out spl_load_fit_image()
  SPL: FIT: allow loading multiple images
  tools: mksunxiboot: allow larger SPL binaries
  sunxi: A64: SPL: allow large SPL binary
  sunxi: A64: move SPL stack to end of SRAM A2
  sunxi: SPL: add FIT config selector for Pine64 boards
  sunxi: Pine64: defconfig: enable SPL FIT support
  sunxi: Pine64: add FIT image source
  SPL: SPI: sunxi: add SPL FIT image support

 board/sunxi/board.c             |  13 +++
 board/sunxi/pine64_atf.its      |  54 +++++++++
 common/spl/spl_fit.c            | 241 +++++++++++++++++++++++-----------------
 configs/pine64_plus_defconfig   |   5 +
 drivers/mtd/spi/sunxi_spi_spl.c |  39 +++++--
 include/configs/sunxi-common.h  |   6 +-
 scripts/Makefile.spl            |   7 +-
 tools/mksunxiboot.c             |  51 ++++++---
 8 files changed, 290 insertions(+), 126 deletions(-)
 create mode 100644 board/sunxi/pine64_atf.its

-- 
2.8.2

^ permalink raw reply	[flat|nested] 61+ messages in thread
* [U-Boot] [linux-sunxi] Re: [RFC PATCH 08/11] sunxi: SPL: add FIT config selector for Pine64 boards
@ 2017-01-24  6:30 Icenowy Zheng
  2017-01-26 10:57 ` Maxime Ripard
  0 siblings, 1 reply; 61+ messages in thread
From: Icenowy Zheng @ 2017-01-24  6:30 UTC (permalink / raw)
  To: u-boot


2017?1?24? 01:29? Maxime Ripard <maxime.ripard@free-electrons.com>???
>
> On Sat, Jan 21, 2017 at 03:15:27PM +0000, Andr? Przywara wrote: 
> > >>> On Fri, Jan 20, 2017 at 01:53:28AM +0000, Andre Przywara wrote:? 
> > >>>> For a board or platform to support FIT loading in the SPL, it has to 
> > >>>> provide a board_fit_config_name_match() routine, which helps to select 
> > >>>> one of possibly multiple DTBs contained in a FIT image. 
> > >>>> Provide a simple function to cover the two different Pine64 models, 
> > >>>> which can be easily told apart by looking at the amount of installed 
> > >>>> RAM. 
> > >>>> 
> > >>>> Signed-off-by: Andre Przywara <andre.przywara@arm.com> 
> > >>>> --- 
> > >>>>? board/sunxi/board.c | 13 +++++++++++++ 
> > >>>>? 1 file changed, 13 insertions(+) 
> > >>>> 
> > >>>> diff --git a/board/sunxi/board.c b/board/sunxi/board.c 
> > >>>> index 5365638..bbbb826 100644 
> > >>>> --- a/board/sunxi/board.c 
> > >>>> +++ b/board/sunxi/board.c 
> > >>>> @@ -726,3 +726,16 @@ int ft_board_setup(void *blob, bd_t *bd) 
> > >>>>? #endif 
> > >>>>? return 0; 
> > >>>>? } 
> > >>>> + 
> > >>>> +#ifdef CONFIG_SPL_LOAD_FIT 
> > >>>> +int board_fit_config_name_match(const char *name) 
> > >>>> +{ 
> > >>>> +#ifdef CONFIG_MACH_SUN50I 
> > >>>> + if ((gd->ram_size > 512 * 1024 * 1024)) 
> > >>>> + return !strcmp(name, "sun50i-a64-pine64-plus"); 
> > >>>> + else 
> > >>>> + return !strcmp(name, "sun50i-a64-pine64"); 
> > >>>> +#endif 
> > >>>> + return -1; 
> > >>>> +}? 
> > >>> 
> > >>> That looks fishy. It means that any A64 board with CONFIG_SPL_LOAD_FIT 
> > >>> enabled will be considered a pine64 board?? 
> > >> 
> > >> Yes, at least for now, because that's the only A64 board we officially 
> > >> support so far. 
> > >> And yes again, it is fishy. It is more a demo or a placeholder for now, 
> > >> because you _need_ an implementation of board_fit_config_name_match() 
> > >> once you enable CONFIG_SPL_LOAD_FIT. 
> > >> 
> > >> One solution would be to have only one DTB supported per build, so 
> > >> board_fit_config_name_match() always returns 0. 
> > >> 
> > >> Another (better) solution would be to store the board name in the SPL 
> > >> header, which could be done later when flashing the image. Then this 
> > >> function would just return strcmp(name, spl_header_name) or 0 if no name 
> > >> is found for whatever reason. 
> > > 
> > > Yes, this is a good solution in the case if we have some non-removable 
> > > storage on the board (SPI NOR flash, NAND, EEPROM or something else). 
> > > We can discuss it separately. 
> > 
> > I totally agree. I rebased your patch to latest mainline already and 
> > will send out something later. 
> > 
> > > But the current generation of Pine64 boards don't have any 
> > > non-removable storage yet. My understanding is that you tried to 
> > > provide the DTB selection, which is based on circumstantial evidences, 
> > > such as the RAM size. IMHO this is also a valid selection method, 
> > > because it can reduce the number of required OS image variants. 
> > 
> > Yes, the point is that for U-Boot's purposes the only difference between 
> > the Pine64 and Pine64+ (apart from DRAM size, which is autodetected) is 
> > using MII vs. RGMII for the Ethernet PHY. The sun8i_emac driver gets 
> > this information from the DT only, so there is no point at all for 
> > different defconfigs. And the DRAM size is a safe indicator for that 
> > difference, at least if we confine our view to Pine64 boards. 
> > 
> > Now how other boards fit in here is a separate discussion IMO, so let's 
> > solve one problem after the other. 
> > I just thought that we could use: 
> > 
> > #ifdef CONFIG_SPL_LOAD_FIT 
> > int board_fit_config_name_match(const char *name) 
> > { 
> > return strcmp(name, CONFIG_DEFAULT_DEVICE_TREE); 
> > } 
> > #endif 
>
> I guess an easy way around this would be to add a Kconfig option for 
> the pine64, like I tried to do for the CHIP (but never ended up 
> merging). That way, at least we won't impact the other board, and we 
> can have that default. 

For every alike, SPL-compatible, easily-detectable board groups?

>
> Maxime 
>
> -- 
> Maxime Ripard, Free Electrons 
> Embedded Linux and Kernel engineering 
> http://free-electrons.com 
>
> -- 
> You received this message because you are subscribed to the Google Groups "linux-sunxi" group. 
> To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe at googlegroups.com. 
> For more options, visit https://groups.google.com/d/optout. 

^ permalink raw reply	[flat|nested] 61+ messages in thread

end of thread, other threads:[~2017-02-06 16:37 UTC | newest]

Thread overview: 61+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2017-02-06 16:32         ` Andre Przywara
2017-02-06 16:37           ` Andrew F. Davis
2017-01-24  6:30 [U-Boot] [linux-sunxi] Re: [RFC PATCH 08/11] sunxi: SPL: add FIT config selector for Pine64 boards Icenowy Zheng
2017-01-26 10:57 ` Maxime Ripard

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.