Skip to contentSkip to conversation

arm64: Add fit images for sc7180-trogdor and google,lga

RFC PATCH Superseded Douglas Anderson 4 participants 27 messages Oct 20 – Nov 13

Subsystems (10)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover arm64: Add fit images for sc7180-trogdor and google,lga

The end goal of this series is to move forward on producing a "universal" Pixel 10 boot image that can boot on a variety of Pixel 10 devices (frankel, blazer, and mustang and eventually multiple revisions of each). At the moment, this is impossible since the Pixel 10 bootloader:
* Picks the base devicetree based on SoC ID information.
* Picks an overlay devicetree based on Board ID information.
* Needs metadata associated with each overlay to match it up.

Since we don't have per-board overlays and don't have per-board metadata, that means that today you need to pick exactly one revision of one board and build a boot image just for that.

How does this series help us?
1. It uses a checked-in .its script to associate metadata with each board's devicetree. Other tools can parse this metadata in order to craft a package that the Pixel bootloader can understand.
2. It integrates a call to the new fdtfactor tool [1], which results in a "base dtb + board dtbo" that looks like what the bootloader needs, at least as long as all the boards have the same SoC.

What happens if everyone hates this series and it gets dropped on the floor? Honestly, everything here could just go out of tree and it would be "fine". IMO it's nice to have the Board ID / SoC ID information for each devicetree stored in the same repository as the devicetrees themselves are, but if this has to live somewhere else then so be it.

NOTE: from reading the above, you might wonder why the sc7180-trogdor .its script is part of this series. The answer: it's a board I was previously deeply involved in and it is a convenient way for me to prove out that the Chromebook use case works well. I did hack up some changes to the ChromeOS build system to use the provided FIT image and it worked great, but since I'm not on the ChromeOS team these days it's not something I personally plan to follow-up with. It sounds plausible that Chen-Yu may follow-up with it or post a similar change for some Mediatek Chromebooks.

[1] http://lore.kernel.org/r/[email protected]

Douglas Anderson (7):
scripts/dtc: Add fdtget.c and fdtput.c to sync script scripts/dtc: Update to upstream version v1.8.1-22-gf3451d12532b scripts/dtc: Build fdtget and fdtput host tools
arm64: boot: Support building image.fit from a specified FIT_ITS
script
kbuild: fit: Add opt-in FIT_FACTOR_DTBS support using fdtfactor
arm64: dts: google: lga: Add lga.its FIT image script
arm64: dts: qcom: sc7180: Add sc7180-trogdor.its FIT image script

 Makefile                                    |   2 +-
 arch/arm64/Makefile                         |   3 +
 arch/arm64/boot/Makefile                    |   9 +-
 arch/arm64/boot/dts/google/lga.its          |  68 ++
 arch/arm64/boot/dts/qcom/sc7180-trogdor.its | 728 ++++++++++++++++++++
 scripts/Makefile.dtbs                       |  51 +-
 scripts/Makefile.lib                        |  67 +-
 scripts/dtc/.gitignore                      |   2 +
 scripts/dtc/Makefile                        |   6 +-
 scripts/dtc/checks.c                        |   2 +-
 scripts/dtc/fdtget.c                        | 207 +++---
 scripts/dtc/fdtput.c                        | 280 ++++++--
 scripts/dtc/libfdt/fdt_ro.c                 |   2 +
 scripts/dtc/libfdt/fdt_rw.c                 |  41 +-
 scripts/dtc/libfdt/fdt_sw.c                 |   3 +-
 scripts/dtc/libfdt/libfdt.h                 |  70 +-
 scripts/dtc/livetree.c                      |   2 +-
 scripts/dtc/update-dtc-source.sh            |   4 +-
 scripts/dtc/version_gen.h                   |   2 +-
 19 files changed, 1322 insertions(+), 227 deletions(-)
 create mode 100644 arch/arm64/boot/dts/google/lga.its
 create mode 100644 arch/arm64/boot/dts/qcom/sc7180-trogdor.its
Signature · 1 line
2.56.0.212.g129ede20d9-goog
#1 lore raw

RFC PATCH 1/7 scripts/dtc: Add fdtget.c and fdtput.c to sync script

fdtget.c and fdtput.c were imported into scripts/dtc/ in commit cd296721a964 ("dtc: import latest upstream dtc") prior to the creation of update-dtc-source.sh, and were never added to the sync script.

Add FDTGET_SOURCE and FDTPUT_SOURCE to update-dtc-source.sh so they are kept in sync with the rest of scripts/dtc/.

---

 scripts/dtc/update-dtc-source.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
scripts/dtc/update-dtc-source.sh +3 -1
index 94627541533e..f21da460742e 100755
@@ -38,6 +38,8 @@ LIBFDT_SOURCE="fdt.c fdt.h fdt_addresses.c fdt_empty_tree.c \
 		fdt_overlay.c fdt_ro.c fdt_rw.c fdt_strerror.c fdt_sw.c \
 		fdt_wip.c libfdt.h libfdt_env.h libfdt_internal.h"
 FDTOVERLAY_SOURCE=fdtoverlay.c
+FDTGET_SOURCE=fdtget.c
+FDTPUT_SOURCE=fdtput.c
 
 get_last_dtc_version() {
 	git log --oneline scripts/dtc/ | grep 'upstream' | head -1 | sed -e 's/^.* \(.*\)/\1/'
@@ -55,7 +57,7 @@ dtc_log=$(git log --oneline ${last_dtc_ver}..)
 
 # Copy the files into the Linux tree
 cd $DTC_LINUX_PATH
-for f in $DTC_SOURCE $FDTOVERLAY_SOURCE; do
+for f in $DTC_SOURCE $FDTOVERLAY_SOURCE $FDTGET_SOURCE $FDTPUT_SOURCE; do
 	cp ${DTC_UPSTREAM_PATH}/${f} ${f}
 	git add ${f}
 done
Signature · 1 line
2.56.0.212.g129ede20d9-goog
maintainer Reviewed-by on v1 1/7
#2 lore raw

Re: [RFC PATCH 1/7] scripts/dtc: Add fdtget.c and fdtput.c to sync script

Quoted 6 lines · Douglas Anderson

scripts/dtc: Add fdtget.c and fdtput.c to sync script

fdtget.c and fdtput.c were imported into scripts/dtc/ in commit cd296721a964 ("dtc: import latest upstream dtc") prior to the creation of update-dtc-source.sh, and were never added to the sync script.

Quoted 7 lines

Add FDTGET_SOURCE and FDTPUT_SOURCE to update-dtc-source.sh so they are kept in sync with the rest of scripts/dtc/.

 scripts/dtc/update-dtc-source.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
#3 lore raw

RFC PATCH 2/7 scripts/dtc: Update to upstream version v1.8.1-22-gf3451d12532b

In reply to Douglas Anderson

This adds the following commits from upstream:

f3451d12532b meson: Only take the version from dtc's own git repository 7a1e01792600 libfdt: pass sources as keyword argument to library() 8c37c14c95d9 fdtget: Use libfdt iterators instead of open coded loops 89c99ce78ac8 pylibfdt: Add add_mem_rsv() and del_mem_rsv()
3750493c8b0f pylibfdt: Add address_cells() and size_cells()
0748c384fde6 pylibfdt: Grow the FdtSw buffer geometrically
5008d1d6a356 pylibfdt: Replace removed SWIG Python 2 compatibility macros 66e1201c3775 libfdt: fdt_check_full: Add can_assume(PERFECT) check 214372a27398 tests: Replace trees.S/dumptrees with treegen for making test dtbs 4df9ca4c8ddb tests: Add treegen, a pure C replacement for trees.S + dumptrees f116f4800edc tests: Dont have test cases link directly against example dtb data 9b53b9a4c2f9 tests: Add missing unterminated_memrsv to dumptrees 5f919a25d71b ci: Merge make and meson jobs using build matrix 6c1426dfa963 ci: Add macOS support to install-deps.sh
23fd89bc8ed8 ci: Move FreeBSD CI from Cirrus CI to GitHub Actions 3ad5ebbdd9d5 ci: Upgrade actions/checkout v4 to v6 for Node.js 24 support 4ad496846a12 Set default permissions for workflows
c0e1d0fd58d4 livetree: Fix a comparison of integers with different signedness d245851f0629 tests: Avoid -Wconstant-logical-operand warnings in integer-expressions.c a74b952f94c8 tests: Fix mkdir() call for Windows compatibility d320877b07d1 tests: More portable installation of SIGINT handler 84d13508d59d tests: Remove unused cleanup() mechanism from tests 8f48565e5cfe Bump version to v1.8.1
25a368100a98 docs: Improvements to release creation tooling
040c1f7e29e2 libfdt: Revert accidental ABI breakage
b1337df19598 Bump version to v1.8.0
83cdc93ca900 ci: Add macOS build to GitHub Actions
1aaa44849b9a ci: Skip swig install for mingw32 Windows build dd1c7f1a919e docs: Add CLAUDE.md referencing AGENTS.md
7fdf750154e9 docs: Add release tagging procedure and finalize-release script 5c35036b2c83 docs: Add AI contribution guidelines
f57e7df35df4 libfdt: fix UBSAN null pointer in fdt_property() 2164019f8483 checks: Add missing phandle_references prereq to interrupts_property 47d7c01ba8a1 libfdt: Fix bugs with unchecked usage of fdt_num_mem_rsv() f551be7b39c8 libfdt: Standardise returns annotation in function documentation

---

 scripts/dtc/checks.c        |   2 +-
 scripts/dtc/fdtget.c        | 207 +++++++++++++-------------
 scripts/dtc/fdtput.c        | 280 +++++++++++++++++++++++++++---------
 scripts/dtc/libfdt/fdt_ro.c |   2 +
 scripts/dtc/libfdt/fdt_rw.c |  41 +++++-
 scripts/dtc/libfdt/fdt_sw.c |   3 +-
 scripts/dtc/libfdt/libfdt.h |  70 +++++----
 scripts/dtc/livetree.c      |   2 +-
 scripts/dtc/version_gen.h   |   2 +-
 9 files changed, 391 insertions(+), 218 deletions(-)
scripts/dtc/checks.c +1 -1
index 946c1429e0f1..a6037ed08000 100644
@@ -1769,7 +1769,7 @@ static void check_interrupts_property(struct check *c,
 			  irq_prop->val.len, (int)(irq_cells * sizeof(cell_t)));
 	}
 }
