efidebug: Introduce bootmgr command

Message ID 20210210105425.356131-1-ilias.apalodimas@linaro.org
State New
Headers show
Series
  • efidebug: Introduce bootmgr command
Related show

Commit Message

Ilias Apalodimas Feb. 10, 2021, 10:54 a.m.
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.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>

---
 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

-- 
2.30.0

Comments

Wolfgang Denk Feb. 10, 2021, 11:23 a.m. | #1
Dear Ilias,

In message <20210210105425.356131-1-ilias.apalodimas@linaro.org> 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

-- 
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@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_
Ilias Apalodimas Feb. 10, 2021, 11:53 a.m. | #2
Hi Wolfgang,

Thanks for having a look, 

On Wed, Feb 10, 2021 at 12:23:47PM +0100, Wolfgang Denk wrote:
> Dear Ilias,

> 

> In message <20210210105425.356131-1-ilias.apalodimas@linaro.org> 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.


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

> 

> 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
> 

> Thanks!

> 

> Wolfgang Denk

> 

> -- 

> 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@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_
Wolfgang Denk Feb. 10, 2021, 12:26 p.m. | #3
Dear Ilias,

In message <YCPJU0hIUTayLuhw@apalos.home> 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

-- 
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@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.
Ilias Apalodimas Feb. 10, 2021, 12:46 p.m. | #4
Dear Wolfgang,

On Wed, Feb 10, 2021 at 01:26:15PM +0100, Wolfgang Denk wrote:
> Dear Ilias,

> 

> In message <YCPJU0hIUTayLuhw@apalos.home> 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

> 


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.

> 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

> Best regards,

> 

> Wolfgang Denk

> 

> -- 

> 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@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.
AKASHI Takahiro Feb. 10, 2021, 12:50 p.m. | #5
On Wed, Feb 10, 2021 at 01:53:55PM +0200, Ilias Apalodimas wrote:
> Hi Wolfgang,

> 

> Thanks for having a look, 

> 

> On Wed, Feb 10, 2021 at 12:23:47PM +0100, Wolfgang Denk wrote:

> > Dear Ilias,

> > 

> > In message <20210210105425.356131-1-ilias.apalodimas@linaro.org> 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.

> > > 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.

> 

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

> 

> > 

> > 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

> 

> 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

> > 

> > Thanks!

> > 

> > Wolfgang Denk

> > 

> > -- 

> > 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@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_
Heinrich Schuchardt Feb. 10, 2021, 12:53 p.m. | #6
On 10.02.21 12:23, Wolfgang Denk wrote:
> Dear Ilias,

>

> In message <20210210105425.356131-1-ilias.apalodimas@linaro.org> 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

>


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
Ilias Apalodimas Feb. 10, 2021, 2:59 p.m. | #7
Hi Akashi, 

On Wed, Feb 10, 2021 at 09:50:33PM +0900, AKASHI Takahiro wrote:
> On Wed, Feb 10, 2021 at 01:53:55PM +0200, Ilias Apalodimas wrote:

> > Hi Wolfgang,

> > 

> > Thanks for having a look, 

> > 

> > On Wed, Feb 10, 2021 at 12:23:47PM +0100, Wolfgang Denk wrote:

> > > Dear Ilias,

> > > 

> > > In message <20210210105425.356131-1-ilias.apalodimas@linaro.org> 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.

> 


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?

> > > > 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.

> > 

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

> > 

> > > 

> > > 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.

> 


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.

> 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.

> 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?

> 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
> 

> -Takahiro Akashi

> 

> > 

> > 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

> > > 

> > > Thanks!

> > > 

> > > Wolfgang Denk

> > > 

> > > -- 

> > > 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@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_
Wolfgang Denk Feb. 10, 2021, 4:10 p.m. | #8
Dear Ilias,

In message <YCPVvmnF7TKxreE2@apalos.home> you wrote:
>

> > 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

> > 

>

> 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

-- 
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@denx.de
The biggest difference between time and space is that you can't reuse
time.                                                 - Merrick Furst
Wolfgang Denk Feb. 10, 2021, 4:17 p.m. | #9
Dear Heinrich,

In message <9966b14a-43ef-42ad-dda4-d40b5e3b974b@gmx.de> you wrote:
>

> > 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' ?]

...
>

> 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

-- 
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@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.

Patch

