From 928a01e0408231a0e634c043dc0dd1f2f05f8ef0 Mon Sep 17 00:00:00 2001 From: Matěj Laitl Date: Wed, 12 Oct 2011 00:05:47 +0200 Subject: GRUB 2 Guide: significantly enhance EFI section (nearly complete) --- docs/grub-2-guide.xml | 118 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 115 insertions(+), 3 deletions(-) diff --git a/docs/grub-2-guide.xml b/docs/grub-2-guide.xml index e8c5b72..44daf5a 100644 --- a/docs/grub-2-guide.xml +++ b/docs/grub-2-guide.xml @@ -289,10 +289,122 @@ use it at all.

-TODO: grub image +Next, you should add (or edit) an entry for the /boot partition into fstab and +mount it: +

+ +
+# cat /etc/fstab | grep efi-boot
+LABEL=efi-boot   /boot   vfat   defaults   0 2
+# mount /boot
+
+ +

+Next, you should copy GRUB 2 modules into /boot where they can be found by +GRUB 2 during system boot: +

+ +
+# mkdir -p /boot/grub2
+# cp /lib/grub2/x86_64-efi/* /boot/grub2/
+
+ +

+The most crucial step is creating the GRUB 2 image (EFI application). This is +accomplished using the grub2-mkimage command: +

+ +
+# grub2-mkimage -p /grub2 -o /boot/grub2/grub.efi -O x86_64-efi part_msdos part_gpt fat
+
+ + + + + + + + + + +where should GRUB 2 look for its modules and config? +/grub2 +relative to the root of the +partition where GRUB 2 EFI application is executed from + + + + +where to store created image? +/boot/grub2/grub.efi + + + + +platform to create image for +x86_64-efi +replace with i386-efi on 32bit systems (old Intel Macs) + + + + +modules from /lib/grub2/[platform] to statically link in +part_msdos part_gpt fat +you only need to specify modules that are needed to be able to load other +modules from filesystem. You may drop part_msdos or part_gpt if +you don't use such partitions. You may add normal for a decent GRUB 2 +shell available even in cases GRUB 2 cannot load other modules + +
grub2-mkimage optionsrecommended valuenotes
-p
-o
-O
<rest>
+ +

When GRUB 2 image (EFI application) is made, you have to tell your firmware +to execute it upon boot. There are two ways to achieve this. If there is +already a default bootloader on your EFI System Partition that you don't want +to overwrite, you have to use the second. Otherwise you can use the first and +we encourage you to do so, since it is simpler. +

+ +
+# mkdir -p /boot/EFI/BOOT
+# cp /boot/grub2/grub.efi /boot/EFI/BOOT/BOOTX64.EFI
+
-After you have prepared your GAGA, you can easily proceed with generating the -configuration. + +EFI 2 specification says that the default bootloader location is [EFI System +Partition]\EFI\BOOT\BOOTx64.EFI for x86_64 hardware. (and +...\BOOTIA32.EFI on 32bit systems) While FAT32 filesystems should be +case-insesitive, it is recommended to use ALL-CAPS filenames in default +bootloader path in order to be compatible with all vfat mount options. + + +
+# efibootmgr TODO TODO TODO
+
+ + +Executing efibootmgr on Macs is known to brick (destroy) your firmware! +Various sources report that the bless command should be used instead. + + +

+Last, you should create a GRUB 2 environment file (where GRUB 2 stores +persistent variables such number of the last booted item) as it is not created +automatically: +

+ +
+# grub2-editenv - create
+
+ + +When you update GRUB 2, be sure to execute all commands that are marked as +such. Failure to do so would result in you using the previously installed GRUB +version. + + +

+The last step is actually installing Linux kernel images into /boot, then you +can easily proceed with generating the configuration.

-- cgit v1.2.3-65-gdbad