-WARNING(interrupts_property, check_interrupts_property, &phandle_references);
+WARNING(interrupts_property, check_interrupts_property, NULL, &phandle_references);
 
 static const struct bus_type graph_port_bus = {
 	.name = "graph-port",
scripts/dtc/fdtget.c +104 -103

307 lines not on this page · raw message

scripts/dtc/fdtput.c +213 -67

451 lines not on this page · raw message

scripts/dtc/libfdt/fdt_ro.c +2 -0
index 63494fb7ad90..11f2e2ee0be3 100644
@@ -191,6 +191,8 @@ int fdt_num_mem_rsv(const void *fdt)
 	int i;
 	const struct fdt_reserve_entry *re;
 
+	FDT_RO_PROBE(fdt);
+
 	for (i = 0; (re = fdt_mem_rsv(fdt, i)) != NULL; i++) {
 		if (fdt64_ld_(&re->size) == 0)
 			return i;
scripts/dtc/libfdt/fdt_rw.c +34 -7

83 lines not on this page · raw message

scripts/dtc/libfdt/fdt_sw.c +2 -1
index 4c569ee7eb0d..96d4cf571319 100644
@@ -330,7 +330,8 @@ int fdt_property(void *fdt, const char *name, const void *val, int len)
 	ret = fdt_property_placeholder(fdt, name, len, &ptr);
 	if (ret)
 		return ret;
-	memcpy(ptr, val, len);
+	if (len)
+		memcpy(ptr, val, len);
 	return 0;
 }
 
scripts/dtc/libfdt/libfdt.h +33 -37

202 lines not on this page · raw message

scripts/dtc/livetree.c +1 -1
index 5d72abceb526..8baed1fca8c5 100644
@@ -1234,7 +1234,7 @@ void fixup_phandles(struct dt_info *dti, const char *name)
 				continue;
 
 			offset = strtol(soffset, NULL, 0);
-			if (offset < 0 || offset + 4 > p->val.len) {
+			if (offset < 0 || (unsigned int)offset + 4 > p->val.len) {
 				if (quiet < 1)
 					fprintf(stderr,
 						"Warning: Label %s contains invalid offset for property %s in node %s\n",
scripts/dtc/version_gen.h +1 -1
index 122e684e76a1..0e11fc60b1f8 100644
@@ -1 +1 @@
-#define DTC_VERSION "DTC 1.7.2-g53373d13"
+#define DTC_VERSION "DTC 1.8.1-gf3451d12"
Signature · 1 line
2.56.0.212.g129ede20d9-goog
maintainer
#4 lore raw

Re: [RFC PATCH 2/7] scripts/dtc: Update to upstream version v1.8.1-22-gf3451d12532b

Hi Doug,

Quoted 6 lines · Douglas Anderson

scripts/dtc: Update to upstream version v1.8.1-22-gf3451d12532b

This adds the following commits from upstream:

f3451d12532b meson: Only take the version from dtc's own git repository

The script builds this list from the last sync point (v1.7.2-69), so fdtget.c and fdtput.c get loads of changes beyond what this lists. That's fine, but you could mention it (e.g. the new -r and -d options in fdtput, automatic growth of the blob, long options, strtol() instead of sscanf() for parsing integers, fdt_pack() before writing, the libfdt iterators in fdtget)

I built scripts/dtc and lib/fdt_rw.o at this patch with no warnings, which covers the in-kernel libfdt now that fdt_setprop() and fdt_setprop_placeholder() are no longer inline.

Quoted 19 lines

f3451d12532b meson: Only take the version from dtc's own git repository 7a1e01792600 libfdt: pass sources as keyword argument to library() 8c37c14c95d9 fdtget: Use libfdt iterators instead of open coded loops 89c99ce78ac8 pylibfdt: Add add_mem_rsv() and del_mem_rsv() 3750493c8b0f pylibfdt: Add address_cells() and size_cells() 0748c384fde6 pylibfdt: Grow the FdtSw buffer geometrically 5008d1d6a356 pylibfdt: Replace removed SWIG Python 2 compatibility macros 66e1201c3775 libfdt: fdt_check_full: Add can_assume(PERFECT) check 214372a27398 tests: Replace trees.S/dumptrees with treegen for making test dtbs 4df9ca4c8ddb tests: Add treegen, a pure C replacement for trees.S + dumptrees f116f4800edc tests: Dont have test cases link directly against example dtb data 9b53b9a4c2f9 tests: Add missing unterminated_memrsv to dumptrees 5f919a25d71b ci: Merge make and meson jobs using build matrix 6c1426dfa963 ci: Add macOS support to install-deps.sh
23fd89bc8ed8 ci: Move FreeBSD CI from Cirrus CI to GitHub Actions 3ad5ebbdd9d5 ci: Upgrade actions/checkout v4 to v6 for Node.js 24 support [...]

Quoted 10 lines
 scripts/dtc/checks.c        |   2 +-
 scripts/dtc/fdtget.c        | 207 ++++++++++++++++----------------
 scripts/dtc/fdtput.c        | 280 +++++++++++++++++++++++++++++++++-----------
 scripts/dtc/libfdt/fdt_ro.c |   2 +
 scripts/dtc/libfdt/fdt_rw.c |  41 +++++--
 scripts/dtc/libfdt/fdt_sw.c |   3 +-
 scripts/dtc/libfdt/libfdt.h |  70 ++++++-----
 scripts/dtc/livetree.c      |   2 +-
 scripts/dtc/version_gen.h   |   2 +-
 9 files changed, 391 insertions(+), 218 deletions(-)

Regards,
Simon

#5 lore raw

RFC PATCH 3/7 scripts/dtc: Build fdtget and fdtput host tools

In reply to Douglas Anderson

Build fdtget and fdtput alongside dtc and fdtoverlay when CONFIG_DTC is enabled so Kbuild rules can query and update properties in compiled device tree / FIT blobs.

---

 scripts/dtc/.gitignore | 2 ++
 scripts/dtc/Makefile   | 6 ++++--
 2 files changed, 6 insertions(+), 2 deletions(-)
scripts/dtc/.gitignore +2 -0
index e0b5c1d2464a..24357adc8896 100644
@@ -1,3 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0-only
 /dtc
 /fdtoverlay
+/fdtget
+/fdtput
scripts/dtc/Makefile +4 -2
index b47f4daa4515..6bce3542d8a9 100644
@@ -2,7 +2,7 @@
 # scripts/dtc makefile
 
 # *** Also keep .gitignore in sync when changing ***
-hostprogs-always-$(CONFIG_DTC)		+= dtc fdtoverlay
+hostprogs-always-$(CONFIG_DTC)		+= dtc fdtoverlay fdtget fdtput
 hostprogs-always-$(CHECK_DTBS)		+= dtc
 
 dtc-objs	:= dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
@@ -10,10 +10,12 @@ dtc-objs	:= dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
 dtc-objs	+= dtc-lexer.lex.o dtc-parser.tab.o
 
 # The upstream project builds libfdt as a separate library.  We are choosing to
-# instead directly link the libfdt object files into fdtoverlay.
+# instead directly link the libfdt object files into the host tools.
 libfdt-objs	:= fdt.o fdt_ro.o fdt_wip.o fdt_sw.o fdt_rw.o fdt_strerror.o fdt_empty_tree.o fdt_addresses.o fdt_overlay.o
 libfdt		= $(addprefix libfdt/,$(libfdt-objs))
 fdtoverlay-objs	:= $(libfdt) fdtoverlay.o util.o
+fdtget-objs	:= $(libfdt) fdtget.o util.o
+fdtput-objs	:= $(libfdt) fdtput.o util.o
 
 # Source files need to get at the userspace version of libfdt_env.h to compile
 HOST_EXTRACFLAGS += -I $(src)/libfdt
Signature · 1 line
2.56.0.212.g129ede20d9-goog
maintainer Reviewed-by on v1 3/7
#6 lore raw

Re: [RFC PATCH 3/7] scripts/dtc: Build fdtget and fdtput host tools

Quoted 11 lines · Douglas Anderson

scripts/dtc: Build fdtget and fdtput host tools

Build fdtget and fdtput alongside dtc and fdtoverlay when CONFIG_DTC is enabled so Kbuild rules can query and update properties in compiled device tree / FIT blobs.

 scripts/dtc/.gitignore | 2 ++
 scripts/dtc/Makefile   | 6 ++++--
 2 files changed, 6 insertions(+), 2 deletions(-)
#7 lore raw

RFC PATCH 4/7 arm64: boot: Support building image.fit from a specified FIT_ITS script

In reply to Douglas Anderson

Allow passing FIT_ITS=<path> on the make command line (relative to either $(srctree) or arch/arm64/boot/dts/) when building image.fit to assemble the FIT image from a checked-in .its script via mkimage instead of auto-generating a FIT image with scripts/make_fit.py. When FIT_ITS is not specified, image.fit continues to be built using scripts/make_fit.py as before.

Supporting a checked-in .its script includes:
- Adding cmd_lz4_frame (Image-framed.lz4 and %.dtb.lz4) for standard LZ4 frame compression (magic 0x184d2204) expected by FIT bootloaders such as U-Boot and depthcharge, plus generic compressed DTB rules (bz2, gz, lz4, lzma, lzo, zst, xz) in scripts/Makefile.dtbs.
- Restricting $(dtb-y) to the DTBs referenced via /incbin/(...) in $(FIT_ITS) and automatically building the referenced kernel image target (e.g. Image-framed.lz4) and any compressed .dtb.<ext> blobs.
- Populating any omitted compatible property on /configurations/conf-* nodes in cmd_fit_its from the corresponding uncompressed .dtb's root /compatible property using fdtget and fdtput. This is useful so we don't have to manually keep the .its script in sync with the source. This is extra important if compression is used since the bootloader may not be able to easily peek into the device trees itself.

The main motivation for checking in an .its script instead of using an auto-generated one is to be able to manually set the "description" field of the configurations. This allows us to provide information that the bootloader can use to figure out which configuration(s) to load. This idea came from Michal Simek.

Assisted-by Gemini:gemini-pro-prerelease

---

 Makefile                 |  2 +-
 arch/arm64/Makefile      |  3 ++
 arch/arm64/boot/Makefile |  9 ++++--
 scripts/Makefile.dtbs    | 43 ++++++++++++++++++++++++++++-
 scripts/Makefile.lib     | 59 ++++++++++++++++++++++++++++++++++++++++
 5 files changed, 111 insertions(+), 5 deletions(-)
Makefile +1 -1
index 0dc1a9f4e63e..8c5500179e2e 100644
@@ -2239,7 +2239,7 @@ clean: $(clean-dirs)
 		\( -name '*.[aios]' -o -name '*.rsi' -o -name '*.ko' -o -name '.*.cmd' \
 		-o -name '*.ko.*' -o -name '*.o.thinlto.bc' \
 		-o -name '*.dtb' -o -name '*.dtbo' \
-		-o -name '*.dtb.S' -o -name '*.dtbo.S' \
+		-o -name '*.dtb.*' -o -name '*.dtbo.S' \
 		-o -name '*.dt.yaml' -o -name 'dtbs-list' \
 		-o -name '*.dwo' -o -name '*.lst' \
 		-o -name '*.su' -o -name '*.mod' \
arch/arm64/Makefile +3 -0
index 6b005c8fef70..f9a25db9ae03 100644
@@ -185,6 +185,9 @@ $(BOOT_TARGETS): vmlinux
 Image.%: Image
 	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
 
+Image-framed.%: Image
+	$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
+
 ifeq ($(CONFIG_COMPRESSED_INSTALL),y)
  DEFAULT_KBUILD_IMAGE = $(KBUILD_IMAGE)
 else
arch/arm64/boot/Makefile +6 -3
index b5a08333bc57..fe21bace3692 100644
@@ -16,8 +16,8 @@
 
 OBJCOPYFLAGS_Image :=-O binary -R .note -R .note.gnu.build-id -R .comment -S
 
-targets := Image Image.bz2 Image.gz Image.lz4 Image.lzma Image.lzo \
-	Image.zst Image.xz image.fit
+targets := Image Image.bz2 Image.gz Image.lz4 Image-framed.lz4 Image.lzma \
+	Image.lzo Image.zst Image.xz image.fit
 
 $(obj)/Image: vmlinux FORCE
 	$(call if_changed,objcopy)
@@ -31,6 +31,9 @@ $(obj)/Image.gz: $(obj)/Image FORCE
 $(obj)/Image.lz4: $(obj)/Image FORCE
 	$(call if_changed,lz4)
 
+$(obj)/Image-framed.lz4: $(obj)/Image FORCE
+	$(call if_changed,lz4_frame)
+
 $(obj)/Image.lzma: $(obj)/Image FORCE
 	$(call if_changed,lzma)
 
@@ -44,7 +47,7 @@ $(obj)/Image.xz: $(obj)/Image FORCE
 	$(call if_changed,xzkern)
 
 $(obj)/image.fit: $(obj)/Image $(obj)/dts/dtbs-list FORCE
-	$(call if_changed,fit)
+	$(if $(FIT_ITS_FILE),$(call if_changed,fit_its),$(call if_changed,fit))
 
 EFI_ZBOOT_PAYLOAD	:= Image
 EFI_ZBOOT_BFD_TARGET	:= elf64-littleaarch64
scripts/Makefile.dtbs +42 -1

61 lines not on this page · raw message

scripts/Makefile.lib +59 -0

74 lines not on this page · raw message

Signature · 1 line
2.56.0.212.g129ede20d9-goog
maintainer
#8 lore raw

Re: [RFC PATCH 4/7] arm64: boot: Support building image.fit from a specified FIT_ITS script

Hi Doug,

Quoted 1 line · Douglas Anderson

arm64: boot: Support building image.fit from a specified FIT_ITS script

Most of this patch is generic kbuild rather than arm64: the top-level Makefile clean pattern, cmd_lz4_frame, the compressed .dtb rules, the dtb-y filtering in Makefile.dtbs and the FIT_ITS handling in Makefile.lib. Please can you split the lz4-frame and compressed-DTB rules into their own 'kbuild:' patch, with the kbuild maintainers on Cc?

Quoted 30 lines

Allow passing FIT_ITS=<path> on the make command line (relative to either $(srctree) or arch/arm64/boot/dts/) when building image.fit to assemble the FIT image from a checked-in .its script via mkimage instead of auto-generating a FIT image with scripts/make_fit.py. When FIT_ITS is not specified, image.fit continues to be built using scripts/make_fit.py as before.

Supporting a checked-in .its script includes:
- Adding cmd_lz4_frame (Image-framed.lz4 and %.dtb.lz4) for standard LZ4 frame compression (magic 0x184d2204) expected by FIT bootloaders such as U-Boot and depthcharge, plus generic compressed DTB rules (bz2, gz, lz4, lzma, lzo, zst, xz) in scripts/Makefile.dtbs.
- Restricting $(dtb-y) to the DTBs referenced via /incbin/(...) in $(FIT_ITS) and automatically building the referenced kernel image target (e.g. Image-framed.lz4) and any compressed .dtb.<ext> blobs.
- Populating any omitted compatible property on
[...]

 Makefile                 |  2 +-
 arch/arm64/Makefile      |  3 +++
 arch/arm64/boot/Makefile |  9 +++++---
 scripts/Makefile.dtbs    | 43 ++++++++++++++++++++++++++++++++++-
 scripts/Makefile.lib     | 59 ++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 111 insertions(+), 5 deletions(-)

scripts/Makefile.dtbs all-dtb := $(dtb-y) $(dtb-) · line 7

Quoted 3 lines
scripts/Makefile.dtbs +3 -0
@@ -5,6 +5,26 @@ all-dtb := $(dtb-y) $(dtb-)
+ifdef FIT_ITS_FILE
+ifneq ($(filter arch/$(SRCARCH)/boot/dts%, $(obj)),)
+its-dtb-files := $(notdir $(shell $(call fit_its_incbin,\.dtb)))

Just to check, is it intended that this also restricts 'make dtbs' and 'make dtbs_install' whenever FIT_ITS is set, not just image.fit? If so, please say so in the commit message. Also, matching on notdir means a DTB with the same name in another vendor directory would be built too. There are no such duplicates today, but comparing the directory with $(obj) would be more robust.

scripts/Makefile.lib quiet_cmd_fit = FIT $@ · line 439

Quoted 6 lines
scripts/Makefile.lib +4 -0
@@ -429,6 +436,58 @@ quiet_cmd_fit = FIT     $@
+			fdt=$$(fdtget $@ $$conf fdt); \
+			inc=$$($(call fit_its_incbin,\.dtb,$$fdt)); \
+			dtb="$(objtree)/$${inc%.dtb*}.dtb"; \
+			compat=$$(fdtget -ts "$$dtb" / compatible); \

A FIT configuration can list more than one fdt (a base followed by overlays, e.g. fdt = 'fdt-1', 'fdt-2'). Then $$fdt is 'fdt-1 fdt-2', the sed range never matches, $$inc is empty and fdtget fails on '$(objtree)/.dtb', breaking the build. Please can you use only the first word here, since the base DTB carries the root compatible?

scripts/Makefile.lib quiet_cmd_fit = FIT $@ · line 479

Quoted 2 lines
scripts/Makefile.lib +2 -0
+		configs=$$(fdtget -l $@ /configurations); \
+		for c in $$configs; do \

BTW, adding 'compatible' to the configuration nodes after mkimage runs would break any configuration signature, since the properties of a signed config node are hashed. mkimage isn't given -k here, so signing isn't supported anyway, but a comment would stop someone adding signing later without noticing.

Regards,
Simon

#9 lore raw

RFC PATCH 5/7 kbuild: fit: Add opt-in FIT_FACTOR_DTBS support using fdtfactor

In reply to Douglas Anderson

Add opt-in support for factoring the DTBs inside a compiled FIT image into shared base DTBs and per-board overlays using fdtfactor when FIT_FACTOR_DTBS=1 is passed to make:

- When FIT_FACTOR_DTBS is set, pass -@ -L to dtc for the DTBs included in the FIT image so they retain /__symbols__ and /__local_fixups__ metadata needed for factoring.
- Run $(FDTFACTOR) $(FDTFACTOR_ARGS) -f $@ (with FDTFACTOR_ARGS defaulting to --strip-local-fixups) at the end of cmd_fit and cmd_fit_its when FIT_FACTOR_DTBS is set.

Assisted-by Gemini:gemini-pro-prerelease

---
You can see the fdtfactor post at:
http://lore.kernel.org/r/[email protected]

This patch obviously could only land if some form of that series lands. Presumably we'd also want to import fdtfactor into the local kernel copy of the devicetree compiler before this patch.

If people hate this patch, we could certainly just run fdtfactor after the kernel build finishes.

 scripts/Makefile.dtbs |  8 ++++++++
 scripts/Makefile.lib  | 18 ++++++++++++------
 2 files changed, 20 insertions(+), 6 deletions(-)
scripts/Makefile.dtbs +8 -0
index 1bc42b30cc52..4b8d7039e45d 100644
@@ -137,6 +137,14 @@ DTC_FLAGS += -Wnode_name_chars_strict \
              -Wunique_unit_address
 endif
 
+# When FIT_FACTOR_DTBS is set, pass -@ -L to dtc so the built DTBs retain the
+# /__symbols__ and /__local_fixups__ nodes required by fdtfactor.
+ifneq ($(FIT_FACTOR_DTBS),)
+ifneq ($(filter arch/$(SRCARCH)/boot/dts%, $(obj)),)
+DTC_FLAGS += -@ -L
+endif
+endif
+
 DTC_FLAGS += $(DTC_FLAGS_$(target-stem))
 
 # Set -@ if the target is a base DTB that overlay is applied onto
scripts/Makefile.lib +12 -6
index 91880648fe21..bcb2b0e749a3 100644
@@ -425,6 +425,8 @@ quiet_cmd_uimage = UIMAGE  $@
 # ---------------------------------------------------------------------------
 
 MAKE_FIT := $(srctree)/scripts/make_fit.py
+FDTFACTOR ?= fdtfactor
+FDTFACTOR_ARGS ?= --strip-local-fixups
 
 # Use this to override the compression algorithm
 FIT_COMPRESSION ?= gzip
@@ -434,7 +436,9 @@ quiet_cmd_fit = FIT     $@
 		--name '$(UIMAGE_NAME)' $(FIT_EXTRA_ARGS) \
 		$(if $(findstring 1,$(KBUILD_VERBOSE)),-v) \
 		$(if $(FIT_DECOMPOSE_DTBS),--decompose-dtbs) \
-		--compress $(FIT_COMPRESSION) -k $< @$(word 2,$^)
+		--compress $(FIT_COMPRESSION) -k $< @$(word 2,$^) \
+		$(if $(FIT_FACTOR_DTBS),&& $(FDTFACTOR) $(FDTFACTOR_ARGS) \
+			$(if $(findstring 1,$(KBUILD_VERBOSE)),-v) -f $@)
 
 # If FIT_ITS is specified on the command line (either relative to $(srctree)
 # or relative to arch/$(SRCARCH)/boot/dts/), locate that .its script and
@@ -465,10 +469,10 @@ $(obj)/image.fit: $(FIT_ITS_IMAGES) $(FIT_ITS_DTBS) $(FIT_ITS_FILE)
 endif
 endif
 
-# Build the FIT image from the .its script with mkimage and populate any
-# missing 'compatible' property on /configurations/conf-* nodes from the
-# corresponding uncompressed .dtb's root '/compatible' property using
-# fdtget/fdtput.
+# Build the FIT image from the .its script with mkimage, populate any missing
+# 'compatible' property on /configurations/conf-* nodes from the corresponding
+# uncompressed .dtb's root '/compatible' property using fdtget/fdtput, and
+# optionally factor the DTBs with fdtfactor when FIT_FACTOR_DTBS is set.
 quiet_cmd_fit_its = FIT     $@
       cmd_fit_its = \
 		PATH="$(abspath $(objtree))/scripts/dtc:$(PATH)"; \
@@ -486,7 +490,9 @@ quiet_cmd_fit_its = FIT     $@
 			dtb="$(objtree)/$${inc%.dtb*}.dtb"; \
 			compat=$$(fdtget -ts "$$dtb" / compatible); \
 			fdtput -ts $@ $$conf compatible $$compat; \
-		done
+		done \
+		$(if $(FIT_FACTOR_DTBS),; $(FDTFACTOR) $(FDTFACTOR_ARGS) \
+			$(if $(findstring 1,$(KBUILD_VERBOSE)),-v) -f $@)
 
 # XZ
 # ---------------------------------------------------------------------------
Signature · 1 line
2.56.0.212.g129ede20d9-goog
maintainer
#10 lore raw

Re: [RFC PATCH 5/7] kbuild: fit: Add opt-in FIT_FACTOR_DTBS support using fdtfactor

Hi Doug,

Quoted 5 lines · Douglas Anderson

kbuild: fit: Add opt-in FIT_FACTOR_DTBS support using fdtfactor

Add opt-in support for factoring the DTBs inside a compiled FIT image into shared base DTBs and per-board overlays using fdtfactor when FIT_FACTOR_DTBS=1 is passed to make:

Please can you add a short paragraph at the start saying why this is wanted (the bootloader needs a base DTB plus a per-board DTBO) and where fdtfactor comes from? It is not in scripts/dtc, so someone reading the git log won't know where the tool lives or which version is needed. A link to the dtc series would help.

Quoted 17 lines

- When FIT_FACTOR_DTBS is set, pass -@ -L to dtc for the DTBs included in the FIT image so they retain /__symbols__ and /__local_fixups__ metadata needed for factoring.
- Run $(FDTFACTOR) $(FDTFACTOR_ARGS) -f $@ (with FDTFACTOR_ARGS defaulting to --strip-local-fixups) at the end of cmd_fit and cmd_fit_its when FIT_FACTOR_DTBS is set.

Assisted-by Gemini:gemini-pro-prerelease
 scripts/Makefile.dtbs |  8 ++++++++
 scripts/Makefile.lib  | 18 ++++++++++++------
 2 files changed, 20 insertions(+), 6 deletions(-)

scripts/Makefile.lib quiet_cmd_uimage = UIMAGE $@ · line 427

Quoted 3 lines
scripts/Makefile.lib +2 -0
@@ -425,6 +425,8 @@ quiet_cmd_uimage = UIMAGE  $@
 MAKE_FIT := $(srctree)/scripts/make_fit.py
+FDTFACTOR ?= fdtfactor
+FDTFACTOR_ARGS ?= --strip-local-fixups

Patches 1-3 go to some trouble to build fdtget and fdtput in-tree, and cmd_fit_its puts scripts/dtc on the PATH, but fdtfactor comes from the host. So FIT_FACTOR_DTBS=1 uses whatever fdtfactor happens to be on the PATH, and the build does not depend on it. Is the plan to sync fdtfactor.c into scripts/dtc once it lands upstream? If so, it would be worth saying so under the --- line.

scripts/Makefile.dtbs DTC_FLAGS += -Wnode_name_chars_strict \ · line 143

Quoted 9 lines
scripts/Makefile.dtbs +7 -0
@@ -137,6 +137,14 @@ DTC_FLAGS += -Wnode_name_chars_strict \
+# When FIT_FACTOR_DTBS is set, pass -@ -L to dtc so the built DTBs retain the
+# /__symbols__ and /__local_fixups__ nodes required by fdtfactor.
+ifneq ($(FIT_FACTOR_DTBS),)
+ifneq ($(filter arch/$(SRCARCH)/boot/dts%, $(obj)),)
+DTC_FLAGS += -@ -L
+endif
+endif

One thing I'd like to check is composite DTBs (the foo-dtbs := base.dtb bar.dtbo entries built by cmd_fdtoverlay). My understanding is that fdt_overlay_apply() merges the overlay's __symbols__ into the base but drops its __local_fixups__ after using them to renumber phandles inside the overlay. So the __local_fixups__ in a composite DTB only cover the base part, even though both inputs were built with -L

This doesn't affect lga or trogdor, but the make_fit.py path packs every DTB in dtbs-list, and qcom has lots of composite entries (lemans-evk-camera.dtb, etc). If fdtfactor relies on __local_fixups__ to find phandle properties, it may silently produce a bad overlay for these. Please can you check this? It might be enough to detect such DTBs and skip or refuse them.

scripts/Makefile.lib quiet_cmd_fit_its = FIT $@ · line 492

Quoted 6 lines
scripts/Makefile.lib +3 -1
@@ -486,7 +490,9 @@ quiet_cmd_fit_its = FIT     $@
-		done
+		done \
+		$(if $(FIT_FACTOR_DTBS),; $(FDTFACTOR) $(FDTFACTOR_ARGS) \
+			$(if $(findstring 1,$(KBUILD_VERBOSE)),-v) -f $@)

Just to check, does fdtfactor handle compressed DTBs in the FIT, i.e. nodes with compression = 'lz4' as in sc7180-trogdor.its from patch 7? If not, FIT_FACTOR_DTBS=1 with that .its will either fail or silently skip the DTBs. Either way, it would be worth mentioning in the commit message.

Regards,
Simon

#11 lore raw

Re: [RFC PATCH 5/7] kbuild: fit: Add opt-in FIT_FACTOR_DTBS support using fdtfactor

Hi,

Quoted 10 lines · Simon Glass

Hi Doug,

Quoted 5 lines · Douglas Anderson

kbuild: fit: Add opt-in FIT_FACTOR_DTBS support using fdtfactor

Add opt-in support for factoring the DTBs inside a compiled FIT image into shared base DTBs and per-board overlays using fdtfactor when FIT_FACTOR_DTBS=1 is passed to make:

Quoted 5 lines

Please can you add a short paragraph at the start saying why this is wanted (the bootloader needs a base DTB plus a per-board DTBO) and where fdtfactor comes from? It is not in scripts/dtc, so someone reading the git log won't know where the tool lives or which version is needed. A link to the dtc series would help.

I think that was in the the "after the cut" part, where I said:

You can see the fdtfactor post at:
http://lore.kernel.org/r/[email protected]

This patch obviously could only land if some form of that series lands. Presumably we'd also want to import fdtfactor into the local kernel copy of the devicetree compiler before this patch.

My plan was for this series to be RFC until fdtfactor lands, after which it would include an import of fdtfactor as one of the earlier patches. ;-)

Quoted 14 lines
Quoted 13 lines

- When FIT_FACTOR_DTBS is set, pass -@ -L to dtc for the DTBs included in the FIT image so they retain /__symbols__ and /__local_fixups__ metadata needed for factoring.
- Run $(FDTFACTOR) $(FDTFACTOR_ARGS) -f $@ (with FDTFACTOR_ARGS defaulting to --strip-local-fixups) at the end of cmd_fit and cmd_fit_its when FIT_FACTOR_DTBS is set.

Assisted-by Gemini:gemini-pro-prerelease
 scripts/Makefile.dtbs |  8 ++++++++
 scripts/Makefile.lib  | 18 ++++++++++++------
 2 files changed, 20 insertions(+), 6 deletions(-)
Quoted 12 lines

scripts/Makefile.lib quiet_cmd_uimage = UIMAGE $@ · line 427

Quoted 5 lines
scripts/Makefile.lib +2 -0
@@ -425,6 +425,8 @@ quiet_cmd_uimage = UIMAGE  $@
 MAKE_FIT := $(srctree)/scripts/make_fit.py
+FDTFACTOR ?= fdtfactor
+FDTFACTOR_ARGS ?= --strip-local-fixups

Patches 1-3 go to some trouble to build fdtget and fdtput in-tree, and cmd_fit_its puts scripts/dtc on the PATH, but fdtfactor comes from the host. So FIT_FACTOR_DTBS=1 uses whatever fdtfactor happens to be on the PATH, and the build does not depend on it. Is the plan to sync fdtfactor.c into scripts/dtc once it lands upstream? If so, it would be worth saying so under the --- line.

Yup, that's the plan.

Quoted 18 lines

scripts/Makefile.dtbs DTC_FLAGS += -Wnode_name_chars_strict \ · line 143

Quoted 9 lines
scripts/Makefile.dtbs +7 -0
@@ -137,6 +137,14 @@ DTC_FLAGS += -Wnode_name_chars_strict \
+# When FIT_FACTOR_DTBS is set, pass -@ -L to dtc so the built DTBs retain the
+# /__symbols__ and /__local_fixups__ nodes required by fdtfactor.
+ifneq ($(FIT_FACTOR_DTBS),)
+ifneq ($(filter arch/$(SRCARCH)/boot/dts%, $(obj)),)
+DTC_FLAGS += -@ -L
+endif
+endif

One thing I'd like to check is composite DTBs (the foo-dtbs := base.dtb bar.dtbo entries built by cmd_fdtoverlay). My understanding is that fdt_overlay_apply() merges the overlay's __symbols__ into the base but drops its __local_fixups__ after using them to renumber phandles inside the overlay. So the __local_fixups__ in a composite DTB only cover the base part, even though both inputs were built with -L

Quoted 6 lines

This doesn't affect lga or trogdor, but the make_fit.py path packs every DTB in dtbs-list, and qcom has lots of composite entries (lemans-evk-camera.dtb, etc). If fdtfactor relies on __local_fixups__ to find phandle properties, it may silently produce a bad overlay for these. Please can you check this? It might be enough to detect such DTBs and skip or refuse them.

I'm not sure I 100% understand, but let me try to respond and you can tell me if I got it right.

The goal was to make sure that we could fully reconstruct __local_fixups__ after applying the overlay to the base. v2 of the fdtfactor series handled this more properly, and I'm planning to see this through and land it unless there are major objections.

By default here, I'm running fdtfactor with "-S" to strip the __local_fixups__ out with the assumption that today people don't really need them. However, someone could easily override that locally.

I'm a little unclear how things would silently produce a bad overlay, though.

Quoted 4 lines
Quoted 4 lines
scripts/Makefile.lib +1 -1
@@ -486,7 +490,9 @@ quiet_cmd_fit_its = FIT     $@
-             done
+             done \
Quoted 8 lines

scripts/Makefile.lib quiet_cmd_fit_its = FIT $@ · line 495

Quoted 2 lines
scripts/Makefile.lib +2 -0
+             $(if $(FIT_FACTOR_DTBS),; $(FDTFACTOR) $(FDTFACTOR_ARGS) \
+                     $(if $(findstring 1,$(KBUILD_VERBOSE)),-v) -f $@)

Just to check, does fdtfactor handle compressed DTBs in the FIT, i.e. nodes with compression = 'lz4' as in sc7180-trogdor.its from patch 7? If not, FIT_FACTOR_DTBS=1 with that .its will either fail or silently skip the DTBs. Either way, it would be worth mentioning in the commit message.

Yes, fdtfactor transparently decompresses compressed FDT image nodes inside the FIT (including lz4 in sc7180-trogdor.its), factors them, and re-compresses the resulting base DTB and overlays. I'l update the commit message to mention this explicitly.

maintainer
#12 lore raw

Re: [RFC PATCH 5/7] kbuild: fit: Add opt-in FIT_FACTOR_DTBS support using fdtfactor

Hi Doug,

Quoted 4 lines · Doug Anderson

I think that was in the the "after the cut" part, where I said:

You can see the fdtfactor post at:
http://lore.kernel.org/r/[email protected]

OK, that covers where the tool comes from, and the question goes away once fdtfactor is imported. Text below the cut doesn't reach the git log, though, so a sentence or two in the commit message on why this is wanted would still help.

Quoted 10 lines

The goal was to make sure that we could fully reconstruct __local_fixups__ after applying the overlay to the base. v2 of the fdtfactor series handled this more properly, and I'm planning to see this through and land it unless there are major objections.

By default here, I'm running fdtfactor with "-S" to strip the __local_fixups__ out with the assumption that today people don't really need them. However, someone could easily override that locally.

I'm a little unclear how things would silently produce a bad overlay, though.

Sorry, I should have been clearer. This is about overlays which kbuild applies at build time, not runtime ones like Beaglebone capes. An entry such as:

lemans-evk-camera-dtbs := lemans-evk.dtb lemans-evk-camera.dtbo

is merged by fdtoverlay into a plain lemans-evk-camera.dtb, which the make_fit.py path then puts in the FIT like any other DTB. There are several hundred of these on arm64.

My concern is the input to fdtfactor, not its output. In the in-tree libfdt, fdt_overlay_apply() uses the .dtbo's __local_fixups__ and __fixups__ to resolve its phandles, then overlay_merge() copies only the __overlay__ contents into the base. Only __symbols__ is merged, so the __local_fixups__ in lemans-evk-camera.dtb cover just the lemans-evk.dtb part. Cells from the .dtso such as:

    avdd-supply = <&vreg_cam1_1p8>;
    remote-endpoint = <&imx577_ep1>;

end up as plain numbers, with nothing marking them as phandles. If fdtfactor needs to renumber them, or puts those nodes in a per-board overlay, it cannot tell they are phandles, so the overlay applies cleanly but the links are wrong. Stripping the fixups from the output with -S doesn't change that, since the information is already gone from the input.

Does v2 make fdt_overlay_apply() keep the overlay's __local_fixups__? If so, composite DTBs would be fine once that is synced into scripts/dtc, and my concern goes away. If not, one option is for FIT_FACTOR_DTBS to imply FIT_DECOMPOSE_DTBS, so that make_fit.py puts the original .dtb and .dtbo files in the FIT separately and the .dtbo keeps its own fixups. Leaving composite DTBs out would be a simpler fallback. What do you think?

Regards,
Simon

#13 lore raw

Re: [RFC PATCH 5/7] kbuild: fit: Add opt-in FIT_FACTOR_DTBS support using fdtfactor

Hi,

Quoted 6 lines · Simon Glass

Hi Doug,

Quoted 2 lines · Doug Anderson

I think that was in the the "after the cut" part, where I said:

Quoted 7 lines
Quoted 2 lines

You can see the fdtfactor post at:
http://lore.kernel.org/r/[email protected]

OK, that covers where the tool comes from, and the question goes away once fdtfactor is imported. Text below the cut doesn't reach the git log, though, so a sentence or two in the commit message on why this is wanted would still help.

Sounds good. I'll plan this for v2.

Quoted 38 lines
Quoted 10 lines

The goal was to make sure that we could fully reconstruct __local_fixups__ after applying the overlay to the base. v2 of the fdtfactor series handled this more properly, and I'm planning to see this through and land it unless there are major objections.

By default here, I'm running fdtfactor with "-S" to strip the __local_fixups__ out with the assumption that today people don't really need them. However, someone could easily override that locally.

I'm a little unclear how things would silently produce a bad overlay, though.

Sorry, I should have been clearer. This is about overlays which kbuild applies at build time, not runtime ones like Beaglebone capes. An entry such as:

lemans-evk-camera-dtbs := lemans-evk.dtb lemans-evk-camera.dtbo

is merged by fdtoverlay into a plain lemans-evk-camera.dtb, which the make_fit.py path then puts in the FIT like any other DTB. There are several hundred of these on arm64.

My concern is the input to fdtfactor, not its output. In the in-tree libfdt, fdt_overlay_apply() uses the .dtbo's __local_fixups__ and __fixups__ to resolve its phandles, then overlay_merge() copies only the __overlay__ contents into the base. Only __symbols__ is merged, so the __local_fixups__ in lemans-evk-camera.dtb cover just the lemans-evk.dtb part. Cells from the .dtso such as:

    avdd-supply = <&vreg_cam1_1p8>;
    remote-endpoint = <&imx577_ep1>;

end up as plain numbers, with nothing marking them as phandles. If fdtfactor needs to renumber them, or puts those nodes in a per-board overlay, it cannot tell they are phandles, so the overlay applies cleanly but the links are wrong. Stripping the fixups from the output with -S doesn't change that, since the information is already gone from the input.

Quoted 7 lines

Does v2 make fdt_overlay_apply() keep the overlay's __local_fixups__? If so, composite DTBs would be fine once that is synced into scripts/dtc, and my concern goes away. If not, one option is for FIT_FACTOR_DTBS to imply FIT_DECOMPOSE_DTBS, so that make_fit.py puts the original .dtb and .dtbo files in the FIT separately and the .dtbo keeps its own fixups. Leaving composite DTBs out would be a simpler fallback. What do you think?

I think your concern just goes away. ;-) The fdtfactor v2 series (and soon to be sent v3 series) includes a bunch of patches to the overlay code, and this code produces a fully valid __local_fixups__ in the final dtb after an overlay is merged in (assuming the original dtb already had a valid __local_fixups__).

The idea is that fdtfactor and the overlay fixes will all land in the upstream dtc project. Then as part of this series we will bring both in, so we should be all good.

-Doug

#14 lore raw

Re: [RFC PATCH 5/7] kbuild: fit: Add opt-in FIT_FACTOR_DTBS support using fdtfactor

Following up on one piece of my earlier reply:

Quoted 3 lines

The idea is that fdtfactor and the overlay fixes will all land in the upstream dtc project. Then as part of this series we will bring both in, so we should be all good.

Thinking about this more, we won't actually be able to sync and run fdtfactor itself from scripts/dtc/. fdtfactor is a Python script that relies on pylibfdt (similar to scripts/make_fit.py), and the upstream kernel maintainers have pushed back against building pylibfdt from the kernel tree's copy of dtc. Since fdtfactor needs a matching pylibfdt installed on the host anyway, fdtfactor will simply remain an optional external host dependency when FIT_FACTOR_DTBS=1 is used.

By contrast, fdtoverlay is a C host tool already built in scripts/dtc/, so we _will_ still sync the libfdt overlay /__local_fixups__ updates into scripts/dtc/libfdt/ once they land upstream, meaning composite DTBs built by kbuild are still covered.

In v2 I've documented the optional fdtfactor external dependency in Documentation/process/changes.rst and Documentation/kbuild/kbuild.rst (as well as in the commit message).

-Doug

#15 lore raw

RFC PATCH 6/7 arm64: dts: google: lga: Add lga.its FIT image script

In reply to Douglas Anderson

Add an Image Tree Source (lga.its) describing the FIT image for Google Tensor G5 (LGA) Pixel 10 family boards (lga-blazer.dtb, lga-frankel.dtb, and lga-mustang.dtb) with board and SoC ID/revision metadata in the configuration descriptions, allowing the LGA FIT image to be built with:

  make \
    FIT_ITS=google/lga.its \
    FIT_FACTOR_DTBS=1 \
    FDTFACTOR_ARGS="--strip-local-fixups --single-base-dtb" \
    image.fit

NOTE: At the moment, Pixel 10 doesn't directly boot from a FIT image. However, packaging scripts will be able to take an image as built above and convert it into a format that the bootloader can handle.

It should also be noted that the "description" of the various configurations here is expected to be parsed to help figure out which configuration to use on which board. This idea came out of discussions at Linux Plumbers Conference 2026 and means we don't need "loader" info polluting device trees. Having a structured (and upstream) place to store this data is part of the motivation for landing this FIT image.

Side note: at the moment, the Pixel bootloader can't handle picking overlays based on the soc_id and soc_rev (it only uses those to pick base dtb files), so for now we won't be able to support boards that might have different SoCs. I've included the soc_id and soc_rev in this FIT image in the hopes that we can improve the bootloader in the future, though.

Assisted-by Gemini:gemini-pro-prerelease

---
Note that building image.fit with lga.its requires the Pixel 10 (lga-blazer.dtb, lga-frankel.dtb, and lga-mustang.dtb) device trees, which are currently in linux-next and not yet in mainline.

 arch/arm64/boot/dts/google/lga.its | 68 ++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)
 create mode 100644 arch/arm64/boot/dts/google/lga.its
arch/arm64/boot/dts/google/lga.its new file +68 -0
new file mode 100644
index 000000000000..5ba19c0b5411
@@ -0,0 +1,68 @@
+// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
+/dts-v1/;
+
+/ {
+	description = "Google Tensor G5 (LGA) kernel and device trees";
+	#address-cells = <1>;
+
+	images {
+		kernel-1 {
+			description = "Linux kernel";
+			data = /incbin/("arch/arm64/boot/Image");
+			type = "kernel_noload";
+			arch = "arm64";
+			os = "linux";
+			compression = "none";
+			load = <0>;
+			entry = <0>;
+		};
+		fdt-1 {
+			description = "lga-blazer.dtb";
+			data = /incbin/("arch/arm64/boot/dts/google/lga-blazer.dtb");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "none";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-2 {
+			description = "lga-frankel.dtb";
+			data = /incbin/("arch/arm64/boot/dts/google/lga-frankel.dtb");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "none";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-3 {
+			description = "lga-mustang.dtb";
+			data = /incbin/("arch/arm64/boot/dts/google/lga-mustang.dtb");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "none";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+	};
+
+	configurations {
+		conf-1 {
+			description = "Blazer (board_id=0x070406,board_rev=0x010000,soc_id=0x0005,soc_rev=0x010000)";
+			kernel = "kernel-1";
+			fdt = "fdt-1";
+		};
+		conf-2 {
+			description = "Frankel (board_id=0x070306,board_rev=0x010000,soc_id=0x0005,soc_rev=0x010000)";
+			kernel = "kernel-1";
+			fdt = "fdt-2";
+		};
+		conf-3 {
+			description = "Mustang (board_id=0x070506,board_rev=0x010000,soc_id=0x0005,soc_rev=0x010000)";
+			kernel = "kernel-1";
+			fdt = "fdt-3";
+		};
+	};
+};
Signature · 1 line
2.56.0.212.g129ede20d9-goog
Acked-by on v1 6/7
#16 lore raw

Re: [RFC PATCH 6/7] arm64: dts: google: lga: Add lga.its FIT image script

Quoted 34 lines · Douglas Anderson

Add an Image Tree Source (lga.its) describing the FIT image for Google Tensor G5 (LGA) Pixel 10 family boards (lga-blazer.dtb, lga-frankel.dtb, and lga-mustang.dtb) with board and SoC ID/revision metadata in the configuration descriptions, allowing the LGA FIT image to be built with:

   make \
     FIT_ITS=google/lga.its \
     FIT_FACTOR_DTBS=1 \
     FDTFACTOR_ARGS="--strip-local-fixups --single-base-dtb" \
     image.fit

NOTE: At the moment, Pixel 10 doesn't directly boot from a FIT image. However, packaging scripts will be able to take an image as built above and convert it into a format that the bootloader can handle.

It should also be noted that the "description" of the various configurations here is expected to be parsed to help figure out which configuration to use on which board. This idea came out of discussions at Linux Plumbers Conference 2026 and means we don't need "loader" info polluting device trees. Having a structured (and upstream) place to store this data is part of the motivation for landing this FIT image.

Side note: at the moment, the Pixel bootloader can't handle picking overlays based on the soc_id and soc_rev (it only uses those to pick base dtb files), so for now we won't be able to support boards that might have different SoCs. I've included the soc_id and soc_rev in this FIT image in the hopes that we can improve the bootloader in the future, though.

Assisted-by Gemini:gemini-pro-prerelease
Quoted 8 lines

---
Note that building image.fit with lga.its requires the Pixel 10 (lga-blazer.dtb, lga-frankel.dtb, and lga-mustang.dtb) device trees, which are currently in linux-next and not yet in mainline.

  arch/arm64/boot/dts/google/lga.its | 68 ++++++++++++++++++++++++++++++
  1 file changed, 68 insertions(+)

create mode 100644 arch/arm64/boot/dts/google/lga.its

Looks good to me.

Cheers,
Michal

maintainer
#17 lore raw

Re: [RFC PATCH 6/7] arm64: dts: google: lga: Add lga.its FIT image script

In reply to Douglas Anderson

Hi Doug,

Quoted 27 lines · Douglas Anderson

arm64: dts: google: lga: Add lga.its FIT image script

Add an Image Tree Source (lga.its) describing the FIT image for Google Tensor G5 (LGA) Pixel 10 family boards (lga-blazer.dtb, lga-frankel.dtb, and lga-mustang.dtb) with board and SoC ID/revision metadata in the configuration descriptions, allowing the LGA FIT image to be built with:

  make \
    FIT_ITS=google/lga.its \
    FIT_FACTOR_DTBS=1 \
    FDTFACTOR_ARGS="--strip-local-fixups --single-base-dtb" \
    image.fit

NOTE: At the moment, Pixel 10 doesn't directly boot from a FIT image. However, packaging scripts will be able to take an image as built above and convert it into a format that the bootloader can handle.

It should also be noted that the "description" of the various [...]

 arch/arm64/boot/dts/google/lga.its | 68 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

arch/arm64/boot/dts/google/lga.its line 10

Quoted 10 lines
arch/arm64/boot/dts/google/lga.its +10 -0
@@ -0,0 +1,68 @@
+		fdt-1 {
+			description = "lga-blazer.dtb";
+			data = /incbin/("arch/arm64/boot/dts/google/lga-blazer.dtb");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "none";
+			hash-1 {
+				algo = "sha1";
+			};
+		};

Just to check, does fdtfactor recalculate hash-1 when it rewrites the fdt-N data? With FIT_FACTOR_DTBS=1 (as used in the commit message), mkimage computes the sha1 over the full lga-blazer.dtb and then the data is replaced by the base or overlay. If the hash is not updated, anything that verifies it will reject the image. I'm also not sure why the FDTs get a hash but kernel-1 does not. If the hashes are only there because the trogdor script has them, it might be simpler to drop them here, since the packaging scripts repack everything anyway.

arch/arm64/boot/dts/google/lga.its line 2

Quoted 4 lines
arch/arm64/boot/dts/google/lga.its +2 -0
@@ -0,0 +1,68 @@
+		conf-1 {
+			description = "Blazer (board_id=0x070406,board_rev=0x010000,soc_id=0x0005,soc_rev=0x010000)";

Since tools are expected to parse this string, please can you add a comment at the top of the file describing the format? For example: are the keys required or optional, can they come in any order, are the numbers always hex, and does the width matter (6 digits for board_id but 4 for soc_id)? Otherwise the format is whatever the first packaging script happens to accept, and anyone adding a board or revision has to copy the existing lines and hope. But I think we should get this into the FIT spec - will mention that on the cover letter.

Regards,
Simon

#18 lore raw

RFC PATCH 7/7 arm64: dts: qcom: sc7180: Add sc7180-trogdor.its FIT image script

In reply to Douglas Anderson

Add an Image Tree Source (sc7180-trogdor.its) describing the FIT image for SC7180 Trogdor family boards using Image-framed.lz4 and LZ4-compressed board DTBs (*.dtb.lz4), allowing the Trogdor FIT image to be built with:

make FIT_ITS=qcom/sc7180-trogdor.its image.fit

Assisted-by Gemini:gemini-pro-prerelease

---
As mentioned in the cover letter, there is no desperate need to land this. The FIT image created here is pretty much the same as what the downstream build scripts for ChromeOS programmatically produce. Switching over to this would have a few benefits:
* It makes it easy to use fdtfactor on the trogdor kernel image.
* It would set the path for future Chromebooks, and on those Chromebooks maybe we could use the "description" of the configurations to help the bootloader so we didn't need the awkward piles of "compatible" strings that we have.
* It could potentially be useful to people in the community putting upstream kernels on sc7180-trogdor devices.

This all being said, there's nothing terribly critical here, so if it's controversial or people hate it then it's fine not to land it.

 arch/arm64/boot/dts/qcom/sc7180-trogdor.its | 728 ++++++++++++++++++++
 1 file changed, 728 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/sc7180-trogdor.its
arch/arm64/boot/dts/qcom/sc7180-trogdor.its new file +728 -0
new file mode 100644
index 000000000000..310c286706f1
@@ -0,0 +1,728 @@
+// SPDX-License-Identifier: (GPL-2.0-or-later OR MIT)
+/dts-v1/;
+
+/ {
+	description = "Chrome OS kernel image with one or more FDT blobs";
+	#address-cells = <1>;
+
+	images {
+		kernel-1 {
+			description = "Linux kernel";
+			data = /incbin/("arch/arm64/boot/Image-framed.lz4");
+			type = "kernel_noload";
+			arch = "arm64";
+			os = "linux";
+			compression = "lz4";
+			load = <0>;
+			entry = <0>;
+		};
+		fdt-1 {
+			description = "sc7180-trogdor-coachz-r1-lte.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1-lte.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-2 {
+			description = "sc7180-trogdor-coachz-r1.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r1.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-3 {
+			description = "sc7180-trogdor-coachz-r3-lte.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r3-lte.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-4 {
+			description = "sc7180-trogdor-coachz-r3.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz-r3.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-5 {
+			description = "sc7180-trogdor-homestar-r2.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-homestar-r2.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-6 {
+			description = "sc7180-trogdor-homestar-r3.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-homestar-r3.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-7 {
+			description = "sc7180-trogdor-homestar-r4.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-homestar-r4.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-8 {
+			description = "sc7180-trogdor-kingoftown.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-kingoftown.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-9 {
+			description = "sc7180-trogdor-lazor-limozeen-nots-r10.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-limozeen-nots-r10.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-10 {
+			description = "sc7180-trogdor-lazor-limozeen-nots-r4.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-limozeen-nots-r4.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-11 {
+			description = "sc7180-trogdor-lazor-limozeen-nots-r5.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-limozeen-nots-r5.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-12 {
+			description = "sc7180-trogdor-lazor-limozeen-nots-r9.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-limozeen-nots-r9.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-13 {
+			description = "sc7180-trogdor-lazor-limozeen-r10.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-limozeen-r10.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-14 {
+			description = "sc7180-trogdor-lazor-limozeen-r4.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-limozeen-r4.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-15 {
+			description = "sc7180-trogdor-lazor-limozeen-r9.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-limozeen-r9.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-16 {
+			description = "sc7180-trogdor-lazor-r1-kb.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1-kb.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-17 {
+			description = "sc7180-trogdor-lazor-r1-lte.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1-lte.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-18 {
+			description = "sc7180-trogdor-lazor-r1.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r1.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-19 {
+			description = "sc7180-trogdor-lazor-r10-kb.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r10-kb.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-20 {
+			description = "sc7180-trogdor-lazor-r10-lte.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r10-lte.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-21 {
+			description = "sc7180-trogdor-lazor-r10.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r10.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-22 {
+			description = "sc7180-trogdor-lazor-r3-kb.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3-kb.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-23 {
+			description = "sc7180-trogdor-lazor-r3-lte.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3-lte.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-24 {
+			description = "sc7180-trogdor-lazor-r3.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r3.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-25 {
+			description = "sc7180-trogdor-lazor-r9-kb.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r9-kb.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-26 {
+			description = "sc7180-trogdor-lazor-r9-lte.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r9-lte.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-27 {
+			description = "sc7180-trogdor-lazor-r9.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-lazor-r9.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-28 {
+			description = "sc7180-trogdor-pazquel-lte-parade.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel-lte-parade.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-29 {
+			description = "sc7180-trogdor-pazquel-lte-ti.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel-lte-ti.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-30 {
+			description = "sc7180-trogdor-pazquel-parade.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel-parade.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-31 {
+			description = "sc7180-trogdor-pazquel-ti.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel-ti.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-32 {
+			description = "sc7180-trogdor-pazquel360-lte.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel360-lte.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-33 {
+			description = "sc7180-trogdor-pazquel360-wifi.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-pazquel360-wifi.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-34 {
+			description = "sc7180-trogdor-pompom-r1-lte.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r1-lte.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-35 {
+			description = "sc7180-trogdor-pompom-r1.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r1.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-36 {
+			description = "sc7180-trogdor-pompom-r2-lte.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2-lte.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-37 {
+			description = "sc7180-trogdor-pompom-r2.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r2.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-38 {
+			description = "sc7180-trogdor-pompom-r3-lte.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3-lte.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-39 {
+			description = "sc7180-trogdor-pompom-r3.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom-r3.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-40 {
+			description = "sc7180-trogdor-quackingstick-r0-lte.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-quackingstick-r0-lte.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-41 {
+			description = "sc7180-trogdor-quackingstick-r0.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-quackingstick-r0.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-42 {
+			description = "sc7180-trogdor-r1-lte.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-r1-lte.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-43 {
+			description = "sc7180-trogdor-r1.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-r1.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-44 {
+			description = "sc7180-trogdor-wormdingler-rev1-boe-rt5682s.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-wormdingler-rev1-boe-rt5682s.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-45 {
+			description = "sc7180-trogdor-wormdingler-rev1-boe.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-wormdingler-rev1-boe.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-46 {
+			description = "sc7180-trogdor-wormdingler-rev1-inx-rt5682s.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-wormdingler-rev1-inx-rt5682s.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+		fdt-47 {
+			description = "sc7180-trogdor-wormdingler-rev1-inx.dtb.lz4";
+			data = /incbin/("arch/arm64/boot/dts/qcom/sc7180-trogdor-wormdingler-rev1-inx.dtb.lz4");
+			type = "flat_dt";
+			arch = "arm64";
+			compression = "lz4";
+			hash-1 {
+				algo = "sha1";
+			};
+		};
+	};
+
+	configurations {
+		conf-1 {
+			description = "sc7180-trogdor-coachz-r1-lte";
+			kernel = "kernel-1";
+			fdt = "fdt-1";
+		};
+		conf-2 {
+			description = "sc7180-trogdor-coachz-r1";
+			kernel = "kernel-1";
+			fdt = "fdt-2";
+		};
+		conf-3 {
+			description = "sc7180-trogdor-coachz-r3-lte";
+			kernel = "kernel-1";
+			fdt = "fdt-3";
+		};
+		conf-4 {
+			description = "sc7180-trogdor-coachz-r3";
+			kernel = "kernel-1";
+			fdt = "fdt-4";
+		};
+		conf-5 {
+			description = "sc7180-trogdor-homestar-r2";
+			kernel = "kernel-1";
+			fdt = "fdt-5";
+		};
+		conf-6 {
+			description = "sc7180-trogdor-homestar-r3";
+			kernel = "kernel-1";
+			fdt = "fdt-6";
+		};
+		conf-7 {
+			description = "sc7180-trogdor-homestar-r4";
+			kernel = "kernel-1";
+			fdt = "fdt-7";
+		};
+		conf-8 {
+			description = "sc7180-trogdor-kingoftown";
+			kernel = "kernel-1";
+			fdt = "fdt-8";
+		};
+		conf-9 {
+			description = "sc7180-trogdor-lazor-limozeen-nots-r10";
+			kernel = "kernel-1";
+			fdt = "fdt-9";
+		};
+		conf-10 {
+			description = "sc7180-trogdor-lazor-limozeen-nots-r4";
+			kernel = "kernel-1";
+			fdt = "fdt-10";
+		};
+		conf-11 {
+			description = "sc7180-trogdor-lazor-limozeen-nots-r5";
+			kernel = "kernel-1";
+			fdt = "fdt-11";
+		};
+		conf-12 {
+			description = "sc7180-trogdor-lazor-limozeen-nots-r9";
+			kernel = "kernel-1";
+			fdt = "fdt-12";
+		};
+		conf-13 {
+			description = "sc7180-trogdor-lazor-limozeen-r10";
+			kernel = "kernel-1";
+			fdt = "fdt-13";
+		};
+		conf-14 {
+			description = "sc7180-trogdor-lazor-limozeen-r4";
+			kernel = "kernel-1";
+			fdt = "fdt-14";
+		};
+		conf-15 {
+			description = "sc7180-trogdor-lazor-limozeen-r9";
+			kernel = "kernel-1";
+			fdt = "fdt-15";
+		};
+		conf-16 {
+			description = "sc7180-trogdor-lazor-r1-kb";
+			kernel = "kernel-1";
+			fdt = "fdt-16";
+		};
+		conf-17 {
+			description = "sc7180-trogdor-lazor-r1-lte";
+			kernel = "kernel-1";
+			fdt = "fdt-17";
+		};
+		conf-18 {
+			description = "sc7180-trogdor-lazor-r1";
+			kernel = "kernel-1";
+			fdt = "fdt-18";
+		};
+		conf-19 {
+			description = "sc7180-trogdor-lazor-r10-kb";
+			kernel = "kernel-1";
+			fdt = "fdt-19";
+		};
+		conf-20 {
+			description = "sc7180-trogdor-lazor-r10-lte";
+			kernel = "kernel-1";
+			fdt = "fdt-20";
+		};
+		conf-21 {
+			description = "sc7180-trogdor-lazor-r10";
+			kernel = "kernel-1";
+			fdt = "fdt-21";
+		};
+		conf-22 {
+			description = "sc7180-trogdor-lazor-r3-kb";
+			kernel = "kernel-1";
+			fdt = "fdt-22";
+		};
+		conf-23 {
+			description = "sc7180-trogdor-lazor-r3-lte";
+			kernel = "kernel-1";
+			fdt = "fdt-23";
+		};
+		conf-24 {
+			description = "sc7180-trogdor-lazor-r3";
+			kernel = "kernel-1";
+			fdt = "fdt-24";
+		};
+		conf-25 {
+			description = "sc7180-trogdor-lazor-r9-kb";
+			kernel = "kernel-1";
+			fdt = "fdt-25";
+		};
+		conf-26 {
+			description = "sc7180-trogdor-lazor-r9-lte";
+			kernel = "kernel-1";
+			fdt = "fdt-26";
+		};
+		conf-27 {
+			description = "sc7180-trogdor-lazor-r9";
+			kernel = "kernel-1";
+			fdt = "fdt-27";
+		};
+		conf-28 {
+			description = "sc7180-trogdor-pazquel-lte-parade";
+			kernel = "kernel-1";
+			fdt = "fdt-28";
+		};
+		conf-29 {
+			description = "sc7180-trogdor-pazquel-lte-ti";
+			kernel = "kernel-1";
+			fdt = "fdt-29";
+		};
+		conf-30 {
+			description = "sc7180-trogdor-pazquel-parade";
+			kernel = "kernel-1";
+			fdt = "fdt-30";
+		};
+		conf-31 {
+			description = "sc7180-trogdor-pazquel-ti";
+			kernel = "kernel-1";
+			fdt = "fdt-31";
+		};
+		conf-32 {
+			description = "sc7180-trogdor-pazquel360-lte";
+			kernel = "kernel-1";
+			fdt = "fdt-32";
+		};
+		conf-33 {
+			description = "sc7180-trogdor-pazquel360-wifi";
+			kernel = "kernel-1";
+			fdt = "fdt-33";
+		};
+		conf-34 {
+			description = "sc7180-trogdor-pompom-r1-lte";
+			kernel = "kernel-1";
+			fdt = "fdt-34";
+		};
+		conf-35 {
+			description = "sc7180-trogdor-pompom-r1";
+			kernel = "kernel-1";
+			fdt = "fdt-35";
+		};
+		conf-36 {
+			description = "sc7180-trogdor-pompom-r2-lte";
+			kernel = "kernel-1";
+			fdt = "fdt-36";
+		};
+		conf-37 {
+			description = "sc7180-trogdor-pompom-r2";
+			kernel = "kernel-1";
+			fdt = "fdt-37";
+		};
+		conf-38 {
+			description = "sc7180-trogdor-pompom-r3-lte";
+			kernel = "kernel-1";
+			fdt = "fdt-38";
+		};
+		conf-39 {
+			description = "sc7180-trogdor-pompom-r3";
+			kernel = "kernel-1";
+			fdt = "fdt-39";
+		};
+		conf-40 {
+			description = "sc7180-trogdor-quackingstick-r0-lte";
+			kernel = "kernel-1";
+			fdt = "fdt-40";
+		};
+		conf-41 {
+			description = "sc7180-trogdor-quackingstick-r0";
+			kernel = "kernel-1";
+			fdt = "fdt-41";
+		};
+		conf-42 {
+			description = "sc7180-trogdor-r1-lte";
+			kernel = "kernel-1";
+			fdt = "fdt-42";
+		};
+		conf-43 {
+			description = "sc7180-trogdor-r1";
+			kernel = "kernel-1";
+			fdt = "fdt-43";
+		};
+		conf-44 {
+			description = "sc7180-trogdor-wormdingler-rev1-boe-rt5682s";
+			kernel = "kernel-1";
+			fdt = "fdt-44";
+		};
+		conf-45 {
+			description = "sc7180-trogdor-wormdingler-rev1-boe";
+			kernel = "kernel-1";
+			fdt = "fdt-45";
+		};
+		conf-46 {
+			description = "sc7180-trogdor-wormdingler-rev1-inx-rt5682s";
+			kernel = "kernel-1";
+			fdt = "fdt-46";
+		};
+		conf-47 {
+			description = "sc7180-trogdor-wormdingler-rev1-inx";
+			kernel = "kernel-1";
+			fdt = "fdt-47";
+		};
+	};
+};
Signature · 1 line
2.56.0.212.g129ede20d9-goog
Acked-by on v1 7/7
#19 lore raw

Re: [RFC PATCH 7/7] arm64: dts: qcom: sc7180: Add sc7180-trogdor.its FIT image script

Quoted 22 lines · Douglas Anderson

Add an Image Tree Source (sc7180-trogdor.its) describing the FIT image for SC7180 Trogdor family boards using Image-framed.lz4 and LZ4-compressed board DTBs (*.dtb.lz4), allowing the Trogdor FIT image to be built with:

make FIT_ITS=qcom/sc7180-trogdor.its image.fit

Assisted-by Gemini:gemini-pro-prerelease

---
As mentioned in the cover letter, there is no desperate need to land this. The FIT image created here is pretty much the same as what the downstream build scripts for ChromeOS programmatically produce. Switching over to this would have a few benefits:
* It makes it easy to use fdtfactor on the trogdor kernel image.
* It would set the path for future Chromebooks, and on those Chromebooks maybe we could use the "description" of the configurations to help the bootloader so we didn't need the awkward piles of "compatible" strings that we have.
* It could potentially be useful to people in the community putting upstream kernels on sc7180-trogdor devices.

Quoted 6 lines

This all being said, there's nothing terribly critical here, so if it's controversial or people hate it then it's fine not to land it.

  arch/arm64/boot/dts/qcom/sc7180-trogdor.its | 728 ++++++++++++++++++++
  1 file changed, 728 insertions(+)

create mode 100644 arch/arm64/boot/dts/qcom/sc7180-trogdor.its

I would consider in this case to put it to any folder. There are a lot of dts/dtsi/dtso files in qcom folder. That having subfolder would be IMHO better structure.

Thanks,
Michal

Acked-by on v1 7/7
#20 lore raw

Re: [RFC PATCH 7/7] arm64: dts: qcom: sc7180: Add sc7180-trogdor.its FIT image script

In reply to Douglas Anderson
Quoted 10 lines · Douglas Anderson

Add an Image Tree Source (sc7180-trogdor.its) describing the FIT image for SC7180 Trogdor family boards using Image-framed.lz4 and LZ4-compressed board DTBs (*.dtb.lz4), allowing the Trogdor FIT image to be built with:

make FIT_ITS=qcom/sc7180-trogdor.its image.fit

Assisted-by Gemini:gemini-pro-prerelease

---

Konrad

maintainer
#21 lore raw

Re: [RFC PATCH 7/7] arm64: dts: qcom: sc7180: Add sc7180-trogdor.its FIT image script

In reply to Douglas Anderson

Hi Doug,

Quoted 6 lines · Douglas Anderson

arm64: dts: qcom: sc7180: Add sc7180-trogdor.its FIT image script

Add an Image Tree Source (sc7180-trogdor.its) describing the FIT image for SC7180 Trogdor family boards using Image-framed.lz4 and LZ4-compressed board DTBs (*.dtb.lz4), allowing the Trogdor FIT image to be built with:

This says what the file is but not why it is wanted. Please can you move a short version of your notes below the --- into the commit message (matching what the ChromeOS scripts produce, a model for future Chromebooks, helping people who run upstream kernels on trogdor)?

Quoted 11 lines

make FIT_ITS=qcom/sc7180-trogdor.its image.fit

Assisted-by Gemini:gemini-pro-prerelease
 arch/arm64/boot/dts/qcom/sc7180-trogdor.its | 728 ++++++++++++++++++++++++++++
 1 file changed, 728 insertions(+)

arch/arm64/boot/dts/qcom/sc7180-trogdor.its line 6

Quoted 6 lines
arch/arm64/boot/dts/qcom/sc7180-trogdor.its +6 -0
@@ -0,0 +1,728 @@
+	configurations {
+		conf-1 {
+			description = "sc7180-trogdor-coachz-r1-lte";
+			kernel = "kernel-1";
+			fdt = "fdt-1";
+		};

One thing I'd like to check. Patch 4 says the main reason for a checked-in .its is to have a hand-written description per configuration, but here each description is just the DTB filename, the compatible is filled in automatically, and patch 5 adds fdtfactor to cmd_fit too. So as far as I can tell, the only thing this file gives over 'make FIT_COMPRESSION=lz4 image.fit' is limiting the FIT to the trogdor DTBs. In exchange there are 47 entries which must be updated by hand whenever a trogdor board is added to or removed from qcom/Makefile, and nothing checks this. The list matches the Makefile today, but the two are likely to drift apart. Would a way to filter the dtbs-list passed to make_fit.py (e.g. by a pattern such as sc7180-trogdor-*) get you the same result without the duplication? What do you think?

Regards,
Simon

maintainer
#22 lore raw
In reply to Douglas Anderson

Hi Doug!

Quoted 3 lines · Douglas Anderson

1. It uses a checked-in .its script to associate metadata with each board's devicetree. Other tools can parse this metadata in order to craft a package that the Pixel bootloader can understand.

One thing I'd like to check before this goes further. In lga.its the metadata is a string packed into the configuration description (board_id=...,board_rev=...,soc_id=...,soc_rev=...). The FIT spec treats 'description' as human-readable text, so this turns a free-form, undocumented string into an ABI that bootloaders and packaging tools must parse. I'd much prefer proper properties in the configuration node, defined in the FIT spec [1], so that every tool can rely on the same names and types. I'm happy to help get that into the spec. What do you think?

Quoted 1 line

How does this series help us?

The FIT_ITS path is a second way to build image.fit alongside make_fit.py, and much of it repeats what make_fit.py already does: it puts the root compatible from each DTB into the configuration and compresses the DTBs. The series adds fdtget/fdtput, sed parsing of /incbin/ paths and a shell loop in Makefile.lib to do the same for a hand-written .its file, and the .its files repeat the DTB lists from the Makefiles. Have you thought about extending make_fit.py to take the per-board metadata (e.g. from a small file next to the DTs, or via FIT_EXTRA_ARGS) and to run fdtfactor itself? That would avoid the in-tree fdtget/fdtput, the mkimage dependency and most of the Makefile logic, and trogdor would come almost for free.

The new FIT_ITS, FIT_FACTOR_DTBS and FDTFACTOR_ARGS variables aren't documented anywhere, including the image.fit entry in the arm64 'make help' output. Please can you add something, perhaps alongside wherever FIT_DECOMPOSE_DTBS ends up being described.

[1] https://github.com/open-source-firmware/flat-image-tree

Regards,
Simon

#23 lore raw

Hi Simon,

Quoted 5 lines · Simon Glass
Quoted 4 lines

1. It uses a checked-in .its script to associate metadata with each board's devicetree. Other tools can parse this metadata in order to craft a package that the Pixel bootloader can understand.

Quoted 9 lines

One thing I'd like to check before this goes further. In lga.its the metadata is a string packed into the configuration description (board_id=...,board_rev=...,soc_id=...,soc_rev=...). The FIT spec treats 'description' as human-readable text, so this turns a free-form, undocumented string into an ABI that bootloaders and packaging tools must parse. I'd much prefer proper properties in the configuration node, defined in the FIT spec [1], so that every tool can rely on the same names and types. I'm happy to help get that into the spec. What do you think?

Putting the metadata in the configuration's description property came out of discussions with Michal Simek at LPC 2026 (where Xilinx/AMD already uses configuration descriptions for similar board matching).

You can actually find one of Michal's files here in U-Boot:
* arch/arm/dts/zynqmp-binman-som.dts

Then parsing happens in:
* board/xilinx/common/board.c

I honestly still think this information would be better to live directly in a board's devicetree itself and then extracted to put in the FIT, but I've decided that fight is lost. Honestly, the allure of using description for me was that, since it as free-form / non-standardized, my hope was that nobody would really care what I put there.

If you want to help get something more structured into the spec then I'd be happy to use that instead. It's my opinion, though, that the metadata that we need will be different depending on the loader. For instance, on Pixel phones the loader has this information to help pick devicetrees:
* board ID (number)
* board rev (number)
* SoC ID (number)
* SoC rev (number)

On trogdor Chromebooks, the bootloader instead had this information to help pick a device tree:
* Board name (string)
* Board revision (numbrer)
* SKU ID (number, though actually made up of a number of bitfields)

Michal's loader obviously has a whole different set of information that it uses to figure out which configuration to pick.

The proposal I've tried to push a few times is that it's OK that different loaders have different types of information available to them, but people don't like that. They want a universal standard, which nobody can come up with. Thus we end up with no solution and everyone does something different / downstream...

In any case, assuming we keep this as 'description', I'll document the exact format in v2.

Quoted 10 lines
Quoted 1 line

How does this series help us?

The FIT_ITS path is a second way to build image.fit alongside make_fit.py, and much of it repeats what make_fit.py already does: it puts the root compatible from each DTB into the configuration and compresses the DTBs. The series adds fdtget/fdtput, sed parsing of /incbin/ paths and a shell loop in Makefile.lib to do the same for a hand-written .its file, and the .its files repeat the DTB lists from the Makefiles.

Quoted 5 lines

Have you thought about extending make_fit.py to take the per-board metadata (e.g. from a small file next to the DTs, or via FIT_EXTRA_ARGS) and to run fdtfactor itself? That would avoid the in-tree fdtget/fdtput, the mkimage dependency and most of the Makefile logic, and trogdor would come almost for free.

I certainly can do that if that's what people want. ...and, yes, I think it would simplify some stuff in this patch series. The question is: what does it look like? Is it a file that is a list of devicetrees along with descriptions? The list of devicetrees would be to limit which devicetrees are built into the FIT and then each would have a description. ...and yes, that would mean it would need to be updated in parallel with the Makefile, but I don't see a significantly better way to do it. Yeah, I guess that could work OK.

If so, I think a bunch of the patches in this series will be dropped or look very different. I probably won't directly reply to your comments on patch 2, 4, 6, and 7 if we go this way.

Should I give it a shot for v2?

Quoted 4 lines

The new FIT_ITS, FIT_FACTOR_DTBS and FDTFACTOR_ARGS variables aren't documented anywhere, including the image.fit entry in the arm64 'make help' output. Please can you add something, perhaps alongside wherever FIT_DECOMPOSE_DTBS ends up being described.

Sure, I will make sure that any newly-introduced variables are documented in v2.

#24 lore raw

Hi,

Quoted 25 lines · Doug Anderson
Quoted 9 lines

The FIT_ITS path is a second way to build image.fit alongside make_fit.py, and much of it repeats what make_fit.py already does: it puts the root compatible from each DTB into the configuration and compresses the DTBs. The series adds fdtget/fdtput, sed parsing of /incbin/ paths and a shell loop in Makefile.lib to do the same for a hand-written .its file, and the .its files repeat the DTB lists from the Makefiles.

Quoted 5 lines

Have you thought about extending make_fit.py to take the per-board metadata (e.g. from a small file next to the DTs, or via FIT_EXTRA_ARGS) and to run fdtfactor itself? That would avoid the in-tree fdtget/fdtput, the mkimage dependency and most of the Makefile logic, and trogdor would come almost for free.

I certainly can do that if that's what people want. ...and, yes, I think it would simplify some stuff in this patch series. The question is: what does it look like? Is it a file that is a list of devicetrees along with descriptions? The list of devicetrees would be to limit which devicetrees are built into the FIT and then each would have a description. ...and yes, that would mean it would need to be updated in parallel with the Makefile, but I don't see a significantly better way to do it. Yeah, I guess that could work OK.

Quoted 5 lines

If so, I think a bunch of the patches in this series will be dropped or look very different. I probably won't directly reply to your comments on patch 2, 4, 6, and 7 if we go this way.

Should I give it a shot for v2?

FWIW, I did a quick prototype of this, and it is definitely a much smaller / less invasive patch series. I've got "sc7180-trogdor.fitconfig" and "lga.fitconfig" files. Because they are easy to parse in python, they're in ".ini" format in my prototype. So "lga.fitconfig" looks like this:

+# SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
+#
+# Each configuration description encodes board and SoC matching metadata +# for downstream packaging tools in the format:
+# "<Model> (<key>=<value>,...)"
+# where <key> includes board_id, board_rev, soc_id, and soc_rev with +# hexadecimal <value>s (in any key order).
+
+[lga-blazer.dtb]
+description = Blazer (board_id=0x070406,board_rev=0x010000,soc_id=0x0005,soc_rev=0x010000) +
+[lga-frankel.dtb]
+description = Frankel (board_id=0x070306,board_rev=0x010000,soc_id=0x0005,soc_rev=0x010000) +
+[lga-mustang.dtb]
+description = Mustang (board_id=0x070506,board_rev=0x010000,soc_id=0x0005,soc_rev=0x010000)

Happy to post a v2 RFC showing what that looks like if you want...

maintainer
#25 lore raw
In reply to Doug Anderson

Hi Doug,

Quoted 3 lines · Doug Anderson

Putting the metadata in the configuration's description property came out of discussions with Michal Simek at LPC 2026 (where Xilinx/AMD already uses configuration descriptions for similar board matching).

Thanks for the background. The Xilinx case is a bit different, though:
the same project writes the string (the binman .dts) and parses it (board.c), so it can change both sides together. Here the kernel would write the string and the Pixel bootloader and outside packaging tools would parse it. That makes it a cross-project ABI, and I'd rather that ABI were typed properties than an unwritten string format.

Quoted 4 lines

The proposal I've tried to push a few times is that it's OK that different loaders have different types of information available to them, but people don't like that. They want a universal standard, which nobody can come up with.

I agree with you here. We don't need a universal set. I've sent a proposed spec change [1] which lets a configuration node hold one or more match sub-nodes. Each one names its scheme with a vendor-prefixed compatible string and carries the properties that scheme defines, for example:

    conf-1 {
        compatible = "google,lga-...";
        ...
        match-1 {
            compatible = "google,board-id";
            board-id = <...>;
            board-rev = <...>;
            soc-id = <...>;
            soc-rev = <...>;
        };
    };

Trogdor would use its own scheme (board name as a string, rev and SKU as u32), and Michal's loader could do the same. Each loader still gets what it needs, the types are explicit, and nobody has to parse 'description'. Please can you take a look and comment there? If it works for you, you can point to it in v2.

Quoted 1 line

Should I give it a shot for v2?

Yes please. The DTB list already reaches make_fit.py from the Makefile through the @file argument, so the new file only has to say which DTBs to include and what metadata each one gets. We'll need a simple per-platform file next to the .dts files, passed with a new option through FIT_EXTRA_ARGS

Running fdtfactor can then be another make_fit.py option, like --decompose-dtbs

[1] https://github.com/open-source-firmware/flat-image-tree/pull/66

Regards,
Simon

#26 lore raw

Hi,

Quoted 9 lines · Simon Glass

Hi Doug,

Quoted 3 lines · Doug Anderson

Putting the metadata in the configuration's description property came out of discussions with Michal Simek at LPC 2026 (where Xilinx/AMD already uses configuration descriptions for similar board matching).

Quoted 6 lines

Thanks for the background. The Xilinx case is a bit different, though:
the same project writes the string (the binman .dts) and parses it (board.c), so it can change both sides together. Here the kernel would write the string and the Pixel bootloader and outside packaging tools would parse it. That makes it a cross-project ABI, and I'd rather that ABI were typed properties than an unwritten string format.

OK, fair enough.

Quoted 23 lines
Quoted 4 lines

The proposal I've tried to push a few times is that it's OK that different loaders have different types of information available to them, but people don't like that. They want a universal standard, which nobody can come up with.

I agree with you here. We don't need a universal set. I've sent a proposed spec change [1] which lets a configuration node hold one or more match sub-nodes. Each one names its scheme with a vendor-prefixed compatible string and carries the properties that scheme defines, for example:

    conf-1 {
        compatible = "google,lga-...";
        ...
        match-1 {
            compatible = "google,board-id";
            board-id = <...>;
            board-rev = <...>;
            soc-id = <...>;
            soc-rev = <...>;
        };
    };
Quoted 2 lines

Trogdor would use its own scheme (board name as a string, rev and SKU as u32),

Sure. For now I might just leave the "match-" out for Trogdor and simply have the config file simply be a list of DTBs. Trogdor currently boots OK with the "compatible" strings. Maybe Chen-Yu will want to propose something for a newer Chromebook where he can take full advantage of it. :-)

Quoted 4 lines

and Michal's loader could do the same. Each loader still gets what it needs, the types are explicit, and nobody has to parse 'description'. Please can you take a look and comment there? If it works for you, you can point to it in v2.

That looks reasonable to me. Do I need to respond directly to the github proposal, or is my response here OK?

Yeah, I can point to it in v2.

Quoted 5 lines
Quoted 1 line

Should I give it a shot for v2?

Yes please. The DTB list already reaches make_fit.py from the Makefile through the @file argument, so the new file only has to say which DTBs to include and what metadata each one gets.

FWIW, I still liked the idea of limiting the DTBs that were actually compiled based on the list of DTBs included in the FIT image. My current v2 draft still has that feature. It adds an argument to make_fit.py where we can give it the "fitconfig" file and it can spit out the list of dtbs. Then the kernel Makefiles use this to limit things. If you don't like that idea, though, it wouldn't be the end of the world to (slightly wastefully) compile a bunch of DTBs that we don't need.

Quoted 3 lines

We'll need a simple
per-platform file next to the .dts files, passed with a new option through FIT_EXTRA_ARGS

At the moment my v2 draft doesn't just use the FIT_EXTRA_ARGS but uses something like this (which will be documented).

FIT_CONFIG=google/lga.fitconfig

Hopefully that looks good.

Quoted 3 lines

Running fdtfactor can then be another make_fit.py option, like --decompose-dtbs

[1] https://github.com/open-source-firmware/flat-image-tree/pull/66

I don't think it buys us anything to have make_fit call fdtfactor directly, does it? The kernel build can just call it. That also makes it easier for people to pass non-standard options into fdtfactor if they want (via FDTFACTOR_ARGS)

-Doug