diff --git a/cmd/Makefile b/cmd/Makefile
index 176bf925fdc4..c50fe9204757 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -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
diff --git a/cmd/bootmgr.c b/cmd/bootmgr.c
new file mode 100644
index 000000000000..332aac4198bc
--- /dev/null
+++ b/cmd/bootmgr.c
@@ -0,0 +1,640 @@ 
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ *  UEFI Bootmanager configuration
+ *
+ *  Copyright (c) 2018 AKASHI Takahiro, Linaro Limited
+ */
+#include <charset.h>
+#include <common.h>
+#include <command.h>
+#include <efi_loader.h>
+#include <efi_rng.h>
+#include <hexdump.h>
+#include <malloc.h>
+
+static char bootmgr_help_text[] =
+	"  - UEFI Shell-like interface to configure UEFI Boot Manager\n"
+	"bootmgr boot add <bootid> <label> <interface> <devnum>[:<part>] <file path> [<load options>]\n"
+	"  - set UEFI BootXXXX variable\n"
+	"    <load options> will be passed to UEFI application\n"
+	"bootmgr boot rm <bootid#1> [<bootid#2> [<bootid#3> [...]]]\n"
+	"  - delete UEFI BootXXXX variables\n"
+	"bootmgr boot dump\n"
+	"  - dump all UEFI BootXXXX variables\n"
+	"bootmgr boot next <bootid>\n"
+	"  - set UEFI BootNext variable\n"
+	"bootmgr boot order [<bootid#1> [<bootid#2> [<bootid#3> [...]]]]\n"
+	"  - set/show UEFI boot order\n"
+	"\n";
+
+static int u16_tohex(u16 c)
+{
+	if (c >= '0' && c <= '9')
+		return c - '0';
+	if (c >= 'A' && c <= 'F')
+		return c - 'A' + 10;
+
+	/* not hexadecimal */
+	return -1;
+}
+
+/**
+ * show_efi_boot_opt_data() - dump UEFI load option
+ *
+ * @varname16:	variable name
+ * @data:	value of UEFI load option variable
+ * @size:	size of the boot option
+ *
+ * Decode the value of UEFI load option variable and print information.
+ */
+static void show_efi_boot_opt_data(u16 *varname16, void *data, size_t *size)
+{
+	struct efi_load_option lo;
+	char *label, *p;
+	size_t label_len16, label_len;
+	u16 *dp_str;
+	efi_status_t ret;
+
+	ret = efi_deserialize_load_option(&lo, data, size);
+	if (ret != EFI_SUCCESS) {
+		printf("%ls: invalid load option\n", varname16);
+		return;
+	}
+
+	label_len16 = u16_strlen(lo.label);
+	label_len = utf16_utf8_strnlen(lo.label, label_len16);
+	label = malloc(label_len + 1);
+	if (!label)
+		return;
+	p = label;
+	utf16_utf8_strncpy(&p, lo.label, label_len16);
+
+	printf("%ls:\nattributes: %c%c%c (0x%08x)\n",
+	       varname16,
+	       /* ACTIVE */
+	       lo.attributes & LOAD_OPTION_ACTIVE ? 'A' : '-',
+	       /* FORCE RECONNECT */
+	       lo.attributes & LOAD_OPTION_FORCE_RECONNECT ? 'R' : '-',
+	       /* HIDDEN */
+	       lo.attributes & LOAD_OPTION_HIDDEN ? 'H' : '-',
+	       lo.attributes);
+	printf("  label: %s\n", label);
+
+	dp_str = efi_dp_str(lo.file_path);
+	printf("  file_path: %ls\n", dp_str);
+	efi_free_pool(dp_str);
+
+	printf("  data:\n");
+	print_hex_dump("    ", DUMP_PREFIX_OFFSET, 16, 1,
+		       lo.optional_data, *size, true);
+	free(label);
+}
+
+/**
+ * show_efi_boot_opt() - dump UEFI load option
+ *
+ * @varname16:	variable name
+ *
+ * Dump information defined by UEFI load option.
+ */
+static void show_efi_boot_opt(u16 *varname16)
+{
+	void *data;
+	efi_uintn_t size;
+	efi_status_t ret;
+
+	size = 0;
+	ret = EFI_CALL(efi_get_variable(varname16, &efi_global_variable_guid,
+					NULL, &size, NULL));
+	if (ret == EFI_BUFFER_TOO_SMALL) {
+		data = malloc(size);
+		if (!data) {
+			printf("ERROR: Out of memory\n");
+			return;
+		}
+		ret = EFI_CALL(efi_get_variable(varname16,
+						&efi_global_variable_guid,
+						NULL, &size, data));
+		if (ret == EFI_SUCCESS)
+			show_efi_boot_opt_data(varname16, data, &size);
+		free(data);
+	}
+}
+
+/**
+ * do_efi_boot_add() - set UEFI load option
+ *
+ * @cmdtp:	Command table
+ * @flag:	Command flag
+ * @argc:	Number of arguments
+ * @argv:	Argument array
+ * Return:	CMD_RET_SUCCESS on success,
+ *		CMD_RET_USAGE or CMD_RET_RET_FAILURE on failure
+ *
+ * Implement bootmgr "boot add" sub-command. Create or change UEFI load option.
+ *
+ *     bootmgr boot add <id> <label> <interface> <devnum>[:<part>] <file> <options>
+ */
+static int do_efi_boot_add(struct cmd_tbl *cmdtp, int flag,
+			   int argc, char *const argv[])
+{
+	int id;
+	char *endp;
+	char var_name[9];
+	u16 var_name16[9], *p;
+	efi_guid_t guid;
+	size_t label_len, label_len16;
+	u16 *label;
+	struct efi_device_path *device_path = NULL, *file_path = NULL;
+	struct efi_load_option lo;
+	void *data = NULL;
+	efi_uintn_t size;
+	efi_status_t ret;
+	int r = CMD_RET_SUCCESS;
+
+	if (argc < 6 || argc > 7)
+		return CMD_RET_USAGE;
+
+	id = (int)simple_strtoul(argv[1], &endp, 16);
+	if (*endp != '\0' || id > 0xffff)
+		return CMD_RET_USAGE;
+
+	sprintf(var_name, "Boot%04X", id);
+	p = var_name16;
+	utf8_utf16_strncpy(&p, var_name, 9);
+
+	guid = efi_global_variable_guid;
+
+	/* attributes */
+	lo.attributes = LOAD_OPTION_ACTIVE; /* always ACTIVE */
+
+	/* label */
+	label_len = strlen(argv[2]);
+	label_len16 = utf8_utf16_strnlen(argv[2], label_len);
+	label = malloc((label_len16 + 1) * sizeof(u16));
+	if (!label)
+		return CMD_RET_FAILURE;
+	lo.label = label; /* label will be changed below */
+	utf8_utf16_strncpy(&label, argv[2], label_len);
+
+	/* file path */
+	ret = efi_dp_from_name(argv[3], argv[4], argv[5], &device_path,
+			       &file_path);
+	if (ret != EFI_SUCCESS) {
+		printf("Cannot create device path for \"%s %s\"\n",
+		       argv[3], argv[4]);
+		r = CMD_RET_FAILURE;
+		goto out;
+	}
+	lo.file_path = file_path;
+	lo.file_path_length = efi_dp_size(file_path)
+				+ sizeof(struct efi_device_path); /* for END */
+
+	/* optional data */
+	if (argc == 6)
+		lo.optional_data = NULL;
+	else
+		lo.optional_data = (const u8 *)argv[6];
+
+	size = efi_serialize_load_option(&lo, (u8 **)&data);
+	if (!size) {
+		r = CMD_RET_FAILURE;
+		goto out;
+	}
+
+	ret = EFI_CALL(efi_set_variable(var_name16, &guid,
+					EFI_VARIABLE_NON_VOLATILE |
+					EFI_VARIABLE_BOOTSERVICE_ACCESS |
+					EFI_VARIABLE_RUNTIME_ACCESS,
+					size, data));
+	if (ret != EFI_SUCCESS) {
+		printf("Cannot set %ls\n", var_name16);
+		r = CMD_RET_FAILURE;
+	}
+out:
+	free(data);
+	efi_free_pool(device_path);
+	efi_free_pool(file_path);
+	free(lo.label);
+
+	return r;
+}
+
+/**
+ * do_efi_boot_rm() - delete UEFI load options
+ *
+ * @cmdtp:	Command table
+ * @flag:	Command flag
+ * @argc:	Number of arguments
+ * @argv:	Argument array
+ * Return:	CMD_RET_SUCCESS on success, CMD_RET_RET_FAILURE on failure
+ *
+ * Implement bootmgr "boot rm" sub-command.
+ * Delete UEFI load options.
+ *
+ *     bootmgr boot rm <id> ...
+ */
+static int do_efi_boot_rm(struct cmd_tbl *cmdtp, int flag,
+			  int argc, char *const argv[])
+{
+	efi_guid_t guid;
+	int id, i;
+	char *endp;
+	char var_name[9];
+	u16 var_name16[9], *p;
+	efi_status_t ret;
+
+	if (argc == 1)
+		return CMD_RET_USAGE;
+
+	guid = efi_global_variable_guid;
+	for (i = 1; i < argc; i++, argv++) {
+		id = (int)simple_strtoul(argv[1], &endp, 16);
+		if (*endp != '\0' || id > 0xffff)
+			return CMD_RET_FAILURE;
+
+		sprintf(var_name, "Boot%04X", id);
+		p = var_name16;
+		utf8_utf16_strncpy(&p, var_name, 9);
+
+		ret = EFI_CALL(efi_set_variable(var_name16, &guid, 0, 0, NULL));
+		if (ret) {
+			printf("Cannot remove %ls\n", var_name16);
+			return CMD_RET_FAILURE;
+		}
+	}
+
+	return CMD_RET_SUCCESS;
+}
+
+/**
+ * show_efi_boot_dump() - dump all UEFI load options
+ *
+ * @cmdtp:	Command table
+ * @flag:	Command flag
+ * @argc:	Number of arguments
+ * @argv:	Argument array
+ * Return:	CMD_RET_SUCCESS on success, CMD_RET_RET_FAILURE on failure
+ *
+ * Implement bootmgr "boot dump" sub-command.
+ * Dump information of all UEFI load options defined.
+ *
+ *     bootmgr boot dump
+ */
+static int do_efi_boot_dump(struct cmd_tbl *cmdtp, int flag,
+			    int argc, char *const argv[])
+{
+	u16 *var_name16, *p;
+	efi_uintn_t buf_size, size;
+	efi_guid_t guid;
+	int id, i, digit;
+	efi_status_t ret;
+
+	if (argc > 1)
+		return CMD_RET_USAGE;
+
+	buf_size = 128;
+	var_name16 = malloc(buf_size);
+	if (!var_name16)
+		return CMD_RET_FAILURE;
+
+	var_name16[0] = 0;
+	for (;;) {
+		size = buf_size;
+		ret = EFI_CALL(efi_get_next_variable_name(&size, var_name16,
+							  &guid));
+		if (ret == EFI_NOT_FOUND)
+			break;
+		if (ret == EFI_BUFFER_TOO_SMALL) {
+			buf_size = size;
+			p = realloc(var_name16, buf_size);
+			if (!p) {
+				free(var_name16);
+				return CMD_RET_FAILURE;
+			}
+			var_name16 = p;
+			ret = EFI_CALL(efi_get_next_variable_name(&size,
+								  var_name16,
+								  &guid));
+		}
+		if (ret != EFI_SUCCESS) {
+			free(var_name16);
+			return CMD_RET_FAILURE;
+		}
+
+		if (memcmp(var_name16, L"Boot", 8))
+			continue;
+
+		for (id = 0, i = 0; i < 4; i++) {
+			digit = u16_tohex(var_name16[4 + i]);
+			if (digit < 0)
+				break;
+			id = (id << 4) + digit;
+		}
+		if (i == 4 && !var_name16[8])
+			show_efi_boot_opt(var_name16);
+	}
+
+	free(var_name16);
+
+	return CMD_RET_SUCCESS;
+}
+
+/**
+ * do_efi_boot_next() - manage UEFI BootNext variable
+ *
+ * @cmdtp:	Command table
+ * @flag:	Command flag
+ * @argc:	Number of arguments
+ * @argv:	Argument array
+ * Return:	CMD_RET_SUCCESS on success,
+ *		CMD_RET_USAGE or CMD_RET_RET_FAILURE on failure
+ *
+ * Implement bootmgr "boot next" sub-command.
+ * Set BootNext variable.
+ *
+ *     bootmgr boot next <id>
+ */
+static int do_efi_boot_next(struct cmd_tbl *cmdtp, int flag,
+			    int argc, char *const argv[])
+{
+	u16 bootnext;
+	efi_uintn_t size;
+	char *endp;
+	efi_guid_t guid;
+	efi_status_t ret;
+	int r = CMD_RET_SUCCESS;
+
+	if (argc != 2)
+		return CMD_RET_USAGE;
+
+	bootnext = (u16)simple_strtoul(argv[1], &endp, 16);
+	if (*endp) {
+		printf("invalid value: %s\n", argv[1]);
+		r = CMD_RET_FAILURE;
+		goto out;
+	}
+
+	guid = efi_global_variable_guid;
+	size = sizeof(u16);
+	ret = EFI_CALL(efi_set_variable(L"BootNext", &guid,
+					EFI_VARIABLE_NON_VOLATILE |
+					EFI_VARIABLE_BOOTSERVICE_ACCESS |
+					EFI_VARIABLE_RUNTIME_ACCESS,
+					size, &bootnext));
+	if (ret != EFI_SUCCESS) {
+		printf("Cannot set BootNext\n");
+		r = CMD_RET_FAILURE;
+	}
+out:
+	return r;
+}
+
+/**
+ * show_efi_boot_order() - show order of UEFI load options
+ *
+ * Return:	CMD_RET_SUCCESS on success, CMD_RET_RET_FAILURE on failure
+ *
+ * Show order of UEFI load options defined by BootOrder variable.
+ */
+static int show_efi_boot_order(void)
+{
+	u16 *bootorder;
+	efi_uintn_t size;
+	int num, i;
+	char var_name[9];
+	u16 var_name16[9], *p16;
+	void *data;
+	struct efi_load_option lo;
+	char *label, *p;
+	size_t label_len16, label_len;
+	efi_status_t ret;
+
+	size = 0;
+	ret = EFI_CALL(efi_get_variable(L"BootOrder", &efi_global_variable_guid,
+					NULL, &size, NULL));
+	if (ret != EFI_BUFFER_TOO_SMALL) {
+		if (ret == EFI_NOT_FOUND) {
+			printf("BootOrder not defined\n");
+			return CMD_RET_SUCCESS;
+		} else {
+			return CMD_RET_FAILURE;
+		}
+	}
+	bootorder = malloc(size);
+	if (!bootorder) {
+		printf("ERROR: Out of memory\n");
+		return CMD_RET_FAILURE;
+	}
+	ret = EFI_CALL(efi_get_variable(L"BootOrder", &efi_global_variable_guid,
+					NULL, &size, bootorder));
+	if (ret != EFI_SUCCESS) {
+		ret = CMD_RET_FAILURE;
+		goto out;
+	}
+
+	num = size / sizeof(u16);
+	for (i = 0; i < num; i++) {
+		sprintf(var_name, "Boot%04X", bootorder[i]);
+		p16 = var_name16;
+		utf8_utf16_strncpy(&p16, var_name, 9);
+
+		size = 0;
+		ret = EFI_CALL(efi_get_variable(var_name16,
+						&efi_global_variable_guid, NULL,
+						&size, NULL));
+		if (ret != EFI_BUFFER_TOO_SMALL) {
+			printf("%2d: %s: (not defined)\n", i + 1, var_name);
+			continue;
+		}
+
+		data = malloc(size);
+		if (!data) {
+			ret = CMD_RET_FAILURE;
+			goto out;
+		}
+		ret = EFI_CALL(efi_get_variable(var_name16,
+						&efi_global_variable_guid, NULL,
+						&size, data));
+		if (ret != EFI_SUCCESS) {
+			free(data);
+			ret = CMD_RET_FAILURE;
+			goto out;
+		}
+
+		ret = efi_deserialize_load_option(&lo, data, &size);
+		if (ret != EFI_SUCCESS) {
+			printf("%ls: invalid load option\n", var_name16);
+			ret = CMD_RET_FAILURE;
+			goto out;
+		}
+
+		label_len16 = u16_strlen(lo.label);
+		label_len = utf16_utf8_strnlen(lo.label, label_len16);
+		label = malloc(label_len + 1);
+		if (!label) {
+			free(data);
+			ret = CMD_RET_FAILURE;
+			goto out;
+		}
+		p = label;
+		utf16_utf8_strncpy(&p, lo.label, label_len16);
+		printf("%2d: %s: %s\n", i + 1, var_name, label);
+		free(label);
+
+		free(data);
+	}
+out:
+	free(bootorder);
+
+	return ret;
+}
+
+/**
+ * do_efi_boot_order() - manage UEFI BootOrder variable
+ *
+ * @cmdtp:	Command table
+ * @flag:	Command flag
+ * @argc:	Number of arguments
+ * @argv:	Argument array
+ * Return:	CMD_RET_SUCCESS on success, CMD_RET_RET_FAILURE on failure
+ *
+ * Implement bootmgr "boot order" sub-command.
+ * Show order of UEFI load options, or change it in BootOrder variable.
+ *
+ *     bootmgr boot order [<id> ...]
+ */
+static int do_efi_boot_order(struct cmd_tbl *cmdtp, int flag,
+			     int argc, char *const argv[])
+{
+	u16 *bootorder = NULL;
+	efi_uintn_t size;
+	int id, i;
+	char *endp;
+	efi_guid_t guid;
+	efi_status_t ret;
+	int r = CMD_RET_SUCCESS;
+
+	if (argc == 1)
+		return show_efi_boot_order();
+
+	argc--;
+	argv++;
+
+	size = argc * sizeof(u16);
+	bootorder = malloc(size);
+	if (!bootorder)
+		return CMD_RET_FAILURE;
+
+	for (i = 0; i < argc; i++) {
+		id = (int)simple_strtoul(argv[i], &endp, 16);
+		if (*endp != '\0' || id > 0xffff) {
+			printf("invalid value: %s\n", argv[i]);
+			r = CMD_RET_FAILURE;
+			goto out;
+		}
+
+		bootorder[i] = (u16)id;
+	}
+
+	guid = efi_global_variable_guid;
+	ret = EFI_CALL(efi_set_variable(L"BootOrder", &guid,
+					EFI_VARIABLE_NON_VOLATILE |
+					EFI_VARIABLE_BOOTSERVICE_ACCESS |
+					EFI_VARIABLE_RUNTIME_ACCESS,
+					size, bootorder));
+	if (ret != EFI_SUCCESS) {
+		printf("Cannot set BootOrder\n");
+		r = CMD_RET_FAILURE;
+	}
+out:
+	free(bootorder);
+
+	return r;
+}
+
+static struct cmd_tbl cmd_bootmgr_boot_sub[] = {
+	U_BOOT_CMD_MKENT(add, CONFIG_SYS_MAXARGS, 1, do_efi_boot_add, "", ""),
+	U_BOOT_CMD_MKENT(rm, CONFIG_SYS_MAXARGS, 1, do_efi_boot_rm, "", ""),
+	U_BOOT_CMD_MKENT(dump, CONFIG_SYS_MAXARGS, 1, do_efi_boot_dump, "", ""),
+	U_BOOT_CMD_MKENT(next, CONFIG_SYS_MAXARGS, 1, do_efi_boot_next, "", ""),
+	U_BOOT_CMD_MKENT(order, CONFIG_SYS_MAXARGS, 1, do_efi_boot_order,
+			 "", ""),
+};
+
+/**
+ * do_efi_boot_opt() - manage UEFI load options
+ *
+ * @cmdtp:	Command table
+ * @flag:	Command flag
+ * @argc:	Number of arguments
+ * @argv:	Argument array
+ * Return:	CMD_RET_SUCCESS on success,
+ *		CMD_RET_USAGE or CMD_RET_RET_FAILURE on failure
+ *
+ * Implement bootmgr "boot" sub-command.
+ */
+static int do_efi_boot_opt(struct cmd_tbl *cmdtp, int flag,
+			   int argc, char *const argv[])
+{
+	struct cmd_tbl *cp;
+
+	if (argc < 2)
+		return CMD_RET_USAGE;
+
+	argc--; argv++;
+
+	cp = find_cmd_tbl(argv[0], cmd_bootmgr_boot_sub,
+			  ARRAY_SIZE(cmd_bootmgr_boot_sub));
+	if (!cp)
+		return CMD_RET_USAGE;
+
+	return cp->cmd(cmdtp, flag, argc, argv);
+}
+
+static struct cmd_tbl cmd_bootmgr_sub[] = {
+	U_BOOT_CMD_MKENT(boot, CONFIG_SYS_MAXARGS, 1, do_efi_boot_opt, "", ""),
+};
+
+/**
+ * do_bootmgr() - display and configure UEFI boot manager
+ *
+ * @cmdtp:	Command table
+ * @flag:	Command flag
+ * @argc:	Number of arguments
+ * @argv:	Argument array
+ * Return:	CMD_RET_SUCCESS on success,
+ *		CMD_RET_USAGE or CMD_RET_RET_FAILURE on failure
+ *
+ * Implement bootmgr command which allows us to display and
+ * configure UEFI environment.
+ */
+static int do_bootmgr(struct cmd_tbl *cmdtp, int flag,
+		      int argc, char *const argv[])
+{
+	struct cmd_tbl *cp;
+	efi_status_t r;
+
+	if (argc < 2)
+		return CMD_RET_USAGE;
+
+	argc--; argv++;
+
+	/* Initialize UEFI drivers */
+	r = efi_init_obj_list();
+	if (r != EFI_SUCCESS) {
+		printf("Error: Cannot initialize UEFI sub-system, r = %lu\n",
+		       r & ~EFI_ERROR_MASK);
+		return CMD_RET_FAILURE;
+	}
+
+	cp = find_cmd_tbl(argv[0], cmd_bootmgr_sub,
+			  ARRAY_SIZE(cmd_bootmgr_sub));
+	if (!cp)
+		return CMD_RET_USAGE;
+
+	return cp->cmd(cmdtp, flag, argc, argv);
+}
+
+U_BOOT_CMD(bootmgr, CONFIG_SYS_MAXARGS, 0, do_bootmgr,
+	   "Configure UEFI boot manager", bootmgr_help_text);
diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index bbbcb0a54643..337ca5a4a13b 100644
--- a/cmd/efidebug.c
+++ b/cmd/efidebug.c
@@ -794,571 +794,6 @@  static int do_efi_show_tables(struct cmd_tbl *cmdtp, int flag,
 	return CMD_RET_SUCCESS;
 }
 
