From: sashiko-bot@kernel.org
To: "Douglas Anderson" <dianders@chromium.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Konrad Dybcio" <konradybcio@kernel.org>
Cc: "Julius Werner" <jwerner@chromium.org>,
"Michal Simek" <michal.simek@amd.com>,
"André Draszik" <andre.draszik@linaro.org>,
"Simon Glass" <sjg@chromium.org>,
"Peter Griffin" <peter.griffin@linaro.org>,
linux-kbuild@vger.kernel.org,
"Tudor Ambarus" <tudor.ambarus@linaro.org>,
"Chen-Yu Tsai" <wenst@chromium.org>,
"Will Deacon" <will@kernel.org>,
"Nathan Chancellor" <nathan@kernel.org>,
Devicetree@vger.kernel.org,
"Catalin Marinas" <catalin.marinas@arm.com>,
"Nicolas Schier" <nsc@kernel.org>,
"Saravana Kannan" <saravanak@kernel.org>,
"Brian Norris" <briannorris@chromium.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Jonathan Corbet" <corbet@lwn.net>,
"Josh Poimboeuf" <jpoimboe@kernel.org>,
"Lorenzo Stoakes (ARM)" <ljs@kernel.org>,
"Manuel Ebner" <manuelebnerli@mailbox.org>,
"Marco Elver" <elver@google.com>,
"Mark Rutland" <mark.rutland@arm.com>,
"Mauro Carvalho Chehab" <mchehab+huawei@kernel.org>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
"Randy Dunlap" <rdunlap@infradead.org>,
"Rong Xu" <xur@google.com>,
"Shuah Khan" <skhan@linuxfoundation.org>
Subject: Re: [RFC PATCH v2 2/5] kbuild: fit: Support selecting DTBs and config properties from a file
Date: Sat, 14 Nov 2026 21:09:49 +0000 [thread overview]
Message-ID: <sashiko-outbox-215033@kernel.org> (raw)
In-Reply-To: <20261113130858.RFC.v2.2.I5cd8aab4380bc4cfd302c4e4708af58c43370715@changeid>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] kbuild: fit: leading ./ in FIT_CONFIG_DTBS breaks
Makefile.dtbs matching
- [Medium] kbuild: fit: basename lookup in _process_dtbs() breaks O=
subdir DTBs
--
commit 7793aa0a3f31c2e79bf996dd2bb1dcd0d8affc8c
Author: Douglas Anderson <dianders@chromium.org>
kbuild: fit: Support selecting DTBs and config properties from a file
This commit adds support for a FIT_CONFIG make variable pointing to a
.fitconfig file that selects which DTBs to build and include in image.fit
and sets properties or subnodes on /configurations/conf-N nodes.
> diff --git a/scripts/Makefile.dtbs b/scripts/Makefile.dtbs
> index c4e4663902844..cc14fc905ea3b 100644
> --- a/scripts/Makefile.dtbs
> +++ b/scripts/Makefile.dtbs
> @@ -5,6 +5,15 @@ all-dtb := $(dtb-y) $(dtb-)
> # If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
> dtb-$(CONFIG_OF_ALL_DTBS) += $(dtb-)
>
> +# If FIT_CONFIG is specified, restrict $(dtb-y) to only the DTBs listed in
> +# $(FIT_CONFIG_FILE).
> +ifdef FIT_CONFIG_FILE
> +ifneq ($(filter arch/$(SRCARCH)/boot/dts%, $(obj)),)
> +dtb-y := $(filter $(all-dtb), \
> + $(patsubst $(obj)/%, %, $(filter $(obj)/%, $(FIT_CONFIG_DTBS))))
> +endif
> +endif
> +
> # Composite DTB (i.e. DTB constructed by overlay)
> multi-dtb-y := $(call multi-search, $(dtb-y), .dtb, -dtbs)
> # Primitive DTB compiled from *.dts
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 19e96b30a122f..e08e35d4ed747 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -427,8 +427,33 @@ quiet_cmd_fit = FIT $@
> --name '$(UIMAGE_NAME)' $(FIT_EXTRA_ARGS) \
> $(if $(findstring 1,$(KBUILD_VERBOSE)),-v) \
> $(if $(FIT_DECOMPOSE_DTBS),--decompose-dtbs) \
> + $(if $(FIT_CONFIG_FILE),--config $(FIT_CONFIG_FILE)) \
> --compress $(FIT_COMPRESSION) -k $< @$(word 2,$^)
>
> +# If FIT_CONFIG is specified on the command line (either relative to $(srctree)
> +# or relative to arch/$(SRCARCH)/boot/dts/), locate that file and extract the
> +# list of .dtb files to build.
> +ifdef FIT_CONFIG
> +FIT_CONFIG_REL := $(firstword $(patsubst $(abs_srctree)/%,%,\
> + $(patsubst $(srctree)/%,%,$(patsubst ./%,%,$(wildcard \
> + $(FIT_CONFIG) \
> + $(srctree)/$(FIT_CONFIG) \
> + $(srctree)/arch/$(SRCARCH)/boot/dts/$(FIT_CONFIG))))))
> +ifeq ($(FIT_CONFIG_REL),)
> +$(error FIT_CONFIG '$(FIT_CONFIG)' not found)
> +endif
> +FIT_CONFIG_FILE := $(srctree)/$(FIT_CONFIG_REL)
> +ifndef FIT_CONFIG_DTBS
> +export FIT_CONFIG_DTBS := $(addprefix $(dir $(FIT_CONFIG_REL)), \
> + $(shell $(MAKE_FIT) -C $(FIT_CONFIG_FILE) --list-dtbs))
> +$(if $(FIT_CONFIG_DTBS),,$(error Failed to parse DTB list from $(FIT_CONFIG_FILE)))
> +endif
[Severity: Medium]
Does $(dir $(FIT_CONFIG_REL)) prepend a leading ./ to every entry in
FIT_CONFIG_DTBS when FIT_CONFIG points to a file in the root of $(srctree)?
When FIT_CONFIG_REL has no slash (or when FIT_CONFIG is passed with a
leading ./ in an out-of-tree build so $(patsubst ./%,%,...) runs before
$(srctree)/ is stripped), $(dir $(FIT_CONFIG_REL)) evaluates to ./. In
scripts/Makefile.dtbs, $(filter $(obj)/%, $(FIT_CONFIG_DTBS)) compares
against $(obj) without a leading ./, so nothing matches, dtb-y is cleared
across all DTS directories, and no DTBs are built. Stripping ./ from
$(dir $(FIT_CONFIG_REL)) and running $(patsubst ./%,%,...) after stripping
$(srctree)/ and $(abs_srctree)/ would avoid this.
[ ... ]
> diff --git a/scripts/make_fit.py b/scripts/make_fit.py
> index 9bd35aa721191..0c0af80426411 100755
> --- a/scripts/make_fit.py
> +++ b/scripts/make_fit.py
[ ... ]
> @@ -322,9 +397,20 @@ def _process_dtbs(args, fsw, entries, fdts):
>
> # First figure out the unique DTB files that need compression
> todo = []
> - file_info = [] # List of (fname, model, compat, files) tuples
> + file_info = [] # List of (fname, model, compat, files, props) tuples
> +
> + if args.config:
> + config = parse_config(args.config)
> + by_name = {os.path.basename(fn): fn for fn in args.dtbs}
> + config_dir = os.path.dirname(args.config)
> + dtb_configs = [
> + (by_name.get(dtb, os.path.join(config_dir, dtb)), props)
> + for dtb, props in config.items()
> + ]
> + else:
> + dtb_configs = [(fname, {}) for fname in args.dtbs]
[Severity: Medium]
Will by_name.get(dtb, ...) always miss in out-of-tree (O=) builds when a
.fitconfig section header includes a subdirectory path such as
[google/lga-blazer.dtb]?
by_name is keyed by os.path.basename(fn), so any dtb key containing a
slash never matches and falls back to os.path.join(config_dir, dtb).
Because scripts/Makefile.lib sets FIT_CONFIG_FILE in $(srctree),
config_dir points into the source tree rather than $(objtree) where the
compiled .dtb and .dtb.cmd files live, causing process_dtb() to fail with
FileNotFoundError. Looking up os.path.basename(dtb) (or matching the
suffix against args.dtbs) would find the built DTB in $(objtree).
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261113210918.356261-1-dianders@chromium.org?part=2
next prev parent reply other threads:[~2026-11-14 21:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 21:09 [RFC PATCH v2 0/5] arm64: Add FIT configurations for sc7180-trogdor and google,lga Douglas Anderson
2026-11-13 21:09 ` [RFC PATCH v2 1/5] kbuild: fit: Document FIT_COMPRESSION and FIT_DECOMPOSE_DTBS Douglas Anderson
2026-11-13 21:09 ` [RFC PATCH v2 2/5] kbuild: fit: Support selecting DTBs and config properties from a file Douglas Anderson
2026-11-14 21:09 ` sashiko-bot [this message]
2026-11-13 21:09 ` [RFC PATCH v2 3/5] kbuild: fit: Add opt-in FIT_FACTOR_DTBS support using fdtfactor Douglas Anderson
2026-11-14 21:09 ` sashiko-bot
2026-11-13 21:09 ` [RFC PATCH v2 4/5] arm64: dts: google: lga: Add lga.fitconfig FIT configuration file Douglas Anderson
2026-11-13 21:09 ` [RFC PATCH v2 5/5] arm64: dts: qcom: sc7180: Add sc7180-trogdor.fitconfig FIT config file Douglas Anderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-215033@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Devicetree@vger.kernel.org \
--cc=aliceryhl@google.com \
--cc=andre.draszik@linaro.org \
--cc=briannorris@chromium.org \
--cc=catalin.marinas@arm.com \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=dianders@chromium.org \
--cc=elver@google.com \
--cc=jpoimboe@kernel.org \
--cc=jwerner@chromium.org \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=ljs@kernel.org \
--cc=manuelebnerli@mailbox.org \
--cc=mark.rutland@arm.com \
--cc=mchehab+huawei@kernel.org \
--cc=michal.simek@amd.com \
--cc=nathan@kernel.org \
--cc=nsc@kernel.org \
--cc=peter.griffin@linaro.org \
--cc=peterz@infradead.org \
--cc=rdunlap@infradead.org \
--cc=robh@kernel.org \
--cc=saravanak@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sjg@chromium.org \
--cc=skhan@linuxfoundation.org \
--cc=tudor.ambarus@linaro.org \
--cc=wenst@chromium.org \
--cc=will@kernel.org \
--cc=xur@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.