[PATCH RFC] ARM: dove: build multiple pbl images for DT based boards

Sascha Hauer s.hauer at pengutronix.de
Sun Feb 9 16:30:46 EST 2014


On Sun, Feb 09, 2014 at 11:31:13AM +0100, Sebastian Hesselbarth wrote:
> On 02/09/2014 09:36 AM, Sascha Hauer wrote:
> >On Sat, Feb 08, 2014 at 02:27:36PM +0100, Sebastian Hesselbarth wrote:
> [...]
> >>What I want to achieve is to have a common pbl entry function for all
> >>DT based boards of one SoC. For now, let's just talk about Marvell Dove
> >>here, but on the long run, I'd like to have it also for the other MVEBU
> >>SoCs. Right now, I guess, each SoC will still have its own "DT board"
> >>but it could also end up in one board for all MVEBU SoCs..
> [...]
> >>Now, for having one board file for a set of selectable dtbs, you would
> >>need a single entry function name and also a single symbol to access
> >>the linked dtb at runtime. In the example for Dove below, I have chosen
> >>start_dove_dt for the entry function and __linked_dtb_start for the
> >>required dtb.
> >
> >It's not quite clear to me what you want to archieve or maybe better why
> >you want to archieve it. Right now there are board specific entry
> >functions, with 'board' meaning everything that you can't detect during
> >runtime. So if want to support multiple boards and can detect during
> >runtime on which one you are on then you can use a single entry
> >function, detect the board and pass the correct dtb to
> >barebox_arm_entry. If you can't detect the board then you need different
> >images, one per board. An image is defined by its entry function. Why do
> >you want to make the entry function common per SoC? I mean if there's
> >some SoC specific setup that every board of a SoC type needs, then you
> >can factor it out to a common function and call mvebu_setup_something()
> >in each entry function or make a mvebu_barebox_entry like we already
> >have.
> >I think the entry functions are short and easy enough to duplicate them
> >per board. Also it gives you the chance to do board specific quirks very
> >early without having to #ifdef common code.
> 
> Well, the idea was clearly driven from me being too lazy to copy the
> board code for every supported board we have. For example, there are
> three different CuBox revisions around, ES, Production 1GB, and 2GB.
> You can detect the 2GB version at runtime from the mem region registers,
> but you cannot tell ES and 1GB apart.
> 
> Also, currently you cannot really select a different dtb for e.g. the
> CuBox because the board code depends on __dtb_dove_cubox_start.
> Choosing a different dtb e.g. dove-cubox-1gb.dts will break the board
> code because of the missing symbol.

The idea is to copy the start_solidrun_cubox function to another,
start_solidrun_cubox_myversion function, pass in another dtb and you're
done. No need to select a dtb then, just build images for all versions
and pick the correct one later.

> 
> With one single board code and selectable dtbs, you would link only
> one dtb at link time and get another layer of differentiation for free
> without bloating the code with multiple dtbs. I admit, "real" board
> specific quirks would have to be dealt with somehow.

What do you mean with bloat? The linker will throw away all unused dtbs
in images. If you build in support for different boards each image will
only contain the dtbs it needs.
If you choose for common entry functions then I guess the "real" board
specific quirks like different RAM configurations would mean ifdeffing
it. Each time we ifdef something, maybe based on Kconfig variables, we
duplicate the defconfig files which means much more duplication than
the few lines of board code.

> 
> Maybe the idea is non-sense, but I though giving the user a list of
> currently supported boards from which he can select from and get
> boot images for every board selected would be nicer than spreading
> the same board code over and over again in arm/boards/.

Actually selecting (one or many) from a list of supported boards is the
idea behind the multi image support. Try building the imx_v7_defconfig.
It builds images for a dozen boards in different configurations. Some
of these boards are also used in customer projects with a different dtb.
What I do in this case is to duplicate the boards ENTRY_FUNCTION with
another dtb. That's a few lines of duplicated code but I get images
for all board/dtb combinations at once.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list