Thursday, November 8, 2018

boot - How to create efi partition and install GRUB bootloader manually

I am currently struggling to install the grub bootloader in a efi partition created by myself.
I am using a GPT partition table and I created some partitions where one of them is of type ESP (EFI System Partition) with its respective type UUID. I created a FAT file system within that volume by mkfs.fat -F32. Now I am hanging on the part of installing the GRUB bootloader.



My preferred way of doing this would be to just copy the GRUB binaries to the mounted EFI partition, but the binaries are not available anywhere and so this would not be the recommended way to approach this (I guess?).
Would this work in theory (the UEFI firmwares seem to be able to read the fat file-system of the EFI partition, so why shouldn't I just copy the binaries)?
So the common approach seems to be to use grub-install (from within some Linux OS, which I am running in a VM). The problem right now is, that I am not really sure what this does in the end. I want to install a plain EFI-Bootloader without any MBR-Legacy things, so this whole thing should only consist of files within the EFI partition, right?
It seems quite opaque what grub-install does. After quite some effort to get it running out of the box, I installed the grub-efi-amd64 package.
After a reboot I was able to install it, but I needed to specify a device. Which again confuses me, because considering the prior assumptions it should only need to know the mount-point of the EFI-partition.

There seems to be an option called --efi-directory which probably should resolve this but if used, grub-install complains about me not specifying a device.



In my view it is also quite suspicious that the bootloader seems to be installed but the EFI partition is empty. I have a feeling that it was installed in the legacy-MBR way, can you confirm this?
What would be your advice for me to reach the goal of a vanilla EFI grub installation?
I would highly appreciate your help, thx in advance!

No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...