u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
To: Simon Glass <sjg@chromium.org>
Cc: "Xavier Drudis Ferran" <xdrudis@tinet.cat>,
	"Quentin Schulz" <foss+uboot@0leil.net>,
	"Kever Yang" <kever.yang@rock-chips.com>,
	"Andy Yan" <andy.yan@rock-chips.com>,
	"Lin Huang" <hl@rock-chips.com>, 陈健洪 <chenjh@rock-chips.com>,
	"Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
	"Nick Xie" <nick@khadas.com>, "Johan Jonker" <jbx6244@gmail.com>,
	deepakdas.linux@gmail.com, linux@alxd.me,
	"U-Boot Mailing List" <u-boot@lists.denx.de>
Subject: Re: Replace make-fit-atf.py with binman. Was: migrate u-boot-rockchip.bin to binman and generate an image for SPI
Date: Wed, 27 Jul 2022 12:34:07 +0200	[thread overview]
Message-ID: <702c542e-ccbf-4fc4-3584-744d701d3fe1@theobroma-systems.com> (raw)
In-Reply-To: <CAPnjgZ0X6s4BbnDH6AT6_XsxdWm34txo4yJJsQ1cuFi=fUaMJQ@mail.gmail.com>

Hi Simon,

On 7/26/22 21:58, Simon Glass wrote:
> Hi Quentin,
> 
> On Tue, 26 Jul 2022 at 03:08, Quentin Schulz
> <quentin.schulz@theobroma-systems.com> wrote:
>>
>> Hi Xavier,
>>
>> On 7/25/22 19:33, Xavier Drudis Ferran wrote:
>>> El Mon, Jul 25, 2022 at 07:29:53PM +0200, Xavier Drudis Ferran deia:
>>>>
>>>> I copy here the rockchip-u-boot.dtsi file and then 2 patches on top of yours.
>>>>
>>>
>>> Sorry I copied a dirty version that din't work. The patches were correct, the dtsi wasn't.
>>>
> 
> [..]
> 
>>
>>>> +                            };
>>>> +                    };
>>>> +            };
>>>> +    };
>>>>       simple-bin {
>>>>               filename = "u-boot-rockchip.bin";
>>>>               pad-byte = <0xff>;
>>>> @@ -62,6 +131,7 @@
>>>>    #ifdef CONFIG_ARM64
>>>>               blob {
>>>>                       filename = "u-boot.itb";
>>>> +
>>
>> This is unfortunately not possible since binman parallelizes the build
>> of images in the binman DT node. This means there is no guarantee the
>> u-boot.itb file is generated before this section is worked on by binman.
>> Or maybe I misunderstood the docs.
> 
> You are correct, but this is something that has bothered me.
> 
> At the moment we handle this by embedding the definition for one file
> into the one that uses it. This is on the theory that there is no need
> to actually write the embedded file, since it is a temporary file. In
> fact binman does generate temporary files though.
> 
> Is that good enough? If not I'd like to understand the need better,
> before we make any changes.
> 

For Rockchip, with the patch series from 
https://lore.kernel.org/u-boot/20220722113505.3875669-1-foss+uboot@0leil.net/, 
we now have two binaries:
u-boot-rockchip.bin and u-boot-rockchip-spi.bin

Both share the exact same u-boot.itb file (though at a different offset 
in the storage medium) embedded.

This u-boot.itb is currently externally created via the Makefile + 
make_fit_atf.py prior to binman being called. This allows us to have a 
blob { filename = "u-boot.itb"; } in the binman DT node and that's 
enough for it to work fine.

There's a desire to get rid of make_fit_atf.py in favor of binman. This 
means that we need to create this file in binman now.

There's been some resistance to making binman not create idbloader.img 
image in the patch series mentioned above (it is *technically* created 
by binman but only in temporary files and then embedded in 
u-boot-rockchip*.bin). I assume the same resistance will be met for 
u-boot.itb.

With how binman works currently and since we have u-boot.itb content 
embedded in at least two different images created by binman (might be 
even more once there's USB/NAND support?), we'd need to have the fit 
device tree node appear thrice (or more). One for u-boot.itb creation 
(because of people not wanting it disappear from binaries generated by 
U-Boot), one for embedding into u-boot-rockchip.bin and one for 
embedding into u-boot-rockchip-spi.bin.
This increases the risk of not updating all fit device tree nodes at once.
This is suboptimal in terms of build time because the image will 
effectively be created thrice (or more).
This is also not the best for easy check of reproducibility since the 
content of the fit device tree node is technically not the same as 
u-boot.itb file (because it is the result of a different image built by 
binman).

So I think the minimal implementation would be to allow to define an 
image/section (u-boot.itb) and to "#include" it inline in another 
section (where blob { filename = "u-boot.itb"; } currently is for 
u-boot-rockchip.bin and u-boot-rockchip-spi.bin). From reading the docs, 
I expected collection entry to be exactly this? But I couldn't make it work.

Ideally, allowing binman to define a dependency from one image on 
another would mean we could still use the blob image/section, but 
safely, because the dependency is explicit so binman will know which 
image to build first. Phandles is what we're after on the Device Tree 
side I would assume. We could have something like: blob { image = 
<&u-boot-itb>; } for example. No idea how binman would create this 
dependency tree though :)

Straight from my brain, lemme know if something needs to be clarified or 
rephrased.

Cheers,
Quentin

  reply	other threads:[~2022-07-27 10:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-25 17:29 Replace make-fit-atf.py with binman. Was: migrate u-boot-rockchip.bin to binman and generate an image for SPI Xavier Drudis Ferran
2022-07-25 17:33 ` Xavier Drudis Ferran
2022-07-26  9:08   ` Quentin Schulz
2022-07-26 19:08     ` Xavier Drudis Ferran
2022-07-26 19:15       ` Jerome Forissier
2022-07-26 19:48         ` [SPAM] " Xavier Drudis Ferran
2022-07-26 19:52       ` Xavier Drudis Ferran
2022-07-26 19:58       ` Simon Glass
2022-07-26 19:58     ` Simon Glass
2022-07-27 10:34       ` Quentin Schulz [this message]
2022-07-31  1:27         ` Simon Glass
2022-08-01 17:04           ` Quentin Schulz
2022-08-01 19:13             ` Simon Glass
2022-08-02  8:19               ` [SPAM] " Xavier Drudis Ferran
2022-08-02 12:41                 ` Simon Glass
2022-08-02 17:19                   ` Xavier Drudis Ferran
2022-08-07 18:50                     ` Simon Glass

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=702c542e-ccbf-4fc4-3584-744d701d3fe1@theobroma-systems.com \
    --to=quentin.schulz@theobroma-systems.com \
    --cc=andy.yan@rock-chips.com \
    --cc=chenjh@rock-chips.com \
    --cc=deepakdas.linux@gmail.com \
    --cc=foss+uboot@0leil.net \
    --cc=hl@rock-chips.com \
    --cc=jbx6244@gmail.com \
    --cc=kever.yang@rock-chips.com \
    --cc=linux@alxd.me \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=nick@khadas.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    --cc=xdrudis@tinet.cat \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).