EFISTUB: Load Linux with Clover

Discussion in 'Bootloaders' started by vulgo, Aug 21, 2016.

  1. vulgo

    vulgo

    Joined:
    Jul 24, 2015
    Messages:
    2,281
    Motherboard:
    MSI H81i
    CPU:
    i5-4570
    Graphics:
    RX 580
    Aug 21, 2016 at 9:17 PM #1
    vulgo

    vulgo

    Joined:
    Jul 24, 2015
    Messages:
    2,281
    Motherboard:
    MSI H81i
    CPU:
    i5-4570
    Graphics:
    RX 580
    Clover can boot linux without the need for chain-loading of bootloaders e.g. GRUB. This is possible because for some time (>3.3) the kernel has contained its own EFI bootloader. Clover loads the kernel as an EFI executable.

    Arch Linux

    Example steps using an existing EFI system partition (e.g. same one as Clover). Using the EFI partition in this way means we don't need additional file system drivers.

    First, discover some partition UUIDs, and edit /etc/fstab so that the EFI partition mounts at boot time on /boot.

    Unmount whatever is mounted on /boot

    Code:
    sudo umount /boot
    We need 2 partition UUIDs (PARTUUID), one for the root volume (for the kernel command line) and one for the EFI partition (from where the kernel itself will be loading). Copy them for later use.

    List partitions with blkid

    Code:
    sudo blkid
    PARTUUIDs obtained from 'blkid' output that will be used in this example:

    EFI: 3ecfa8d5-8c7f-485e-a90e-a917f1fa7da5
    Root: c8c7afb0-55c6-4065-bf3d-dd39cbd39e69

    Edit existing or create new fstab entry for /boot

    Code:
    sudo nano /etc/fstab
    Use the EFI partition UUID you obtained earlier e.g.

    Code:
    PARTUUID=3ecfa8d5-8c7f-485e-a90e-a917f1fa7da5     /boot    vfat
    Save the file, and mount the partition

    Code:
    sudo mount PARTUUID=3ecfa8d5-8c7f-485e-a90e-a917f1fa7da5 /boot
    Next configure kernel and ramdisk updates so both of these get located at /boot (i.e. root of EFI partition). See your distro's documentation, steps for Arch:

    mkinitcpio: Backup + edit linux.preset

    Code:
    sudo cp /etc/mkinitcpio.d/linux.preset /etc/mkinitcpio.d/linux.backup
    sudo nano /etc/mkinitcpio.d/linux.preset
    Verify contents of mkinitcpio 'linux' preset, if no changes needed that is fine

    Install the kernel package with the new configuration + /boot mount point

    Code:
    sudo pacman -S linux
    Verify that the kernel and ramdisk are now present in the root of our EFI partition:

    Code:
    ls /boot
    Edit Clover's config.plist, creating a custom entry for the Linux kernel

    Code:
    sudo nano /boot/efi/clover/config.plist
    The custom entry should look something like this. We are still using the same UUIDs obtained earlier, pay attention to the EFI-style path (\ separator) in the Clover 'Path' property vs the POSIX-style path (/ separator) in the kernel command line.

    With the kernel now loadable from the EFI partition you could also add an option in the firmware boot menu with efibootmgr. EFISTUB on ArchWiki
     
    Last edited: Sep 12, 2018
  2. iKarith

    iKarith

    Joined:
    Aug 26, 2017
    Messages:
    15
    Motherboard:
    Dell MS0520 (Inspiron 620)
    CPU:
    i5-2400
    Graphics:
    GeForce GTX 650
    Mac:
    iMac, MacBook Air
    Classic Mac:
    Apple, LC
    Mobile Phone:
    iOS
    Sep 25, 2017 at 10:15 PM #2
    iKarith

    iKarith

    Joined:
    Aug 26, 2017
    Messages:
    15
    Motherboard:
    Dell MS0520 (Inspiron 620)
    CPU:
    i5-2400
    Graphics:
    GeForce GTX 650
    Mac:
    iMac, MacBook Air
    Classic Mac:
    Apple, LC
    Mobile Phone:
    iOS
    I started playing with Clover's options a bit and found that if I installed the proper filesystem drivers, Clover sees my Linux kernels just fine--no need to copy them anywhere. They don't boot without specifying a command line of course. With rEFInd, I can create a file that specifies how to do that for all kernels coming from a particular location (so multiple Linux distributions are possible). Is this something Clover can do and is it documented anywhere?

    If not, as long as I can specify Linux options for kernels from ONE distribution by default, that'll be enough. I just don't like it breaking when I upgrade kernels. ;)
     
  3. vulgo

    vulgo

    Joined:
    Jul 24, 2015
    Messages:
    2,281
    Motherboard:
    MSI H81i
    CPU:
    i5-4570
    Graphics:
    RX 580
    Sep 25, 2017 at 10:23 PM #3
    vulgo

    vulgo

    Joined:
    Jul 24, 2015
    Messages:
    2,281
    Motherboard:
    MSI H81i
    CPU:
    i5-4570
    Graphics:
    RX 580
    Using Clover's custom entries feature, you can pass the kernel command line in 'Arguments'.
     
  4. iKarith

    iKarith

    Joined:
    Aug 26, 2017
    Messages:
    15
    Motherboard:
    Dell MS0520 (Inspiron 620)
    CPU:
    i5-2400
    Graphics:
    GeForce GTX 650
    Mac:
    iMac, MacBook Air
    Classic Mac:
    Apple, LC
    Mobile Phone:
    iOS
    Sep 25, 2017 at 10:31 PM #4
    iKarith

    iKarith

    Joined:
    Aug 26, 2017
    Messages:
    15
    Motherboard:
    Dell MS0520 (Inspiron 620)
    CPU:
    i5-2400
    Graphics:
    GeForce GTX 650
    Mac:
    iMac, MacBook Air
    Classic Mac:
    Apple, LC
    Mobile Phone:
    iOS
    I found this entry on the Arch wiki talking about how to do that for a generic kernel symlink, but not necessarily, "for any Linux kernels you find on <partition ID>, use this command line..." If I want that, I may need to resort to chainloading bootloaders or spending an afternoon with the git repository perhaps.
     
  5. vulgo

    vulgo

    Joined:
    Jul 24, 2015
    Messages:
    2,281
    Motherboard:
    MSI H81i
    CPU:
    i5-4570
    Graphics:
    RX 580
    Sep 25, 2017 at 10:42 PM #5
    vulgo

    vulgo

    Joined:
    Jul 24, 2015
    Messages:
    2,281
    Motherboard:
    MSI H81i
    CPU:
    i5-4570
    Graphics:
    RX 580
    Command line is likely available at runtime, at /proc/cmdline and in bootloader configuration files. Mainly you need to pass the root disk path and ramdisk path and you will be able to boot. The Arch wiki has good documentation of efistub.
     
  6. jpz4085

    jpz4085

    Joined:
    Aug 2, 2015
    Messages:
    19
    Motherboard:
    Z97X-UD3H-BK
    CPU:
    i7-4790k
    Graphics:
    GTX 970
    Mobile Phone:
    Android
    Oct 1, 2017 at 4:58 AM #6
    jpz4085

    jpz4085

    Joined:
    Aug 2, 2015
    Messages:
    19
    Motherboard:
    Z97X-UD3H-BK
    CPU:
    i7-4790k
    Graphics:
    GTX 970
    Mobile Phone:
    Android
    I'd like to add something here. There is a Linux Kernel Scan feature which could potentially do this if the default arguments will work for you. Otherwise as indicated above you need to create a custom entry to specify a kernel file and command line. I just use one custom entry with the default options for the Arch and Ubuntu kernels on my machine and chainload GRUB for more options since Clover doesn't have working custom subentries.
     
  7. vulgo

    vulgo

    Joined:
    Jul 24, 2015
    Messages:
    2,281
    Motherboard:
    MSI H81i
    CPU:
    i5-4570
    Graphics:
    RX 580
    Oct 1, 2017 at 12:23 PM #7
    vulgo

    vulgo

    Joined:
    Jul 24, 2015
    Messages:
    2,281
    Motherboard:
    MSI H81i
    CPU:
    i5-4570
    Graphics:
    RX 580
    Not sure what options you mean. I have Arch installed on a desktop and on a chromebook and have found no need for GRUB.
     
  8. jpz4085

    jpz4085

    Joined:
    Aug 2, 2015
    Messages:
    19
    Motherboard:
    Z97X-UD3H-BK
    CPU:
    i7-4790k
    Graphics:
    GTX 970
    Mobile Phone:
    Android
    Oct 3, 2017 at 3:40 AM #8
    jpz4085

    jpz4085

    Joined:
    Aug 2, 2015
    Messages:
    19
    Motherboard:
    Z97X-UD3H-BK
    CPU:
    i7-4790k
    Graphics:
    GTX 970
    Mobile Phone:
    Android
    I found GRUB subentries useful for organizing multiple Linux kernels, with different command lines, from one or more distributions rather than creating several custom entries for each OS and kernel combination in Clover. This way I can boot each with it's standard options directly from Clover or select GRUB if I want to boot a different kernel or recovery mode, single user mode, terminal mode or want to change the arguments at boot time. The person above could use rEFInd too and hide it until it's needed so the Clover menu is cleaner. It's just an idea from my experience and maybe it'll help someone.
     
  9. commandlion

    commandlion

    Joined:
    Apr 14, 2017
    Messages:
    4
    Mar 24, 2018 at 11:46 PM #9
    commandlion

    commandlion

    Joined:
    Apr 14, 2017
    Messages:
    4
    Any chance you can elaborate on "the proper filesystem drivers?" I copied VBoxExt4.efi into drivers64UEFI and it doesn't see my linux kernels.

    Antergos keeps them at /boot with a consistent name.
     
  10. vulgo

    vulgo

    Joined:
    Jul 24, 2015
    Messages:
    2,281
    Motherboard:
    MSI H81i
    CPU:
    i5-4570
    Graphics:
    RX 580
    Mar 25, 2018 at 9:50 AM #10
    vulgo

    vulgo

    Joined:
    Jul 24, 2015
    Messages:
    2,281
    Motherboard:
    MSI H81i
    CPU:
    i5-4570
    Graphics:
    RX 580
    /Boot is the mount point - Clover needs a driver for whatever partition is mounted at /boot - i.e. in /etc/fstab. If you have your EFI partition mounted on /boot no extra filesystem driver is needed.

    Once you are sure Clover can read the partition and the kernel and ram disk are present create a custom entry with the required properties:

    Volume: GPT Partition UUID of whatever is mounted on /boot (Clover matches what you put here to its device path description so anything that matches should do really)
    Path: Path to linux kernel on above partition (EFI style so backslash not forward slash in paths)
    Arguments: Kernel command line (POSIX style paths)

    e.g.

    Edit:

    If the kernel is at /boot/vmlinuz-linux then
     
    Last edited: Mar 25, 2018

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice