Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
efibootmgr questions
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
houtworm
Guru
Guru


Joined: 08 Mar 2003
Posts: 391
Location: Den Haag, Netherlands

PostPosted: Wed Jan 04, 2023 9:38 am    Post subject: efibootmgr questions Reply with quote

I have a few questions about the efibootmgr.
I looked at the wiki page https://wiki.gentoo.org/wiki/Efibootmgr

questions:
1/ what does the efibootmgr do what grub can't do?
2/ do I have to rename my kernel to kernel.efi ?
3/ why do I have to remount efivars to rw ? When rebooting, the changes are lost.

comment: I think it is a bad idea to put the kernel in the efi partition. With multiple linux distro's the efi partition it too small. I put my kernels in the partition of each distribution, in /boot and mount efi at /boot/efi like other distro's do. That is also where grub can find it.
_________________
niemand is onbekwamer, dan een timmerman zonder hamer

Kees
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54300
Location: 56N 3W

PostPosted: Wed Jan 04, 2023 9:58 am    Post subject: Reply with quote

houtworm,

efibootmgr manages the efivars, stored in the EFI non volatile memory.
The efivars tell the EFI firmware what the boot order is and for each entry, where to try to boot from.
They do other things too but in the context of your question, that's the main one.
As such, they are consulted before grub, or any other EFI compatible program is loaded.

Grub comes later, if the efivars instruct the EFI firmware to load grub.

The EFI firmware will only load EFI compatible binaries with filenames ending in .efi.
To make the kernel an EFI compatible binary, select the EFI_STUB option in the kernel and give it a name ending in .efi when its copied to the EFI System Partition.

The EFI firmware can only read the ESP, so anything it is to load has to go there.
If its a boot loader, the boot loader can load things from other places, provided that it can read the filesystem(s).
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
sMueggli
Guru
Guru


Joined: 03 Sep 2022
Posts: 374

PostPosted: Wed Jan 04, 2023 10:21 am    Post subject: Re: efibootmgr questions Reply with quote

houtworm wrote:

3/ why do I have to remount efivars to rw ? When rebooting, the changes are lost.


The rw mounting is needed so that the operating system is able to delete/update/add EFI variables, that are stored in NVRAM. The behaviour depends on the actual implementation of the firmware. Some do a housekeeping of valid entries and others not. With some implementations you can block any write access to the EFI variables. The command grub-install has the option --no-nvram to skip the modification of the EFI variables (either because the firmware blocks write access or you do not want to change the boot order).

houtworm wrote:

comment: I think it is a bad idea to put the kernel in the efi partition. With multiple linux distro's the efi partition it too small. I put my kernels in the partition of each distribution, in /boot and mount efi at /boot/efi like other distro's do. That is also where grub can find it.


Using a bootloader, there is no good reason to (ab)use the EFI System Partition as /boot. Just mount the ESP to /boot/efi and install only the different bootloaders on the ESP.
Back to top
View user's profile Send private message
houtworm
Guru
Guru


Joined: 08 Mar 2003
Posts: 391
Location: Den Haag, Netherlands

PostPosted: Wed Jan 04, 2023 12:30 pm    Post subject: Re: efibootmgr questions Reply with quote

Ah so the nvram is on my motherboard! I have never used an OS that writes on the motherboard so this is new to me. It makes a lot of sense!
Thank you both for the answers, I am seeing the light now!
Ok so grubx64.efi is enough, no kernel needed.
I have never used UEFI but now with a few linux distro's it became very complicated with using a single boot partition for everything. And now I could install windows without ruining the bootsector :-) Yeah got you there Bill Gates!
It tooko me a few days of reading and trying and I am so glad with your help, now just the finishing touch and it is done!
_________________
niemand is onbekwamer, dan een timmerman zonder hamer

Kees
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54300
Location: 56N 3W

PostPosted: Wed Jan 04, 2023 12:50 pm    Post subject: Reply with quote

houtworm,

Perhaps a contrast between BIOS bootinh anh EFI booting is useful.
The (non-EFI) BIOS can read exactly one sector from the boot drive. That's LBA 0. A long time ago that was known as Cylinder 0, Head 0, Sector 0.
If LBA 0 failed, the drive could not be used as a boot drive.
The code there had to be enough to start the system. It was just enough to load a better loader ...

With EFI, the is no boot sector any more. EFI can read exactly one filesystem type. VFAT.
It loads an EFI compliant binary from the ESP. The EFI compliant binary can do whatever you want.

With both systems its possible to enter the firmware and change the boot order.
With BIOS, you choose a different drive as each drive has at most one boot sector.
With EFI, you choose a different boot entry in the efivars, and maybe define a new one. Different entries may be on different drives but need not be.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum