INSTALLING GRUB2/EFI

FROM SCRATCH

wget https://ftp.gnu.org/gnu/grub/grub-2.04.tar.gz
#rm -rf grub-2.04
tar xzf grub-2.04.tar.gz 
cd grub-2.04/
./configure --with-platform=efi
nice make -j$j
make install

EFI INSTALL

ls -lF /usr/local/lib/grub/x86_64-efi/
mkdir /boot/efi/EFI/grub
/usr/local/bin/grub-mkimage --format=x86_64-efi --output=/boot/efi/EFI/grub/grub.efi -p "" part_gpt part_msdos fat ext2 normal chain boot configfile linux multiboot xfs all_video
#ntfs ntfscomp hfsplus

SETUP

#modprobe efivars
efibootmgr --create --gpt --disk /dev/sda --part 1 --write-signature --label "GRUB2" --loader "\\EFI\\grub\\grub.efi"
efibootmgr -v

#normal multiboot
grub-file --is-x86-multiboot /boot/xen.gz && echo YES
#grub-file --is-x86-multiboot /boot/vmlinuz && echo YES

#EFI multiboot
#grub-file --is-x86-multiboot2 /boot/xen.gz && echo YES
#grub-file --is-x86-multiboot2 /boot/vmlinuz && echo YES

vi /boot/efi/EFI/grub/grub.cfg

    insmod all_video

and see Setting up GRUB2

FIXING EFI FROM BIOS/CSM/LEGACY

no EFI functions are available

#modprobe efivars
efibootmgr

EFI variables are not supported on this system.

get the EFI partition

fsck.vfat /dev/sda2
mount /dev/sda2 /mnt/

no need for tweaking the EFI boot manager

mkdir -p /mnt/EFI/boot/
grub-mkimage --format=x86_64-efi --output=/mnt/EFI/boot/BOOTX64.EFI -p "" part_gpt part_msdos fat ext2 normal chain boot configfile linux multiboot xfs all_video

setup

vi /mnt/EFI/boot/grub.cfg

...
insmod all_video
...

umount /mnt
reboot

TROUBLESHOOTING

error: no suitable mode found.
booting in blind mode

==> insmod all_video

Re: no suitable video mode found https://lists.gnu.org/archive/html/help-grub/2018-01/msg00009.html

(no error no suitable video mode found https://sourceforge.net/p/g4l/discussion/408763/thread/9b13dddb75/?limit=25

error: no multiboot header found

RESOURCES

EFI system partition https://en.wikipedia.org/wiki/EFI_system_partition

Grub2 + EFI from scratch https://www.linuxquestions.org/questions/linux-general-1/grub2-efi-from-scratch-4175426615/

UEFIBooting https://help.ubuntu.com/community/UEFIBooting

Efibootmgr https://wiki.gentoo.org/wiki/Efibootmgr

GRUB2 https://wiki.gentoo.org/wiki/GRUB2#UEFI.2FGPT

Xen EFI https://wiki.xenproject.org/wiki/Xen_EFI

OpenBSD (U)EFI bootloader howto https://blog.jasper.la/openbsd-uefi-bootloader-howto.html

Installing Slackware on UEFI-based hardware https://docs.slackware.com/howtos:slackware_admin:installing_on_uefi_hardware

Linux kernel options for UEFI and ELILO https://docs.slackware.com/howtos:slackware_admin:linux_kernel_options_for_uefi_and_elilo

multiboot

Multiboot specification https://en.wikipedia.org/wiki/Multiboot_specification

Multiboot https://wiki.osdev.org/Multiboot

Multiboot headers https://intermezzos.github.io/book/first-edition/multiboot-headers.html


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun