Repository navigation
feat(dts): generate device trees at build time with nemu_board - #71
Merged
Merged
Conversation
Generate the firmware device tree from nemu_board's DTS generator instead of keeping one .dts.in per board, memory size and hart count under dts/. scripts/generate-nemu-board-dts.py maps a DEFAULT_DTB basename to a nemu_board profile and writes the template into build/generated-dts. Hart count, memory size and the -novec suffix keep coming from the basename. Recognized basenames are always regenerated, so they cannot go stale; an unsupported basename is read from dts/<name>.dts.in, which keeps custom templates in the tracked tree rather than in the build directory. Firmware assembly, OpenSBI and LibCheckpointAlpha all consume that same generated template, and the Make dependencies now track the generator, the profile data and the selected custom template.
Single-hart images kept the device tree at 1.75 MiB while multi-hart images placed it at 2 MiB, so the two layouts had to be described separately and OpenSBI's FDT address differed per image type. Move the single-hart device tree to 2 MiB so both layouts agree, and move the single-hart kernel to the next 2 MiB-aligned address at 4 MiB so the two cannot overlap. The OpenSBI jump and FDT addresses, the packer offsets and the exported manifest follow the same addresses.
The generated xiangshan-fpga-noAIA profiles can describe either Kunminghu V2 or V3 hardware, but the build had no way to choose between them. Add DTS_ISA_CONFIG, accepting kunminghu-v2 and kunminghu-v3 with kunminghu-v3 as the default, and pass it to the generator. Only the FPGA noAIA profiles consume it; QEMU/NEMU profiles and supplied custom templates are unchanged, and a non-default value for a profile that does not support it is rejected. Include the selector in every firmware and DTS configuration stamp so switching versions cannot silently reuse the previous firmware. The superseded scripts/generate-xiangshan-multihart-dts.py and its documentation section are removed here, since that section is replaced by the DTS_ISA_CONFIG notes.
Pick up the nemu_board commit that documents the generated rng-seed bytes with their ASCII reading, matching the checked-in dts/*.dts.in templates.
Record the upstream source and GitHub authors in the README.
poemonsense
reviewed
Sep 11, 2026
| @@ -0,0 +1,226 @@ | |||
| { | |||
| "fpga-noaia-novec": { | |||
| "source": "https://github.com/OpenXiangShan/workload-builder/blob/aaf4d8bd7d2da5351fc2640c8d61c9d849d69342/dts/xiangshan-fpga-noAIA-novec.dts.in", | |||
Contributor
Author
There was a problem hiding this comment.
It record the source of this dts config, but it is not used for generating.
Share profile rendering between the DTS entry points and keep legacy and structured ISA declarations consistent. Restore explicit custom template handling and track those templates as firmware build dependencies.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Some generated profiles have incorrect or missing hardware declarations, and SPECjbb lacks a required rebuild dependency.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Replaces checked-in DTS templates with build-time, profile-driven generation and updates firmware workflows accordingly.
Changes:
- Adds canonical DTS generators, profile data, ISA selection, and custom-template fallback.
- Rewires firmware builds and rebuild identities to use generated templates.
- Removes obsolete templates/scripts and updates documentation.
File summaries
| File | Description |
|---|---|
Makefile |
Integrates generated DTS profiles and ISA selection. |
README.md |
Documents the generation workflow. |
scripts/dts-config.sh |
Adds build-time template generation. |
scripts/build-sbi.sh |
Uses generated DTS templates. |
scripts/build-gcpt.sh |
Generates DTS before GCPT configuration. |
scripts/build-firmware-linux.sh |
Generates the selected firmware template. |
scripts/generate-xiangshan-multihart-dts.py |
Removes obsolete transformation script. |
dts/DTSGen.py |
Adds the foundational DTS renderer. |
dts/generate-nemu-board-dts.py |
Adds basename/profile-driven generation. |
dts/generate-workload-builder-dts.py |
Adds the profile-oriented CLI. |
dts/workload-builder-profiles.json |
Defines memory and ISA profiles. |
dts/README.md |
Documents generator usage and profiles. |
dts/xiangshan.dts.in |
Removes generated built-in template. |
dts/yanqihu.dts.in |
Removes generated built-in template. |
dts/yanqihu-2core.dts.in |
Removes generated built-in template. |
dts/nutshell.dts.in |
Removes generated built-in template. |
dts/spike.dts.in |
Removes generated built-in template. |
dts/spike-2core.dts.in |
Removes generated built-in template. |
dts/xiangshan-qemu-nemu-mem2g.dts.in |
Removes generated QEMU template. |
dts/xiangshan-qemu-nemu-mem8g.dts.in |
Removes generated QEMU template. |
dts/xiangshan-qemu-nemu-mem24g.dts.in |
Removes generated QEMU template. |
dts/xiangshan-fpga-noAIA.dts.in |
Removes generated FPGA template. |
dts/xiangshan-fpga-noAIA-novec.dts.in |
Removes generated no-vector template. |
dts/xiangshan-fpga-noAIA-mem8g.dts.in |
Removes generated 8 GiB template. |
dts/xiangshan-fpga-noAIA-mem8g-novec.dts.in |
Removes generated 8 GiB no-vector template. |
dts/xiangshan-fpga-noAIA-mem24g.dts.in |
Removes generated 24 GiB template. |
dts/xiangshan-fpga-noAIA-mem24g-novec.dts.in |
Removes generated 24 GiB no-vector template. |
dts/xiangshan-fpga-noAIA-mem64g.dts.in |
Removes generated 64 GiB template. |
dts/xiangshan-fpga-noAIA-mem64g-novec.dts.in |
Removes generated 64 GiB no-vector template. |
dts/xiangshan-fpga-noAIA-mem16g-novec.dts.in |
Removes generated 16 GiB template. |
dts/xiangshan-fpga-noAIA-mem128g-novec.dts.in |
Removes generated 128 GiB template. |
dts/xiangshan-fpga-noAIA-2hart-mem8g-novec.dts.in |
Removes generated two-hart template. |
dts/xiangshan-fpga-noAIA-2hart-mem16g-novec.dts.in |
Removes generated two-hart template. |
dts/xiangshan-fpga-AIA-mem16g.dts.in |
Removes generated AIA template. |
workloads/linux/specjbb2015/rules.mk |
Tracks generator inputs and firmware identity. |
workloads/linux/spec2026/rules.mk |
Uses generated templates and ISA-aware stamps. |
workloads/linux/spec2026/README.md |
Updates generated-template paths. |
workloads/linux/spec2017/rules.mk |
Uses generated templates and ISA-aware stamps. |
workloads/linux/spec2017/README.md |
Updates generated-template paths. |
workloads/linux/spec2006/rules.mk |
Uses generated templates and ISA-aware identity. |
workloads/linux/spec2006/README.md |
Documents generated profile selection. |
workloads/linux/rocksdb/rules.mk |
Uses generated DTS inputs and stamps. |
workloads/linux/gapbs/rules.mk |
Uses generated DTS inputs and stamps. |
workloads/linux/geekbench-common.mk |
Generates Geekbench firmware templates. |
workloads/linux/geekbench5/README.md |
Documents generated default profile. |
workloads/linux/geekbench6/README.md |
Documents generated default profile. |
Review details
- Files reviewed: 47/47 changed files
- Comments generated: 5
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Removed unnecessary details about source URLs and streamlined the explanation of profile data storage. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
poemonsense
approved these changes
Sep 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR replaces the built-in checked-in DTS template set with a profile-based
generation flow for workload-builder firmware.
Main changes:
dts/.build/generated-dtsduring the build.and Kunminghu V2/V3 configurations.
DTS_ISA_CONFIG=kunminghu-v2|kunminghu-v3for generated FPGA noAIAprofiles.
riscv,isaand structuredriscv,isa-extensionsdeclarationsconsistent.
dts/<name>.dts.in.relevant Make dependencies.
firmware reuse.
transformation script.
DTS profiles
The generator supports the following profile families:
nemuThe basename continues to select board type, hart count, memory profile, and
vector mode. For generated FPGA noAIA profiles,
DTS_ISA_CONFIGselects theKunminghu ISA declaration:
kunminghu-v3is the default.kunminghu-v2selects the existing V2 declaration.QEMU multi-hart profiles generate the required CPU, CLINT, PLIC, debug, UART,
and checkpoint-reservation nodes. The generated DTS uses the selected memory
capacity and validates the fixed firmware address contract.
Custom DTS templates
Built-in names are always regenerated from the profile generator.
For an unsupported basename, the build accepts a matching custom template: