efi_loader: Add test to boot OpenBSD's efi bootloader
RFC 1/1 efi_loader: Add test to boot OpenBSD's efi bootloader
---
Kinda works, but since we don't have an 'exit' command like grub, we have to reboot, which leaves the "board" in a bad state (I guess, since the next test fails). I haven't tackled the travis bits to get travis to download OpenBSD's bootloader, or other little details like that.
So suggestions welcome ;-)
test/py/tests/test_efi_loader.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
test/py/tests/test_efi_loader.py +19 -0
@@ -193,3 +193,22 @@ def test_efi_grub_net(u_boot_console): # And give us our U-Boot prompt back u_boot_console.run_command('') + + at pytest.mark.buildconfigspec('cmd_bootefi') +def test_efi_openbsd_net(u_boot_console): + """Run OpenBSD's bootloader via TFTP. + + The bootaa64.efi file is downloaded from the TFTP server and + gets executed. + """ + + addr = fetch_tftp_file(u_boot_console, 'env__efi_loader_openbsd_file') + + u_boot_console.run_command('bootefi %x' % addr, wait_for_prompt=False) + + # Check that bootloader loads properly: + u_boot_console.wait_for('boot>') + + # There is no exit, but there is a reboot cmd.. maybe we need to do + # more than this to get u-boot running again?? + u_boot_console.run_command('reboot', wait_for_prompt=False, wait_for_echo=False)
Signature · 1 line
2.13.0
Quoted 10 lines
From: Rob Clark <[email protected]>
Date: Sun, 6 Aug 2017 12:10:28 -0400Signed-off-by Rob Clark <[email protected]>---
Kinda works, but since we don't have an 'exit' command like grub, we have to reboot, which leaves the "board" in a bad state (I guess, since the next test fails). I haven't tackled the travis bits to get travis to download OpenBSD's bootloader, or other little details like that.
What does the grub "exit" command do? Simply call EFI_BOOT_SERVICE.Exit()? Wouldn't be too difficult for me to add a command that does this.
The OpenBSD bootloader currently just executes an illegal instruction as EFI_RUNTIME_SERVICES.ResetSystem() didn't work at the time I wrote the code. Perhaps I should revisit that issue now.
Quoted 39 lines
test/py/tests/test_efi_loader.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)test/py/tests/test_efi_loader.py +19
-0@@ -193,3 +193,22 @@ def test_efi_grub_net(u_boot_console): # And give us our U-Boot prompt back u_boot_console.run_command('') + + at pytest.mark.buildconfigspec('cmd_bootefi') +def test_efi_openbsd_net(u_boot_console): + """Run OpenBSD's bootloader via TFTP. + + The bootaa64.efi file is downloaded from the TFTP server and + gets executed. + """ + + addr = fetch_tftp_file(u_boot_console, 'env__efi_loader_openbsd_file') + + u_boot_console.run_command('bootefi %x' % addr, wait_for_prompt=False) + + # Check that bootloader loads properly: + u_boot_console.wait_for('boot>') + + # There is no exit, but there is a reboot cmd.. maybe we need to do + # more than this to get u-boot running again?? + u_boot_console.run_command('reboot', wait_for_prompt=False, wait_for_echo=False)Signature · 6 lines
2.13.0 _______________________________________________ U-Boot mailing list U-Boot at lists.denx.de https://lists.denx.de/listinfo/u-boot
Quoted 11 lines · Mark Kettenis
Quoted 10 lines
From: Rob Clark <[email protected]>
Date: Sun, 6 Aug 2017 12:10:28 -0400Signed-off-by Rob Clark <[email protected]>---
Kinda works, but since we don't have an 'exit' command like grub, we have to reboot, which leaves the "board" in a bad state (I guess, since the next test fails). I haven't tackled the travis bits to get travis to download OpenBSD's bootloader, or other little details like that.
Quoted 2 lines
What does the grub "exit" command do? Simply call
EFI_BOOT_SERVICE.Exit()? Wouldn't be too difficult for me to add a command that does this.
Yeah, I think just calls BS->Exit().. that would be quite useful.
BR,
-R
Quoted 43 lines
The OpenBSD bootloader currently just executes an illegal instruction as
EFI_RUNTIME_SERVICES.ResetSystem()didn't work at the time I wrote the code. Perhaps I should revisit that issue now.Quoted 39 lines
test/py/tests/test_efi_loader.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)test/py/tests/test_efi_loader.py +19
-1@@ -193,3 +193,22 @@ def test_efi_grub_net(u_boot_console): # And give us our U-Boot prompt back u_boot_console.run_command('') + + at pytest.mark.buildconfigspec('cmd_bootefi') +def test_efi_openbsd_net(u_boot_console): + """Run OpenBSD's bootloader via TFTP. + + The bootaa64.efi file is downloaded from the TFTP server and + gets executed. + """ + + addr = fetch_tftp_file(u_boot_console, 'env__efi_loader_openbsd_file') + + u_boot_console.run_command('bootefi %x' % addr, wait_for_prompt=False) + + # Check that bootloader loads properly: + u_boot_console.wait_for('boot>') + + # There is no exit, but there is a reboot cmd.. maybe we need to do + # more than this to get u-boot running again?? + u_boot_console.run_command('reboot', wait_for_prompt=False, wait_for_echo=False) --2.13.0
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot
Quoted 12 lines · Rob Clark
Quoted 11 lines · Mark Kettenis
Quoted 10 lines
From: Rob Clark <[email protected]>
Date: Sun, 6 Aug 2017 12:10:28 -0400Signed-off-by Rob Clark <[email protected]>---
Kinda works, but since we don't have an 'exit' command like grub, we have to reboot, which leaves the "board" in a bad state (I guess, since the next test fails). I haven't tackled the travis bits to get travis to download OpenBSD's bootloader, or other little details like that.
Quoted 4 lines
Quoted 2 lines
What does the grub "exit" command do? Simply call
EFI_BOOT_SERVICE.Exit()? Wouldn't be too difficult for me to add a command that does this.Yeah, I think just calls
BS->Exit().. that would be quite useful.
Mark committed the change for this and snapshots now have "machine exit" and "machine poweroff".
https://ftp.openbsd.org/pub/OpenBSD/snapshots/armv7/BOOTARM.EFI
https://ftp.openbsd.org/pub/OpenBSD/snapshots/arm64/BOOTAA64.EFI
Quoted 16 lines · Jonathan Gray
Quoted 15 lines · Rob Clark
Quoted 13 lines · Mark Kettenis
Quoted 10 lines
From: Rob Clark <[email protected]>
Date: Sun, 6 Aug 2017 12:10:28 -0400Signed-off-by Rob Clark <[email protected]>---
Kinda works, but since we don't have an 'exit' command like grub, we have to reboot, which leaves the "board" in a bad state (I guess, since the next test fails). I haven't tackled the travis bits to get travis to download OpenBSD's bootloader, or other little details like that.What does the grub "exit" command do? Simply call
EFI_BOOT_SERVICE.Exit()? Wouldn't be too difficult for me to add a command that does this.
Quoted 7 lines
Quoted 1 line
Yeah, I think just calls
BS->Exit().. that would be quite useful.Mark committed the change for this and snapshots now have "machine exit" and "machine poweroff".
https://ftp.openbsd.org/pub/OpenBSD/snapshots/armv7/BOOTARM.EFI
https://ftp.openbsd.org/pub/OpenBSD/snapshots/arm64/BOOTAA64.EFI
Excellent.. I'll update my patch and give this a spin today.
BR,
-R
test/py/tests/test_efi_loader.py def test_efi_grub_net(u_boot_console): · line 214
Quoted 11 lines · Rob Clark
Signed-off-by Rob Clark <[email protected]>---
Kinda works, but since we don't have an 'exit' command like grub, we have to reboot, which leaves the "board" in a bad state (I guess, since the next test fails). I haven't tackled the travis bits to get travis to download OpenBSD's bootloader, or other little details like that.test/py/tests/test_efi_loader.py +3
-0+ # There is no exit, but there is a reboot cmd.. maybe we need to do + # more than this to get u-boot running again?? + u_boot_console.run_command('reboot', wait_for_prompt=False, wait_for_echo=False)
Assuming that 'reboot' works here, and actually resets the system, it'll probably end up booting whatever code is in flash/storage, which isn't necessarily the version of U-Boot that's being tested; the version under test may not be in flash, but might be downloaded at boot time e.g. over serial/USB to avoid flash wear. So yes, this test certainly needs to do something different to restart U-Boot if the test can't simply exit back to the previous running instance.
There's a core test/py function cons.restart_uboot() that should do everything required to restart the target system. test/test_vboot.py already uses it, in particular at the tail end of test_with_algo() in order to return the target back to the expected state that the next test expects.
I also recall writing down some ideas about how to add Linux-booting testing into U-Boot, along with actually running some tests in Linux mode to validate the boot without having to manually code up all the command-line request/response logic. That was in an email to the U-Boot list, perhaps during a conversation with Heiko. However, Google can't find it right now:-( Still, I don't think it would improve things for the test you're proposing right now since it's so simple, and it was mostly just thinking about how to do it rather than actual code anyway.
Quoted 7 lines · Rob Clark
Signed-off-by Rob Clark <[email protected]>---
Kinda works, but since we don't have an 'exit' command like grub, we have to reboot, which leaves the "board" in a bad state (I guess, since the next test fails). I haven't tackled the travis bits to get travis to download OpenBSD's bootloader, or other little details like that.
I think it's a very good addition to the tests - we should definitely try and test the OpenBSD bootloader as well.
Adding the travis bits to download it should be a matter of wget'ing it into the right directory.
As for the reboot - I think you only have to get yourself back to a boot prompt and check for that. That's basically what ensure_spawned() does too.
Alex
Quoted 34 lines
So suggestions welcome ;-)
test/py/tests/test_efi_loader.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)test/py/tests/test_efi_loader.py +19
-0@@ -193,3 +193,22 @@ def test_efi_grub_net(u_boot_console): # And give us our U-Boot prompt back u_boot_console.run_command('') + + at pytest.mark.buildconfigspec('cmd_bootefi') +def test_efi_openbsd_net(u_boot_console): + """Run OpenBSD's bootloader via TFTP. + + The bootaa64.efi file is downloaded from the TFTP server and + gets executed. + """ + + addr = fetch_tftp_file(u_boot_console, 'env__efi_loader_openbsd_file') + + u_boot_console.run_command('bootefi %x' % addr, wait_for_prompt=False) + + # Check that bootloader loads properly: + u_boot_console.wait_for('boot>') + + # There is no exit, but there is a reboot cmd.. maybe we need to do + # more than this to get u-boot running again?? + u_boot_console.run_command('reboot', wait_for_prompt=False, wait_for_echo=False)