Skip to contentSkip to conversation

efidebug: Introduce bootmgr command

PATCH New Ilias Apalodimas 4 participants 10 messages Feb 10, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 efidebug: Introduce bootmgr command

Up to now we've been adding all the efi related configuration to 'efidebug' command. The command name feels a bit weird to configure boot manager related commands. Since the bootmanager is growing and we intend to extend it with features like defining the initrd we want to expose to the kernel, it would make sense to split it on a command of it's own.

So let's introduce a new command called bootmgr and move all of the existing Boot manager functionality there.

---
 cmd/Makefile                                  |   1 +
 cmd/bootmgr.c                                 | 640 ++++++++++++++++++
 cmd/efidebug.c                                | 580 +---------------
 doc/board/emulation/qemu_capsule_update.rst   |   8 +-
 doc/uefi/uefi.rst                             |   2 +-
 .../test_efi_capsule/test_capsule_firmware.py |  12 +-
 test/py/tests/test_efi_secboot/test_signed.py |  48 +-
 .../test_efi_secboot/test_signed_intca.py     |  22 +-
 .../tests/test_efi_secboot/test_unsigned.py   |  22 +-
 9 files changed, 699 insertions(+), 636 deletions(-)
 create mode 100644 cmd/bootmgr.c
cmd/Makefile +1 -0
index 176bf925fdc4..c50fe9204757 100644
@@ -29,6 +29,7 @@ obj-$(CONFIG_CMD_BLOCK_CACHE) += blkcache.o
 obj-$(CONFIG_CMD_BMP) += bmp.o
 obj-$(CONFIG_CMD_BOOTCOUNT) += bootcount.o
 obj-$(CONFIG_CMD_BOOTEFI) += bootefi.o
+obj-$(CONFIG_CMD_BOOTEFI_BOOTMGR) += bootmgr.o
 obj-$(CONFIG_CMD_BOOTMENU) += bootmenu.o
 obj-$(CONFIG_CMD_BOOTSTAGE) += bootstage.o
 obj-$(CONFIG_CMD_BOOTZ) += bootz.o
cmd/bootmgr.c new file +640 -0

640 lines not on this page · raw message

cmd/efidebug.c +1 -579

598 lines not on this page · raw message

doc/board/emulation/qemu_capsule_update.rst +4 -4
index 9fec75f8f1c9..3f94f72e5e34 100644
@@ -60,8 +60,8 @@ to be pointing to the EFI System Partition which contains the capsule
 file. The BootNext, BootXXXX and OsIndications variables can be set
 using the following commands::
 
-    => efidebug boot add 0 Boot0000 virtio 0:1 <capsule_file_name>
-    => efidebug boot next 0
+    => bootmgr boot add 0 Boot0000 virtio 0:1 <capsule_file_name>
+    => bootmgr boot next 0
     => setenv -e -nv -bs -rt -v OsIndications =0x04
     => saveenv
 
@@ -198,8 +198,8 @@ command line::
     3. Set the following environment and UEFI boot variables
 
         => setenv -e -nv -bs -rt -v OsIndications =0x04
-        => efidebug boot add 0 Boot0000 virtio 0:1 <capsule_file_name>
-        => efidebug boot next 0
+        => bootmgr boot add 0 Boot0000 virtio 0:1 <capsule_file_name>
+        => bootmgr boot next 0
         => saveenv
 
     4. Finally, the capsule update can be initiated with the following
doc/uefi/uefi.rst +1 -1
index 5a67737c1579..02a377b834f0 100644
@@ -178,7 +178,7 @@ Now in U-Boot install the keys on your board::
 
 Set up boot parameters on your board::
 
-    efidebug boot add 1 HELLO mmc 0:1 /helloworld.efi.signed ""
+    bootmgr boot add 1 HELLO mmc 0:1 /helloworld.efi.signed ""
 
 Now your board can run the signed image via the boot manager (see below).
 You can also try this sequence by running Pytest, test_efi_secboot,
