I'm trying to write an EFI shell script which deletes all boot entries (as given in bcfg dump boot
), without knowing how many exist ahead-of-time.
The language provides a looping construct, patterned off that from Microsoft's shells:
for var in <set>
...
endfor
...but I'm unclear on whether there's a reasonable way to get the numeric identifiers of the boot entries from bcfg dump
into the <set>
.
At this moment (UEFI Shell v2.1 and UEFI v2.50) there is no way for parsing bcfg
output using UEFI Shell.
The only supported method for parsing in UEFI Shell script is by using parse
command, which require Standard-Format Output
(it seems to be CSV). Unfortunately only 7 commands can generate SFO
, by using -sfo
flag as parameters. Supported commands are: ls
, map
, memmap
, date
, dh
, devices
, drivers
.
Removing all boot options can be achieved by writing simple C application that mimic bcfg behavior. I managed to do that and sample code can be found here.
Note that removing all boot options can be dangerous in some cases and can lead to unrecoverable state of your hardware. Make sure you know what you doing.