-/**
- * do_efi_boot_add() - set UEFI load option
- *
- * @cmdtp:	Command table
- * @flag:	Command flag
- * @argc:	Number of arguments
- * @argv:	Argument array
- * Return:	CMD_RET_SUCCESS on success,
- *		CMD_RET_USAGE or CMD_RET_RET_FAILURE on failure
- *
- * Implement efidebug "boot add" sub-command. Create or change UEFI load option.
- *
- *     efidebug boot add <id> <label> <interface> <devnum>[:<part>] <file> <options>
- */
-static int do_efi_boot_add(struct cmd_tbl *cmdtp, int flag,
-			   int argc, char *const argv[])
-{
-	int id;
-	char *endp;
-	char var_name[9];
-	u16 var_name16[9], *p;
-	efi_guid_t guid;
-	size_t label_len, label_len16;
-	u16 *label;
-	struct efi_device_path *device_path = NULL, *file_path = NULL;
-	struct efi_load_option lo;
-	void *data = NULL;
-	efi_uintn_t size;
-	efi_status_t ret;
-	int r = CMD_RET_SUCCESS;
-
-	if (argc < 6 || argc > 7)
-		return CMD_RET_USAGE;
-
-	id = (int)simple_strtoul(argv[1], &endp, 16);
-	if (*endp != '\0' || id > 0xffff)
-		return CMD_RET_USAGE;
-
-	sprintf(var_name, "Boot%04X", id);
-	p = var_name16;
-	utf8_utf16_strncpy(&p, var_name, 9);
-
-	guid = efi_global_variable_guid;
-
-	/* attributes */
-	lo.attributes = LOAD_OPTION_ACTIVE; /* always ACTIVE */
-
-	/* label */
-	label_len = strlen(argv[2]);
-	label_len16 = utf8_utf16_strnlen(argv[2], label_len);
-	label = malloc((label_len16 + 1) * sizeof(u16));
-	if (!label)
-		return CMD_RET_FAILURE;
-	lo.label = label; /* label will be changed below */
-	utf8_utf16_strncpy(&label, argv[2], label_len);
-
-	/* file path */
-	ret = efi_dp_from_name(argv[3], argv[4], argv[5], &device_path,
-			       &file_path);
-	if (ret != EFI_SUCCESS) {
-		printf("Cannot create device path for \"%s %s\"\n",
-		       argv[3], argv[4]);
-		r = CMD_RET_FAILURE;
-		goto out;
-	}
-	lo.file_path = file_path;
-	lo.file_path_length = efi_dp_size(file_path)
-				+ sizeof(struct efi_device_path); /* for END */
-
-	/* optional data */
-	if (argc == 6)
-		lo.optional_data = NULL;
-	else
-		lo.optional_data = (const u8 *)argv[6];
-
-	size = efi_serialize_load_option(&lo, (u8 **)&data);
-	if (!size) {
-		r = CMD_RET_FAILURE;
-		goto out;
-	}
-
-	ret = EFI_CALL(efi_set_variable(var_name16, &guid,
-					EFI_VARIABLE_NON_VOLATILE |
-					EFI_VARIABLE_BOOTSERVICE_ACCESS |
-					EFI_VARIABLE_RUNTIME_ACCESS,
-					size, data));
-	if (ret != EFI_SUCCESS) {
-		printf("Cannot set %ls\n", var_name16);
-		r = CMD_RET_FAILURE;
-	}
-out:
-	free(data);
-	efi_free_pool(device_path);
-	efi_free_pool(file_path);
-	free(lo.label);
-
-	return r;
-}
-
-/**
- * do_efi_boot_rm() - delete UEFI load options
- *
- * @cmdtp:	Command table
- * @flag:	Command flag
- * @argc:	Number of arguments
- * @argv:	Argument array
- * Return:	CMD_RET_SUCCESS on success, CMD_RET_RET_FAILURE on failure
- *
- * Implement efidebug "boot rm" sub-command.
- * Delete UEFI load options.
- *
- *     efidebug boot rm <id> ...
- */
-static int do_efi_boot_rm(struct cmd_tbl *cmdtp, int flag,
-			  int argc, char *const argv[])
-{
-	efi_guid_t guid;
-	int id, i;
-	char *endp;
-	char var_name[9];
-	u16 var_name16[9], *p;
-	efi_status_t ret;
-
-	if (argc == 1)
-		return CMD_RET_USAGE;
-
-	guid = efi_global_variable_guid;
-	for (i = 1; i < argc; i++, argv++) {
-		id = (int)simple_strtoul(argv[1], &endp, 16);
-		if (*endp != '\0' || id > 0xffff)
-			return CMD_RET_FAILURE;
-
-		sprintf(var_name, "Boot%04X", id);
-		p = var_name16;
-		utf8_utf16_strncpy(&p, var_name, 9);
-
-		ret = EFI_CALL(efi_set_variable(var_name16, &guid, 0, 0, NULL));
-		if (ret) {
-			printf("Cannot remove %ls\n", var_name16);
-			return CMD_RET_FAILURE;
-		}
-	}
-
-	return CMD_RET_SUCCESS;
-}
-
-/**
- * show_efi_boot_opt_data() - dump UEFI load option
- *
- * @varname16:	variable name
- * @data:	value of UEFI load option variable
- * @size:	size of the boot option
- *
- * Decode the value of UEFI load option variable and print information.
- */
-static void show_efi_boot_opt_data(u16 *varname16, void *data, size_t *size)
-{
-	struct efi_load_option lo;
-	char *label, *p;
-	size_t label_len16, label_len;
-	u16 *dp_str;
-	efi_status_t ret;
-
-	ret = efi_deserialize_load_option(&lo, data, size);
-	if (ret != EFI_SUCCESS) {
-		printf("%ls: invalid load option\n", varname16);
-		return;
-	}
-
-	label_len16 = u16_strlen(lo.label);
-	label_len = utf16_utf8_strnlen(lo.label, label_len16);
-	label = malloc(label_len + 1);
-	if (!label)
-		return;
-	p = label;
-	utf16_utf8_strncpy(&p, lo.label, label_len16);
-
-	printf("%ls:\nattributes: %c%c%c (0x%08x)\n",
-	       varname16,
-	       /* ACTIVE */
-	       lo.attributes & LOAD_OPTION_ACTIVE ? 'A' : '-',
-	       /* FORCE RECONNECT */
-	       lo.attributes & LOAD_OPTION_FORCE_RECONNECT ? 'R' : '-',
-	       /* HIDDEN */
-	       lo.attributes & LOAD_OPTION_HIDDEN ? 'H' : '-',
-	       lo.attributes);
-	printf("  label: %s\n", label);
-
-	dp_str = efi_dp_str(lo.file_path);
-	printf("  file_path: %ls\n", dp_str);
-	efi_free_pool(dp_str);
-
-	printf("  data:\n");
-	print_hex_dump("    ", DUMP_PREFIX_OFFSET, 16, 1,
-		       lo.optional_data, *size, true);
-	free(label);
-}
-
-/**
- * show_efi_boot_opt() - dump UEFI load option
- *
- * @varname16:	variable name
- *
- * Dump information defined by UEFI load option.
- */
-static void show_efi_boot_opt(u16 *varname16)
-{
-	void *data;
-	efi_uintn_t size;
-	efi_status_t ret;
-
-	size = 0;
-	ret = EFI_CALL(efi_get_variable(varname16, &efi_global_variable_guid,
-					NULL, &size, NULL));
-	if (ret == EFI_BUFFER_TOO_SMALL) {
-		data = malloc(size);
-		if (!data) {
-			printf("ERROR: Out of memory\n");
-			return;
-		}
-		ret = EFI_CALL(efi_get_variable(varname16,
-						&efi_global_variable_guid,
-						NULL, &size, data));
-		if (ret == EFI_SUCCESS)
-			show_efi_boot_opt_data(varname16, data, &size);
-		free(data);
-	}
-}
-
-static int u16_tohex(u16 c)
-{
-	if (c >= '0' && c <= '9')
-		return c - '0';
-	if (c >= 'A' && c <= 'F')
-		return c - 'A' + 10;
-
-	/* not hexadecimal */
-	return -1;
-}
-
-/**
- * show_efi_boot_dump() - dump all UEFI load options
- *
- * @cmdtp:	Command table
- * @flag:	Command flag
- * @argc:	Number of arguments
- * @argv:	Argument array
- * Return:	CMD_RET_SUCCESS on success, CMD_RET_RET_FAILURE on failure
- *
- * Implement efidebug "boot dump" sub-command.
- * Dump information of all UEFI load options defined.
- *
- *     efidebug boot dump
- */
-static int do_efi_boot_dump(struct cmd_tbl *cmdtp, int flag,
-			    int argc, char *const argv[])
-{
-	u16 *var_name16, *p;
-	efi_uintn_t buf_size, size;
-	efi_guid_t guid;
-	int id, i, digit;
-	efi_status_t ret;
-
-	if (argc > 1)
-		return CMD_RET_USAGE;
-
-	buf_size = 128;
-	var_name16 = malloc(buf_size);
-	if (!var_name16)
-		return CMD_RET_FAILURE;
-
-	var_name16[0] = 0;
-	for (;;) {
-		size = buf_size;
-		ret = EFI_CALL(efi_get_next_variable_name(&size, var_name16,
-							  &guid));
-		if (ret == EFI_NOT_FOUND)
-			break;
-		if (ret == EFI_BUFFER_TOO_SMALL) {
-			buf_size = size;
-			p = realloc(var_name16, buf_size);
-			if (!p) {
-				free(var_name16);
-				return CMD_RET_FAILURE;
-			}
-			var_name16 = p;
-			ret = EFI_CALL(efi_get_next_variable_name(&size,
-								  var_name16,
-								  &guid));
-		}
-		if (ret != EFI_SUCCESS) {
-			free(var_name16);
-			return CMD_RET_FAILURE;
-		}
-
-		if (memcmp(var_name16, L"Boot", 8))
-			continue;
-
-		for (id = 0, i = 0; i < 4; i++) {
-			digit = u16_tohex(var_name16[4 + i]);
-			if (digit < 0)
-				break;
-			id = (id << 4) + digit;
-		}
-		if (i == 4 && !var_name16[8])
-			show_efi_boot_opt(var_name16);
-	}
-
-	free(var_name16);
-
-	return CMD_RET_SUCCESS;
-}
-
-/**
- * show_efi_boot_order() - show order of UEFI load options
- *
- * Return:	CMD_RET_SUCCESS on success, CMD_RET_RET_FAILURE on failure
- *
- * Show order of UEFI load options defined by BootOrder variable.
- */
-static int show_efi_boot_order(void)
-{
-	u16 *bootorder;
-	efi_uintn_t size;
-	int num, i;
-	char var_name[9];
-	u16 var_name16[9], *p16;
-	void *data;
-	struct efi_load_option lo;
-	char *label, *p;
-	size_t label_len16, label_len;
-	efi_status_t ret;
-
-	size = 0;
-	ret = EFI_CALL(efi_get_variable(L"BootOrder", &efi_global_variable_guid,
-					NULL, &size, NULL));
-	if (ret != EFI_BUFFER_TOO_SMALL) {
-		if (ret == EFI_NOT_FOUND) {
-			printf("BootOrder not defined\n");
-			return CMD_RET_SUCCESS;
-		} else {
-			return CMD_RET_FAILURE;
-		}
-	}
-	bootorder = malloc(size);
-	if (!bootorder) {
-		printf("ERROR: Out of memory\n");
-		return CMD_RET_FAILURE;
-	}
-	ret = EFI_CALL(efi_get_variable(L"BootOrder", &efi_global_variable_guid,
-					NULL, &size, bootorder));
-	if (ret != EFI_SUCCESS) {
-		ret = CMD_RET_FAILURE;
-		goto out;
-	}
-
-	num = size / sizeof(u16);
-	for (i = 0; i < num; i++) {
-		sprintf(var_name, "Boot%04X", bootorder[i]);
-		p16 = var_name16;
-		utf8_utf16_strncpy(&p16, var_name, 9);
-
-		size = 0;
-		ret = EFI_CALL(efi_get_variable(var_name16,
-						&efi_global_variable_guid, NULL,
-						&size, NULL));
-		if (ret != EFI_BUFFER_TOO_SMALL) {
-			printf("%2d: %s: (not defined)\n", i + 1, var_name);
-			continue;
-		}
-
-		data = malloc(size);
-		if (!data) {
-			ret = CMD_RET_FAILURE;
-			goto out;
-		}
-		ret = EFI_CALL(efi_get_variable(var_name16,
-						&efi_global_variable_guid, NULL,
-						&size, data));
-		if (ret != EFI_SUCCESS) {
-			free(data);
-			ret = CMD_RET_FAILURE;
-			goto out;
-		}
-
-		ret = efi_deserialize_load_option(&lo, data, &size);
-		if (ret != EFI_SUCCESS) {
-			printf("%ls: invalid load option\n", var_name16);
-			ret = CMD_RET_FAILURE;
-			goto out;
-		}
-
-		label_len16 = u16_strlen(lo.label);
-		label_len = utf16_utf8_strnlen(lo.label, label_len16);
-		label = malloc(label_len + 1);
-		if (!label) {
-			free(data);
-			ret = CMD_RET_FAILURE;
-			goto out;
-		}
-		p = label;
-		utf16_utf8_strncpy(&p, lo.label, label_len16);
-		printf("%2d: %s: %s\n", i + 1, var_name, label);
-		free(label);
-
-		free(data);
-	}
-out:
-	free(bootorder);
-
-	return ret;
-}
-
-/**
- * do_efi_boot_next() - manage UEFI BootNext variable
- *
- * @cmdtp:	Command table
- * @flag:	Command flag
- * @argc:	Number of arguments
- * @argv:	Argument array
- * Return:	CMD_RET_SUCCESS on success,
- *		CMD_RET_USAGE or CMD_RET_RET_FAILURE on failure
- *
- * Implement efidebug "boot next" sub-command.
- * Set BootNext variable.
- *
- *     efidebug boot next <id>
- */
-static int do_efi_boot_next(struct cmd_tbl *cmdtp, int flag,
-			    int argc, char *const argv[])
-{
-	u16 bootnext;
-	efi_uintn_t size;
-	char *endp;
-	efi_guid_t guid;
-	efi_status_t ret;
-	int r = CMD_RET_SUCCESS;
-
-	if (argc != 2)
-		return CMD_RET_USAGE;
-
-	bootnext = (u16)simple_strtoul(argv[1], &endp, 16);
-	if (*endp) {
-		printf("invalid value: %s\n", argv[1]);
-		r = CMD_RET_FAILURE;
-		goto out;
-	}
-
-	guid = efi_global_variable_guid;
-	size = sizeof(u16);
-	ret = EFI_CALL(efi_set_variable(L"BootNext", &guid,
-					EFI_VARIABLE_NON_VOLATILE |
-					EFI_VARIABLE_BOOTSERVICE_ACCESS |
-					EFI_VARIABLE_RUNTIME_ACCESS,
-					size, &bootnext));
-	if (ret != EFI_SUCCESS) {
-		printf("Cannot set BootNext\n");
-		r = CMD_RET_FAILURE;
-	}
-out:
-	return r;
-}
-
-/**
- * do_efi_boot_order() - manage UEFI BootOrder variable
- *
- * @cmdtp:	Command table
- * @flag:	Command flag
- * @argc:	Number of arguments
- * @argv:	Argument array
- * Return:	CMD_RET_SUCCESS on success, CMD_RET_RET_FAILURE on failure
- *
- * Implement efidebug "boot order" sub-command.
- * Show order of UEFI load options, or change it in BootOrder variable.
- *
- *     efidebug boot order [<id> ...]
- */
-static int do_efi_boot_order(struct cmd_tbl *cmdtp, int flag,
-			     int argc, char *const argv[])
-{
-	u16 *bootorder = NULL;
-	efi_uintn_t size;
-	int id, i;
-	char *endp;
-	efi_guid_t guid;
-	efi_status_t ret;
-	int r = CMD_RET_SUCCESS;
-
-	if (argc == 1)
-		return show_efi_boot_order();
-
-	argc--;
-	argv++;
-
-	size = argc * sizeof(u16);
-	bootorder = malloc(size);
-	if (!bootorder)
-		return CMD_RET_FAILURE;
-
-	for (i = 0; i < argc; i++) {
-		id = (int)simple_strtoul(argv[i], &endp, 16);
-		if (*endp != '\0' || id > 0xffff) {
-			printf("invalid value: %s\n", argv[i]);
-			r = CMD_RET_FAILURE;
-			goto out;
-		}
-
-		bootorder[i] = (u16)id;
-	}
-
-	guid = efi_global_variable_guid;
-	ret = EFI_CALL(efi_set_variable(L"BootOrder", &guid,
-					EFI_VARIABLE_NON_VOLATILE |
-					EFI_VARIABLE_BOOTSERVICE_ACCESS |
-					EFI_VARIABLE_RUNTIME_ACCESS,
-					size, bootorder));
-	if (ret != EFI_SUCCESS) {
-		printf("Cannot set BootOrder\n");
-		r = CMD_RET_FAILURE;
-	}
-out:
-	free(bootorder);
-
-	return r;
-}
-
-static struct cmd_tbl cmd_efidebug_boot_sub[] = {
-	U_BOOT_CMD_MKENT(add, CONFIG_SYS_MAXARGS, 1, do_efi_boot_add, "", ""),
-	U_BOOT_CMD_MKENT(rm, CONFIG_SYS_MAXARGS, 1, do_efi_boot_rm, "", ""),
-	U_BOOT_CMD_MKENT(dump, CONFIG_SYS_MAXARGS, 1, do_efi_boot_dump, "", ""),
-	U_BOOT_CMD_MKENT(next, CONFIG_SYS_MAXARGS, 1, do_efi_boot_next, "", ""),
-	U_BOOT_CMD_MKENT(order, CONFIG_SYS_MAXARGS, 1, do_efi_boot_order,
-			 "", ""),
-};
-
-/**
- * do_efi_boot_opt() - manage UEFI load options
- *
- * @cmdtp:	Command table
- * @flag:	Command flag
- * @argc:	Number of arguments
- * @argv:	Argument array
- * Return:	CMD_RET_SUCCESS on success,
- *		CMD_RET_USAGE or CMD_RET_RET_FAILURE on failure
- *
- * Implement efidebug "boot" sub-command.
- */
-static int do_efi_boot_opt(struct cmd_tbl *cmdtp, int flag,
-			   int argc, char *const argv[])
-{
-	struct cmd_tbl *cp;
-
-	if (argc < 2)
-		return CMD_RET_USAGE;
-
-	argc--; argv++;
-
-	cp = find_cmd_tbl(argv[0], cmd_efidebug_boot_sub,
-			  ARRAY_SIZE(cmd_efidebug_boot_sub));
-	if (!cp)
-		return CMD_RET_USAGE;
-
-	return cp->cmd(cmdtp, flag, argc, argv);
-}
-
 /**
  * do_efi_test_bootmgr() - run simple bootmgr for test
  *
@@ -1488,7 +923,6 @@  static int do_efi_query_info(struct cmd_tbl *cmdtp, int flag,
 }
 
 static struct cmd_tbl cmd_efidebug_sub[] = {
-	U_BOOT_CMD_MKENT(boot, CONFIG_SYS_MAXARGS, 1, do_efi_boot_opt, "", ""),
 #ifdef CONFIG_EFI_HAVE_CAPSULE_SUPPORT
 	U_BOOT_CMD_MKENT(capsule, CONFIG_SYS_MAXARGS, 1, do_efi_capsule,
 			 "", ""),
@@ -1555,19 +989,7 @@  static int do_efidebug(struct cmd_tbl *cmdtp, int flag,
 static char efidebug_help_text[] =
 	"  - UEFI Shell-like interface to configure UEFI environment\n"
 	"\n"
-	"efidebug boot add <bootid> <label> <interface> <devnum>[:<part>] <file path> [<load options>]\n"
-	"  - set UEFI BootXXXX variable\n"
-	"    <load options> will be passed to UEFI application\n"
-	"efidebug boot rm <bootid#1> [<bootid#2> [<bootid#3> [...]]]\n"
-	"  - delete UEFI BootXXXX variables\n"
-	"efidebug boot dump\n"
-	"  - dump all UEFI BootXXXX variables\n"
-	"efidebug boot next <bootid>\n"
-	"  - set UEFI BootNext variable\n"
-	"efidebug boot order [<bootid#1> [<bootid#2> [<bootid#3> [...]]]]\n"
-	"  - set/show UEFI boot order\n"
-	"\n"
-#ifdef CONFIG_EFI_HAVE_CAPSULE_SUPPORT
+	#ifdef CONFIG_EFI_HAVE_CAPSULE_SUPPORT
 	"efidebug capsule update [-v] <capsule address>\n"
 	"  - process a capsule\n"
 	"efidebug capsule disk-update\n"
diff --git a/doc/board/emulation/qemu_capsule_update.rst b/doc/board/emulation/qemu_capsule_update.rst
index 9fec75f8f1c9..3f94f72e5e34 100644
--- a/doc/board/emulation/qemu_capsule_update.rst
+++ b/doc/board/emulation/qemu_capsule_update.rst
@@ -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
diff --git a/doc/uefi/uefi.rst b/doc/uefi/uefi.rst
index 5a67737c1579..02a377b834f0 100644
--- a/doc/uefi/uefi.rst
+++ b/doc/uefi/uefi.rst
@@ -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,
diff --git a/test/py/tests/test_efi_capsule/test_capsule_firmware.py b/test/py/tests/test_efi_capsule/test_capsule_firmware.py
index f006fa95d650..a76213bb095c 100644
--- a/test/py/tests/test_efi_capsule/test_capsule_firmware.py
+++ b/test/py/tests/test_efi_capsule/test_capsule_firmware.py
@@ -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'])
diff --git a/test/py/tests/test_efi_secboot/test_signed.py b/test/py/tests/test_efi_secboot/test_signed.py
index 863685e215b7..e43ccd9532d8 100644
--- a/test/py/tests/test_efi_secboot/test_signed.py
+++ b/test/py/tests/test_efi_secboot/test_signed.py
@@ -28,16 +28,16 @@  class TestEfiSignedImage(object):
             # Test Case 1a, run signed image if no PK
             output = u_boot_console.run_command_list([
                 'host bind 0 %s' % disk_img,
-                'efidebug boot add 1 HELLO1 host 0:1 /helloworld.efi.signed ""',
-                'efidebug boot next 1',
+                'bootmgr boot add 1 HELLO1 host 0:1 /helloworld.efi.signed ""',
+                'bootmgr boot next 1',
                 'bootefi bootmgr'])
             assert 'Hello, world!' in ''.join(output)
 
         with u_boot_console.log.section('Test Case 1b'):
             # Test Case 1b, run unsigned image if no PK
             output = u_boot_console.run_command_list([
-                'efidebug boot add 2 HELLO2 host 0:1 /helloworld.efi ""',
-                'efidebug boot next 2',
+                'bootmgr boot add 2 HELLO2 host 0:1 /helloworld.efi ""',
+                'bootmgr boot next 2',
                 'bootefi bootmgr'])
             assert 'Hello, world!' in ''.join(output)
 
@@ -58,14 +58,14 @@  class TestEfiSignedImage(object):
                 'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK'])
             assert 'Failed to set EFI variable' not in ''.join(output)
             output = u_boot_console.run_command_list([
-                'efidebug boot add 1 HELLO1 host 0:1 /helloworld.efi.signed ""',
-                'efidebug boot next 1',
+                'bootmgr boot add 1 HELLO1 host 0:1 /helloworld.efi.signed ""',
+                'bootmgr boot next 1',
                 'efidebug test bootmgr'])
             assert('\'HELLO1\' failed' in ''.join(output))
             assert('efi_start_image() returned: 26' in ''.join(output))
             output = u_boot_console.run_command_list([
-                'efidebug boot add 2 HELLO2 host 0:1 /helloworld.efi ""',
-                'efidebug boot next 2',
+                'bootmgr boot add 2 HELLO2 host 0:1 /helloworld.efi ""',
+                'bootmgr boot next 2',
                 'efidebug test bootmgr'])
             assert '\'HELLO2\' failed' in ''.join(output)
             assert 'efi_start_image() returned: 26' in ''.join(output)
@@ -77,12 +77,12 @@  class TestEfiSignedImage(object):
                 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db'])
             assert 'Failed to set EFI variable' not in ''.join(output)
             output = u_boot_console.run_command_list([
-                'efidebug boot next 2',
+                'bootmgr boot next 2',
                 'efidebug test bootmgr'])
             assert '\'HELLO2\' failed' in ''.join(output)
             assert 'efi_start_image() returned: 26' in ''.join(output)
             output = u_boot_console.run_command_list([
-                'efidebug boot next 1',
+                'bootmgr boot next 1',
                 'bootefi bootmgr'])
             assert 'Hello, world!' in ''.join(output)
 
@@ -104,8 +104,8 @@  class TestEfiSignedImage(object):
                 'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK'])
             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.signed ""',
-                'efidebug boot next 1',
+                'bootmgr boot add 1 HELLO host 0:1 /helloworld.efi.signed ""',
+                'bootmgr boot next 1',
                 'efidebug test bootmgr'])
             assert '\'HELLO\' failed' in ''.join(output)
             assert 'efi_start_image() returned: 26' in ''.join(output)
@@ -117,7 +117,7 @@  class TestEfiSignedImage(object):
                 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db'])
             assert 'Failed to set EFI variable' not in ''.join(output)
             output = u_boot_console.run_command_list([
-                'efidebug boot next 1',
+                'bootmgr boot next 1',
                 'efidebug test bootmgr'])
             assert '\'HELLO\' failed' in ''.join(output)
             assert 'efi_start_image() returned: 26' in ''.join(output)
@@ -142,8 +142,8 @@  class TestEfiSignedImage(object):
                 'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK'])
             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.signed ""',
-                'efidebug boot next 1',
+                'bootmgr boot add 1 HELLO host 0:1 /helloworld.efi.signed ""',
+                'bootmgr boot next 1',
                 'efidebug test bootmgr'])
             assert '\'HELLO\' failed' in ''.join(output)
             assert 'efi_start_image() returned: 26' in ''.join(output)
@@ -169,8 +169,8 @@  class TestEfiSignedImage(object):
                 'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK'])
             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.signed_2sigs ""',
-                'efidebug boot next 1',
+                'bootmgr boot add 1 HELLO host 0:1 /helloworld.efi.signed_2sigs ""',
+                'bootmgr boot next 1',
                 'efidebug test bootmgr'])
             assert 'Hello, world!' in ''.join(output)
 
@@ -181,7 +181,7 @@  class TestEfiSignedImage(object):
                 'setenv -e -nv -bs -rt -at -a -i 4000000:$filesize db'])
             assert 'Failed to set EFI variable' not in ''.join(output)
             output = u_boot_console.run_command_list([
-                'efidebug boot next 1',
+                'bootmgr boot next 1',
                 'efidebug test bootmgr'])
             assert 'Hello, world!' in ''.join(output)
 
@@ -193,7 +193,7 @@  class TestEfiSignedImage(object):
                 'setenv -e -nv -bs -rt -at -i 4000000:$filesize dbx'])
             assert 'Failed to set EFI variable' not in ''.join(output)
             output = u_boot_console.run_command_list([
-                'efidebug boot next 1',
+                'bootmgr boot next 1',
                 'efidebug test bootmgr'])
             assert 'Hello, world!' in ''.join(output)
 
@@ -204,7 +204,7 @@  class TestEfiSignedImage(object):
                 'setenv -e -nv -bs -rt -at -a -i 4000000:$filesize dbx'])
             assert 'Failed to set EFI variable' not in ''.join(output)
             output = u_boot_console.run_command_list([
-                'efidebug boot next 1',
+                'bootmgr boot next 1',
                 'efidebug test bootmgr'])
             assert '\'HELLO\' failed' in ''.join(output)
             assert 'efi_start_image() returned: 26' in ''.join(output)
@@ -227,8 +227,8 @@  class TestEfiSignedImage(object):
                 'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK'])
             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.signed ""',
-                'efidebug boot next 1',
+                'bootmgr boot add 1 HELLO host 0:1 /helloworld.efi.signed ""',
+                'bootmgr boot next 1',
                 'bootefi bootmgr'])
             assert 'Hello, world!' in ''.join(output)
 
@@ -239,7 +239,7 @@  class TestEfiSignedImage(object):
                 'setenv -e -nv -bs -rt -at -i 4000000:$filesize dbx'])
             assert 'Failed to set EFI variable' not in ''.join(output)
             output = u_boot_console.run_command_list([
-                'efidebug boot next 1',
+                'bootmgr boot next 1',
                 'efidebug test bootmgr'])
             assert '\'HELLO\' failed' in ''.join(output)
             assert 'efi_start_image() returned: 26' in ''.join(output)
@@ -253,7 +253,7 @@  class TestEfiSignedImage(object):
                 'setenv -e -nv -bs -rt -at -i 4000000:$filesize dbx'])
             assert 'Failed to set EFI variable' not in ''.join(output)
             output = u_boot_console.run_command_list([
-                'efidebug boot next 1',
+                'bootmgr boot next 1',
                 'efidebug test bootmgr'])
             assert '\'HELLO\' failed' in ''.join(output)
             assert 'efi_start_image() returned: 26' in ''.join(output)
diff --git a/test/py/tests/test_efi_secboot/test_signed_intca.py b/test/py/tests/test_efi_secboot/test_signed_intca.py
index 70d6be00e8a8..77f5de4072c7 100644
--- a/test/py/tests/test_efi_secboot/test_signed_intca.py
+++ b/test/py/tests/test_efi_secboot/test_signed_intca.py
@@ -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)
diff --git a/test/py/tests/test_efi_secboot/test_unsigned.py b/test/py/tests/test_efi_secboot/test_unsigned.py
index 56f56e19eb84..2d7f5d656f1a 100644
--- a/test/py/tests/test_efi_secboot/test_unsigned.py
+++ b/test/py/tests/test_efi_secboot/test_unsigned.py
@@ -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)