test/py/tests/test_efi_capsule/test_capsule_firmware.py +6 -6
index f006fa95d650..a76213bb095c 100644
@@ -39,8 +39,8 @@ class TestEfiCapsuleFirmwareFit(object):
         with u_boot_console.log.section('Test Case 1-a, before reboot'):
             output = u_boot_console.run_command_list([
                 'host bind 0 %s' % disk_img,
-                'efidebug boot add 1 TEST host 0:1 /helloworld.efi ""',
-                'efidebug boot order 1',
+                'bootmgr boot add 1 TEST host 0:1 /helloworld.efi ""',
+                'bootmgr boot order 1',
                 'env set -e OsIndications',
                 'env set dfu_alt_info "sf 0:0=u-boot-bin raw 0x100000 0x50000;u-boot-env raw 0x150000 0x200000"',
                 'env save'])
@@ -114,8 +114,8 @@ class TestEfiCapsuleFirmwareFit(object):
         with u_boot_console.log.section('Test Case 2-a, before reboot'):
             output = u_boot_console.run_command_list([
                 'host bind 0 %s' % disk_img,
-                'efidebug boot add 1 TEST host 0:1 /helloworld.efi ""',
-                'efidebug boot order 1',
+                'bootmgr boot add 1 TEST host 0:1 /helloworld.efi ""',
+                'bootmgr boot order 1',
                 'env set -e -nv -bs -rt OsIndications =0x0000000000000004',
                 'env set dfu_alt_info "sf 0:0=u-boot-bin raw 0x100000 0x50000;u-boot-env raw 0x150000 0x200000"',
                 'env save'])
@@ -188,8 +188,8 @@ class TestEfiCapsuleFirmwareFit(object):
         with u_boot_console.log.section('Test Case 3-a, before reboot'):
             output = u_boot_console.run_command_list([
                 'host bind 0 %s' % disk_img,
-                'efidebug boot add 1 TEST host 0:1 /helloworld.efi ""',
-                'efidebug boot order 1',
+                'bootmgr boot add 1 TEST host 0:1 /helloworld.efi ""',
+                'bootmgr boot order 1',
                 'env set -e -nv -bs -rt OsIndications =0x0000000000000004',
                 'env set dfu_alt_info "sf 0:0=u-boot-bin raw 0x100000 0x50000;u-boot-env raw 0x150000 0x200000"',
                 'env save'])
test/py/tests/test_efi_secboot/test_signed.py +24 -24

140 lines not on this page · raw message

test/py/tests/test_efi_secboot/test_signed_intca.py +11 -11
index 70d6be00e8a8..77f5de4072c7 100644
@@ -39,8 +39,8 @@ class TestEfiSignedImageIntca(object):
             assert 'Failed to set EFI variable' not in ''.join(output)
 
             output = u_boot_console.run_command_list([
-                'efidebug boot add 1 HELLO_a host 0:1 /helloworld.efi.signed_a ""',
-                'efidebug boot next 1',
+                'bootmgr boot add 1 HELLO_a host 0:1 /helloworld.efi.signed_a ""',
+                'bootmgr boot next 1',
                 'efidebug test bootmgr'])
             assert '\'HELLO_a\' failed' in ''.join(output)
             assert 'efi_start_image() returned: 26' in ''.join(output)
@@ -48,8 +48,8 @@ class TestEfiSignedImageIntca(object):
         with u_boot_console.log.section('Test Case 1b'):
             # Test Case 1b, signed and authenticated by root CA
             output = u_boot_console.run_command_list([
-                'efidebug boot add 2 HELLO_ab host 0:1 /helloworld.efi.signed_ab ""',
-                'efidebug boot next 2',
+                'bootmgr boot add 2 HELLO_ab host 0:1 /helloworld.efi.signed_ab ""',
+                'bootmgr boot next 2',
                 'bootefi bootmgr'])
             assert 'Hello, world!' in ''.join(output)
 
@@ -70,8 +70,8 @@ class TestEfiSignedImageIntca(object):
             assert 'Failed to set EFI variable' not in ''.join(output)
 
             output = u_boot_console.run_command_list([
-                'efidebug boot add 1 HELLO_abc host 0:1 /helloworld.efi.signed_abc ""',
-                'efidebug boot next 1',
+                'bootmgr boot add 1 HELLO_abc host 0:1 /helloworld.efi.signed_abc ""',
+                'bootmgr boot next 1',
                 'efidebug test bootmgr'])
             assert '\'HELLO_abc\' failed' in ''.join(output)
             assert 'efi_start_image() returned: 26' in ''.join(output)
