Tutorial Modify UEFI with EFI Shell

erzaScarlet

Blog Author
VC
16
Tho UEFI is a feature rich firmware. It has been made complicated by the lack of reliable tools to manupulate it.

Windows doent provide any native commands to modify UEFI. Thought entries can be added via bcdedit they are not accessable via boot menu and can only be booted via boot sequence. There are some tools like easyUEFI but these doent always work. Specially on old hardwares like mine.

Most debian or arch shifts with a command tool efibootmgr thanks to the kernel exposing a efi modification api. But like easyUEFI these also doent always work. If you have installed ubuntu on a blank disk and faced "no bootable device error". Its because of this. Even though the efibootmgr show the entry , it doent show at boot menu.

A fix for such a error without uefi shell can be found here

You dont need secure boot enabled always for this method. Just enable,add efi and disable again.
(This method adds a permenent boot entry which even efi shell cant remove.The only way to remove is reset secure boot configs which deletes all entries)


Newer systems comes with a embeded boot entry "efi shell" in firmware settings to make UEFI manupulation. But fred not potato users. A team named tianocore has made a custom uefi shell as an efi file. This shell is semi bash like. So it has some common utilities like ping,ls,cp,rm....etc. But most importantly it has "bcfg"
bcfg is what used to modify UEFI entried via shell. It has very simple syntax.

bcfg boot dump [-v (optional)] <-- List all boot entried. -v gives a detailed lists
bcfg boot add X PATH_TO_EFI "TITILE" <--Adds a new boot entry at x position(Positions cannot be over written.Instead all at and down are shifted down)
bcfg rm X <--Removes the entry at x position.

NOTE:
#1: efi-shell only supports fat32 or like systems similar to UEFI firmware
#2: partitions in efi shell are names as "fsX:". Full list of them can be get via "map" command
#3: The postions are treated as boot orders

Example:
Add entry: bcfg boot add 0 fs0:\EFI\ubuntu\grubx64.efi "Ubuntu"
Remove entry: bcfg rm 0

If you have efibootmgr issue and cannot even add the shell.Use this iso

This iso contains efi shell v2 which requires uefi v2.3+. For older systems check the arch wiki.
Post automatically merged:

Please dont expect reply from me in about month or 2. I am preparing for exam and will be available after that
 
Last edited:
  • Like
Reactions: Xtr

Get Connected

Discord Server

New Threads

Latest From Blog

Top