Dear Maintainers,
I hope this message finds you well.
Attached is the patch containing some of my changes I'm proposing: 0001-boot-Allow-setting-bootorder-from-CMOS-entry.patch
The change allows seabios to load bootorder not only from CBFS but also from the NVRAM as well, making use of coreboot's cmos.layout.
To prepare testing environment: - Prepare the coreboot source code with coreboot-qemu-q35-cmos.layout-test.patch. Configure coreboot for QEMU Q35 platform. For the payload, you can select anything (I simply choose SeaBIOS for simplicity), with secondary payloads of coreinfo and nvramcui. I've attached the qemu-q35-defconfig to eliminate possible ambiguity. - Compile a coreboot.rom. - Prepare the SeaBIOS source code with 0001-boot-Allow-setting-bootorder-from-CMOS-entry.patch, and compile it. - On the newly compiled coreboot.rom, use cbfstool (which gets compiled along with the coreboot.rom) to remove fallback/payload, then add the newly compiled bios.bin.elf as the new fallback/payload. - Prepare a Linux bootable. In general, any Linux system would do as long as you can run the required software. I go with Alpine Linux live disk as its ISO image is only 64MB. Any additional files go in a secondary disk, including its overlay system. I simply created a 16MB image using dd command and then formatted it with FAT. - Compile cbmem and nvramtool from coreboot's util directory. For my Alpine Linux setup, I need to make sure to compile with musl instead of glibc (e.g. in an Alpine chroot) - Include cbmem and nvramtool to the Linux bootable. For my Alpine setup, I simply have a secondary disk image (also where I put the overlay). - For convenience, I'd put everything in the same directory.
To actually test: - Run QEMU with `qemu-system-x86_64 -enable-kvm -cpu host -M q35 -bios coreboot-qemu.rom -m 1G <disks>` - For the QEMU options, serial output can be used as well, however it tends to break when loading coreinfo & nvramcui. Regardless, it's useful when all I have to do is debug with cbmem output. - On the BIOS screen, press Esc to see the menu. Note the disks should be on top. Boot to the disk. - Once your Linux system boots on QEMU, login to CLI as root, use nvramtool to modify the 'bootorder' entry. I myself ran `nvramtool -w bootorder="/rom@img/coreinfo"` to make it boot coreinfo first thing. - Reboot the QEMU system (do NOT kill the QEMU), press Esc again and see that coreinfo now jumps to the top. You can also not press Esc and see it loads coreinfo. Feel free to replace coreinfo with something else!
Some todo - Create a tool to modify bootorder more properly (i.e. loading from file would be nice, for starters) -- in progress - Make bootorder a reserved section on cmos.layout to prevent unintended changes. - Test on a read hardware, I have a Thinkpad X230 eager to try it
Do let me know if you have any feedback!
Warm regards, Timothy Kenno Handojo