Skip to content

fit-dtb-compatible: invert key direction and split linux-qcom-only entries#2305

Open
ricardosalveti wants to merge 2 commits into
qualcomm-linux:masterfrom
ricardosalveti:fit-compatible
Open

fit-dtb-compatible: invert key direction and split linux-qcom-only entries#2305
ricardosalveti wants to merge 2 commits into
qualcomm-linux:masterfrom
ricardosalveti:fit-compatible

Conversation

@ricardosalveti
Copy link
Copy Markdown
Contributor

Redesigns FIT_DTB_COMPATIBLE so each encoded compatible string is the flag
key and the DTB+overlay combo is the value, inverting the previous layout
that buried the firmware target in the value field and made duplicate
compatible detection impossible at parse time.

Linux-qcom-only entries (el2, camx, staging, ifp-mezzanine overlays) are
moved into a new fit-dtb-compatible-linux-qcom.inc, loaded via
LINUX_QCOM_FIT_DTB_COMPATIBLE_INC only for linux-qcom* kernel variants,
keeping the base file valid for linux-yocto builds. Selftests are updated
to cover both files.

Assisted-by: GitHub Copilot:claude-opus-4-6

@ricardosalveti
Copy link
Copy Markdown
Contributor Author

@lumag @kraghava-qti @vkraleti as discussed at #2273 (comment), I decided to get copilot to invert the logic as it makes more sense, and it is also aligned with qcom-metadata. I also separated the the list of entries based on the kernel used, so we can easily maintain the two sets separately, making it clear about the origin of the DTS.

This is a major change (the inverted logic), but I believe it is easier to understand and maintain this way.

Opened as draft until it is properly validated with all targets.

@github-actions
Copy link
Copy Markdown

Test run workflow

Test jobs for commit a63ed71

qcom-distro
Pass: 269 | Fail: 2 | Total: 286
nodistro
Pass: 9 | Fail: 0 | Total: 9
qcom-distro_linux-qcom-6.18
Pass: 6 | Fail: 1 | Total: 7

@test-reporting-app
Copy link
Copy Markdown

test-reporting-app Bot commented May 27, 2026

Test Results

  103 files    632 suites   5h 0m 47s ⏱️
  126 tests   126 ✅  0 💤 0 ❌
6 023 runs  5 974 ✅ 49 💤 0 ❌

Results for commit 3d5748b.

♻️ This comment has been updated with latest results.

Comment thread conf/machine/include/fit-dtb-compatible.inc Outdated
Comment thread classes-recipe/dtb-fit-image.bbclass Outdated
@ricardosalveti ricardosalveti marked this pull request as ready for review May 28, 2026 08:46
Comment thread classes-recipe/dtb-fit-image.bbclass Outdated

fdtentries = [f"fdt-{dt}" for dt in dt_list]
lookup_key = "+".join([os.path.splitext(dt)[0].replace(',', '_') for dt in dt_list])
lookup_key = " ".join([os.path.splitext(dt)[0].replace(',', '_') for dt in dt_list])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. Does it mean that it requires exactly one whitespace the value? It would be really inconvenient.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here it is just building a key to index the overlay_compats dict, and it is derived out of a .split, which drops the extra whitespace that could be part of the variable, so this is safe.

@github-actions
Copy link
Copy Markdown

Test run workflow

Test jobs for commit 4d0c068

qcom-distro_linux-qcom-6.18
Pass: 3 | Fail: 4 | Total: 7
qcom-distro
Pass: 7 | Fail: 2 | Total: 9
nodistro
Pass: 6 | Fail: 3 | Total: 9

@Vkenjam
Copy link
Copy Markdown

Vkenjam commented May 29, 2026

bootup failure on Rb8 and RB4 :https://axiom.qualcomm.com/#/reports/job/36984663
[2026-05-29 05:00:48.260] BDS: LogFs sync skipped, Unsupported
[2026-05-29 05:00:48.260] App Log Flush : 0 ms
[2026-05-29 05:00:48.260] RemoteObj_invoke count 1
[2026-05-29 05:00:48.260] RemoteObj_invoke count 1
[2026-05-29 05:00:48.260] Remote object table is not empty. 4
[2026-05-29 05:00:48.260] Local object table is not empty. 2
[2026-05-29 05:00:48.310] ScmArmV8ExitBootServicesHandler, Status = 0x0.
[2026-05-29 05:00:48.310] Gunyah based bootup
[2026-05-29 05:00:48.310] SmcInvokeInit ret 0
[2026-05-29 05:00:48.310] SmcInvokeCompatInit ret 0
[2026-05-29 05:00:48.310] Exit EBS [ 3478] UEFI End

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>
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>
@github-actions
Copy link
Copy Markdown

Test run workflow

Test jobs for commit 3d5748b

qcom-distro_linux-qcom-6.18
Pass: 223 | Fail: 0 | Total: 249
qcom-distro
Pass: 253 | Fail: 1 | Total: 273
nodistro
Pass: 9 | Fail: 0 | Total: 9

@github-actions
Copy link
Copy Markdown

Test run workflow

Test jobs for commit 3d5748b

qcom-distro_linux-qcom-6.18
Pass: 223 | Fail: 0 | Total: 249
qcom-distro
Pass: 271 | Fail: 2 | Total: 296
nodistro
Pass: 9 | Fail: 0 | Total: 9

@github-actions
Copy link
Copy Markdown

Test run workflow

Test jobs for commit 3d5748b

qcom-distro_linux-qcom-6.18
Pass: 223 | Fail: 0 | Total: 249
qcom-distro
Pass: 273 | Fail: 0 | Total: 296
nodistro
Pass: 9 | Fail: 0 | Total: 9

@ricardosalveti
Copy link
Copy Markdown
Contributor Author

Lava and Axiom tests all functional now.

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.

4 participants