@@ -81,7 +81,7 @@ class TestEfiSignedImageIntca(object):
             output = u_boot_console.run_command_list([
                 'fatload host 0:1 4000000 db_b.auth',
                 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db',
-                'efidebug boot next 1',
+                'bootmgr boot next 1',
                 'efidebug test bootmgr'])
             assert '\'HELLO_abc\' failed' in ''.join(output)
             assert 'efi_start_image() returned: 26' in ''.join(output)
@@ -91,7 +91,7 @@ class TestEfiSignedImageIntca(object):
             output = u_boot_console.run_command_list([
                 'fatload host 0:1 4000000 db_c.auth',
                 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db',
-                'efidebug boot next 1',
+                'bootmgr boot next 1',
                 'efidebug test bootmgr'])
             assert 'Hello, world!' in ''.join(output)
 
@@ -116,8 +116,8 @@ class TestEfiSignedImageIntca(object):
             assert 'Failed to set EFI variable' not in ''.join(output)
 
             output = u_boot_console.run_command_list([
-                'efidebug boot add 1 HELLO_abc host 0:1 /helloworld.efi.signed_abc ""',
-                'efidebug boot next 1',
+                'bootmgr boot add 1 HELLO_abc host 0:1 /helloworld.efi.signed_abc ""',
+                'bootmgr boot next 1',
                 'efidebug test bootmgr'])
             assert 'Hello, world!' in ''.join(output)
             # Or,
@@ -129,7 +129,7 @@ class TestEfiSignedImageIntca(object):
             output = u_boot_console.run_command_list([
                 'fatload host 0:1 4000000 dbx_c.auth',
                 'setenv -e -nv -bs -rt -at -i 4000000:$filesize dbx',
-                'efidebug boot next 1',
+                'bootmgr boot next 1',
                 'efidebug test bootmgr'])
             assert '\'HELLO_abc\' failed' in ''.join(output)
             assert 'efi_start_image() returned: 26' in ''.join(output)
test/py/tests/test_efi_secboot/test_unsigned.py +11 -11
index 56f56e19eb84..2d7f5d656f1a 100644
@@ -35,12 +35,12 @@ class TestEfiUnsignedImage(object):
             assert 'Failed to set EFI variable' not in ''.join(output)
 
             output = u_boot_console.run_command_list([
-                'efidebug boot add 1 HELLO host 0:1 /helloworld.efi ""',
-                'efidebug boot next 1',
+                'bootmgr boot add 1 HELLO host 0:1 /helloworld.efi ""',
+                'bootmgr boot next 1',
                 'bootefi bootmgr'])
             assert '\'HELLO\' failed' in ''.join(output)
             output = u_boot_console.run_command_list([
-                'efidebug boot next 1',
+                'bootmgr boot next 1',
                 'efidebug test bootmgr'])
             assert 'efi_start_image() returned: 26' in ''.join(output)
             assert 'Hello, world!' not in ''.join(output)
@@ -64,8 +64,8 @@ class TestEfiUnsignedImage(object):
             assert 'Failed to set EFI variable' not in ''.join(output)
 
             output = u_boot_console.run_command_list([
-                'efidebug boot add 1 HELLO host 0:1 /helloworld.efi ""',
-                'efidebug boot next 1',
+                'bootmgr boot add 1 HELLO host 0:1 /helloworld.efi ""',
+                'bootmgr boot next 1',
                 'bootefi bootmgr'])
             assert 'Hello, world!' in ''.join(output)
 
@@ -88,12 +88,12 @@ class TestEfiUnsignedImage(object):
             assert 'Failed to set EFI variable' not in ''.join(output)
 
             output = u_boot_console.run_command_list([
-                'efidebug boot add 1 HELLO host 0:1 /helloworld.efi ""',
-                'efidebug boot next 1',
+                'bootmgr boot add 1 HELLO host 0:1 /helloworld.efi ""',
+                'bootmgr boot next 1',
                 'bootefi bootmgr'])
             assert '\'HELLO\' failed' in ''.join(output)
             output = u_boot_console.run_command_list([
-                'efidebug boot next 1',
+                'bootmgr boot next 1',
                 'efidebug test bootmgr'])
             assert 'efi_start_image() returned: 26' in ''.join(output)
             assert 'Hello, world!' not in ''.join(output)
