* [PATCH v3 0/1] Add support for custom compatible string via optional parameter
@ 2025-09-29 16:12 Kavinaya S
2025-09-29 16:12 ` [PATCH v3 1/1] fitimage: " Kavinaya S
2025-09-29 16:42 ` [OE-core] [PATCH v3 0/1] " Ricardo de Araujo (Salveti)
0 siblings, 2 replies; 7+ messages in thread
From: Kavinaya S @ 2025-09-29 16:12 UTC (permalink / raw)
To: openembedded-core; +Cc: Kavinaya S
This update adds flexibility to FIT image generation by introducing
an optional mechanism to override the DTB compatible string.
Instead of always extracting the value from the DTB, the generator
can now use a custom string defined in build metadata. This is
particularly useful when the FIT configuration requires a different
compatible value than what is embedded in the DTB.
Key changes:
Adds a custom_compatible parameter to fitimage_emit_section_dtb().
Preserves existing behavior when no override is specified.
Usage:
To override the default behavior, define in machine configuration
or local.conf:
FIT_DTB_COMPATIBLE_OVERRIDE:<dtb-filename.dtb> = "custom-compatible-string"
This method avoids using custom ITS files, keeps the build process
consistent, and makes it easy to understand and track changes.
Kavinaya S (1):
fitimage: Add support for custom compatible string via optional
parameter
meta/classes-recipe/kernel-fit-image.bbclass | 3 ++-
meta/conf/image-fitimage.conf | 6 ++++++
meta/lib/oe/fitimage.py | 9 ++++++---
3 files changed, 14 insertions(+), 4 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH v3 1/1] fitimage: Add support for custom compatible string via optional parameter 2025-09-29 16:12 [PATCH v3 0/1] Add support for custom compatible string via optional parameter Kavinaya S @ 2025-09-29 16:12 ` Kavinaya S 2025-09-29 17:00 ` Alexander Kanavin 2025-09-29 16:42 ` [OE-core] [PATCH v3 0/1] " Ricardo de Araujo (Salveti) 1 sibling, 1 reply; 7+ messages in thread From: Kavinaya S @ 2025-09-29 16:12 UTC (permalink / raw) To: openembedded-core; +Cc: Kavinaya S, Alexander Kanavin Currently, fitimage_emit_section_dtb() always reads the 'compatible' property from the DTB when add_compatible=True. This patch adds an optional 'custom_compatible' parameter that, when set, overrides the value from the DTB. If not provided, the existing behavior remains. The compatible property is also skipped for DTBO nodes. Suggested-By: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Kavinaya S <kavinaya@qti.qualcomm.com> --- meta/classes-recipe/kernel-fit-image.bbclass | 3 ++- meta/conf/image-fitimage.conf | 6 ++++++ meta/lib/oe/fitimage.py | 9 ++++++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/meta/classes-recipe/kernel-fit-image.bbclass b/meta/classes-recipe/kernel-fit-image.bbclass index f04aee1807..2a266242d0 100644 --- a/meta/classes-recipe/kernel-fit-image.bbclass +++ b/meta/classes-recipe/kernel-fit-image.bbclass @@ -84,8 +84,9 @@ python do_compile() { # Copy the dtb or dtbo file into the FIT image assembly directory shutil.copyfile(os.path.join(kernel_deploydir, dtb_name), dtb_name) + custom_compatible_str = d.getVar(f"FIT_DTB_COMPATIBLE_OVERRIDE:{dtb_name}") or None root_node.fitimage_emit_section_dtb(dtb_name, dtb_name, - d.getVar("UBOOT_DTB_LOADADDRESS"), d.getVar("UBOOT_DTBO_LOADADDRESS")) + d.getVar("UBOOT_DTB_LOADADDRESS"), d.getVar("UBOOT_DTBO_LOADADDRESS"), True, custom_compatible=custom_compatible_str) if external_kernel_devicetree: # iterate over all .dtb and .dtbo files in the external kernel devicetree directory diff --git a/meta/conf/image-fitimage.conf b/meta/conf/image-fitimage.conf index 090ee148f4..62f7bcde6c 100644 --- a/meta/conf/image-fitimage.conf +++ b/meta/conf/image-fitimage.conf @@ -65,3 +65,9 @@ FIT_ADDRESS_CELLS ?= "1" # Machine configurations needing such a script file should include it in the # SRC_URI of the kernel recipe and set the FIT_UBOOT_ENV parameter. FIT_UBOOT_ENV ?= "" + + +# To override the DTB 'compatible' string in the FIT image, add in your +# machine.conf or local.conf: +# +# FIT_DTB_COMPATIBLE_OVERRIDE:<dtb-filename.dtb> = "custom-compatible-string" diff --git a/meta/lib/oe/fitimage.py b/meta/lib/oe/fitimage.py index f303799155..0d42bca5d7 100644 --- a/meta/lib/oe/fitimage.py +++ b/meta/lib/oe/fitimage.py @@ -289,7 +289,7 @@ class ItsNodeRootKernel(ItsNode): self._kernel = kernel_node def fitimage_emit_section_dtb(self, dtb_id, dtb_path, dtb_loadaddress=None, - dtbo_loadaddress=None, add_compatible=False): + dtbo_loadaddress=None, add_compatible=False, custom_compatible=None): """Emit the fitImage ITS DTB section""" load=None dtb_ext = os.path.splitext(dtb_path)[1] @@ -308,8 +308,11 @@ class ItsNodeRootKernel(ItsNode): # Preserve the DTB's compatible string to be added to the configuration node compatible = None - if add_compatible: - compatible = get_compatible_from_dtb(dtb_path) + if add_compatible and dtb_ext != ".dtbo": + if custom_compatible: + compatible = str(custom_compatible).split() + else: + compatible = get_compatible_from_dtb(dtb_path) dtb_node = self.its_add_node_dtb( "fdt-" + dtb_id, -- 2.34.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v3 1/1] fitimage: Add support for custom compatible string via optional parameter 2025-09-29 16:12 ` [PATCH v3 1/1] fitimage: " Kavinaya S @ 2025-09-29 17:00 ` Alexander Kanavin 2025-09-30 6:11 ` Kavinaya S 0 siblings, 1 reply; 7+ messages in thread From: Alexander Kanavin @ 2025-09-29 17:00 UTC (permalink / raw) To: Kavinaya S; +Cc: openembedded-core On Mon, 29 Sept 2025 at 18:12, Kavinaya S <kavinaya@qti.qualcomm.com> wrote: > > Currently, fitimage_emit_section_dtb() always reads the 'compatible' > property from the DTB when add_compatible=True. This patch adds an > optional 'custom_compatible' parameter that, when set, overrides the > value from the DTB. If not provided, the existing behavior remains. At this point you should explain *why* this is necessary. Present your use case. Explain why the string coming from dtb doesn't work. Don't be afraid to make the commit message very detailed or very long. The more details, the more it helps reviewers or people looking at commit history. I think some of it was previously discussed, and you can reuse that. > The compatible property is also skipped for DTBO nodes. Why? > meta/classes-recipe/kernel-fit-image.bbclass | 3 ++- > meta/conf/image-fitimage.conf | 6 ++++++ > meta/lib/oe/fitimage.py | 9 ++++++--- Tests are missing. You will find existing tests in meta/lib/oeqa/selftest/cases/fitimage.py Look in particular for test_get_compatible_from_dtb(), and see if you can extend or copy and tweak that. > + custom_compatible_str = d.getVar(f"FIT_DTB_COMPATIBLE_OVERRIDE:{dtb_name}") or None I suspect you need to use _ here instad of : (but I don't have time to verify it now). : is used for bitbake overrides, and this is not one of them. > +# To override the DTB 'compatible' string in the FIT image, add in your > +# machine.conf or local.conf: > +# > +# FIT_DTB_COMPATIBLE_OVERRIDE:<dtb-filename.dtb> = "custom-compatible-string" Add: # for example, # <insert an actual working example line> > diff --git a/meta/lib/oe/fitimage.py b/meta/lib/oe/fitimage.py > index f303799155..0d42bca5d7 100644 > --- a/meta/lib/oe/fitimage.py > +++ b/meta/lib/oe/fitimage.py > @@ -289,7 +289,7 @@ class ItsNodeRootKernel(ItsNode): > self._kernel = kernel_node > > def fitimage_emit_section_dtb(self, dtb_id, dtb_path, dtb_loadaddress=None, > - dtbo_loadaddress=None, add_compatible=False): > + dtbo_loadaddress=None, add_compatible=False, custom_compatible=None): > """Emit the fitImage ITS DTB section""" > load=None > dtb_ext = os.path.splitext(dtb_path)[1] > @@ -308,8 +308,11 @@ class ItsNodeRootKernel(ItsNode): > > # Preserve the DTB's compatible string to be added to the configuration node > compatible = None > - if add_compatible: > - compatible = get_compatible_from_dtb(dtb_path) > + if add_compatible and dtb_ext != ".dtbo": > + if custom_compatible: > + compatible = str(custom_compatible).split() > + else: > + compatible = get_compatible_from_dtb(dtb_path) get_compatible_from_dtb() is also used in fitimage_emit_section_dtb_alias(). Does that need to be fixed similarly? Alex ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 1/1] fitimage: Add support for custom compatible string via optional parameter 2025-09-29 17:00 ` Alexander Kanavin @ 2025-09-30 6:11 ` Kavinaya S 0 siblings, 0 replies; 7+ messages in thread From: Kavinaya S @ 2025-09-30 6:11 UTC (permalink / raw) To: openembedded-core Hi Alex, Thanks for the suggestions. I will upload a new patch with the suggestions. Thanks, Kavinaya ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [OE-core] [PATCH v3 0/1] Add support for custom compatible string via optional parameter 2025-09-29 16:12 [PATCH v3 0/1] Add support for custom compatible string via optional parameter Kavinaya S 2025-09-29 16:12 ` [PATCH v3 1/1] fitimage: " Kavinaya S @ 2025-09-29 16:42 ` Ricardo de Araujo (Salveti) 2025-09-29 16:54 ` Kavinaya S 1 sibling, 1 reply; 7+ messages in thread From: Ricardo de Araujo (Salveti) @ 2025-09-29 16:42 UTC (permalink / raw) To: kavinaya; +Cc: openembedded-core On Mon, Sep 29, 2025 at 1:12 PM Kavinaya S via lists.openembedded.org <kavinaya=qti.qualcomm.com@lists.openembedded.org> wrote: > > This update adds flexibility to FIT image generation by introducing > an optional mechanism to override the DTB compatible string. > Instead of always extracting the value from the DTB, the generator > can now use a custom string defined in build metadata. This is > particularly useful when the FIT configuration requires a different > compatible value than what is embedded in the DTB. Please provide an example showing how this will be used in your scenario. Cheers, Ricardo ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 0/1] Add support for custom compatible string via optional parameter 2025-09-29 16:42 ` [OE-core] [PATCH v3 0/1] " Ricardo de Araujo (Salveti) @ 2025-09-29 16:54 ` Kavinaya S 2025-10-05 22:39 ` Dmitry Baryshkov 0 siblings, 1 reply; 7+ messages in thread From: Kavinaya S @ 2025-09-29 16:54 UTC (permalink / raw) To: openembedded-core Hi Ricardo, I’ve implemented this change by adding a custom compatible string for one specific DTB in my machine.conf: FIT_DTB_COMPATIBLE_OVERRIDE:qcs6490-rb3gen2-vision-mezzanine.dtb = "qcom,qcs6490-rb-subtype5" For qcs6490-rb3gen2.dtb, I have not defined any override, so it continues to use the compatible string extracted from the DTB itself. As a result, the ITS configuration section looks like this: configurations { default = "conf-qcs6490-rb3gen2.dtb"; conf-qcs6490-rb3gen2.dtb { description = "1 Linux kernel, FDT blob"; kernel = "kernel-1"; fdt = "fdt-qcs6490-rb3gen2.dtb"; compatible = "qcom,qcs6490-rb3gen2", "qcom,qcm6490"; hash-1 { algo = "sha256"; }; }; conf-qcs6490-rb3gen2-vision-mezzanine.dtb { description = "0 Linux kernel, FDT blob"; kernel = "kernel-1"; fdt = "fdt-qcs6490-rb3gen2-vision-mezzanine.dtb"; compatible = "qcom,qcs6490-rb-subtype5"; hash-1 { algo = "sha256"; }; }; } This demonstrates how the override works: If an override is defined in machine.conf, the FIT generator uses that value. If no override is provided, it falls back to the compatible string from the DTB. Thanks, Kavinaya ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 0/1] Add support for custom compatible string via optional parameter 2025-09-29 16:54 ` Kavinaya S @ 2025-10-05 22:39 ` Dmitry Baryshkov 0 siblings, 0 replies; 7+ messages in thread From: Dmitry Baryshkov @ 2025-10-05 22:39 UTC (permalink / raw) To: Kavinaya S; +Cc: openembedded-core On Mon, Sep 29, 2025 at 09:54:38AM -0700, Kavinaya S wrote: > Hi Ricardo, Don't delete the whole message you are responding to. How do we know what are you talking about? > > I’ve implemented this change by adding a custom compatible string for one specific DTB in my machine.conf: > FIT_DTB_COMPATIBLE_OVERRIDE:qcs6490-rb3gen2-vision-mezzanine.dtb = "qcom,qcs6490-rb-subtype5" -- With best wishes Dmitry ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-10-05 22:39 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-09-29 16:12 [PATCH v3 0/1] Add support for custom compatible string via optional parameter Kavinaya S 2025-09-29 16:12 ` [PATCH v3 1/1] fitimage: " Kavinaya S 2025-09-29 17:00 ` Alexander Kanavin 2025-09-30 6:11 ` Kavinaya S 2025-09-29 16:42 ` [OE-core] [PATCH v3 0/1] " Ricardo de Araujo (Salveti) 2025-09-29 16:54 ` Kavinaya S 2025-10-05 22:39 ` Dmitry Baryshkov
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.