rhboot / efibootmgr

efibootmgr development tree
GNU General Public License v2.0
519 stars 99 forks source link

Set guid when reading boot entries in read_vars. #27

Closed amurzeau closed 9 years ago

amurzeau commented 9 years ago

In my /sys/firmware/efi/vars/ i have duplicated BootXXXX entries like that:

Boot0000-00000000-0000-0000-0000-000000000000
Boot0000-8be4df61-93ca-11d2-aa0d-00e098032b8c
Boot0001-00000000-0000-0000-0000-000000000000
Boot0001-8be4df61-93ca-11d2-aa0d-00e098032b8c

Using efibootmgr -A -b 0001 was not disabling the Boot0001 entry as expected. It turns out that it was using Boot0001-00000000-0000-0000-0000-000000000000 instead of Boot0001-8be4df61-93ca-11d2-aa0d-00e098032b8c because set_active_state uses boot->guid which is set to 0 in read_vars (because of memset() at src/efibootmgr.c:108)

So I set it to EFI_GLOBAL_GUID when reading vars.

FYI, I use that feature to disable Windows boot entry so I can boot Linux without modifying Windows' bootmgfw.efi (my BIOS reset the boot order at every boot so the Windows entry is the first).

vathpela commented 9 years ago

Thanks, I've pushed this to master.