efi: Partial attempt at a test for EFI bootmeth
cover efi: Partial attempt at a test for EFI bootmeth
The test coverage for the EFI bootmeth is incomplete since it does not actually boot the application.
This series makes an attempt at this.
However there are at least two problems:
1. The test does not set up the loaded image properly, so it isn't found by the app.
2. The test needs to use USB instead of mmc, so that usb_stop() is called
Simon Glass (7):
efi: Use puts() in cout so that console recording works
efi: Show the vendor in helloworld
efi: test: Create a disk image with and EFI app in it
WIP: efi: Disable ANSI output
WIP: efi: Add a test for the EFI bootmeth
WIP: efi: Allow helloworld to exit boot services
WIP: efi: debugging
arch/sandbox/dts/test.dts | 10 ++++++- boot/bootflow.c | 2 ++ boot/bootmeth_efi.c | 1 + cmd/bootefi.c | 1 + include/efi_loader.h | 14 +++++++-- lib/efi_loader/efi_boottime.c | 5 ++++ lib/efi_loader/efi_console.c | 19 +++++------- lib/efi_loader/efi_setup.c | 2 +- lib/efi_loader/helloworld.c | 39 ++++++++++++++++++++++++- test/boot/bootflow.c | 55 ++++++++++++++++++++++++++++++++++- test/py/tests/test_ut.py | 32 ++++++++++++++++++++ 11 files changed, 163 insertions(+), 17 deletions(-)
Signature · 1 line
2.43.0.rc1.413.gea7ed67945-goog
PATCH 1/7 efi: Use puts() in cout so that console recording works
At present EFI output to the console use fputs() which bypasses the console-recording feature. This makes it impossible for tests to check the output of an EFI app.
There doesn't seem to be any need to do this bypass, so adjust it to simply use the puts() function.
---
lib/efi_loader/efi_console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/efi_loader/efi_console.c +1 -1
@@ -182,7 +182,7 @@ static efi_status_t EFIAPI efi_cout_output_string( } pos = buf;utf16_utf8_strcpy (&pos, string); -fputs (stdout, buf); +puts (buf);free (buf);/*
Signature · 1 line
2.43.0.rc1.413.gea7ed67945-goog
Re: [PATCH 1/7] efi: Use puts() in cout so that console recording works
Quoted 8 lines · Simon Glass
At present EFI output to the console use
fputs()which bypasses the console-recording feature. This makes it impossible for tests to check the output of an EFI app.There doesn't seem to be any need to do this bypass, so adjust it to simply use the
puts()function.Signed-off-by Simon Glass <[email protected]>
Reviewed: Heinrich Schuchardt <[email protected]>
Quoted 18 lines
---
lib/efi_loader/efi_console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/efi_loader/efi_console.c +1
-1@@ -182,7 +182,7 @@ static efi_status_t EFIAPI efi_cout_output_string( } pos = buf;utf16_utf8_strcpy (&pos, string); -fputs (stdout, buf); +puts (buf);free (buf);/*
Re: [PATCH 1/7] efi: Use puts() in cout so that console recording works
In reply to Simon GlassQuoted 2 lines · Simon Glass
At present EFI output to the console use
fputs()which bypasses the
nit, use ->uses
Quoted 7 lines
console-recording feature. This makes it impossible for tests to check the output of an EFI app.
There doesn't seem to be any need to do this bypass, so adjust it to simply use the
puts()function.Signed-off-by Simon Glass <[email protected]>
Quoted 21 lines
---
lib/efi_loader/efi_console.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)lib/efi_loader/efi_console.c +1
-2@@ -182,7 +182,7 @@ static efi_status_t EFIAPI efi_cout_output_string( } pos = buf;utf16_utf8_strcpy (&pos, string); -fputs (stdout, buf); +puts (buf);free (buf);/* -- 2.43.0.rc1.413.gea7ed67945-goog
PATCH 2/7 efi: Show the vendor in helloworld
In reply to Simon GlassShow the vendor name since it useful to see that.
---
lib/efi_loader/helloworld.c | 3 +++ 1 file changed, 3 insertions(+)
lib/efi_loader/helloworld.c +3 -0
@@ -234,6 +234,9 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle, (con_out,u"Missing device path for device handle\r\n" ); goto out; } + con_out->output_string (con_out,u"Vendor: " ); + con_out->output_string (con_out, systab->fw_vendor); + con_out->output_string (con_out,u"\n" ); con_out->output_string (con_out,u"Boot device: " ); ret =print_device_path (device_path, device_path_to_text);if (ret !=EFI_SUCCESS )
Signature · 1 line
2.43.0.rc1.413.gea7ed67945-goog
Re: [PATCH 2/7] efi: Show the vendor in helloworld
Quoted 1 line · Simon Glass
Show the vendor name since it useful to see that.
With this commit message it remains unclear why displaying the constant value (u"Das U-Boot") is of any value.
Best regards
Heinrich
Quoted 21 lines
Signed-off-by Simon Glass <[email protected]>---
lib/efi_loader/helloworld.c | 3 +++ 1 file changed, 3 insertions(+)lib/efi_loader/helloworld.c +3
-0@@ -234,6 +234,9 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle, (con_out,u"Missing device path for device handle\r\n" ); goto out; } + con_out->output_string (con_out,u"Vendor: " ); + con_out->output_string (con_out, systab->fw_vendor); + con_out->output_string (con_out,u"\n" ); con_out->output_string (con_out,u"Boot device: " ); ret =print_device_path (device_path, device_path_to_text);if (ret !=EFI_SUCCESS )
PATCH 3/7 efi: test: Create a disk image with and EFI app in it
In reply to Simon GlassCreate a new disk for use with test, which contains the sandbox helloworld app. This will be used to test the EFI boot bootmeth.
---
test/py/tests/test_ut.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
test/py/tests/test_ut.py +32 -0
@@ -468,6 +468,37 @@ def test_ut_dm_init(u_boot_console): with open(fn, 'wb') as fh: fh.write(data) + +def setup_efi_image(cons): + """Create a 20MB disk image with an EFI app on it""" + mmc_dev = 7 + fname, mnt = setup_image(cons, mmc_dev, 0xc, second_part=True) + + loop = None + mounted = False + try: + loop = mount_image(cons, fname, mnt, 'ext4') + mounted = True + efi_dir = os.path.join(mnt, 'efi') + mkdir_cond(efi_dir) + bootdir = os.path.join(efi_dir, 'boot') + mkdir_cond(bootdir) + efi_src = os.path.join(cons.config.build_dir, + f'lib/efi_loader/helloworld.efi') + efi_dst = os.path.join(bootdir, 'bootsbox.efi') + with open(efi_src, 'rb') as inf: + with open(efi_dst, 'wb') as outf: + outf.write(inf.read()) + + finally: + if mounted: + u_boot_utils.run_and_log(cons, 'sudo umount --lazy %s' % mnt) + if loop: + u_boot_utils.run_and_log(cons, 'sudo losetup -d %s' % loop) + + + + @pytest.mark.buildconfigspec('cmd_bootflow') def test_ut_dm_init_bootstd(u_boot_console): """Initialise data for bootflow tests"""
@@ -476,6 +507,7 @@ def test_ut_dm_init_bootstd(u_boot_console): setup_bootmenu_image(u_boot_console) setup_cedit_file(u_boot_console) setup_cros_image(u_boot_console) + setup_efi_image(u_boot_console) # Restart so that the new mmc1.img is picked up u_boot_console.restart_uboot()
Signature · 1 line
2.43.0.rc1.413.gea7ed67945-goog
Re: [PATCH 3/7] efi: test: Create a disk image with and EFI app in it
Quoted 14 lines · Simon Glass
Create a new disk for use with test, which contains the sandbox helloworld app. This will be used to test the EFI boot bootmeth.
Signed-off-by Simon Glass <[email protected]>---
test/py/tests/test_ut.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)test/py/tests/test_ut.py +0
-0
test/py/tests/test_ut.py def test_ut_dm_init(u_boot_console): · line 475
Quoted 8 lines
test/py/tests/test_ut.py +5
-0@@ -468,6 +468,37 @@ def test_ut_dm_init(u_boot_console): with open(fn, 'wb') as fh: fh.write(data) + +def setup_efi_image(cons): + """Create a 20MB disk image with an EFI app on it""" + mmc_dev = 7 + fname, mnt = setup_image(cons, mmc_dev, 0xc, second_part=True)
If you would set the partition type GUID to ESP, U-Boot would stop to complain about EFI variable that cannot be persisted.
There is a pending patch that wants to make the failure to persist EFI variable fatal.
[RESEND,v2] efi_loader: Fix UEFI variable error handling
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Best regards
Heinrich
Quoted 37 lines
test/py/tests/test_ut.py +27
-0+ + loop = None + mounted = False + try: + loop = mount_image(cons, fname, mnt, 'ext4') + mounted = True + efi_dir = os.path.join(mnt, 'efi') + mkdir_cond(efi_dir) + bootdir = os.path.join(efi_dir, 'boot') + mkdir_cond(bootdir) + efi_src = os.path.join(cons.config.build_dir, + f'lib/efi_loader/helloworld.efi') + efi_dst = os.path.join(bootdir, 'bootsbox.efi') + with open(efi_src, 'rb') as inf: + with open(efi_dst, 'wb') as outf: + outf.write(inf.read()) + + finally: + if mounted: + u_boot_utils.run_and_log(cons, 'sudo umount --lazy %s' % mnt) + if loop: + u_boot_utils.run_and_log(cons, 'sudo losetup -d %s' % loop) + + + + @pytest.mark.buildconfigspec('cmd_bootflow') def test_ut_dm_init_bootstd(u_boot_console): """Initialise data for bootflow tests"""@@ -476,6 +507,7 @@ def test_ut_dm_init_bootstd(u_boot_console): setup_bootmenu_image(u_boot_console) setup_cedit_file(u_boot_console) setup_cros_image(u_boot_console) + setup_efi_image(u_boot_console) # Restart so that the new mmc1.img is picked up u_boot_console.restart_uboot()
Re: [PATCH 3/7] efi: test: Create a disk image with and EFI app in it
Hi Heinrich,
Quoted 19 lines · Heinrich Schuchardt
Quoted 17 lines · Simon Glass
Create a new disk for use with test, which contains the sandbox helloworld app. This will be used to test the EFI boot bootmeth.
Signed-off-by Simon Glass <[email protected]>---
test/py/tests/test_ut.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)test/py/tests/test_ut.py +0
-0@@ -468,6 +468,37 @@ def test_ut_dm_init(u_boot_console): with open(fn, 'wb') as fh: fh.write(data)
Quoted 8 lines
test/py/tests/test_ut.py def test_ut_dm_init(u_boot_console): · line 475
Quoted 5 lines
test/py/tests/test_ut.py +5
-0+ +def setup_efi_image(cons): + """Create a 20MB disk image with an EFI app on it""" + mmc_dev = 7 + fname, mnt = setup_image(cons, mmc_dev, 0xc, second_part=True)If you would set the partition type GUID to ESP, U-Boot would stop to complain about EFI variable that cannot be persisted.
Doesn't that need a GPT partition type?
We do use that for the ChromeOS bootmeth (in setup_cros_image) so we could use it here too.
Quoted 6 lines
There is a pending patch that wants to make the failure to persist EFI variable fatal.
[RESEND,v2]
efi_loader: Fix UEFI variable error handling
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/
Regards,
Simon
PATCH 4/7 WIP: efi: Disable ANSI output
In reply to Simon GlassWe don't want ANSI characters written in tests since it is a pain to check the output.
For now, don't bother checking the console size.
A better solution is need, which allows ANSI output to be controlled within EFI.
---
include/efi_loader.h | 14 ++++++++++++-- lib/efi_loader/efi_console.c | 17 +++++++---------- lib/efi_loader/efi_setup.c | 2 +- 3 files changed, 20 insertions(+), 13 deletions(-)
include/efi_loader.h +12 -2
@@ -527,8 +527,18 @@ efi_status_t efi_bootmgr_update_media_device_boot_option(void);efi_status_t efi_bootmgr_delete_boot_option (u16 boot_index);/* search the boot option index in BootOrder */ bool efi_search_bootorder (u16 *bootorder,efi_uintn_t num,u32 target,u32 *index); -/* Set up console modes */ -void efi_setup_console_size (void ); + +/** +* efi_setup_console_size() - update the mode table. +* +* @allow_ansi: Allow emitting ANSI characters +* +* By default the only mode available is 80x25. If the console has at least 50 +* lines, enable mode 80x50. If we can query the console size and it is neither +* 80x25 nor 80x50, set it as an additional mode. +*/ +void efi_setup_console_size (bool allow_ansi); +/* Install device tree */ efi_status_t efi_install_fdt (void *fdt);/* Run loaded UEFI image */
lib/efi_loader/efi_console.c +7 -10
@@ -349,22 +349,19 @@ static int __maybe_unused query_vidconsole(int *rows, int *cols)return 0 ; } -/** -* efi_setup_console_size() - update the mode table. -* -* By default the only mode available is 80x25. If the console has at least 50 -* lines, enable mode 80x50. If we can query the console size and it is neither -* 80x25 nor 80x50, set it as an additional mode. -*/ -void efi_setup_console_size (void ) +void efi_setup_console_size (bool allow_ansi) {int rows =25 , cols =80 ;int ret = -ENODEV ;if (IS_ENABLED (CONFIG_VIDEO )) ret =query_vidconsole (&rows, &cols); -if (ret) - ret =query_console_serial (&rows, &cols); +if (ret) { +if (allow_ansi) + ret =query_console_serial (&rows, &cols); +else + ret =0 ; + }if (ret)return ;
lib/efi_loader/efi_setup.c +1 -1
@@ -230,7 +230,7 @@ efi_status_t efi_init_obj_list(void)return efi_obj_list_initialized;/* Set up console modes */ -efi_setup_console_size (); +efi_setup_console_size (false);/* * Probe block devices to find the ESP.
Signature · 1 line
2.43.0.rc1.413.gea7ed67945-goog
Re: [PATCH 4/7] WIP: efi: Disable ANSI output
Quoted 2 lines · Simon Glass
We don't want ANSI characters written in tests since it is a pain to check the output.
I never experienced such pain. The Gitlab output just renders things as expected.
Quoted 78 lines
For now, don't bother checking the console size.
A better solution is need, which allows ANSI output to be controlled within EFI.
Signed-off-by Simon Glass <[email protected]>---
include/efi_loader.h | 14 ++++++++++++-- lib/efi_loader/efi_console.c | 17 +++++++---------- lib/efi_loader/efi_setup.c | 2 +- 3 files changed, 20 insertions(+), 13 deletions(-)include/efi_loader.h +12
-2@@ -527,8 +527,18 @@ efi_status_t efi_bootmgr_update_media_device_boot_option(void);efi_status_t efi_bootmgr_delete_boot_option (u16 boot_index);/* search the boot option index in BootOrder */ bool efi_search_bootorder (u16 *bootorder,efi_uintn_t num,u32 target,u32 *index); -/* Set up console modes */ -void efi_setup_console_size (void ); + +/** +* efi_setup_console_size() - update the mode table. +* +* @allow_ansi: Allow emitting ANSI characters +* +* By default the only mode available is 80x25. If the console has at least 50 +* lines, enable mode 80x50. If we can query the console size and it is neither +* 80x25 nor 80x50, set it as an additional mode. +*/ +void efi_setup_console_size (bool allow_ansi); +/* Install device tree */ efi_status_t efi_install_fdt (void *fdt);/* Run loaded UEFI image */ lib/efi_loader/efi_console.c +7
-10@@ -349,22 +349,19 @@ static int __maybe_unused query_vidconsole(int *rows, int *cols)return 0 ; } -/** -* efi_setup_console_size() - update the mode table. -* -* By default the only mode available is 80x25. If the console has at least 50 -* lines, enable mode 80x50. If we can query the console size and it is neither -* 80x25 nor 80x50, set it as an additional mode. -*/ -void efi_setup_console_size (void ) +void efi_setup_console_size (bool allow_ansi) {int rows =25 , cols =80 ;int ret = -ENODEV ;if (IS_ENABLED (CONFIG_VIDEO )) ret =query_vidconsole (&rows, &cols); -if (ret) - ret =query_console_serial (&rows, &cols); +if (ret) { +if (allow_ansi) + ret =query_console_serial (&rows, &cols); +else + ret =0 ; + }if (ret)return ;lib/efi_loader/efi_setup.c +0
-0
lib/efi_loader/efi_setup.c efi_status_t efi_init_obj_list(void) · line 233
Quoted 5 lines
lib/efi_loader/efi_setup.c +1
-1@@ -230,7 +230,7 @@ efi_status_t efi_init_obj_list(void)return efi_obj_list_initialized;/* Set up console modes */ -efi_setup_console_size (); +efi_setup_console_size (false);
This would render our console non-compliant. Please, keep it as is.
Testing is not the primary task of U-Boot. If you need to filter test output, please, add a filter method to your test setup.
Best regards
Heinrich
Quoted 3 lines
lib/efi_loader/efi_setup.c +0
-0/* * Probe block devices to find the ESP.
Re: [PATCH 4/7] WIP: efi: Disable ANSI output
Hi Heinrich,
Quoted 88 lines · Heinrich Schuchardt
Quoted 2 lines · Simon Glass
We don't want ANSI characters written in tests since it is a pain to check the output.
I never experienced such pain. The Gitlab output just renders things as expected.
Quoted 80 lines
For now, don't bother checking the console size.
A better solution is need, which allows ANSI output to be controlled within EFI.
Signed-off-by Simon Glass <[email protected]>---
include/efi_loader.h | 14 ++++++++++++-- lib/efi_loader/efi_console.c | 17 +++++++---------- lib/efi_loader/efi_setup.c | 2 +- 3 files changed, 20 insertions(+), 13 deletions(-)include/efi_loader.h +12
-2@@ -527,8 +527,18 @@ efi_status_t efi_bootmgr_update_media_device_boot_option(void);efi_status_t efi_bootmgr_delete_boot_option (u16 boot_index);/* search the boot option index in BootOrder */ bool efi_search_bootorder (u16 *bootorder,efi_uintn_t num,u32 target,u32 *index); -/* Set up console modes */ -void efi_setup_console_size (void ); + +/** +* efi_setup_console_size() - update the mode table. +* +* @allow_ansi: Allow emitting ANSI characters +* +* By default the only mode available is 80x25. If the console has at least 50 +* lines, enable mode 80x50. If we can query the console size and it is neither +* 80x25 nor 80x50, set it as an additional mode. +*/ +void efi_setup_console_size (bool allow_ansi); +/* Install device tree */ efi_status_t efi_install_fdt (void *fdt);/* Run loaded UEFI image */ lib/efi_loader/efi_console.c +7
-10@@ -349,22 +349,19 @@ static int __maybe_unused query_vidconsole(int *rows, int *cols)return 0 ; } -/** -* efi_setup_console_size() - update the mode table. -* -* By default the only mode available is 80x25. If the console has at least 50 -* lines, enable mode 80x50. If we can query the console size and it is neither -* 80x25 nor 80x50, set it as an additional mode. -*/ -void efi_setup_console_size (void ) +void efi_setup_console_size (bool allow_ansi) {int rows =25 , cols =80 ;int ret = -ENODEV ;if (IS_ENABLED (CONFIG_VIDEO )) ret =query_vidconsole (&rows, &cols); -if (ret) - ret =query_console_serial (&rows, &cols); +if (ret) { +if (allow_ansi) + ret =query_console_serial (&rows, &cols); +else + ret =0 ; + }if (ret)return ;lib/efi_loader/efi_setup.c +0
-0@@ -230,7 +230,7 @@ efi_status_t efi_init_obj_list(void)return efi_obj_list_initialized;
Quoted 8 lines
lib/efi_loader/efi_setup.c efi_status_t efi_init_obj_list(void) · line 233
Quoted 3 lines
lib/efi_loader/efi_setup.c +1
-1/* Set up console modes */ -efi_setup_console_size (); +efi_setup_console_size (false);This would render our console non-compliant. Please, keep it as is.
Testing is not the primary task of U-Boot. If you need to filter test output, please, add a filter method to your test setup.
This is just a WIP patch, but we do need a way to avoid outputting ANSI output since ut_assert_nextline() needs that. Can you suggest a better way? Perhaps we could have some EFI settings somewhere?
Regards,
Simon
PATCH 5/7 WIP: efi: Add a test for the EFI bootmeth
In reply to Simon GlassAdd a simple test which checks that we can run an EFI app and that the call to exit boot services works OK.
This is intended to catch the recent bootflow bug fixed by:
https://patchwork.ozlabs.org/project/uboot/patch/
20231115183522.1.I4cbfd34d576c0ad66a74c6ec3e8024adabc73573@changeid/
TODO:
- change it to use USB instead of mmc
- drop the hacks in test.dts
---
arch/sandbox/dts/test.dts | 10 +++++++- test/boot/bootflow.c | 53 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-)
arch/sandbox/dts/test.dts +9 -1
@@ -43,6 +43,7 @@ mmc4 = "/mmc4"; mmc5 = "/mmc5"; mmc6 = "/mmc6"; + mmc7 = "/mmc7"; pci0 = &pci0; pci1 = &pci1; pci2 = &pci2;
@@ -108,7 +109,7 @@ compatible = "u-boot,boot-std"; filename-prefixes = "/", "/boot/"; - bootdev-order = "mmc2", "mmc1"; + /*bootdev-order = "mmc2", "mmc1";*/ extlinux { compatible = "u-boot,extlinux";
@@ -1127,6 +1128,13 @@ filename = "mmc6.img"; }; + /* This is used for EFI tests */ + mmc7 { +/* status = "disabled";*/ + compatible = "sandbox,mmc"; + filename = "mmc7.img"; + }; + pch { compatible = "sandbox,pch"; };
test/boot/bootflow.c +53 -0
68 lines not on this page · raw message
Signature · 1 line
2.43.0.rc1.413.gea7ed67945-goog
PATCH 6/7 WIP: efi: Allow helloworld to exit boot services
In reply to Simon GlassThis allows testing of the exit_boot_services call, providing more coverage of the EFI bootmeth.
---
lib/efi_loader/helloworld.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-)
lib/efi_loader/helloworld.c +35 -1
@@ -206,6 +206,26 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle, (con_out,u"Cannot open loaded image protocol\r\n" ); goto out; } + + { +ulong ptr = (ulong )loaded_image; +u16 str[80 ]; +int i; + +for (i =0 ; i <8 ; i++) { +uint digit = (ptr >> ((7 - i) *4 )) &0xf ; + +if (digit >9 ) + digit ='a' + digit -10 ; +else + digit +='0' ; + str[i] = digit; + } + str[i] =0 ; + con_out->output_string (con_out, str); + con_out->output_string (con_out,u"\n" ); + } +print_load_options (loaded_image);/* Get the device path to text protocol */
@@ -243,7 +263,21 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle, goto out; out: - boottime->exit (handle, ret,0 ,NULL ); +/* +* TODO: Use vendor string to decide whether to call exit-boot-services +*/ +efi_uintn_t map_size =0 ; +efi_uintn_t map_key; +efi_uintn_t desc_size; +u32 desc_version; + + ret = boottime->get_memory_map (&map_size,NULL , &map_key, &desc_size, + &desc_version); + con_out->output_string (con_out,u"Exiting boot sevices\n" ); + + boottime->exit_boot_services (handle, map_key); + + ret = boottime->exit (handle, ret,0 ,NULL );/* We should never arrive here */ return ret;
Signature · 1 line
2.43.0.rc1.413.gea7ed67945-goog
Re: [PATCH 6/7] WIP: efi: Allow helloworld to exit boot services
Quoted 4 lines · Simon Glass
This allows testing of the
exit_boot_servicescall, providing more coverage of the EFI bootmeth.Signed-off-by Simon Glass <[email protected]>
I would prefer to keep helloworld.efi benign.
Please, create a new EFI binary for testing ExitBootServices().
Quoted 46 lines
---
lib/efi_loader/helloworld.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-)lib/efi_loader/helloworld.c +25
-1@@ -206,6 +206,26 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle, (con_out,u"Cannot open loaded image protocol\r\n" ); goto out; } + + { +ulong ptr = (ulong )loaded_image; +u16 str[80 ]; +int i; + +for (i =0 ; i <8 ; i++) { +uint digit = (ptr >> ((7 - i) *4 )) &0xf ; + +if (digit >9 ) + digit ='a' + digit -10 ; +else + digit +='0' ; + str[i] = digit; + } + str[i] =0 ; + con_out->output_string (con_out, str); + con_out->output_string (con_out,u"\n" ); + } +print_load_options (loaded_image);/* Get the device path to text protocol */ @@ -243,7 +263,21 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle, goto out; out: - boottime->exit (handle, ret,0 ,NULL ); +/* +* TODO: Use vendor string to decide whether to call exit-boot-services +*/ +efi_uintn_t map_size =0 ; +efi_uintn_t map_key;
lib/efi_loader/helloworld.c efi_status_t EFIAPI efi_main(efi_handle_t handle, · line 280
Quoted 10 lines
lib/efi_loader/helloworld.c +10
-0+efi_uintn_t desc_size; +u32 desc_version; + + ret = boottime->get_memory_map (&map_size,NULL , &map_key, &desc_size, + &desc_version); + con_out->output_string (con_out,u"Exiting boot sevices\n" ); + + boottime->exit_boot_services (handle, map_key); + + ret = boottime->exit (handle, ret,0 ,NULL );
After ExitBootServices() you must not call boot services.
Call runtime->reset_system(EFI_RESET_COLD, EFI_SUCCESS, 0, NULL) instead.
Best regards
Heinrich
Quoted 3 lines
lib/efi_loader/helloworld.c +0
-0/* We should never arrive here */ return ret;
Re: [PATCH 6/7] WIP: efi: Allow helloworld to exit boot services
Hi Heinrich,
Quoted 10 lines · Heinrich Schuchardt
Quoted 4 lines · Simon Glass
This allows testing of the
exit_boot_servicescall, providing more coverage of the EFI bootmeth.Signed-off-by Simon Glass <[email protected]>I would prefer to keep helloworld.efi benign.
Please, create a new EFI binary for testing
ExitBootServices().
Eek...isn't helloworld already used in tets?
Quoted 60 lines
Quoted 47 lines
---
lib/efi_loader/helloworld.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-)lib/efi_loader/helloworld.c +25
-1@@ -206,6 +206,26 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle, (con_out,u"Cannot open loaded image protocol\r\n" ); goto out; } + + { +ulong ptr = (ulong )loaded_image; +u16 str[80 ]; +int i; + +for (i =0 ; i <8 ; i++) { +uint digit = (ptr >> ((7 - i) *4 )) &0xf ; + +if (digit >9 ) + digit ='a' + digit -10 ; +else + digit +='0' ; + str[i] = digit; + } + str[i] =0 ; + con_out->output_string (con_out, str); + con_out->output_string (con_out,u"\n" ); + } +print_load_options (loaded_image);/* Get the device path to text protocol */ @@ -243,7 +263,21 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle, goto out; out: - boottime->exit (handle, ret,0 ,NULL ); +/* +* TODO: Use vendor string to decide whether to call exit-boot-services +*/ +efi_uintn_t map_size =0 ; +efi_uintn_t map_key;lib/efi_loader/helloworld.c efi_status_t EFIAPI efi_main(efi_handle_t handle, · line 280
Quoted 10 lines
lib/efi_loader/helloworld.c +10
-0+efi_uintn_t desc_size; +u32 desc_version; + + ret = boottime->get_memory_map (&map_size,NULL , &map_key, &desc_size, + &desc_version); + con_out->output_string (con_out,u"Exiting boot sevices\n" ); + + boottime->exit_boot_services (handle, map_key); + + ret = boottime->exit (handle, ret,0 ,NULL );After
ExitBootServices()you must not call boot services.
Quoted 1 line
Call
runtime->reset_system(EFI_RESET_COLD, EFI_SUCCESS, 0, NULL)instead.
OK, will do. That will be ignored by sandbox, right?
For now this is just a hack to try to resolve the problem mentioned.
Regards,
Simon
Re: [PATCH 6/7] WIP: efi: Allow helloworld to exit boot services
Hi Simon,
Quoted 9 lines · Simon Glass
Hi Heinrich,
Quoted 5 lines · Heinrich Schuchardt
Quoted 3 lines · Simon Glass
This allows testing of the
exit_boot_servicescall, providing more coverage of the EFI bootmeth.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Simon Glass <[email protected]>I would prefer to keep helloworld.efi benign.
Please, create a new EFI binary for testing
ExitBootServices().Eek...isn't helloworld already used in tets?\
Yes, but calling exitboot services from it means we need to be really careful when/how we call it, since once that app runs the boottime services along with any attached disks will disappear. Instead having a single EFI app that calls that and then tests for any runtime services is more scalable
Thanks
/Ilias
Quoted 69 lines
Quoted 61 lines
Quoted 48 lines
---
lib/efi_loader/helloworld.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-)lib/efi_loader/helloworld.c +25
-1@@ -206,6 +206,26 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle, (con_out,u"Cannot open loaded image protocol\r\n" ); goto out; } + + { +ulong ptr = (ulong )loaded_image; +u16 str[80 ]; +int i; + +for (i =0 ; i <8 ; i++) { +uint digit = (ptr >> ((7 - i) *4 )) &0xf ; + +if (digit >9 ) + digit ='a' + digit -10 ; +else + digit +='0' ; + str[i] = digit; + } + str[i] =0 ; + con_out->output_string (con_out, str); + con_out->output_string (con_out,u"\n" ); + } +print_load_options (loaded_image);/* Get the device path to text protocol */ @@ -243,7 +263,21 @@ efi_status_t EFIAPI efi_main(efi_handle_t handle, goto out; out: - boottime->exit (handle, ret,0 ,NULL ); +/* +* TODO: Use vendor string to decide whether to call exit-boot-services +*/ +efi_uintn_t map_size =0 ; +efi_uintn_t map_key;lib/efi_loader/helloworld.c efi_status_t EFIAPI efi_main(efi_handle_t handle, · line 280
Quoted 10 lines
lib/efi_loader/helloworld.c +10
-0+efi_uintn_t desc_size; +u32 desc_version; + + ret = boottime->get_memory_map (&map_size,NULL , &map_key, &desc_size, + &desc_version); + con_out->output_string (con_out,u"Exiting boot sevices\n" ); + + boottime->exit_boot_services (handle, map_key); + + ret = boottime->exit (handle, ret,0 ,NULL );After
ExitBootServices()you must not call boot services.Quoted 1 line
Call
runtime->reset_system(EFI_RESET_COLD, EFI_SUCCESS, 0, NULL)instead.OK, will do. That will be ignored by sandbox, right?
For now this is just a hack to try to resolve the problem mentioned.
Regards,
Simon
Re: [PATCH 6/7] WIP: efi: Allow helloworld to exit boot services
Hi Ilias,
Quoted 19 lines · Ilias Apalodimas
Hi Simon,
Quoted 15 lines · Simon Glass
Hi Heinrich,
Quoted 10 lines · Heinrich Schuchardt
Quoted 4 lines · Simon Glass
This allows testing of the
exit_boot_servicescall, providing more coverage of the EFI bootmeth.Signed-off-by Simon Glass <[email protected]>I would prefer to keep helloworld.efi benign.
Please, create a new EFI binary for testing
ExitBootServices().
Quoted 7 lines
Quoted 1 line
Eek...isn't helloworld already used in tets?\
Yes, but calling exitboot services from it means we need to be really careful when/how we call it, since once that app runs the boottime services along with any attached disks will disappear. Instead having a single EFI app that calls that and then tests for any runtime services is more scalable
OK I can add a new app.
I am still stuck on the actual bug mentioned in the cover letter, though.
Regards,
Simon
PATCH 7/7 WIP: efi: debugging
In reply to Simon GlassThis works when run outside a test:
good:
/tmp/b/sandbox/u-boot -T
-c "bootfl scan mmc; bootfl sel 1; bootfl list; bootfl b"
** Booting bootflow 'mmc7.bootdev.part_1' with efi
desc = 0000000018c86ee0
dev=mmc, devnr=7:1, path=efi/boot/bootsbox.efi, buffer=0000000011001000, size=1600
- boot device /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/SD(7)/SD(3)/HD(1,MBR,0x2f7d9756,0x800,0x9000)
- image /efi\boot\bootsbox.efi
No EFI system partition
No EFI system partition
Failed to persist EFI variables
EFI using ACPI tables at 8ef8000
WARNING: Can't have ACPI table and device tree - ignoring DT.
Loaded from disk
Booting /efi\boot\bootsbox.efi
EFI: Call: efi_load_image(false, efi_root, file_path, source_buffer, source_size, &handle) info->device_handle = 0000000018f180e0loaded_image info for 0000000018f184e0: 0000000018f18470
EFI: 0 returned by efi_load_image(false, efi_root, file_path, source_buffer, source_size, &handle)
EFI: Call: efi_start_image(handle, &exit_data_size, &exit_data)
Hello, world!
Running on UEFI 2.10
Have ACPI 2.0 table
Have SMBIOS table18f18470
Load options: <none>
finding
- search 0000000018c931a0 ret=0
File path: /efi\boot\bootsbox.efi
Vendor: Das U-Boot
Boot device: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/SD(7)/SD(3)/HD(1,MBR,0x2f7d9756,0x800,0x9000) Exiting boot sevices
EFI: 5 returned by efi_start_image(handle, &exit_data_size, &exit_data)
Boot failed (err=-22)
bad:
rtv bootflow_efi
** Booting bootflow 'mmc7.bootdev.part_1' with efi
desc = 0000000018c86ee0
dev=mmc, devnr=8:1, path=efi/boot/bootsbox.efi, buffer=0000000011001000, size=1600
- boot device /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/SD(7)/SD(3)/HD(1,MBR,0x2f7d9756,0x800,0x9000)
- image /efi\boot\bootsbox.efi
No EFI system partition
No EFI system partition
Failed to persist EFI variables
EFI using ACPI tables at 8ef8000
WARNING: Can't have ACPI table and device tree - ignoring DT.
Loaded from disk
Booting /efi\boot\bootsbox.efi
EFI: Call: efi_load_image(false, efi_root, file_path, source_buffer, source_size, &handle) info->device_handle = 0000000000000000loaded_image info for 0000000018c924e0: 0000000018f15080
EFI: 0 returned by efi_load_image(false, efi_root, file_path, source_buffer, source_size, &handle)
EFI: Call: efi_start_image(handle, &exit_data_size, &exit_data)
Hello, world!
Running on UEFI 2.10
Have ACPI 2.0 table
Have SMBIOS table18f15080
Load options: <none>
finding
- search 0000000018c931a0 ret=0
File path: /efi\boot\bootsbox.efi
Missing device handle
Exiting boot sevices
EFI: 5 returned by efi_start_image(handle, &exit_data_size, &exit_data)
Boot failed (err=-22)test/boot/bootflow.c:1091, bootflow_efi(): console:
Expected 'No EFI system partition',
got 'desc = 0000000018c86ee0'
Test bootflow_efi failed 1 times
Failures: 1
(see 'Missing device handle')
It seems that the device number is inconsistent between generation and decoding.
function rt_get_suite_and_name() {
local arg
#echo arg $arg
suite=
name=
if [ "$1" = "-f" ]; then
force="-f"
shift
fi
arg="$1"
rest="$2"
# The symbol is something like this:
# _u_boot_list_2_ut_bootstd_test_2_vbe_simple_test_base
# Split it into the suite name (bootstd) and test name
# (vbe_simple_test_base)
read suite name < \
<(nm /tmp/b/$exec/u-boot |grep "list_2_ut.*$arg.*" \
| cut -d' ' -f3 \
| head -1 \
| sed -n 's/_u_boot_list_2_ut_\(.*\)_test_2_/\1 /p')
#echo suite $suite
#echo name $name
#name=${1#dm_test_}
#name=${name#ut_dm_}
}function rtv() {
local exec=sandbox
local suite name force rest
rt_get_suite_and_name $*
U_BOOT_PERSISTENT_DATA_DIR=/tmp/b/sandbox/persistent-data \
/tmp/b/$exec/u-boot -v -T $rest -c "ut $suite $force $name"
}---
boot/bootflow.c | 2 ++ boot/bootmeth_efi.c | 1 + cmd/bootefi.c | 1 + lib/efi_loader/efi_boottime.c | 5 +++++ test/boot/bootflow.c | 2 +- 5 files changed, 10 insertions(+), 1 deletion(-)
boot/bootflow.c +2 -0
@@ -464,6 +464,8 @@ void bootflow_init(struct bootflow *bflow, struct udevice *bootdev,void bootflow_free (struct bootflow *bflow) { +/* this is where we want to get to (will only happen with USB) */ +printf ("bootflow free\n" );free (bflow->name);free (bflow->subdir);free (bflow->fname);
boot/bootmeth_efi.c +1 -0
@@ -127,6 +127,7 @@ static void set_efi_bootdev(struct blk_desc *desc, struct bootflow *bflow)* this can go away. */ media_dev =dev_get_parent (bflow->dev); +printf ("desc = %p\n" , desc);snprintf (devnum_str,sizeof (devnum_str),"%x:%x" , desc ? desc->devnum :dev_seq (media_dev), bflow->part);
cmd/bootefi.c +1 -0
@@ -5,6 +5,7 @@* Copyright (c) 2016 Alexander Graf */ +#define LOG_DEBUG #define LOG_CATEGORY LOGC_EFI#include <common.h>
lib/efi_loader/efi_boottime.c +5 -0
@@ -1820,6 +1820,7 @@ efi_status_t efi_setup_loaded_image(struct efi_device_path *device_path,if (device_path) { info->device_handle =efi_dp_find_obj (device_path,NULL ,NULL ); +printf ("info->device_handle = %p\n" , info->device_handle); dp =efi_dp_append (device_path, file_path);if (!dp) {
@@ -1828,6 +1829,7 @@ efi_status_t efi_setup_loaded_image(struct efi_device_path *device_path, } }else { dp =NULL ; +printf ("\nno device handle\n" ); } ret =efi_add_protocol (&obj->header, &efi_guid_loaded_image_device_path, dp);
@@ -1842,6 +1844,7 @@ efi_status_t efi_setup_loaded_image(struct efi_device_path *device_path, &efi_guid_loaded_image, info);if (ret !=EFI_SUCCESS ) goto failure; +printf ("loaded_image info for %p: %p\n\n" , &obj->header, info); *info_ptr = info; *handle_ptr = obj;
@@ -2665,8 +2668,10 @@ static efi_status_t EFIAPI efi_locate_protocol(const efi_guid_t *protocol,if (ret ==EFI_SUCCESS ) goto found; }else { +printf ("finding\n" );list_for_each_entry (efiobj, &efi_obj_list, link) { ret =efi_search_protocol (efiobj, protocol, &handler); +printf ("- search %p ret=%lx\n" , efiobj, ret);if (ret ==EFI_SUCCESS ) goto found; }
test/boot/bootflow.c +1 -1
@@ -536,7 +536,7 @@ static int prep_mmc_bootdev(struct unit_test_state *uts, const char *mmc_dev, order[2 ] = mmc_dev; -/* Enable the mmc4 node since we need a second bootflow */ +/* Enable the requested mmc node since we need a second bootflow */ root =oftree_root (oftree_default ()); node =ofnode_find_subnode (root, mmc_dev);ut_assert (ofnode_valid (node));
Signature · 1 line
2.43.0.rc1.413.gea7ed67945-goog
Re: [PATCH 7/7] WIP: efi: debugging
Quoted 40 lines · Simon Glass
This works when run outside a test:
good:
/tmp/b/sandbox/u-boot-T
-c "bootfl scan mmc; bootfl sel 1; bootfl list; bootfl b"** Booting bootflow 'mmc7.bootdev.part_1' with efi
desc =0000000018c86ee0
dev=mmc, devnr=7:1, path=efi/boot/bootsbox.efi, buffer=0000000011001000, size=1600
- boot device /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/SD(7)/SD(3)/HD(1,MBR,0x2f7d9756,0x800,0x9000)
- image /efi\boot\bootsbox.efi
No EFI system partition
No EFI system partition
Failed to persist EFI variables
EFI using ACPI tables at 8ef8000
WARNING: Can't have ACPI table and device tree - ignoring DT.
Loaded from disk
Booting /efi\boot\bootsbox.efi
EFI: Call:efi_load_image(false, efi_root, file_path, source_buffer, source_size, &handle)info->device_handle=0000000018f180e0loaded_imageinfo for0000000018f184e0:0000000018f18470EFI: 0 returned by
efi_load_image(false, efi_root, file_path, source_buffer, source_size, &handle)
EFI: Call:efi_start_image(handle, &exit_data_size, &exit_data)
Hello, world!
Running on UEFI 2.10
Have ACPI 2.0 table
Have SMBIOS table18f18470
Load options: <none>
finding
- search0000000018c931a0ret=0
File path: /efi\boot\bootsbox.efi
Vendor: Das U-Boot
Boot device: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/SD(7)/SD(3)/HD(1,MBR,0x2f7d9756,0x800,0x9000) Exiting boot sevices
EFI: 5 returned byefi_start_image(handle, &exit_data_size, &exit_data)
Boot failed (err=-22)
Quoted 5 lines
bad:
rtv
bootflow_efi** Booting bootflow 'mmc7.bootdev.part_1' with efi
Should we have an ESP on the MMC image to persist UEFI variables?
Best regards
Heinrich
Quoted 177 lines
desc =
0000000018c86ee0
dev=mmc, devnr=8:1, path=efi/boot/bootsbox.efi, buffer=0000000011001000, size=1600
- boot device /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/SD(7)/SD(3)/HD(1,MBR,0x2f7d9756,0x800,0x9000)
- image /efi\boot\bootsbox.efi
No EFI system partition
No EFI system partition
Failed to persist EFI variables
EFI using ACPI tables at 8ef8000
WARNING: Can't have ACPI table and device tree - ignoring DT.
Loaded from disk
Booting /efi\boot\bootsbox.efi
EFI: Call:efi_load_image(false, efi_root, file_path, source_buffer, source_size, &handle)info->device_handle= 0000000000000000loaded_imageinfo for0000000018c924e0:0000000018f15080EFI: 0 returned by
efi_load_image(false, efi_root, file_path, source_buffer, source_size, &handle)
EFI: Call:efi_start_image(handle, &exit_data_size, &exit_data)
Hello, world!
Running on UEFI 2.10
Have ACPI 2.0 table
Have SMBIOS table18f15080
Load options: <none>
finding
- search0000000018c931a0ret=0
File path: /efi\boot\bootsbox.efi
Missing device handle
Exiting boot sevices
EFI: 5 returned byefi_start_image(handle, &exit_data_size, &exit_data)
Boot failed (err=-22)test/boot/bootflow.c:1091,bootflow_efi(): console:
Expected 'No EFI system partition',got 'desc = 0000000018c86ee0'Test
bootflow_efifailed 1 times
Failures: 1(see 'Missing device handle')
It seems that the device number is inconsistent between generation and decoding.
function rt_get_suite_and_name() { local arg #echo arg $arg suite= name= if [ "$1" = "-f" ]; then force="-f" shift fi arg="$1" rest="$2" # The symbol is something like this: # _u_boot_list_2_ut_bootstd_test_2_vbe_simple_test_base # Split it into the suite name (bootstd) and test name # (vbe_simple_test_base) read suite name < \ <(nm /tmp/b/$exec/u-boot |grep "list_2_ut.*$arg.*" \ | cut -d' ' -f3 \ | head -1 \ | sed -n 's/_u_boot_list_2_ut_\(.*\)_test_2_/\1 /p') #echo suite $suite #echo name $name #name=${1#dm_test_} #name=${name#ut_dm_} }function rtv() { local exec=sandbox local suite name force rest rt_get_suite_and_name $* U_BOOT_PERSISTENT_DATA_DIR=/tmp/b/sandbox/persistent-data \ /tmp/b/$exec/u-boot -v -T $rest -c "ut $suite $force $name" }Signed-off-by Simon Glass <[email protected]>---
boot/bootflow.c | 2 ++ boot/bootmeth_efi.c | 1 + cmd/bootefi.c | 1 + lib/efi_loader/efi_boottime.c | 5 +++++ test/boot/bootflow.c | 2 +- 5 files changed, 10 insertions(+), 1 deletion(-)boot/bootflow.c +2
-0@@ -464,6 +464,8 @@ void bootflow_init(struct bootflow *bflow, struct udevice *bootdev,void bootflow_free (struct bootflow *bflow) { +/* this is where we want to get to (will only happen with USB) */ +printf ("bootflow free\n" );free (bflow->name);free (bflow->subdir);free (bflow->fname);boot/bootmeth_efi.c +1
-0@@ -127,6 +127,7 @@ static void set_efi_bootdev(struct blk_desc *desc, struct bootflow *bflow)* this can go away. */ media_dev =dev_get_parent (bflow->dev); +printf ("desc = %p\n" , desc);snprintf (devnum_str,sizeof (devnum_str),"%x:%x" , desc ? desc->devnum :dev_seq (media_dev), bflow->part);cmd/bootefi.c +1
-0@@ -5,6 +5,7 @@* Copyright (c) 2016 Alexander Graf */ +#define LOG_DEBUG #define LOG_CATEGORY LOGC_EFI#include <common.h> lib/efi_loader/efi_boottime.c +5
-0@@ -1820,6 +1820,7 @@ efi_status_t efi_setup_loaded_image(struct efi_device_path *device_path,if (device_path) { info->device_handle =efi_dp_find_obj (device_path,NULL ,NULL ); +printf ("info->device_handle = %p\n" , info->device_handle); dp =efi_dp_append (device_path, file_path);if (!dp) {@@ -1828,6 +1829,7 @@ efi_status_t efi_setup_loaded_image(struct efi_device_path *device_path, } }else { dp =NULL ; +printf ("\nno device handle\n" ); } ret =efi_add_protocol (&obj->header, &efi_guid_loaded_image_device_path, dp);@@ -1842,6 +1844,7 @@ efi_status_t efi_setup_loaded_image(struct efi_device_path *device_path, &efi_guid_loaded_image, info);if (ret !=EFI_SUCCESS ) goto failure; +printf ("loaded_image info for %p: %p\n\n" , &obj->header, info); *info_ptr = info; *handle_ptr = obj;@@ -2665,8 +2668,10 @@ static efi_status_t EFIAPI efi_locate_protocol(const efi_guid_t *protocol,if (ret ==EFI_SUCCESS ) goto found; }else { +printf ("finding\n" );list_for_each_entry (efiobj, &efi_obj_list, link) { ret =efi_search_protocol (efiobj, protocol, &handler); +printf ("- search %p ret=%lx\n" , efiobj, ret);if (ret ==EFI_SUCCESS ) goto found; }test/boot/bootflow.c +1
-1@@ -536,7 +536,7 @@ static int prep_mmc_bootdev(struct unit_test_state *uts, const char *mmc_dev, order[2 ] = mmc_dev; -/* Enable the mmc4 node since we need a second bootflow */ +/* Enable the requested mmc node since we need a second bootflow */ root =oftree_root (oftree_default ()); node =ofnode_find_subnode (root, mmc_dev);ut_assert (ofnode_valid (node));
Re: [PATCH 7/7] WIP: efi: debugging
Hi Heinrich,
Quoted 42 lines · Heinrich Schuchardt
Quoted 40 lines · Simon Glass
This works when run outside a test:
good:
/tmp/b/sandbox/u-boot-T
-c "bootfl scan mmc; bootfl sel 1; bootfl list; bootfl b"** Booting bootflow 'mmc7.bootdev.part_1' with efi
desc =0000000018c86ee0
dev=mmc, devnr=7:1, path=efi/boot/bootsbox.efi, buffer=0000000011001000, size=1600
- boot device /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/SD(7)/SD(3)/HD(1,MBR,0x2f7d9756,0x800,0x9000)
- image /efi\boot\bootsbox.efi
No EFI system partition
No EFI system partition
Failed to persist EFI variables
EFI using ACPI tables at 8ef8000
WARNING: Can't have ACPI table and device tree - ignoring DT.
Loaded from disk
Booting /efi\boot\bootsbox.efi
EFI: Call:efi_load_image(false, efi_root, file_path, source_buffer, source_size, &handle)info->device_handle=0000000018f180e0loaded_imageinfo for0000000018f184e0:0000000018f18470EFI: 0 returned by
efi_load_image(false, efi_root, file_path, source_buffer, source_size, &handle)
EFI: Call:efi_start_image(handle, &exit_data_size, &exit_data)
Hello, world!
Running on UEFI 2.10
Have ACPI 2.0 table
Have SMBIOS table18f18470
Load options: <none>
finding
- search0000000018c931a0ret=0
File path: /efi\boot\bootsbox.efi
Vendor: Das U-Boot
Boot device: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b,0000000000000000)/SD(7)/SD(3)/HD(1,MBR,0x2f7d9756,0x800,0x9000) Exiting boot sevices
EFI: 5 returned byefi_start_image(handle, &exit_data_size, &exit_data)
Boot failed (err=-22)
Quoted 7 lines
Quoted 5 lines
bad:
rtv
bootflow_efi** Booting bootflow 'mmc7.bootdev.part_1' with efi
Should we have an ESP on the MMC image to persist UEFI variables?
That would be a good enhancement, but I would like to get the basics going first.
Regards,
Simon
Hi Heinrich,
Quoted 11 lines · Simon Glass
The test coverage for the EFI bootmeth is incomplete since it does not actually boot the application.
This series makes an attempt at this.
However there are at least two problems:
1. The test does not set up the loaded image properly, so it isn't found by the app.
2. The test needs to use USB instead of mmc, so thatusb_stop()is called
I think you may have missed the point of this series. I am not sure how to fix problem #1 above. Do you know what is going on, or could you help figure it out, please?
Quoted 24 lines
Simon Glass (7):
efi: Useputs()in cout so that console recording works
efi: Show the vendor in helloworld
efi: test: Create a disk image with and EFI app in it
WIP: efi: Disable ANSI output
WIP: efi: Add a test for the EFI bootmeth
WIP: efi: Allow helloworld to exit boot services
WIP: efi: debuggingarch/sandbox/dts/test.dts | 10 ++++++- boot/bootflow.c | 2 ++ boot/bootmeth_efi.c | 1 + cmd/bootefi.c | 1 + include/efi_loader.h | 14 +++++++-- lib/efi_loader/efi_boottime.c | 5 ++++ lib/efi_loader/efi_console.c | 19 +++++------- lib/efi_loader/efi_setup.c | 2 +- lib/efi_loader/helloworld.c | 39 ++++++++++++++++++++++++- test/boot/bootflow.c | 55 ++++++++++++++++++++++++++++++++++- test/py/tests/test_ut.py | 32 ++++++++++++++++++++ 11 files changed, 163 insertions(+), 17 deletions(-)
Quoted 3 lines
--
2.43.0.rc1.413.gea7ed67945-goog
Regards,
Simon