[PATCH 15/20] binman: Add support for alternative FDTs

Simon Glass sjg at chromium.org
Mon Jul 29 18:19:24 CEST 2024


FIT provides a way to select between different devicetree blobs
depending on the model. This works fine for U-Boot proper and allows SPL
to select the correct blob for the current board at runtime. The boot
sequence (SPL->U-Boot proper) is therefore covered by the existing
feature set.

The first boot phase (typically TPL) cannot use FIT since SoC boot ROMs
don't currently support it. Therefore the TPL image must be specific to
each model it boots on.

To support booting on mulitple models, binman must therefore produce a
separate TPL image for each model, even if the images for the rest of
the phases are identical.

TPL needs to be packaged as an executable binary along with a reduced
devicetree. When multiple models are supported, a reduced devicetree
must be provided for each model.

U-Boot's build system is designed to build a single devicetree for SPL
builds, so does not support this requirement.

Add a new 'alternatives' feature to Binman, allowing it to automatically
subset a devicetree to produce the reduced devicetree for a particular
phase for each supported model. With this it is possible to produce a
separate TPL image for each of the models. The correct one can then be
loaded onto a board, along with the common FIT image(s).

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 tools/binman/btool/fdtgrep.py                |   2 +-
 tools/binman/control.py                      |   3 +
 tools/binman/entries.rst                     |  42 ++++++
 tools/binman/entry.py                        |   4 +-
 tools/binman/etype/alternates_fdt.py         | 132 +++++++++++++++++++
 tools/binman/ftest.py                        | 121 +++++++++++++++++
 tools/binman/image.py                        |  13 ++
 tools/binman/test/328_alternates_fdt.dts     |  28 ++++
 tools/binman/test/329_alternates_fdtgrep.dts |  29 ++++
 tools/binman/test/330_alternates_vpl.dts     |  29 ++++
 tools/binman/test/331_alternates_spl.dts     |  29 ++++
 tools/binman/test/332_alternates_inval.dts   |  29 ++++
 tools/binman/test/alt_dts/model1.dts         |  24 ++++
 tools/binman/test/alt_dts/model2.dts         |  24 ++++
 14 files changed, 507 insertions(+), 2 deletions(-)
 create mode 100644 tools/binman/etype/alternates_fdt.py
 create mode 100644 tools/binman/test/328_alternates_fdt.dts
 create mode 100644 tools/binman/test/329_alternates_fdtgrep.dts
 create mode 100644 tools/binman/test/330_alternates_vpl.dts
 create mode 100644 tools/binman/test/331_alternates_spl.dts
 create mode 100644 tools/binman/test/332_alternates_inval.dts
 create mode 100644 tools/binman/test/alt_dts/model1.dts
 create mode 100644 tools/binman/test/alt_dts/model2.dts

Applied to u-boot-dm, thanks!


More information about the U-Boot mailing list