122 - Boot directly to UEFI mode using Clover


Clover is a later revision of Tianocore. Both are 'firmware in RAM' replacements for UEFI firmware.
It allows you to boot in MBR\CSM mode and then run Clover which acts as a 'pseudo-UEFI boot manager', allowing you to boot to a UEFI OS from an MBR\CSM boot.

You can make a USB drive which boots to grub4dos in MBR mode (grub4dos will not boot in UEFI mode) and then load Clover. From the Clover GUI you can then boot from the UEFI files on the same USB drive (e.g. Windows 7/8 installation files) or UEFI-boot from a different partition/drive.

i.e. without rebooting we will follow this path:
grub4dos --> Clover --> UEFI boot files --> UEFI OS

Note that Easy2Boot now supports Clover for booting 64-bit FAT32 partition images to UEFI.

Note: Clover seems to constantly change and different versions have different bugs. The config.plist syntax also seems to vary a lot between versions. e.g The current release version does not seem to detect \EFI\boot\bootia32.efi files (July 2015).


I will assume the following:
  1. The UEFI boot files are on the FIRST PRIMARY FAT32 partition of your USB drive. This is a MUST HAVE prerequisite. You could use place the Clover files and PBR on a different FAT32 partition if you wish but you would need to modify the menu.lst file. To have the capability of UEFI-booting directly to the Windows installer, the FAT32 partition needs to be the first one - if you always want to boot via Clover from MBR mode, you could put the Clover boot files on a different partition.
  2. Most UEFI firmware will only boot from a FAT32 partition if it is the first one on the USB drive. You can have other partitions (e.g. NTFS) after this first partition if you wish. Note that Windows\WindowsPE\Windows Setup cannot access any partition, other than the first one, if the USB drive is a Removable-type flash drive.
  3. The Partition Boot Record (PBR) will need to contain Clover boot code, therefore we need to backup the current PBR boot sector to PBR.BIN. To boot to syslinux, we can then use chainloader /PBR.BIN instead of chainloader +1.
  4. The Master Boot Record (MBR) must contain grub4dos boot code
  5. Clover will only be able to access USB drives that are connected to a USB 2.0 port (even though you may be able to boot to grub4dos from a USB 3.0 port)
  6. I will assume we are only interested in 64-bit booting (the \EFI\CLOVER\BOOTIA32.EFI file and drivers32 folder is required for 32-bit UEFI).


Obtain the Clover Boot Files

A ready-made download put together by me is here. It contains boot1F32ALT7 and PBR.BIN files and a modified config.plist file to show bootx64.efi entries plus the ntfs.efi driver in the drivers64 folder - or you can make your own version as follows...
    1. You need a Clover bootable file set. I recommend you download BootDiskUtility and use it to install Clover onto a spare USB Flash drive. This will boot directly to Clover. Then copy the files from the USB drive to a folder on your system's hard disk - e.g. C:\temp\Clover\orig.
      You can use this flash drive immediately (on a real system not under QEMU) for testing. Tip: Press 7 immediately after it starts to boot to Clover if you have problems booting.

      Alternatively, download a bootable Clover ISO from here - e.g. CloverISO-2671.tar.lzma. Unzip it and then unzip the Clover2k-xxxx-X64.iso file to your C:\temp\Clover\orig folder.

      You should now have a folder structure like this (ones in red not required):

    2. Make a copy of the orig folder and call it USB - i.e. C:\temp\Clover\USB
    3. Delete from the USB folder the USB\usr, USB\Library and [BOOT] folders (if present)
    4. Delete from the USB folder the USB\EFI\BOOT folder (the Clover \EFI\BOOT\xxx.efi files must NOT be present - these will cause a UEFI boot to boot back to Clover again!)
    5. If present, delete the large 3MB Russian PDF in the USB\EFI\CLOVER\doc folder (unless you speak Russian and find it useful!)
    6. (optional) Some themes are quite large (e.g. USB\EFI\CLOVER\themes\metal is 4MB) - you can delete this 'themes\xxxx' folder and/or replace it with a different theme folder. See 'Themes' below for more details
