[PATCH v9 14/14] treewide: Disable USE_SPL_FIT_GENERATOR by default

Michal Simek michal.simek at amd.com
Tue Jan 10 16:16:38 CET 2023


Hi Simon,

On 1/9/23 16:34, Simon Glass wrote:
> Hi Michal,
> 
> On Mon, 9 Jan 2023 at 04:07, Michal Simek <michal.simek at amd.com 
> <mailto:michal.simek at amd.com>> wrote:
>  >
>  > Hi,
>  >
>  > On 1/8/23 20:36, Simon Glass wrote:
>  > > Hi Tom,
>  > >
>  > > On Sun, 8 Jan 2023 at 09:24, Tom Rini <trini at konsulko.com 
> <mailto:trini at konsulko.com>> wrote:
>  > >>
>  > >> On Sun, Jan 08, 2023 at 09:20:09AM -0700, Simon Glass wrote:
>  > >>> Hi Tom,
>  > >>>
>  > >>> On Sun, 8 Jan 2023 at 09:06, Tom Rini <trini at konsulko.com 
> <mailto:trini at konsulko.com>> wrote:
>  > >>>>
>  > >>>> On Sun, Jan 08, 2023 at 08:48:37AM -0700, Simon Glass wrote:
>  > >>>>> Hi Tom,
>  > >>>>>
>  > >>>>> On Sun, 8 Jan 2023 at 06:41, Tom Rini <trini at konsulko.com 
> <mailto:trini at konsulko.com>> wrote:
>  > >>>>>>
>  > >>>>>> On Sat, Jan 07, 2023 at 02:07:21PM -0700, Simon Glass wrote:
>  > >>>>>>
>  > >>>>>>> This option is deprecated and only used by two boards. Enable it for just
>  > >>>>>>> those two boards, so others don't accidentally enable it.
>  > >>>>>>>
>  > >>>>>>> Signed-off-by: Simon Glass <sjg at chromium.org <mailto:sjg at chromium.org>>
>  > >>>>>> [snip]
>  > >>>>>>> diff --git a/boot/Kconfig b/boot/Kconfig
>  > >>>>>>> index 55f06761ef8..7ab0dd14211 100644
>  > >>>>>>> --- a/boot/Kconfig
>  > >>>>>>> +++ b/boot/Kconfig
>  > >>>>>>> @@ -282,12 +282,13 @@ config SPL_FIT_SOURCE
>  > >>>>>>>   config USE_SPL_FIT_GENERATOR
>  > >>>>>>>        bool "Use a script to generate the .its script"
>  > >>>>>>>        depends on SPL_FIT
>  > >>>>>>> -     default y if SPL_FIT && ARCH_ZYNQMP
>  > >>>>>>> +     help
>  > >>>>>>> +       This is deprecated. Please do not use it. Use binman instead.
>  > >>>>>>
>  > >>>>>> Lets remove the text around bool so it can't be enabled, and move to
>  > >>>>>> select'ing it from the two boards that need it. Michal, Luca, what's
>  > >>>>>> needed to move your two platforms
>  > >>>>>> (avnet_ultrazedev_cc_v1_0_ultrazedev_som_v1_0 and xilinx_zynqmp_virt off
>  > >>>>>> of this very legacy option, given that other xilinx platforms have
>  > >>>>>> already migrated to binman ?
>  > >>>>>
>  > >>>>> That's a good idea, but these two boards do not have TARGET Kconfig
>  > >>>>> options so it is not possible without adding some Kconfig specific to
>  > >>>>> those boards, then defining it in the defconfig files.
>  > >>>>>
>  > >>>>> We already have the legacy warning.
>  > >>>>
>  > >>>> Yes, but I swear these are new legacy users as when we started trying to
>  > >>>> kill off this option it was just a few i.MX platforms lagging behind.
>  > >>>>
>  > >>>> Maybe make ARCH_ZYNQMP select DEPRECATED, USE_SPL_FIT_GENERATOR depend
>  > >>>> on DEPRECATED and add "DERECATED" to the end of the text line?  Or maybe
>  > >>>> Michal or Luca will speak up soon and migrate these over quickly so we
>  > >>>> can just nuke this.
>  > >>>
>  > >>> Isn't that just more tortuous? I can disable SPL_LOAD_FIT on these two
>  > >>> boards since they don't appear in CI. Then they can convert them when
>  > >>> ready.
>  > >>>
>  > >>> That way we can drop the option now, if that is your goal.
>  > >>
>  > >> I thought xilinx_zynqmp_virt was in CI, but I see I'm mistaken. I still
>  > >> don't want to break platforms outright, and since it's Sunday right now
>  > >> afterall, we should let Michal and Luca a chance to catch up and chime
>  > >> in. I hope it's either going to be a quick conversion or expose
>  > >> something missing and needed in binman, as to why these still haven't
>  > >> been converted.
>  > >>
>  > >
>  > > OK let's hold off on this patch for now. It is just a clean-up anyway.
>  >
>  > First of all. ZynqMP is not wired in CI simply because we are missing some bits
>  > and pieces in upstream qemu to run it. If we can wire it with Xilinx version we
>  > can do it. I have asked to fix it our qemu team but they have never done it.
>  >
>  > In U-Boot SPL flow this script is used all the time. I use it all the time when
>  > I build work on ZynqMP. Also buildroot is using it.
>  >
>  > In connection to binman. I have looked at it 2/3 times in past. The biggest
>  > issue which I have with it is that DT node presence in DT which goes to the 
> system.
>  >
>  > Here is example
>  >
>  > [u-boot](binman)$ make kontron_sl28_defconfig >/dev/null
>  > [u-boot](binman)$ make -j8 >/dev/null
>  > [u-boot](binman)$ dtc -I dtb -O dts dts/dt.dtb 2>/dev/null | grep binman
>  >         binman {
>  >                 binman = "/binman";
>  >                 u_boot_rom = "/binman/u-boot-rom";
>  >
>  > where binmap is the part of target DT.
> 
> Thanks for the info.
> 
>  >
>  > It has side effects.
>  > 1. DT is bigger
> 
>  From my experience the size increase typically is less than 2% which does not 
> seem significant.

It depends how many images you want to build and how many you want to describe.
Also in SOM program we are packing multiple DTS to the fit dtb image. It means 
at the end it will be few kB for almost nothing.

> 
>  > 2. It contains information how firmware was packed which is just additional
>  > information which don't need to be shared.
> 
> That depends on the application. For firmware update and debugging it is 
> sometime necessary to see where everything is. While I understand the EFI model 
> of hiding everything away I believe that a better future for the industry is to 
> have the OS and firmware work together more.

of course. But I expect if we start to add it it is just question of time when 
we get request to remove it.
And when I was playing with it xilinx boards are pretty much boards for testing 
not any final product (I can ignore some exceptions). It means how I see binman 
we could generate multiple images to cover all configurations which we are 
testing and which should work together.

Based on environment variable arch/arm/mach-zynqmp/mkimage_fit_atf.sh generates
u-boot.itb in different ways.

u-boot + DTB
u-boot + DTB + TFA
u-boot + DTB + TFA + TEE

where DTB can be fit image with multiple DTBs in it (for DTB reselection)
or multiple DTBs flag via configuration nodes.

And also images for flash which corresponds with configured offsets.

We are also building u-boot based on TEXT_BASE but placing it to different DDR 
location to make sure that it relocates properly. Or running in directly from 
memory above 4GB. When binman is adopted I would like to add description for 
these combinations there too.

> 
>  > 3. binman node as is placed in not documented in dt binding to be able to pass
>  > dtb check.
> 
> This is the root cause of all of the device tree woes. There was a small amount 
> of slow progress at the end of last year but now it has gone quiet. I don't know 
> what to do about this other than prod and wait, since Linux controls the 
> bindings. Perhaps this is something that could be worked out f2f, I'm not sure. 
> For now I will keep prodding and see what can be done. But the initial target is 
> the DM tags, with binman bindings somewhere down the trackz although they may 
> actually be easier.

yes that's why I want to make sure that things what we do are going in a 
direction that our DTs can be all checked without any violation. And adding 
binman node to DT is not helping in this effort. Even adding it to *u-boot.dtsi 
file which stays only in U-Boot is fine for Linux. SR 2.0 IIRC is going to check 
DT which is provided by firmware itself which is in this case DT from U-Boot 
with binman node in it.

> 
> It is easy enough to use fdtgrep to strip out the binman {} node if it is not 
> wanted. I will take a look at a feature for that, but I have a bit of a 
> backlog,with so many things up in the air, pending patches, etc.

I am aware about using fdtgrep for SPL but not against DT used for u-boot 
proper. I am fine if there is any way to remove it from DT.

> 
>  >
>  > I can call binman externally but that would mean additional build step which
>  > everybody wants to avoid.
>  > Can we update Makefile and add Kconfig option to pass configuration dtb file
>  > instead of u-boot.dtb by default?
>  >
>  > Something like:
>  >
>  > diff --git a/Makefile b/Makefile
>  > index 75a599b2c437..4d8d67c7d938 100644
>  > --- a/Makefile
>  > +++ b/Makefile
>  > @@ -1322,7 +1322,7 @@ cmd_binman = $(srctree)/tools/binman/binman $(if
>  > $(BINMAN_DEBUG),-D) \
>  >                  $(foreach f,$(BINMAN_TOOLPATHS),--toolpath $(f)) \
>  >                   --toolpath $(objtree)/tools \
>  >                  $(if $(BINMAN_VERBOSE),-v$(BINMAN_VERBOSE)) \
>  > -               build -u -d u-boot.dtb -O . -m \
>  > +               build -u -d $(CONFIG_BINMAN_CONFIG_DTB) -O . -m \
>  >                  $(if $(BINMAN_ALLOW_MISSING),--allow-missing --ignore-missing) \
>  >                  -I . -I $(srctree) -I $(srctree)/board/$(BOARDDIR) \
>  >                  -I arch/$(ARCH)/dts -a of-list=$(CONFIG_OF_LIST) \
>  >
>  > Then by default u-boot.dtb can be used or platforms can use different file.
>  > Then I would add zynqmp-binman.dts with configurations which can replace
>  > existing arch/arm/mach-zynqmp/mkimage_fit_atf.sh script.
>  > What do you think?
> 
> I'm sure you could do that locally, but I'd prefer to get the bindings sorted 
> out so that binman nodes can go in there, along with a Kconfig option to 
> enable/disable them. The more we bifurcate things, the more complicated 
> everything is.

I expect if you move binman to options {}; maybe options { u-boot{};}; node Rob 
won't have any issue with it. But of course that's needs to be discussed with him.

> 
> For now, can you live with the binman nodes? What problem does it cause?

Current script is used only in SPL flow which is not actually officially 
supported AMD/XILINX flow. It means there won't be any issue on AMD/XILINX side 
if we simply remove the script but likely we will break users which are using 
SPL flow. And they are definitely there.
All these users will start to see binman nodes and to be fair none will likely 
spot it anytime soon because if boot is working why you should look at it.

But as I said above when I start to use it I want to use it for all image 
generations that by one make I get all combinations for testing.
It means DT in SD boot mode will also contain information about QSPI image and 
also other combinations which were built.
It will create just confusion which I want to avoid as much as possible.

Can you live with passing external binman DTB via Kconfig option till fdtgrep 
option is working?


>  >
>  > BTW: Is there a way to generate also capsules from binman?
> 
> Is that an EFI capsule? If so, I haven't seen any work on that yet.
> 

yes EFI capsule. This is pretty much what I generate by external script after 
u-boot compilation.

pushd spl
/mnt/disk/u-boot/tools/mkeficapsule -g "de6066e8-0256-4fad-8238-e406e274c4cf" 
boot.bin --index 1 ../capsule1.bin
popd
/mnt/disk/u-boot/tools/mkeficapsule -g "cf9ecfd4-938b-41c5-8551-1f883ab7dc18" 
u-boot.itb --index 2 capsule2.bin


Also is there a way to get address from ELF but place BIN from that image 
instead (or convert it to BIN)?
I added support for this to avoid situations that image is placed to incorrect 
location. I do use it in case of TF-A which can run out of OCM or DDR that don't 
need to change configuration based on actual file.

Is there also a way to call fdtoverlay to compose DTB + DTBO together to create 
images? Linux kernel does it as the part of make but we are missing this feature 
in U-Boot but binman could actually help in this.

Thanks,
Michal


More information about the U-Boot mailing list