Skip to content

[Backport wrynose] fit-dtb-compatible: invert key direction and split linux-qcom-only entries#2328

Merged
lumag merged 2 commits into
qualcomm-linux:wrynosefrom
vkraleti:wrynose-backport-2305
May 31, 2026
Merged

[Backport wrynose] fit-dtb-compatible: invert key direction and split linux-qcom-only entries#2328
lumag merged 2 commits into
qualcomm-linux:wrynosefrom
vkraleti:wrynose-backport-2305

Conversation

@vkraleti
Copy link
Copy Markdown
Contributor

Backport of #2305 to wrynose.

@vkraleti
Copy link
Copy Markdown
Contributor Author

Depends on #2327

lumag
lumag previously approved these changes May 30, 2026
Previously FIT_DTB_COMPATIBLE used the DTB+overlay combo as the flag key
and the compatible string as the value, so a single key could carry
multiple space-separated compat strings.  This required custom split/join
logic in the bbclass and made it hard to read the mapping (the intended
firmware target was buried in the value field).

Invert the direction: each encoded compatible string (commas replaced
with underscores per BitBake flag-name rules) is now the flag key, and
the DTB+overlay combo string is the value.  Multiple compatible strings
that share the same combo each get their own entry pointing to the same
value.  An accidentally repeated compatible string then collides as a
duplicate flag key; BitBake silently keeps only the last assignment, so
the test_fit_dtb_compatible_no_duplicate_keys selftest scans the include
file and fails when any key is defined more than once.

All entries (base-kernel and linux-qcom-specific) remain in a single
fit-dtb-compatible.inc for now.  Combos that reference linux-qcom-only
overlays (el2, camx, staging, ifp-mezzanine) are silently skipped by
the bbclass for kernel variants whose KERNEL_DEVICETREE does not include
those overlay files, so the single file works correctly across all
kernel variants.

Overlay combos use space-separated stems (e.g. "base overlay1 overlay2")
rather than the previous plus-sign notation, which allows long combos to
be split across multiple lines.

Update the bbclass parser to iterate over keys, decode underscores back
to commas, deduplicate overlay-group entries via a seen_combos set, and
accumulate space-separated compat strings for configs that share one
combo.  Update all unit tests and matrix tests in qcom_fitimage.py to
use the new dict shape, replacing test_fit_dtb_compatible_keys_exist_in_kernel_sources
and test_fit_dtb_compatible_no_duplicate_values with
test_fit_dtb_compatible_combos_exist_in_kernel_sources and
test_fit_dtb_compatible_compat_key_format that match the new format.

Signed-off-by: Ricardo Salveti <ricardo.salveti@oss.qualcomm.com>
(cherry picked from commit 330717e)
linux-qcom tracks a newer kernel than linux-yocto and can carry device
trees -- both .dtb and .dtbo -- that linux-yocto does not have yet (today
these are the el2, camx, staging and ifp-mezzanine overlays and the combos
built on them).  Carrying every entry in a single fit-dtb-compatible.inc
couples those faster-moving linux-qcom additions to linux-yocto and makes
the boundary hard to see.

Split the linux-qcom-only entries into a new
fit-dtb-compatible-linux-qcom.inc and introduce LINUX_QCOM_FIT_DTB_COMPATIBLE
in dtb-fit-image.bbclass to select which include to load.  The variable
defaults to fit-dtb-compatible.inc; linux-qcom* kernel recipes set it to
fit-dtb-compatible-linux-qcom.inc, which opens with a require of the base
file so it is self-contained.  Because BitBake uses last-write-wins for flag
variables, the qcom file is loaded after the base file, so its entries
naturally override any shared key.  This lets linux-qcom add device trees
without waiting for linux-yocto, while a linux-yocto-only build stays
functional from the base file alone; entries migrate back to the base file
as linux-yocto gains the same device trees.

Update the matrix selftest to check both files: base entries against the
union of all kernel sources, linux-qcom entries against qcom-only sources
(since linux-yocto does not ship those newer device tree sources yet).

Signed-off-by: Ricardo Salveti <ricardo.salveti@oss.qualcomm.com>
(cherry picked from commit 3d5748b)
@vkraleti vkraleti force-pushed the wrynose-backport-2305 branch from b68ddb5 to 6875243 Compare May 30, 2026 16:12
@vkraleti vkraleti marked this pull request as ready for review May 30, 2026 16:13
@lumag lumag merged commit bd7d382 into qualcomm-linux:wrynose May 31, 2026
253 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants