Devicetree
 help / color / mirror / Atom feed
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 3/5] kbuild: fit: Add opt-in FIT_FACTOR_DTBS support using fdtfactor
Date: Sat, 14 Nov 2026 21:09:52 +0000	[thread overview]
Message-ID: <sashiko-outbox-215034@kernel.org> (raw)
In-Reply-To: <20261113130858.RFC.v2.3.I4a691041bb6d31e5ab2fde8cd4139ca72ee72c5b@changeid>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] kbuild: fit: incomplete __local_fixups__ on composite DTBs
  with FIT_FACTOR_DTBS
--

commit b1fb21de907c618079fb42ef4673839c84598f6a
Author: Douglas Anderson <dianders@chromium.org>

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

This commit adds opt-in support for factoring DTBs inside a compiled FIT
image into shared base DTBs and per-board overlays using fdtfactor when
FIT_FACTOR_DTBS is set.

> diff --git a/scripts/Makefile.dtbs b/scripts/Makefile.dtbs
> index cc14fc905ea3b..bc0c62617a7c2 100644
> --- a/scripts/Makefile.dtbs
> +++ b/scripts/Makefile.dtbs
> @@ -126,6 +126,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
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index e08e35d4ed747..af2d3e5084249 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -418,6 +418,9 @@ quiet_cmd_uimage = UIMAGE  $@
>  # ---------------------------------------------------------------------------
>  
>  MAKE_FIT := $(srctree)/scripts/make_fit.py
> +# External fdtfactor tool from upstream dtc (requires matching pylibfdt)
> +FDTFACTOR ?= fdtfactor
> +FDTFACTOR_ARGS ?= --strip-local-fixups
>  
>  # Use this to override the compression algorithm
>  FIT_COMPRESSION ?= gzip
> @@ -428,7 +431,9 @@ quiet_cmd_fit = FIT     $@
>  		$(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,$^)
> +		--compress $(FIT_COMPRESSION) -k $< @$(word 2,$^) \
> +		$(if $(FIT_FACTOR_DTBS),&& $(FDTFACTOR) $(FDTFACTOR_ARGS) \
> +			$(if $(findstring 1,$(KBUILD_VERBOSE)),-s) -F $@)

[Severity: Medium]
As reported by Simon Glass on RFC [1], can composite DTBs built via
cmd_fdtoverlay reach fdtfactor with incomplete /__local_fixups__ when
FIT_FACTOR_DTBS=1 is used without FIT_DECOMPOSE_DTBS=1?

Although DTC_FLAGS passes -@ -L to dtc for the base .dtb and .dtbo inputs,
fdt_overlay_apply() in the in-tree scripts/dtc/libfdt/fdt_overlay.c merges
__overlay__ and __symbols__ into the target DTB without merging the
overlay's /__local_fixups__.  When FIT_DECOMPOSE_DTBS is not set,
make_fit.py packs those composite .dtb blobs into image.fit, leaving
fdtfactor without local fixup entries for phandle properties originating
from the overlays.

Until in-tree libfdt preserves overlay /__local_fixups__, should
FIT_FACTOR_DTBS imply --decompose-dtbs (or reject composite DTBs when
FIT_DECOMPOSE_DTBS is not enabled)?

[1] https://lore.kernel.org/r/CAFLszTh6vmFGVD4_Reewe9p4QqQjN=CVJ3SgfQKosAhedJpAQA@mail.gmail.com

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261113210918.356261-1-dianders@chromium.org?part=3

  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
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 [this message]
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-215034@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox