Jump to content
From ArchWiki

Related articles

- Arch boot process
- Master Boot Record
- GUID Partition Table
- Unified Extensible Firmware Interface

Limine is an advanced, portable, multiprotocol boot loader originally developed as the reference implementation for the Limine boot protocol, but also supporting the ability to boot Linux as well as to chainload other boot loaders.

Note: In the entire article `esp` denotes the mountpoint of the EFI system partition aka ESP.

## Supported filesystems

Limine supports ext2, ext3, ext4, FAT12, FAT16, FAT32 and ISO9660.

## Installation

Installing the limine package will not deploy the boot loader for usage: it will just install its files and installation program.

## BIOS systems

### MBR vs. GPT

Legacy PC BIOS is capable of booting from either GPT or MBR partitioned devices. Limine supports both, with a very similar installation procedure. Furthermore, unlike GRUB, it does not require creating an extra partition containing raw data when installing to a GPT partitioned device.

Choosing GPT is beneficial for larger drives as it allows placing partitions further than 2TiB on disk, alongside additional benefits such as partition and disk GUIDs.

On the other hand, MBR is older and more limited, but it will ensure compatibility with quirky BIOSes which refuse to boot from GPT partitioned media.

### Deployment

After installing the limine package, core bootloader files will be installed to `/usr/share/limine`; most important for installing to BIOS systems is the `limine-bios.sys` file, which contains stage 3 code that Limine needs to boot. This file needs to reside on either the root, a `/boot`, a `/limine`, or a `/boot/limine` directory of any partition on the disk onto which Limine will be deployed, as long as the filesystem is supported.

For example:

    # cp /usr/share/limine/limine-bios.sys /boot/

Once that is done, stage 1 and 2 need to be deployed on disk. This is achieved by means of the `limine` utility, installed as part of the limine package, using its `bios-install` command. Installation is identical regardless of whether MBR or GPT is used, as `limine bios-install` will auto-detect what scheme is used and install itself appropriately.

Run `limine bios-install` as such:

    # limine bios-install /dev/sdX

where `/dev/sdX` is the disk (not a partition) where Limine is to be installed. For example `/dev/sda` or `/dev/nvme0n1`. See Device file#Block device names for a description of the block device naming scheme.

## UEFI systems

### Deployment

Deploying Limine on UEFI systems involves copying the `/usr/share/limine/BOOTX64.EFI` file to an EFI system partition, usually to `esp/EFI/BOOT/BOOTX64.EFI`, but it can be given other filenames, as long as the UEFI BIOS is aware of them (see UEFI#efibootmgr).

## UEFI+BIOS bootable drives

As long as a drive is GPT formatted, and it contains an EFI system partition, it is possible to follow both the BIOS and UEFI deployment procedures in order to create a drive capable of booting on both legacy BIOS as well as UEFI systems. This is useful, for example, for installing an operating system on a USB flash drive which is to be used on multiple systems which may, or may not support UEFI, or to ease moving hard drives across systems.

## Configuration

limine does not ship a default configuration file, it is therefore necessary to create one. This file is necessary to teach Limine which operating systems are available for boot. The configuration file has a lot of options as Limine allows for a fair degree of customisation. A detailed documentation of the configuration file, its format, and its keys can be found here.

The configuration file, just like `limine-bios.sys`, needs to reside on either the root, a `/boot`, a `/limine`, or a `/boot/limine` directory of a partition on the drive on which Limine is deployed, as long as the file system of said partition is supported. The configuration file has to be named `limine.cfg`.

Note: In a Limine config, `boot:///` represents the partition on which `limine.cfg` is located. In case there is no separate `/boot` partition, and `limine.cfg` resides on the root partition instead, then, in the following example, `boot:///` should instead be `boot:///boot/`.

Here follows a simple example configuration that contains 1 boot menu entry that describes a typical Arch Linux kernel and initramfs:

    limine.cfg

    TIMEOUT=5

    :Arch Linux
        PROTOCOL=linux
        KERNEL_PATH=boot:///vmlinuz-linux
        CMDLINE=root=UUID=root-uuid rw
        MODULE_PATH=boot:///initramfs-linux.img

where `root-uuid` is to be replaced with the root filesystem's UUID.

### Windows entry

In order to be able to boot windows we need to know the path of `bootmgfw.efi` in the ESP. This can be done by going inside the ESP and using the following command:

    $ find -name "bootmgfw.efi"

    ./EFI/Microsoft/Boot/bootmgfw.efi

All we need to do now is adding the following to the configuration:

    limine.cfg

    :Windows
        PROTOCOL=chainload
        IMAGE_PATH=boot:///EFI/Microsoft/Boot/bootmgfw.efi

## pacman hook

While not mandatory, it may be useful to set up a pacman hook to deploy Limine whenever it is upgraded.

The following are just examples. Edit paths and devices to match the system's configuration.

### BIOS

Note: Keep in mind that the device paths may change with the addition or removal of devices, moving the installation to different machines, and other factors. This may cause the BIOS hook to accidentally install Limine on an unwanted device.

    /etc/pacman.d/hooks/liminedeploy.hook

    [Trigger]
    Operation = Install
    Operation = Upgrade
    Type = Package
    Target = limine

    [Action]
    Description = Deploying Limine after upgrade...
    When = PostTransaction
    Exec = /bin/sh -c "/usr/bin/limine bios-install /dev/sdX && /usr/bin/cp /usr/share/limine/limine-bios.sys /boot/"

### UEFI

    /etc/pacman.d/hooks/liminedeploy.hook

    [Trigger]
    Operation = Install
    Operation = Upgrade
    Type = Package
    Target = limine

    [Action]
    Description = Deploying Limine after upgrade...
    When = PostTransaction
    Exec = /usr/bin/cp /usr/share/limine/BOOTX64.EFI /boot/EFI/BOOT/

## See also

- Limine's website
- Limine's GitHub repository

Category:

- Boot loaders