7. Clover can also use a selection of boot files, these are boot2, boot3, boot6, boot7 and boot8 (\boot is the default file - but we won't be using this).
Also we need a special modified PBR boot file called \Clover\boot1F32ALT7.
These boot files can be downloaded from here.
IMPORTANT: If you have a file called \boot then delete it, as it will prevent you from having a folder called \BOOT which is required by Windows.

8. Download and add the file PBR.BIN to the USB folder (from here).

9. For NTFS support, ensure that the ntfs.efi file is in the \EFI\CLOVER\drivers64 folder (and drivers32 if for 32-bit systems).

10. Check the 'Hide' entries in \EFI\CLOVER\config.plist - ensure BOOTX64.EFI is not there (if so delete that line from the file or add XXX in front of it)

11. Delete any files in the \EFI\BOOT folder - these will boot to Clover from a UEFI boot and we will replace these files with our payload .efi files later so that it boots to the payload OS rather than booting to Clover.

You should now have a C:\temp\Clover\USB folder containing one \EFI\CLOVER folder. In the \EFI\CLOVER folder should be CLOVERX64.efi (used for 64-bit MBR booting) and other files and folders. CLOVERIA32.EFI and the \EFI\CLOVER\drivers32 folder are only used when booting on a 32-bit system.

Essential these files, as a minimum, are present:
  • \boot7
  • \PBR.BIN
  • \Clover\BOOT1F32ALT7
  • \Clover\boot0ss
  • \EFI\CLOVER folder

Make a grub4dos-bootable USB Drive

  1. You need a USB drive that contains a FAT32 partition as the first partition (in the partition table). If you wish you can have further Primary partitions (FAT32 or different).
  2. The FAT32 partition should be marked as Active (bootable) - not essential, but it helps 'bootability' on a wider variety of systems.
  3. For best compatability, the partition geometry should be 255 heads x 63 sectors (use RMPrepUSB to partition it, if you are not sure what this means!)
  4. Install grub4dos to the MBR of the drive (I recommend using the RMPrepUSB - Install grub4dos button) Tip: select the No User Prompts tick box first!
  5. Ensure \grldr is present after installing grub4dos - use a 2014 version (or 2013 at the latest!)
I recommend you use RMPrepUSB to wipe and format a USB drive (RMPrepUSB improves write speeds and gives a more reliable boot experience). If you are only going to have one single partition on the USB drive, tick the RMPrepUSB 4 - Boot as HDD (C: 2PTNS) option, otherwise untick it. If you are going to have more than one partition, set the size of the first partition in the Size box before you format it with RMPrepUSB and then use something else to create the 2nd NTFS Primary partition.

Check the USB drive

Before we go any further, use RMPrepUSB to check your USB drive is formatted correctly using RMPrepUSB (or other methods) as below:
  1. Select the USB drive in the drive selection list and click on Drive Info and type 0 - then look at the NotePad window and check that the first partition is a FAT32 partition and is Active
  2. Check that the END POS HD and SEC numbers are 254 and 63. If they are not then it may not boot correctly on some systems - see below (e.g. Acer 77xx Series laptops are fussy!).
  3. Check that the 'Missing MBR-helper' string is present in the first sector data (see below) - this means that the grub4dos code has been correctly installed to the MBR.
  4. Check that it boots to the grub4dos console by clicking on the Test Using QEMU Emulator F11 button in RMPrepUSB (enter 0 for the Virtual Drive size and accept the default for the memory size) - you should see a grub4dos console window. Check that the grub4dos version (shown at the top of the console) is around mid-2013 or later. If not, replace the \grldr file with one from here. Use version 0.4.5c 2014-01-17 or later (avoid 0.4.6a versions as these are Beta versions).
Example Drive Info partitions displayed in NotePad:
Partition 1 SIZE=30798.969MiB Type: 0C FAT32LBA (2047GB max) *ACTIVE*
START POS = CYL:0 HD:1 SEC:1 END POS = CYL:1023 HD:254 SEC:63
START (LBA) = 63 (0000003F) SIZE (LBA) = 63,076,289 (03C277C1) [End=63,076,351]

Partition 2 SIZE=0MiB Type: 00
START (LBA) = 0 (00000000) SIZE (LBA) = 0 (00000000)

Partition 3 SIZE=0MiB Type: 00
START (LBA) = 0 (00000000) SIZE (LBA) = 0 (00000000)

Partition 4 SIZE=0MiB Type: 00
START (LBA) = 0 (00000000) SIZE (LBA) = 0 (00000000)

0190 0A 4D 69 73 73 69 6E 67 - 20 4D 42 52 2D 68 65 6C .Missing MBR-hel
01A0 70 65 72 2E 00 00 00 00 - 00 00 00 00 00 00 00 00 per..... ........

Add the Clover Files

Assuming you now have a bootable grub4dos USB 'Active' FAT32 drive, we can now add the Clover files
  1. Copy the USB folder contents from C:\temp\Clover\USB to the root of your USB drive's FAT32 first partition
Essential files, as a minimum, that must be present are:
  • \boot7
  • \PBR.BIN
  • \Clover\BOOT1F32ALT7
  • \Clover\boot0ss
  • \EFI folder

Add your Payload Files

Now we need to copy the OS files to the USB drive. I will assume that you want to add Windows 7/8 Installer files from a Windows 7/8 ISO or DVD. Linux could be added instead.
  1. Copy ALL the source OS files directly to the root of the USB drive (or the 2nd NTFS partition if you prefer)
  2. Check that there is an \EFI\boot\bootx64.efi file (used for 64-bit UEFI booting). If not, then the source files you used are not 64-bit UEFI-bootable or you will need to move\rename some files (e.g. if an early Win7 version) so that the \EFI\boot\bootx64.efi file is present.

Add the grub4dos menu

The grub4dos menu is at \menu.lst. You will need to use an existing menu.lst file from one of your other projects or one of my projects from this site or use NotePad to create a own new file. Note: If using Windows NotePad, ensure you save the file as 'Save as *.*' and it is menu.lst and not menu.lst.txt !

The menu.lst code to add a Clover boot menu entry is shown below. Ensure that the \menu.lst file contains this code.
The PBR code is automatically backed up and is changed by the Clover boot menu code (overwritten, non-volatile and remains patched after a reboot).
If your PBR contained needed boot code (e.g. syslinux boot code), use the backup in \PBR.BIN to boot from the PBR now (see last menu entry below).

# backup PBR - this must go at the start of the menu.lst file
dd if=()+2 of=()/PBR.BIN > nul

iftitle [if exist /boot7 && cat --locate="FAT32" --length=10 --skip=0x50 ()+1 > nul] Clover 64-bit UEFI Boot Menu\n Boot via UEFI (choose the UEFI boot option)\n Note: EFI options are for MBR booting\n Use a USB 2.0 port (USB 3.0 not supported)
set CL=0
## boot7 is default boot file
cat --locate="BOOT7" --length=10 --skip=0x58 ()+1 > nul && set /a CL=%CL%+1 > nul
if "%CL%"=="1" echo Information: Clover is already installed to the PBR
echo ffffffffff > (md)0x350+1
dd if=(hd0,0)+1 of=(md)0x350+1 > nul
dd if=()/clover/boot1f32alt7 of=(md)0x350+1 skip=90 seek=90 bs=1 > nul
dd if=()/clover/boot1f32alt7 of=(md)0x350+1 count=3 bs=1 > nul
#cat --hex (md)0x350+1 && pause
if not "%CL%"=="1" dd if=(md)0x350+1 of=(hd0,0)+1 > nul && pause --wait=2 PBR has been updated with Clover boot code...
chainloader /clover/boot0ss

# User can press 2 for 3 for 32-bit UEFI, 6 for 64-bit UEFI or 1 for Chameleon - within 2 seconds - uses \bootx files in root
# boot0md (multi-drive) displays a boot0 message and is slower and needs an active partition - boot0ss is silent and quick.

iftitle [if exist (hd0,1)/bootmgr] Boot Windows on 2nd partition (MBR-mode)\n Boot Windows using bootmgr on (hd0,1)
root (hd0,1)
chainloader /bootmgr

iftitle [cat --locate="SYSLINUX" --length=10 --skip=0x2 /PBR.BIN > nul] Alternate boot (syslinux)\n Try this if the other boot options don't work.
errorcheck off
chainloader /PBR.BIN && boot

IMPORTANT: If you have other menu entries that use chainloader +1 or chainloader ()+1 or chainloader (hd0,0)+1 then you will need to change the code to
chainloader /PBR.BIN

Ready - Steady - Go!

You should now be able to boot the USB drive to grub4dos, select the Clover menu option and boot to the Clover GUI (if you see a text-mode BIOS-type screen, then it did not boot correctly! - check the \EFI\CLOVER\CLOVERxxxx.efi files are present). If it immediately boots to Windows Setup, then you have booted it from a UEFI system in UEFI mode! You must choose a non-UEFI boot option to boot to grub4dos.

You can either test on a real system or use Virtual Box + DavidB's VMUB utility - set up the VM for UEFI booting (Settings - System - Enable EFI (special OSes only)).
Note: The RMPrepUSB QEMU version is 32-bit onlly and will not boot 64-bit Clover.

Clover - Black and Green theme

Using Clover

You can press F1 for help or select a boot option from one of the larger Clover boot icons.

IMPORTANT: Some Clover themes calls MBR\CSM boot options 'EFI'. So the 'Boot EFI...' options mean boot in MBR mode, whereas the 'Boot UEFI xxxxx' options mean boot in UEFI mode.

EFI = MBR\CSM (old BIOS mode)
UEFI = UEFI (new UEFI mode)

For more information on Clover see here and the wiki here.

Only the \boot7 and \Clover\BOOT1F32ALT7 files are essential (as well as the \EFI folder). If you are short of space, you can delete the other bootx files and the other files in the \Clover folder.

FAT32 is limited to 4GB!

You may notice that the largest file (usually \sources\install.wim) that you can have on a FAT32 partition is 4GB. UEFI booting must be from a FAT formatted partition (though you can ask Clover to boot from an NTFS .efi file manually). If you have a large Windows install (e.g. an All-In-One ISO) which you want to add to the USB drive, you have some choices...