feat(kernel): kernel.cmdline and kernel.cmdline_extra in project config - #252
Open
mobileoverlord wants to merge 1 commit into
Open
feat(kernel): kernel.cmdline and kernel.cmdline_extra in project config#252mobileoverlord wants to merge 1 commit into
mobileoverlord wants to merge 1 commit into
Conversation
The kernel command line was reachable only from the Yocto machine
configuration (CONSOLE_CMDLINE / KERNEL_CMDLINE_EXTRA), so anything a
project needs on it -- isolcpus, nohz_full, earlycon while bringing a
board up -- had to be baked into a BSP layer and a feed rebuilt. That is
the wrong seam: those values are properties of the project, not of the
machine, and two projects on the same target want different ones.
Adds two mutually exclusive fields, resolved per-runtime with a global
fallback:
kernel:
cmdline_extra: "isolcpus=4-6 nohz_full=4-6" # append
cmdline: "root=... console=..." # replace outright
and exports the result to the build and provision hooks as
AVOCADO_KERNEL_CMDLINE / AVOCADO_KERNEL_CMDLINE_EXTRA, which is where a
platform hook can act on it (meta-avocado-qcom's avocado-build-rubikpi3
rebuilds the UKI around them).
Append is the field to reach for; replace drops root= and console= on the
floor unless restated, which on most boards means a device that flashes
and boots to a dead console. They are rejected together at validate time
rather than silently letting one win.
Claude-Session: https://claude.ai/code/session_01BFkqZ1vpWd23TeC7dFFjdW
There was a problem hiding this comment.
🟢 Approval recommended
The functional changes are small, tested, and localized; the remaining feedback is a documentation correction.
Pull request overview
This PR makes kernel command-line configuration a first-class project setting by adding kernel.cmdline (replace) and kernel.cmdline_extra (append) to the YAML config, resolving them per-runtime with a top-level fallback, and exporting the resolved values to build/provision hooks via environment variables.
Changes:
- Extend
KernelConfigwithcmdline/cmdline_extra, including mutual-exclusion validation and singleton-vs-named-map deserialization support. - Add
Config::effective_kernel_cmdline()to resolve (replace, append) with runtime-over-top-level precedence. - Export
AVOCADO_KERNEL_CMDLINE/AVOCADO_KERNEL_CMDLINE_EXTRAto both runtime build and provision hook environments.
File summaries
| File | Description |
|---|---|
| src/utils/config.rs | Adds config fields + validation, implements per-runtime cmdline resolver, and includes tests. |
| src/commands/runtime/build.rs | Exports resolved kernel cmdline vars for platform build hooks (e.g., UKI bake-in). |
| src/commands/runtime/provision.rs | Exports resolved kernel cmdline vars for provision-time image assembly hooks. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
1604
to
1608
| /// Resolve a runtime's `kernel:` field to a concrete [`KernelConfig`], | ||
| /// following named refs to the top-level `kernel.<name>` map. | ||
| /// | ||
| /// Returns `None` when the runtime doesn't exist, has no `kernel:` field, | ||
| /// or the named ref doesn't resolve. (Phase 0e adds load-time validation |
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.
What
Adds
kernel.cmdlineandkernel.cmdline_extrato project config, so the kernel command line is something a project sets rather than something baked into a BSP layer.Both are resolved per-runtime with a global fallback and exported to the build and provision hooks as
AVOCADO_KERNEL_CMDLINE/AVOCADO_KERNEL_CMDLINE_EXTRA.Why
The command line was reachable only through the machine configuration (
CONSOLE_CMDLINE,KERNEL_CMDLINE_EXTRA). Anything a project needs on it —isolcpusfor a latency test,earlyconwhile bringing a board up — meant editing a BSP layer and rebuilding a feed. That is the wrong seam: those values are properties of the project, not of the machine, and two projects on the same target legitimately want different ones.This came out of the rubikpi3 RT/KVM work, where tuning the command line per experiment otherwise required a full Yocto rebuild per iteration.
How
cmdlinereplaces,cmdline_extraappends. Append is the one to reach for; replace dropsroot=andconsole=unless restated, which on most boards means a device that flashes and boots to a dead console. They are rejected together at validate time rather than letting one silently win.The platform hook is where these take effect —
meta-avocado-qcom'savocado-build-rubikpi3reads them when it rebuilds the UKI around the pinned kernel.Results
cargo fmtcleancmdline_extra: "earlycon"reached the booted kernel's/proc/cmdlineon a rubikpi3 via the UKI rebuild pathNote
Without this,
references/rubikpi3-rt-kvm-ivshmemdoes not load — it setscmdline_extra, and a CLI lacking the field reads it as an entry name in the kernel named-map form and refuses the file: