Skip to content

feat(qemu): add mtda-cli firmware command to switch boot firmware - #601

Open
chombourger wants to merge 1 commit into
siemens:nextfrom
chombourger:feat/qemu-legacy-firmware
Open

feat(qemu): add mtda-cli firmware command to switch boot firmware#601
chombourger wants to merge 1 commit into
siemens:nextfrom
chombourger:feat/qemu-legacy-firmware

Conversation

@chombourger

Copy link
Copy Markdown
Collaborator

Add "mtda-cli firmware [efi|legacy]" to query or switch the boot firmware used by the qemu power controller, between OVMF (EFI) and SeaBIOS (legacy). Querying with no argument returns the current mode; other power controllers report "not supported".

Config gains optional [efi] and [legacy] sections under [power] to point at OVMF pflash files or a custom legacy BIOS image; flat pflash_ro/pflash_rw/bios keys directly under [power] keep working for backward compatibility. The active mode is persisted across mtda-agent restarts in /var/lib/mtda/qemu-firmware and defaults to efi unless only [legacy] is configured (overridable via [firmware] default=). Switching modes while qemu is already running restarts the qemu process itself so the new firmware takes effect immediately.

@chombourger chombourger added check and removed check labels Jul 24, 2026
@chombourger
chombourger force-pushed the feat/qemu-legacy-firmware branch from 0a2b9b5 to 537be5f Compare July 24, 2026 08:35
@chombourger chombourger added check and removed check labels Jul 24, 2026
@chombourger
chombourger force-pushed the feat/qemu-legacy-firmware branch from 537be5f to 36188b4 Compare July 24, 2026 08:37
Comment thread mtda/grpc/mtda.proto
Add "mtda-cli firmware [efi|legacy]" to query or switch the boot
firmware used by the qemu power controller, between OVMF (EFI) and
SeaBIOS (legacy). Querying with no argument returns the current mode;
other power controllers report "not supported".

Config gains optional [efi] and [legacy] sections under [power] to
point at OVMF pflash files or a custom legacy BIOS image; flat
pflash_ro/pflash_rw/bios keys directly under [power] keep working for
backward compatibility. The active mode is persisted across
mtda-agent restarts in /var/lib/mtda/qemu-firmware and defaults to
efi unless only [legacy] is configured (overridable via [firmware]
default=). Switching modes while qemu is already running restarts
the qemu process itself so the new firmware takes effect immediately.

Internal drives now get an explicit bootindex (0, 1, ...) instead of
none at all: without one, OVMF's BootOrder ends up empty and it drops
to the EFI shell instead of booting them. Hot-plugged USB storage
(e.g. an installer image) keeps a higher bootindex (100+) so it never
preempts internal storage; picking it instead requires going through
the firmware's own boot menu, which "-boot menu=on" now enables for
both firmwares.

Restarting qemu for a firmware switch also unlinks and recreates its
serial pipes, so an already-attached console needs to be closed and
reopened around the restart or it's left on a stale fifo; fixed
console.qemu.close(), which used to be a no-op, to actually release
its file handles.

Signed-off-by: Cedric Hombourger <cedric.hombourger@siemens.com>
@chombourger
chombourger force-pushed the feat/qemu-legacy-firmware branch from 36188b4 to 87fd3b0 Compare July 26, 2026 09:26
@chombourger chombourger added check and removed check labels Jul 26, 2026
@chombourger

Copy link
Copy Markdown
Collaborator Author

found an issue with consoles not being re-attached to the new qemu/kvm instance on restart. fixed now.

@chombourger
chombourger requested a review from baprusty July 30, 2026 12:00
@chombourger

Copy link
Copy Markdown
Collaborator Author

Proposing to rebase this MR after #603

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants