bootc: support grub2 serial console customization#2403
Conversation
9d7b50c to
b1afdd7
Compare
|
@jbtrystram I'll mark this one as draft until we land the required |
b1afdd7 to
80612a9
Compare
|
@supakeen I see the blueprints changes have been released so I guess this can be reviewed ? I just noticed the |
Yea, you can undraft. |
joelcapitao
left a comment
There was a problem hiding this comment.
I tested this PR alongside other PRs I have and got:
============================================================
=== Processing artifact: qemu for x86_64
============================================================
IMAGE_TYPE: qcow2
MEDIA_TYPE: application/vnd.diskimage.qcow2
=== Pre-merged blueprint for qemu ===
name = "Fedora CoreOS"
[customizations]
[customizations.ignition]
[customizations.ignition.firstboot]
empty = true
[customizations.kernel]
append = "mitigations=auto,nosmt $ignition_firstboot ignition.platform.id=qemu console=tty0 console=ttyS0,115200n8"
[customizations.bootloader]
[customizations.bootloader.grub2]
terminal_input = ["serial", "console"]
terminal_output = ["serial", "console"]
serial = "serial --speed=115200"
=== Building qemu disk image ===
Manifest generation step
Building manifest for bootc-based-qcow2
Using disk.yaml root filesystem (xfs), ignoring bootc config (xfs)
Image building step
<stdin> has errors:
.pipelines[2].stages[7].options:
'path' is a required property
error: error running osbuild: exit status 2
ERROR: Failed to build qemu
80612a9 to
cb7d8ac
Compare
cb7d8ac to
90ca81e
Compare
supakeen
left a comment
There was a problem hiding this comment.
Mmm I still had the default path value in my head too :)
90ca81e to
7e81b82
Compare
brlane-rht
left a comment
There was a problem hiding this comment.
This needs tests. I also like to see separate commits for changes to the different pkg/* subdirectories.
7e81b82 to
f58fa24
Compare
Add Go types and constructor for the org.osbuild.grub2.d stage which writes a GRUB2 drop-in configuration file at a configurable path. Include a converter NewGrub2DConfigFromGrub2Config() that extracts console-related fields (terminal_input, terminal_output, serial) from the existing GRUB2Config type. Requires: osbuild/osbuild#2473 Authored-by: Opencode.ai <claude-opus-4-6@default>
f58fa24 to
a354f0b
Compare
I added tests and split the PR into 3 commits. |
When OSCustomizations.Grub2Config has console-related settings (terminal_input, terminal_output, serial), emit an org.osbuild.grub2.d stage that writes a drop-in config to boot/grub2/console.cfg. This uses bootupd mounts (like the ignition stage) because the config must be written to /boot after bootc install-to-filesystem. This relies on bootupd's console.cfg grub config: https://github.com/coreos/bootupd/blob/main/src/grub2/grub-static-pre.cfg#L41 Authored-by: Opencode.ai <claude-opus-4-6@default>
Read blueprint bootloader.grub2 settings (terminal_input, terminal_output, serial) and pass them as a GRUB2Config to the raw_bootc pipeline, which emits the grub2.d stage. Add 'customizations.bootloader' to the supported options list for bootc disk image types so blueprint validation accepts it. Requires: osbuild/blueprint#53 Authored-by: Opencode.ai <claude-opus-4-6@default>
a354f0b to
6bc677d
Compare
thozza
left a comment
There was a problem hiding this comment.
Thanks. Except for my inline comments, everything looks nice. Those are minor and can be a follow-up.
| Path string `json:"path"` | ||
|
|
||
| // GRUB2 configuration to write | ||
| Config *Grub2DConfig `json:"config"` |
There was a problem hiding this comment.
Nitpick: this doesn't need to be a pointer, since config is a required stage option. It should never be omitted and null is not a valid value for the stage options schema.
| func NewGrub2DStage(options *Grub2DStageOptions) *Stage { | ||
| return &Stage{ | ||
| Type: "org.osbuild.grub2.d", | ||
| Options: options, | ||
| } | ||
| } |
There was a problem hiding this comment.
The options.Path values could have been checked against the same regexes as those defined in the stage schema.
Wire the blueprint bootloader customization into the bootc disk image pipeline.
When blueprint specifies grub2 serial/terminal settings, emit an org.osbuild.grub2.d stage that writes a drop-in config to
boot/grub2/console.cfgafter bootc install-to-filesystem.This relies on
bootupd'sconsole.cfggrub config: https://github.com/coreos/bootupd/blob/main/src%2Fgrub2%2Fgrub-static-pre.cfg#L41This adds a Go wrapper for the new osbuild stage and reads
GetBootloader()in the bootc image type.Assisted-by: Opencode.ai <Opus 4.6>
Requires: osbuild/blueprint#53
Requires: osbuild/osbuild#2473