Clover

From ArchWiki

Clover EFI is a boot loader developed to boot OS X (Hackintoshes), Windows and Linux in legacy or UEFI mode.

The main advantages of Clover are:

  • Emulate UEFI on legacy BIOS systems
  • Boot Linux kernels with EFISTUB support
  • Supports native resolution GUI on wide screens people commonly use today
  • Easy to use
  • Easily customizable

Installation

As Clover emulates a UEFI environment on BIOS systems, the steps for each type of system are similar.

UEFI Systems

Mount EFI system partition to /boot. This is the preferred method when directly booting an EFISTUB kernel from UEFI.

Generate initial ramdisk environment with mkinitcpio

Download Clover Bootable ISO from here.

Extract the archive Clover-*-X64.iso.7z and find the Clover-*-X64.iso file, mount it to a directory like /mnt/iso. It should be noted all file/folder names will be displayed in lower case in Linux, which is different from Windows and Mac OS.

Copy the whole /mnt/iso/efi folder to your EFI system partition. The tree for /boot should look likes the following

/boot/efi
/boot/efi/boot
/boot/efi/clover
/boot/initramfs-linux-fallback.img
/boot/initramfs-linux.img
/boot/vmlinuz-linux

BIOS Systems

Note: Even though this is Legacy BIOS, the UEFI/GPT partitioning layout is required. The only difference is the "Legacy BIOS bootable" flag needs to be set on the EFI system partition.

Download the Clover Bootable ISO.

Extract the archive Clover-*-X64.iso.7z and find the Clover-*-X64.iso file, mount it to directory like /mnt/iso.

Merge Clover code with current Master and Partition Boot Records (assuming ESP is partition 1 of /dev/sda, change if necessary):

# dd if=/dev/sda1 of=/tmp/origPBR bs=512 count=1 conv=notrunc

# cp /mnt/iso/usr/standalone/i386/boot1f32 /tmp/newPBR

# dd if=/tmp/origPBR of=/tmp/newPBR skip=3 seek=3 bs=1 count=87 conv=notrunc

# dd if=/tmp/newPBR of=/dev/sda1 bs=512 count=1 conv=notrunc

# dd if=/mnt/iso/usr/standalone/i386/boot0ss of=/dev/sda bs=440 count=1 conv=notrunc

Mount the EFI system partition to /boot.

Copy the whole /mnt/iso/efi folder to your EFI system partition.

Copy the legacy bootloader to the EFI system partition:

# cp /mnt/iso/usr/standalone/i386/x64/boot6 /boot/boot

Configuration

Configuration is done through an xml file config.plist under path EFI/CLOVER from the UEFI partition.

A tool is now available to easily edit your config.plist in any OS: Cloud Clover Editor (CCE)

For the meaning of each key, please reference their wiki for custom entries. The key Volume should be the PARTUUID of the EFI partition and must be in upper case. The minimal initramfs initramfs-linux.img in Argumentsand the Linux kernel executable vmlinuz-linux in Path are relative to the EFI partition. Backslashes should be used in accordance with EFI standards. For other arguments in Arguments, please reference EFISTUB and Kernel parameters#Parameter list.

In this example, the initramfs and kernel files are placed at the root of the EFI partition, at the same level as the efi directory. The EFI partition is mounted at /boot

/boot/efi/clover/config.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>GUI</key>
  <dict>
    <key>Custom</key>
    <dict>
      <key>Entries</key>
      <array>
        <dict>
          <key>Arguments</key>
          <string>initrd=\initramfs-linux.img root=PARTUUID=d5d0fceb-c58e-c745-a7ff-f2f1b2824e66 rw add_efi_memmap</string>
          <key>Path</key>
          <string>\vmlinuz-linux</string>
          <key>Title</key>
          <string>Arch Linux</string>
          <key>Type</key>
          <string>Linux</string>
          <key>Volume</key>
          <string>33BA6C23-4772-294D-9053-72A49FCAEF39</string>
          <key>VolumeType</key>
          <string>Internal</string>
        </dict>
        <dict>
          <key>Arguments</key>
          <string>initrd=\initramfs-linux-fallback.img root=PARTUUID=d5d0fceb-c58e-c745-a7ff-f2f1b2824e66 rw debug add_efi_memmap</string>
          <key>Path</key>
          <string>\vmlinuz-linux</string>
          <key>Title</key>
          <string>Arch Linux Rescue Mode</string>
          <key>Type</key>
          <string>Linux</string>
          <key>Volume</key>
          <string>33BA6C23-4772-294D-9053-72A49FCAEF39</string>
          <key>VolumeType</key>
          <string>Internal</string>
        </dict>
      </array>
    </dict>
  </dict>
</dict>
</plist>

chainload systemd-boot

If you need a bootloader for BIOS systems that follows The Boot Loader Specification, then systemd-boot can be pressed into service on BIOS systems. This is the configuration file needed make Clover chainload systemd-boot.

/boot/efi/clover/config.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Boot</key>
	<dict>
		<key>DefaultVolume</key>
		<string>EFI</string>
		<key>DefaultLoader</key>
		<string>\EFI\systemd\systemd-bootx64.efi</string>
		<key>Fast</key>
		<true/>
	</dict>
	<key>GUI</key>
	<dict>
		<key>Custom</key>
		<dict>
			<key>Entries</key>
			<array>
				<dict>
					<key>Hidden</key>
					<false/>
					<key>Disabled</key>
					<false/>
					<key>Image</key>
					<string>os_arch</string>
					<key>Volume</key>
					<string>EFI</string>
					<key>Path</key>
					<string>\EFI\systemd\systemd-bootx64.efi</string>
					<key>Title</key>
					<string>Arch Linux</string>
					<key>Type</key>
					<string>Linux</string>
				</dict>
			</array>
		</dict>
	</dict>
</dict>
</plist>

See also