Skip to content

[RFC] Add support for matching device-trees base on the /model property#76

Draft
xypron wants to merge 2 commits into
ubuntu:mainfrom
xypron:machdb
Draft

[RFC] Add support for matching device-trees base on the /model property#76
xypron wants to merge 2 commits into
ubuntu:mainfrom
xypron:machdb

Conversation

@xypron

@xypron xypron commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Model-based matching via machdb (pre-installed firmware device-tree needed)

If compatible string matching fails and a .machdb section is present, Stubble
extracts the model property from the firmware-provided device-tree and looks
it up in the machdb database. The machdb maps model strings to device-tree
compatible strings, allowing device-tree selection when the compatible property
doesn't provide a direct match.

The machdb file format is a simple text format:

Model: <model-string-1>
Model: <model-string-2>
Compatible: <compatible-string>

Model: <model-string-3>
Compatible: <another-compatible-string>

Each Model: entry specifies a model string to match (from the firmware
device-tree's /model property). Multiple Model: entries can precede a
single Compatible: entry. The Compatible: value must match the compatible
string of one of the appended device-trees. Whitespace after the labels is
ignored.

Use parameter --machdb for ./ukify.py.

@xypron xypron marked this pull request as draft July 1, 2026 16:02
xypron added 2 commits July 2, 2026 03:45
Extend Stubble to support device-tree selection using the /model
property from firmware-provided device-trees via a new .machdb section.

The machdb section contains Machine:/DTB-Id: mappings that allow
matching device-trees based on the model string when a compatible-based
match is not possible.

Device-tree matching now follows this priority:
1. HWID matching (if no firmware dtb exists)
2. /compatible property matching
3. /model property matching via machdb (if machdb section exists)
4. Use pre-installed device-tree

Changes:
- Add UNIFIED_SECTION_MACHDB enum and .machdb section support
- Add devicetree_get_model() to extract /model property from dtb
- Add pe_machdb() for machdb parsing and model-based matching
- Update pe_use_this_dtb() to call pe_machdb() when appropriate
- Update README.md

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Provide our own copy of ukify to allow adding the --machdb parameter.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
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.

1 participant