OpenBoot
Draft: this page is not reviewed yet.

Adding a deviceDraft

This guide covers two jobs: writing a descriptor for a board, and sharing a device-tree (ADT) dump so others can check it. Adding a descriptor does not make a board supported. A new descriptor starts as experimental, and a board becomes supported only after the project has verified it on a real machine.

Write a descriptor#

  1. Pick the names. The SoC name is the directory, devices/<soc>/, and the board name is the file, <board>.toml. Both match [a-z0-9]+.
  2. Start from the smallest existing file under devices/, and set [device]: name, soc (the same as the directory), tier = "experimental", and the chip_ids and board_ids that the device tree reports in /chosen.
  3. Leave out [layout], [cpu] and [quirks] unless you have evidence for each value. A [layout] read from the device tree of the machine it describes proves nothing; it is a fallback and must equal what the derivation gives for that board and that RAM configuration (the first supported descriptor holds for 48 GiB only). If you share a chip id with an existing descriptor, [layout] and [cpu] must be identical to it.
  4. Add quirk names only if the board was shown to need the workaround. See Named quirks.

Check it with devgen#

From the repository root:

python3 -I tools/devgen/devgen.py --devices devices --check

Success prints nothing and exits 0. A problem prints one line and exits 1. For example, a tier that is not one of the two allowed values gives:

devgen: devices/t6050/x.toml: [device]: tier must be one of ['experimental', 'supported'] (tier unknown has no descriptor)

To see the generated files, run devgen.py --devices devices --out-dir build. It writes devtable_data.c and quirk_ids.h, and rewrites a file only when its content changed. Every key and rule is in the schema reference.

Get a device-tree dump#

The analysis tooling works on a raw ADT file. Today there is no supported way to read the raw tree from an unknown Mac. The design under consideration is a monitor command that streams the bytes over the debug link to a host, but it does not exist yet. A dump you already hold, from any source you are entitled to use, can be processed with the tools below. Only one real tree, from the generation that has hardware results, has been analysed so far.

Sanitise the dump#

A raw ADT carries per-unit values: serial numbers, MAC addresses, chip-unique identifiers, key slots, a boot nonce and stored variables. Never commit or send a raw dump. tools/adtsan/adtsan.py turns it into a trimmed tree that is meant to be shared.

python3 -I tools/adtsan/adtsan.py sanitize raw.bin mac.bin --manifest mac.manifest.txt
python3 -I tools/adtsan/adtsan.py verify   raw.bin mac.bin
python3 -I tools/adtsan/adtsan.py check    mac.bin
python3 -I tools/adtsan/adtsan.py audit    mac.bin

What is stripped#

The sanitiser is an allowlist, not a denylist. Every node stays. A property stays only if its name is on the allowlist, and every other property is removed, with no attempt to recognise secrets by their shape. The default allowlist keeps these property names on any node:

  • name, compatible, device_type
  • reg, ranges, #address-cells, #size-cells
  • chip-id, board-id, dram-base, dram-size
  • cluster-id, cluster-core-id, cluster-type, max_cpus, cpu-cluster-count, #main-cpus
  • AAPL,phandle, interrupts

It also keeps region-id-* and region-name-id-* under /chosen/carveout-memory-map, and aic-* under /arm-io/aic. Everything else is dropped, including the contents of every node you did not expect to matter. A different list can be given with --allow FILE: one rule per line, either name-glob or path-glob:name-glob.

The --manifest file lists each dropped property as a line of path, name and length, separated by tabs. It holds no values.

Verify before you share#

  • verify raw.bin mac.bin fails if any dropped value of four bytes or more, with at least four distinct byte values, still appears anywhere in the output. Flatter values cannot be told apart from ordinary data. Names listed with --benign FILE are skipped; read that file before you trust it.
  • check mac.bin fails if a property outside the allowlist is present.
  • audit mac.bin prints every kept property with its path and full value in hex. Read all of it. The tools only catch what the input and the allowlist define; nobody can know what is sensitive in a tree they have not looked at.

Only after all four steps, share the sanitised file with the manifest, for example attached to a pull request together with the descriptor.

Run the analyzer on the dump#

The analyzer compares the nodes of a tree with the drivers that exist. See Analysis mode for how to build and read it. Its draft output is a starting point for a descriptor; the draft needs editing, and it is still checked with devgen.py --check.