selftests: add matrix validation for dtb and detect duplicated compatibles #2273
Conversation
FIT_DTB_COMPATIBLE[sa8775p-ride-camx] and FIT_DTB_COMPATIBLE[sa8775p-ride-camx+lemans-staging] produced the same compatible strings (qcom,sa8775p-qam-camx and qcom,sa8775p-qam-camx-staging) as the existing composite-key entries: FIT_DTB_COMPATIBLE[sa8775p-ride+sa8775p-ride-camx] FIT_DTB_COMPATIBLE[sa8775p-ride+sa8775p-ride-camx+lemans-staging] Duplicate compatible strings cause UEFI firmware to stop at the first ITS match, potentially selecting the wrong DTB configuration at boot. Remove the two redundant standalone entries, which are also incorrect as sa8775p-ride-camx is just the overlay. Signed-off-by: Ricardo Salveti <ricardo.salveti@oss.qualcomm.com>
…roviders Add QcomFitImageMatrixTests class with two test methods to validate DTB coverage without full image builds: - test_machine_dtb_entries_exist_for_kernel_providers: validates all machine/kernel DTB combinations have corresponding sources via lightweight bitbake -c unpack and kernel source tree parsing. Detects available qcom kernel providers (linux-qcom, linux-qcom-next) and cross-validates against kernel KERNEL_DEVICETREE and LINUX_QCOM_KERNEL_DEVICETREE metadata. - test_fit_dtb_compatible_keys_exist_in_kernel_sources: validates all FIT_DTB_COMPATIBLE keys in conf/machine/include/fit-dtb-compatible.inc map to real DTB/DTBO files in kernel sources. Supports both single-part keys (either .dtb or .dtbo) and composite keys with base DTB + overlay DTBOs. Implementation includes: - Require LAYERDIR_qcom from bitbake metadata (hard-fail if undefined) - Assume linux-yocto is always present via oe-core dependency - Restrict DTS scanning to architecture DT roots: arch/arm64/boot/dts and arch/arm/boot/dts - Recursively scan only those DT roots (not the full kernel source tree) - Cache provider output files and availability across test runs - Handle machine incompatibilities with linux-yocto gracefully (skip checks for incompatible machines, validate via qcom kernels only) - Support DT file naming variants (commas vs underscores) via _name_variants() Signed-off-by: Ricardo Salveti <ricardo.salveti@oss.qualcomm.com>
Add two tests to QcomFitImageMatrixTests that catch mistakes like those fixed in PR qualcomm-linux#2236, where identical compatible strings were assigned to multiple FIT_DTB_COMPATIBLE keys: - test_fit_dtb_compatible_no_duplicate_keys: fails if the same bracketed key appears more than once in fit-dtb-compatible.inc (bitbake silently overwrites the first assignment, losing compatible strings). - test_fit_dtb_compatible_no_duplicate_values: fails if the same compatible string is listed under more than one key (UEFI firmware stops at the first ITS match, so duplicates can select the wrong DTB). A helper _fit_compatible_map() is added to parse the file into a {key: [compat_str, ...]} dict, handling both single-line and backslash-continued multi-line value syntax. Signed-off-by: Ricardo Salveti <ricardo.salveti@oss.qualcomm.com>
|
I think instead we need to invert the logic. The |
But you still need to have validate that the DTBs are indeed valid, as you still need to include the dtb / dtbos in the end. This PR is not done to change the behavior, this was just to catch possible issues with the current file, we can for sure change it, but it would be out of the scope from this PR I would say. |
koenkooi
left a comment
There was a problem hiding this comment.
LGTM, the more checks for things like this, the better
8917dc1
into
qualcomm-linux:master
Add QcomFitImageMatrixTests class with two test methods to validate DTB coverage without full image builds and two tests to QcomFitImageMatrixTests that catch mistakes like those fixed in PR #2236.