@@ -106,12 +106,12 @@ class TestEfiUnsignedImage(object):
             assert 'Failed to set EFI variable' not in ''.join(output)
 
             output = u_boot_console.run_command_list([
-                'efidebug boot add 1 HELLO host 0:1 /helloworld.efi ""',
-                'efidebug boot next 1',
+                'bootmgr boot add 1 HELLO host 0:1 /helloworld.efi ""',
+                'bootmgr boot next 1',
                 'bootefi bootmgr'])
             assert '\'HELLO\' failed' in ''.join(output)
             output = u_boot_console.run_command_list([
-                'efidebug boot next 1',
+                'bootmgr boot next 1',
                 'efidebug test bootmgr'])
             assert 'efi_start_image() returned: 26' in ''.join(output)
             assert 'Hello, world!' not in ''.join(output)
Signature · 1 line
2.30.0
#1 lore raw

PATCH 1/1 efidebug: Introduce bootmgr command

Dear Ilias,

Quoted 8 lines · In message <[email protected]> you wrote:

Up to now we've been adding all the efi related configuration to 'efidebug' command. The command name feels a bit weird to configure boot manager related commands. Since the bootmanager is growing and we intend to extend it with features like defining the initrd we want to expose to the kernel, it would make sense to split it on a command of it's own.

So let's introduce a new command called bootmgr and move all of the existing Boot manager functionality there.

As this is EFI specific, I would appreciate to have "efi" in the command name, too.

Maybe all EFi related commands should be collected as "efi <subcommand>" like we did it with the "env" commands long ago.

For backward compatibility e. g. 'efidebug' could be kept, but the new name would be 'efi debug'; likewise, your new command would be 'efi bootmgr' [or just 'efi boot' ?]

Thanks!

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
In my experience the best way to get something done  is to give it to
someone who is busy.               - Terry Pratchett, _Going_Postal_
#2 lore raw

PATCH 1/1 efidebug: Introduce bootmgr command

Hi Wolfgang,

Thanks for having a look,

Quoted 9 lines · Wolfgang Denk

Dear Ilias,

Quoted 6 lines · In message <[email protected]> you wrote:

Up to now we've been adding all the efi related configuration to 'efidebug' command. The command name feels a bit weird to configure boot manager related commands. Since the bootmanager is growing and we intend to extend it with features like defining the initrd we want to expose to the kernel, it would make sense to split it on a command of it's own.

Quoted 8 lines
Quoted 2 lines

So let's introduce a new command called bootmgr and move all of the existing Boot manager functionality there.

As this is EFI specific, I would appreciate to have "efi" in the command name, too.

Maybe all EFi related commands should be collected as "efi <subcommand>" like we did it with the "env" commands long ago.

We could, I'll discuss this with Heinrich and see what he thinks.

Quoted 4 lines

For backward compatibility e. g. 'efidebug' could be kept, but the new name would be 'efi debug'; likewise, your new command would be 'efi bootmgr' [or just 'efi boot' ?]

The efidebug for boot options wasn't introduced that long ago and I don't think anyone uses it in production. If someone would want to have it backwards compatible, please shout and we'll see what we can do, but I'd strongly prefer replacing it overall. If we truly want backwards compatibility though we must keep efidebug, changing the name to something like 'efi debug' just for the name similarity wouldn't help much as it would break things regardless.

Heinrich feel free to ignore the followup patch fixing the documentation of efidebug. I'll change the name to something we all agree and fold in the doc changes in v2.

Thanks
/Ilias

Quoted 11 lines

Thanks!

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
In my experience the best way to get something done  is to give it to
someone who is busy.               - Terry Pratchett, _Going_Postal_
#3 lore raw

PATCH 1/1 efidebug: Introduce bootmgr command

Dear Ilias,

Quoted 7 lines · In message <[email protected]> you wrote:

The efidebug for boot options wasn't introduced that long ago and I don't think anyone uses it in production. If someone would want to have it backwards compatible, please shout and we'll see what we can do, but I'd strongly prefer replacing it overall. If we truly want backwards compatibility though we must keep efidebug, changing the name to something like 'efi debug' just for the name similarity wouldn't help much as it would break things regardless.

