linuxboot / heads

A minimal Linux that runs as a coreboot or LinuxBoot ROM payload to provide a secure, flexible boot environment for laptops, workstations and servers.
https://osresearch.net/
GNU General Public License v2.0
1.4k stars 180 forks source link

Have qemu boards support writeable pflash and internal flashing #1203

Open tlaurion opened 1 year ago

tlaurion commented 1 year ago

Seems like both qemu and flashrom will need to be patched. Meanwhile, injecting key is made from separate qemu board build statement, and "reflashing" is rebooting qemu/kvm with newer built rom.


Current limitations stated under OP under #1188, where the following traces are what needs to be resolved:

@JonathonHall-Purism : would like to know what is the issue with nvram you were talking about earlier, and also what avenues possible with pflash since from what I've read from libvirt XML and qemu doc, the flash is not writable. Any input you have there would be useful in other open issues

Looks like the size limit is just a matter of changing this default for max_fw_size: https://gitlab.com/qemu-project/qemu/-/blob/master/hw/i386/pc.c#L1833

Re: writable flash, it seems to exist but the only discussion I can find is about people using it incorrectly: https://bugs.launchpad.net/qemu/+bug/1818367/comments/4

The element, with @type='pflash', no other attributes, and then no sibling element either, happens to be valid, but it is an extremely niche use case. It is used when you have a unified, writeable, OVMF.fd file that contains both the firmware executable and the live variable store.

This does sound like what we want, I have no idea right now how this works with plain qemu, whether flashrom supports it, or what it would take to add.

Originally posted by @JonathonHall-Purism in https://github.com/osresearch/heads/issues/1188#issuecomment-1218004671

tlaurion commented 1 year ago

Leaving traces of pertinent mailing list sub threads

tlaurion commented 1 month ago

Track https://github.com/Dasharo/dasharo-issues/issues/828

tlaurion commented 1 month ago

Specifically

As referred by https://github.com/Dasharo/dasharo-issues/issues/828

tlaurion commented 2 weeks ago