Introduction
The main reason to use EFI bios is to boot from GPT partitionins instead of MBR.
GPT allows more than 3 primay partitions to be created, so it is useful if one should install for example - several VMs on the same hard-drive.
This article assumes the following:
1. You are using Linux RedHat EL 6 or Oracle EL 6 x64.
2. You are using VMWare with physical partitions.
3. Linux 6 is already installed which comes with Grub1 so we need to install and setup Grub2.
Grub2 will be available in RHEL/OEL 7.
4. You have created a vfat (FAT32) formatted partition to be used for EFI boot.
GNU Parted can be used if you are using the whole phisical disk or diskpart/Disk Management from the Windows host if running VMWare Workstation.
Installation
1. Create a 100MB vfat (FAT32) partition then configure VMWare to use it as well as the Linux partitions
2. Change the bios type for the VM by adding to the .vmx file
firmware="efi"
3. Add the vfat EFI partition (called ESP) to automount in Linux
- Using the Linux rescue DVD, boot with Network enabled and:
chroot /mnt/sysimage
mkdir /boot/efi
- Assuming yout vfat partition is /dev/sda5, add it to /etc/fstab
/dev/sda5 /boot/efi vfat defaults 1 2
- Mount the partition
mount -a
4. Uninstall Grub1
rpm -e grub
5. Install required packages (assuming you have yum setup)
yum install efibootmgr.x86_64
More software will be required and will be asked by ./configure utility, depending on your installation.
You need to have (from Grub2 INSTALL file):
* GCC 4.1.3 or later* GNU Make* GNU Bison 2.3 or later* GNU gettext 0.17 or later* GNU binutils 2.9.1.0.23 or later* Flex 2.5.35 or later* Other standard GNU/Unix toolsOn GNU/Linux, you also need:* libdevmapper 1.02.34 or later (recommended)To build grub-emu, you need:* ncurses* libusb (recommended)* SDL (recommended)To build GRUB's graphical terminal (gfxterm), you need:* FreeType 2 or later* GNU Unifont
6. Get Grub2
7. Configure and build grub2 for x86_64
./configure --sbindir=/sbin --prefix=/usr --target=x86_64 --with-platform=efi
./configure --sbindir=/sbin --prefix=/usr --with-platform=efi
make install
8. Install grub2
grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id="Linux" --boot-directory=/boot/efi/EFI --recheck
grub-install performs the following:
- Creates a folder called "Linux" in /boot/efi/EFI
- Creates the EFI boot binary PE: /boot/efi/EFI/Linux/grubx64.efi
- Adds the default boot entry labeled "Linux" in the EFI Bios using efibootmgr
9. Create the grub config
grub-mkconfig -o /boot/efi/EFI/grub/grub.cfg
The cfg is created in the pre-defined location called "grub" so it can be loaded automatically. It will scan and use the current boot settings and create a grub2 menu.
Now your system should boot and you should be able to see the Grub2 menu.
Notes with VMWare physical partitions: if the EFI boot partition is of type "c12a7328-f81f-11d2-ba4b-00a0c93ec93b" (in Windows diskpart) - which means EFI System Partition, you might receive access denied errors while writing to /boot/efi from VMWare. The id for EFI System Partition must be set before installing RHEL/OEL so Anaconda installer can properly use the /boot/efi partition.
I think that after installation, it would be best to reassign the partition a normal type, "ebd0a0a2-b9e5-4433-87c0-68b6b72699c7", as follows:
diskpart
Select the disk that contains your EFI System Partition (disk number might be different)
sel disk 1
List the volumes
lis vol
Select the volume with the partition (yours might be different)
sel vol 11
set id=ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
exit
Sign up here with your email
Emoticon Emoticon