BootOrder recovery behavior

Li, Walon

Hi edk2 guys,

I have a question about BootOrder recovery behavior and want to consult with you. I found Boot0000 would be first place in BootOrder when system try to recover options. Please check steps as below.

1. Boot to OS and check BootOrder. In my case, it's "Boot0004, Boot0001, Boot0000, Boot0002, Boot0003".
2. Then, adjust BootOrder by efibootmgr, only set one boot option in order by "efibootmgr -o 0004". As screenshot, you can see 5 boot options, but only one(Boot0004) in BootOrder after changing.
3. Reboot system, will see Boot0000 be located at first place in BootOrder and others behind the specified option.

Ideally, BootOrder would be reconstruct again so it should be "Boot0004, Boot0000, Boot0001, Boot0002, Boot0003" as I thought. Is it any reason to put Boot0000 at first place? Or just a bug? I used edk2-stable202008 to reproduce that on OVMF.
By the way, Boot0000 is none-bootable so the boot flow still works good to boot Boot0004. But options behavior aren't consistent, and it might affect user scripts if the specified option is not first one in BootOrder.