In this case, "debug" would just be a sub-command of the "efi" command, with more sub-commands under efi (like bootmgr or such) following, same as we did for example with "env" (where many commands maintain backward compatibility, but here this was necessary because these have been in use forever):

	env print 	-> printenv
	env save	-> saveenv
	env set		-> setenv

etc.

Maybe a similar approach makes sense for "efi" (with or without backward compatibility, as you like - after all, this is just a little name space pollution ;-) :

efi:

	efi debug
	efi bootmgr
	efi ...

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If you believe that feeling bad or worrying long enough will change a
past or future event, then you are residing on another planet with  a
different reality system.
#4 lore raw

PATCH 1/1 efidebug: Introduce bootmgr command

Dear Wolfgang,

Quoted 17 lines · Wolfgang Denk

Dear Ilias,

Quoted 7 lines · In message <[email protected]> you wrote:

The efidebug for boot options wasn't introduced that long ago and I don't think anyone uses it in production. If someone would want to have it backwards compatible, please shout and we'll see what we can do, but I'd strongly prefer replacing it overall. If we truly want backwards compatibility though we must keep efidebug, changing the name to something like 'efi debug' just for the name similarity wouldn't help much as it would break things regardless.

In this case, "debug" would just be a sub-command of the "efi" command, with more sub-commands under efi (like bootmgr or such) following, same as we did for example with "env" (where many commands maintain backward compatibility, but here this was necessary because these have been in use forever):

Quoted 4 lines
	env print 	-> printenv
	env save	-> saveenv
	env set		-> setenv

Yes, but it would still look a bit strange, because the efidebug command was overloaded in our case. So you could test capsules, set EFI bootmgr variables, dump EFI tables amongst other things. The saveenv & friends had a tightly defined scope already.
So that would require a lot of code to keep the convention running, but since it's rarely used, I don't think it's worth the effort or the additional complexity (once again unless someone has a valid reason), hence my suggestion to define it properly while we still have time.

Quoted 11 lines

etc.

Maybe a similar approach makes sense for "efi" (with or without backward compatibility, as you like - after all, this is just a little name space pollution ;-) :

efi:

	efi debug
	efi bootmgr
	efi ...

Exactly

Thanks
/Ilias

Quoted 11 lines

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
If you believe that feeling bad or worrying long enough will change a
past or future event, then you are residing on another planet with  a
different reality system.
#5 lore raw

PATCH 1/1 efidebug: Introduce bootmgr command

Dear Ilias,

Quoted 12 lines · In message <[email protected]> you wrote:
Quoted 11 lines

In this case, "debug" would just be a sub-command of the "efi" command, with more sub-commands under efi (like bootmgr or such) following, same as we did for example with "env" (where many commands maintain backward compatibility, but here this was necessary because these have been in use forever):

	env print 	-> printenv
	env save	-> saveenv
	env set		-> setenv
Quoted 8 lines

Yes, but it would still look a bit strange, because the efidebug command was overloaded in our case. So you could test capsules, set EFI bootmgr variables, dump EFI tables amongst other things. The saveenv & friends had a tightly defined scope already.
So that would require a lot of code to keep the convention running, but since it's rarely used, I don't think it's worth the effort or the additional complexity (once again unless someone has a valid reason), hence my suggestion to define it properly while we still have time.

Indeed - if it was rarely used before, it makes a lot of sense to break combined functionality into separate subcommands (probably also with separate Kconfig options so you can select what you really need only).

Thanks!

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The biggest difference between time and space is that you can't reuse
time.                                                 - Merrick Furst
#6 lore raw

PATCH 1/1 efidebug: Introduce bootmgr command

In reply to Ilias Apalodimas
Quoted 11 lines · Ilias Apalodimas

Hi Wolfgang,

Thanks for having a look,

Quoted 6 lines · Wolfgang Denk

Dear Ilias,

Quoted 3 lines · In message <[email protected]> you wrote:

Up to now we've been adding all the efi related configuration to 'efidebug' command. The command name feels a bit weird to configure boot manager related commands. Since the bootmanager is growing and we intend

I developed the command as a poorman's "efishell" as, at that time, EDK2's shell didn't work well on U-Boot UEFI subsystem.

As far as I remember, Alex (ex-maintainer) didn't like to take this command, including "efidebug boot" subcommand, as a standard U-Boot command.

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

