Dasharo / open-source-firmware-validation

OSFV infrastructure with automated tests and scripts for managing test results
Apache License 2.0
9 stars 2 forks source link

WIP: SeaBIOS support #574

Open pietrushnic opened 2 weeks ago

pietrushnic commented 2 weeks ago

Please let me know how to split those changes to merge most of them. The results are far from production, but I'm working on fixes.

% ./scripts/ci/qemu-self-test-seabios.sh
==============================================================================
Setup-And-Boot-Seabios :: This suite verifies the correct operation of keyw...
==============================================================================
Enter Boot Menu SeaBIOS :: Test Enter Boot Menu kwd                   | PASS |
------------------------------------------------------------------------------
Enter Boot Menu SeaBIOS And Return Construction :: Test Enter Boot... | PASS |
------------------------------------------------------------------------------
Enter sortbootorder :: Test Enter sortbootorder kwd                   | FAIL |
No match found for 'Save configuration and exit' in 10 seconds. Output:
SeaBIOS (version rel-1.16.0.1-23-g5b5fd6ffPCI: XHCI at 00:04.0 (mmio 0xfcf64000)
XHCI init: regs @ 0xfcf64000, 8 ports, 64 slots, 32 byte contexts
XHCI    protocol USB  2.00, 4 ports (offset 5), def 0
XHCI    protocol USB  3.00, 4 ports (offset 1), def 0
/3ed38000\ Start thread
AHCI controller at 00:1f.2, iobase 0xfcf61000, irq 10
AHCI: cap 0xc0141f05, ports_impl 0x3f
/3ed36000\ Start thread
|3ed36000| AHCI/0: probing
/3ed35000\ Start thread
|3ed35000| AHCI/1: probing
/3ed33000\ Start thread
|3ed33000| AHCI/2: probing
|3ed33000| AHCI/2: link up
|3ed33000| Searching bootorder for: /pci@i0cf8/*@1f,2/drive@2/disk@0
|3ed33000| Searching bios-geometry for: /pci@i0cf8/*@1f,2/drive@2/disk@0
/3ed32000\ Start thread
|3ed32000| AHCI/3: probing
    [ Message content over the limit has been removed. ]
Searching bootorder for: /pci@i0cf8/*@2
Unable to find VPD table
Unable to find VPD table

Press F10 key now for boot menu

Searching bootorder for: HALT
Space available for UMB: dc800-ed000, f69e0-f70e0
Returned 16773120 bytes of ZoneHigh
e820 map has 7 items:
  0: 0000000000000000 - 000000000009fc00 = 1 RAM
  1: 000000000009fc00 - 00000000000a0000 = 2 RESERVED
  2: 00000000000f0000 - 0000000000100000 = 2 RESERVED
  3: 0000000000100000 - 000000003fd45000 = 1 RAM
  4: 000000003fd45000 - 0000000040000000 = 2 RESERVED
  5: 00000000b0000000 - 00000000c0000000 = 2 RESERVED
  6: 00000000fed40000 - 00000000fed45000 = 2 RESERVED
enter handle_19:

Booting from ROM..Booting from ca00:0385
.
iPXE starting execution...ok
iPXE initialising devices...unimplemented handle_1aXX:258:
    [ Message content over the limit has been removed. ]
Trying next device: 2
Booting from DVD/CD..AHCI/2: ... finished, status 0x41, ERROR 0x20
Device reports MEDIUM NOT PRESENT - 2 tries left
AHCI/2: ... finished, status 0x41, ERROR 0x20
Device reports MEDIUM NOT PRESENT - 1 tries left
AHCI/2: ... finished, status 0x41, ERROR 0x20
Device reports MEDIUM NOT PRESENT - 0 tries left
AHCI/2: ... finished, status 0x41, ERROR 0x20
.
Boot failed: Could not read from CDROM (code 0003enter handle_18:
  NULL
)
Trying next device: enter handle_18:
  NULL
3
Trying next device: enter handle_18:
  NULL
4
Trying next device: 5
No bootable device.  Retrying in 60 seconds.
------------------------------------------------------------------------------
Setup-And-Boot-Seabios :: This suite verifies the correct operatio... | FAIL |
5 tests, 3 passed, 2 failed
==============================================================================

The two most important fixes support for flash in sortbootorder and figuring out how to run iPXE in QEMU, so QEMU would not use OptionROM, but SeaBIOS will load builtin one.

pietrushnic commented 1 week ago

@macpijan I wonder how far I should go with that, now results are as follows:

% ./scripts/ci/qemu-self-test-seabios.sh
==============================================================================
Setup-And-Boot-Seabios :: This suite verifies the correct operation of keyw...
==============================================================================
Enter Boot Menu SeaBIOS :: Test Enter Boot Menu kwd                   | PASS |
------------------------------------------------------------------------------
Enter Boot Menu SeaBIOS And Return Construction :: Test Enter Boot... | PASS |
------------------------------------------------------------------------------
Enter sortbootorder :: Test Enter sortbootorder kwd                   | PASS |
------------------------------------------------------------------------------
Enter TPM Configuration :: Test Enter TPM Configuration kwd           | PASS |
------------------------------------------------------------------------------
Enter iPXE :: Test Enter iPXE kwd                                     | FAIL |
No match found for 'autoboot' in 10 seconds. Output:
------------------------------------------------------------------------------
Setup-And-Boot-Seabios :: This suite verifies the correct operatio... | FAIL |
5 tests, 4 passed, 1 failed
==============================================================================
Output:  /home/user/src/3mdeb/dasharo/open-source-firmware-validation/logs/2024.11.12_14.29.14/setup-and-boot-seabios/output.xml
Log:     /home/user/src/3mdeb/dasharo/open-source-firmware-validation/logs/2024.11.12_14.29.14/setup-and-boot-seabios/log.html
Report:  /home/user/src/3mdeb/dasharo/open-source-firmware-validation/logs/2024.11.12_14.29.14/setup-and-boot-seabios/report.html
zsh: exit 1     ./scripts/ci/qemu-self-test-seabios.sh

Of course, I can satisfy all the checks despite the self-test change, and if my approach is correct, I would probably need your approval.

Regarding the SeaBIOS self-test, my concern is that I'm entering the land of testing sortbootorder; some tests exist in the legacy framework, and I could start porting those, but then the question arises: what is the difference between the keyword that should be tested and test itself. I think we should validate iPXE and network booting comprehensively, but to enter iPXE you need to enable network, which means you have to teach OSFV how to walk into sortbootorder (already done ) and change some option (probably done in legacy test suite).

pietrushnic commented 1 week ago

Another set of changes:

% ./scripts/ci/qemu-self-test-seabios.sh
==============================================================================
Setup-And-Boot-Seabios :: This suite verifies the correct operation of keyw...
==============================================================================
Enter Boot Menu SeaBIOS :: Test Enter Boot Menu kwd                   | PASS |
------------------------------------------------------------------------------
Enter Boot Menu SeaBIOS And Return Construction :: Test Enter Boot... | PASS |
------------------------------------------------------------------------------
Enter sortbootorder :: Test Enter sortbootorder kwd                   | PASS |
------------------------------------------------------------------------------
Get sortbootorder Menu Construction :: Get sortbootorder Menu Cons... | PASS |
------------------------------------------------------------------------------
Get Option State :: Test Get Option State kwd                         | PASS |
------------------------------------------------------------------------------
Enter Menu From Snapshot and Return sortbootorder Consruction :: T... | PASS |
------------------------------------------------------------------------------
Enter TPM Configuration :: Test Enter TPM Configuration kwd           | PASS |
------------------------------------------------------------------------------
Enter iPXE :: Test Enter iPXE kwd                                     | FAIL |
No match found for 'autoboot' in 10 seconds. Output:
------------------------------------------------------------------------------
Setup-And-Boot-Seabios :: This suite verifies the correct operatio... | FAIL |
8 tests, 7 passed, 1 failed
==============================================================================
Output:  /home/user/src/3mdeb/dasharo/open-source-firmware-validation/logs/2024.11.14_00.54.30/setup-and-boot-seabios/output.xml
Log:     /home/user/src/3mdeb/dasharo/open-source-firmware-validation/logs/2024.11.14_00.54.30/setup-and-boot-seabios/log.html
Report:  /home/user/src/3mdeb/dasharo/open-source-firmware-validation/logs/2024.11.14_00.54.30/setup-and-boot-seabios/report.html
zsh: exit 1     ./scripts/ci/qemu-self-test-seabios.sh
pietrushnic commented 3 days ago
% ./scripts/ci/qemu-self-test-seabios.sh
==============================================================================
Setup-And-Boot-Seabios :: This suite verifies the correct operation of keyw...
==============================================================================
Enter Boot Menu SeaBIOS :: Test Enter Boot Menu kwd                   | PASS |
------------------------------------------------------------------------------
Enter Boot Menu SeaBIOS And Return Construction :: Test Enter Boot... | PASS |
------------------------------------------------------------------------------
Enter sortbootorder :: Test Enter sortbootorder kwd                   | PASS |
------------------------------------------------------------------------------
Get sortbootorder Menu Construction :: Get sortbootorder Menu Cons... | PASS |
------------------------------------------------------------------------------
Get Option State :: Test Get Option State kwd                         | PASS |
------------------------------------------------------------------------------
Enter Menu From Snapshot and Return sortbootorder Consruction :: T... | PASS |
------------------------------------------------------------------------------
Enter TPM Configuration :: Test Enter TPM Configuration kwd           | PASS |
------------------------------------------------------------------------------
Enable Network Boot :: Test Enable Network/PXE boot                   | PASS |
------------------------------------------------------------------------------
Enter iPXE :: Test Enter iPXE kwd                                     | PASS |
------------------------------------------------------------------------------
Setup-And-Boot-Seabios :: This suite verifies the correct operatio... | PASS |
9 tests, 9 passed, 0 failed
==============================================================================