ContributingDraft
Contributions are welcome: code, drivers, device descriptors, tests and
documentation. This page states the rules a change has to follow. The
files CONTRIBUTING.md and RULES.md in the repository root hold the
same rules and are authoritative.
Contributions written with AI coding tools are welcome under the same rules; read AI-assisted contributions first.
Sign-off: DCO, no CLA#
Every commit carries a Signed-off-by: line, added with git commit -s.
The line certifies the Developer Certificate of Origin 1.1, whose text is
in CONTRIBUTING.md. In short, you certify that you wrote the change or
have the right to submit it under the licence of the files you touch, and
you accept that the contribution and your sign-off are public.
There is no contributor licence agreement. Copyright stays with each contributor. Your work is released under the licence of the files you touch, which is GPL-2.0-or-later unless the file states otherwise. See Legal and licences.
Content rules#
- Everything in the tree must be reproducible from the repository and public sources. No private data: no home-directory paths, host names, local network addresses, account names, personal e-mail addresses, tokens, keys or certificates.
- No vendor firmware, vendor binaries or proprietary tables. Hardware behaviour is documented from observation of devices you own, and the documentation says how it was observed. See Hardware facts policy.
- No private workspace of a tool: session logs, plans, scratch and
hand-off notes and tool settings with local paths stay out of the tree.
The shared instruction files
AGENTS.mdandCLAUDE.mdare project files. Commits carry no attribution trailers for a tool (noCo-Authored-By:for a tool, no "Generated with" line). Write each document and message as the author who stands behind it. - No large generated or binary artefacts: more than 2 MB, or
.efi,.o,.whlfiles and disk images, do not belong in the tree.
Licensing of new files#
Every source file (C, headers, assembly, Rust, Python, shell, linker
scripts, makefiles) starts with an SPDX header with the licence identifier
and the copyright line. Files derived from other projects keep their
original tag and copyright lines; never re-stamp a file you did not write.
New third-party code needs a compatible licence, an entry in NOTICE and
its licence text in LICENSES/.
Tests#
- Pure logic (parsers, encoders, checkers, transforms) comes with host tests, written before or together with the implementation.
- Code that drives hardware is validated on the hardware first. Record in the pull request what was run, on which machine, and the result. Host tests written afterwards from the captured behaviour do not by themselves prove the hardware behaviour.
- Run the test targets of the directory you changed before opening a pull
request. Build and host tests lists the commands and
the Python packages they need;
make -C tests/dbg_host testruns without trackpad firmware.
Community#
Ask questions and discuss work on Discord. Firmware, keys and other vendor files must not be shared there or in issues and pull requests.
Pull requests#
- Keep them focused, with one logical change per commit. The subject line states what changes, in the imperative.
- Describe what changed, how you tested it and on which hardware.
- Say in the description when AI assistance was significant. The sign-off is made by a person who has read and tested the change.
- Continuous integration enforces the mechanical rules above.
Adding a device#
A machine is added through a descriptor file, devices/<soc>/<board>.toml.
The file is flat TOML: tables of
scalars and arrays of scalars, with no expressions, includes or branches.
The generator tools/devgen/devgen.py validates every descriptor and
generates the table that is compiled into the image; there is no TOML
parser at run time. Unknown tables and keys are errors.
A descriptor has these tables:
| Table | Required | Purpose |
|---|---|---|
[device] |
yes | name, SoC directory name, tier, the chip IDs and board IDs read from the device tree |
[layout] |
no, all five keys or none | known-good early memory layout, used only when the layout cannot be derived from the live device tree |
[cpu] |
no | CPU start-mask stride and the power-state register addresses of the clusters |
[quirks] |
no | names of workarounds the board needs, each a row of devices/quirks.toml |
The pair of chip ID and board ID identifies a machine and must not be
claimed by two descriptors. Descriptors that share a chip ID must carry
identical [layout] and [cpu] data, because those tables are looked up
by chip ID alone.
To add a machine:
-
Copy an existing descriptor to a new
devices/<soc>/<board>.toml. Directory and file names are lowercase letters and digits. -
Set the tier to
experimental. A descriptor becomessupportedonly after the code has run on that hardware and the results are recorded. -
Fill in the chip ID and board ID of the machine, then only the optional tables you can justify from observation.
-
Validate it:
python3 -I tools/devgen/devgen.py --devices devices --check python3 -I -m unittest discover -s tools/devgen/tests -q -
Run the host tests of the directory
tests/dbg_host, which include the descriptor and layout tests (see Build and host tests).
An analysis mode exists as a host tool. It reads a device tree dump and
reports which of the machine's blocks already have a driver; it never reads
a register and does not prove that a block works. The firmware entry for
analysis mode is not built yet, and there is no automatic way to obtain a
device tree dump from an unknown machine. A raw dump holds serial numbers
and other unique identifiers: sanitise it with tools/adtsan and read
the result before you share it.
Supporting a new SoC also needs drivers and code, not only a descriptor. A descriptor alone makes the code recognise the machine; it does not make unsupported hardware work.