to extend it with features like defining the initrd we want to expose to the kernel, it would make sense to split it on a command of it's own.

So let's introduce a new command called bootmgr and move all of the existing Boot manager functionality there.

Quoted 12 lines
Quoted 5 lines

As this is EFI specific, I would appreciate to have "efi" in the command name, too.

Maybe all EFi related commands should be collected as "efi <subcommand>" like we did it with the "env" commands long ago.

We could, I'll discuss this with Heinrich and see what he thinks.

Quoted 4 lines

For backward compatibility e. g. 'efidebug' could be kept, but the new name would be 'efi debug'; likewise, your new command would be 'efi bootmgr' [or just 'efi boot' ?]

As a matter of fact, "efi" is even now recognized as "efidebug" thanks to command name completion as there is no other "efi*" command.

Then,
efidebug boot ..., and
[efi]bootmgr boot ...
can be invoked literally as
efi boot ...

So I don't see much advantage to Ilias' proposal.

My suggestions are:
* alias "efi" to "efidebug" (if preferred),
* add new configuration options for efidebug's subcommands,
* only enable "boot"-related options by default (if needed)

Personally, I don't like to move the portion of code from one file to another since it will break git history.

In addition, I have proposed to make "bootefi bootmgr" a standalone command/application, but Heinrich rejected it.
Given Ilias' concern(?), I still believe that the change is logical and makes more sense.

-Takahiro Akashi

Quoted 25 lines

The efidebug for boot options wasn't introduced that long ago and I don't think anyone uses it in production. If someone would want to have it backwards compatible, please shout and we'll see what we can do, but I'd strongly prefer replacing it overall. If we truly want backwards compatibility though we must keep efidebug, changing the name to something like 'efi debug' just for the name similarity wouldn't help much as it would break things regardless.

Heinrich feel free to ignore the followup patch fixing the documentation of efidebug. I'll change the name to something we all agree and fold in the doc changes in v2.

Thanks
/Ilias

Quoted 11 lines

Thanks!

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
In my experience the best way to get something done  is to give it to
someone who is busy.               - Terry Pratchett, _Going_Postal_
#7 lore raw

PATCH 1/1 efidebug: Introduce bootmgr command

Hi Akashi,

Quoted 13 lines · AKASHI Takahiro
Quoted 11 lines · Ilias Apalodimas

Hi Wolfgang,

Thanks for having a look,

Quoted 6 lines · Wolfgang Denk

Dear Ilias,

Quoted 3 lines · In message <[email protected]> you wrote:

Up to now we've been adding all the efi related configuration to 'efidebug' command. The command name feels a bit weird to configure boot manager related commands. Since the bootmanager is growing and we intend

Quoted 6 lines

I developed the command as a poorman's "efishell" as, at that time, EDK2's shell didn't work well on U-Boot UEFI subsystem.

As far as I remember, Alex (ex-maintainer) didn't like to take this command, including "efidebug boot" subcommand, as a standard U-Boot command.

UEFI has grown substantially since then though and we can now use it to install full distros. Having a command named 'efidebug' is the last place some would look to configure boot options. Does it only feel weird to me?

Quoted 22 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

to extend it with features like defining the initrd we want to expose to the kernel, it would make sense to split it on a command of it's own.

So let's introduce a new command called bootmgr and move all of the existing Boot manager functionality there.

Quoted 12 lines
Quoted 5 lines

As this is EFI specific, I would appreciate to have "efi" in the command name, too.

Maybe all EFi related commands should be collected as "efi <subcommand>" like we did it with the "env" commands long ago.

We could, I'll discuss this with Heinrich and see what he thinks.

Quoted 4 lines

For backward compatibility e. g. 'efidebug' could be kept, but the new name would be 'efi debug'; likewise, your new command would be 'efi bootmgr' [or just 'efi boot' ?]

As a matter of fact, "efi" is even now recognized as "efidebug" thanks to command name completion as there is no other "efi*" command.

Quoted 8 lines

Then,
efidebug boot ..., and
[efi]bootmgr boot ...
can be invoked literally as
efi boot ...

So I don't see much advantage to Ilias' proposal.

Breaking the code in smaller, readable files, looked like a better option. I'd much prefer it over a single huge file implementing a variety of commands completely unrelated to each other, just because 'everything belongs to the efi spec'.
It would also make our life and readability a lot easier in case we want to include specific commands on a built. The alternative you propose implies a file full of ifdefs, while we could just control them with Kconfig options and makefiles.

