How to run shim from inside grub2 code?

555 views Asked by At

I am new to grub. I am trying to enable UEFI secure boot from grub. I have decided to use shim to verify kernel's signature. Grub can be verified from UEFI.

I have pulled patches from Ubuntu's grub git repository. Grub uses grub_efi_locate_protocol() function to locate shim, currently it is not able to find shim and returns NULL.

I have following queries:

  1. Where should I place shim.efi binary (I have placed it /boot partition)
  2. Where does grub_efi_system_table variable get populated, and how is it used by grub_efi_locate_protocol?

Thanks

1

There are 1 answers

0
Sharath Kurudi On BEST ANSWER

I was able to solve this issue. When shim is executed, it installs shim protocol. Shim protocol is installed only when secure boot is enabled. I was trying to use the shim protocol with no secure boot, so, grub was unable to find shim protocol. A complete explanation of shim is here https://mjg59.dreamwidth.org/19448.html