Quoted 8 lines

My suggestions are:
* alias "efi" to "efidebug" (if preferred),
* add new configuration options for efidebug's subcommands,
* only enable "boot"-related options by default (if needed)

Personally, I don't like to move the portion of code from one file to another since it will break git history.

How? The commit message clearly says "move the bootmgr functions to a diffrent file" and the git log on efidebug will clear that up. It will even show the file that was moved to.

Quoted 2 lines

In addition, I have proposed to make "bootefi bootmgr" a standalone command/application, but Heinrich rejected it.

That's a different discussion, but if you go down that road you'd have to move the 'bootefi selftest' as well?

Quoted 2 lines

Given Ilias' concern(?), I still believe that the change is logical and makes more sense.

My concern here is to help people wanting to use the bootmgr. I don't have a strong opinion on how that eventually can be implemented and that's why I am open to suggestions. For the record I do prefer seperate commands, maybe even prefixed by efi to make the distinction clear between u-boot native and EFI related commands.

Cheers
/Ilias

Quoted 28 lines

-Takahiro Akashi

Quoted 25 lines

The efidebug for boot options wasn't introduced that long ago and I don't think anyone uses it in production. If someone would want to have it backwards compatible, please shout and we'll see what we can do, but I'd strongly prefer replacing it overall. If we truly want backwards compatibility though we must keep efidebug, changing the name to something like 'efi debug' just for the name similarity wouldn't help much as it would break things regardless.

Heinrich feel free to ignore the followup patch fixing the documentation of efidebug. I'll change the name to something we all agree and fold in the doc changes in v2.

Thanks
/Ilias

Quoted 11 lines

Thanks!

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
In my experience the best way to get something done  is to give it to
someone who is busy.               - Terry Pratchett, _Going_Postal_
#8 lore raw

PATCH 1/1 efidebug: Introduce bootmgr command

In reply to Wolfgang Denk
Quoted 18 lines · Wolfgang Denk

Dear Ilias,

Quoted 8 lines · In message <[email protected]> you wrote:

Up to now we've been adding all the efi related configuration to 'efidebug' command. The command name feels a bit weird to configure boot manager related commands. Since the bootmanager is growing and we intend to extend it with features like defining the initrd we want to expose to the kernel, it would make sense to split it on a command of it's own.

So let's introduce a new command called bootmgr and move all of the existing Boot manager functionality there.

As this is EFI specific, I would appreciate to have "efi" in the command name, too.

Maybe all EFi related commands should be collected as "efi <subcommand>" like we did it with the "env" commands long ago.

Quoted 8 lines

For backward compatibility e. g. 'efidebug' could be kept, but the new name would be 'efi debug'; likewise, your new command would be 'efi bootmgr' [or just 'efi boot' ?]

Thanks!

Wolfgang Denk

Hello Wolfgang,

what is the benefit for the user to have a single command with an endless list of options?

I can't see any.

Best regards

Heinrich

#9 lore raw

PATCH 1/1 efidebug: Introduce bootmgr command

Dear Heinrich,

Quoted 4 lines · In message <[email protected]> you wrote:
Quoted 4 lines

For backward compatibility e. g. 'efidebug' could be kept, but the new name would be 'efi debug'; likewise, your new command would be 'efi bootmgr' [or just 'efi boot' ?]

...

Quoted 5 lines

what is the benefit for the user to have a single command with an endless list of options?

I can't see any.

You miss the point. The complexisty for the user will be the same; as is, we already have a single command whichimplements a number of different functions as one big monolithig block of code.

What we are discussing here is to split this into logical components, each implementing one specific function only.

The suggested change will not make things any harder to the user, on contrary, it has the chance to make it easier andmore consistent to use.

Also, it's not options, but separate commands grouped into one topic.

Advantages are:

- maintenance: it is much easier to maintain and debug a number of separate functions than monster spaghetti code
- configurability: you can select needed / unselect unnecessary sub commands
- memory footprint: comes with configurability
- style: it follows existing practise.

Just to name a few.

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
When the tide of life turns against you
And the current upsets your boat
Don't waste tears on what might have been
Just lie on your back and float.