Yes, it is possible to load a smaller boot manager that can load a Btrfs EFI filesystem driver and then chainload GRUB from a Btrfs subvolume instead of the EFI System Partition (ESP). This approach leverages the extensibility of the UEFI (Unified Extensible Firmware Interface) firmware, which allows for loading additional drivers and applications during the boot process.
Here's how it can be done:
-
Use a Boot Manager That Supports Loading EFI Drivers:
- Boot managers like rEFInd are designed to load EFI drivers at boot time. rEFInd can be installed on the ESP (which is formatted as FAT32, as required by UEFI specifications).
- rEFInd can load filesystem drivers, including a Btrfs EFI driver, enabling it to read Btrfs-formatted partitions.
-
Install the Btrfs EFI Filesystem Driver:
- Obtain a Btrfs EFI driver compatible with your system. This driver enables the UEFI firmware (or the boot manager) to understand the Btrfs filesystem.
- Place the Btrfs EFI driver in the appropriate directory where the boot manager expects to find EFI drivers (e.g.,
drivers folder for rEFInd).
-
Configure the Boot Manager to Load the Btrfs Driver:
- Modify the boot manager's configuration file to load the Btrfs driver at startup. For rEFInd, this involves editing the
refind.conf file and ensuring the scanfor and also_scan_dirs options include settings to detect Btrfs volumes.
-
Chainload GRUB from a Btrfs Subvolume:
- With the Btrfs driver loaded, the boot manager can now access Btrfs subvolumes.
- Configure the boot manager to chainload the GRUB EFI executable (
grubx64.efi) located on the Btrfs subvolume.
- Ensure that GRUB is installed correctly on the Btrfs subvolume and that its configuration files point to the correct locations for your kernel and initramfs images.
Considerations and Caveats:
-
Compatibility: Ensure that the EFI drivers and boot manager are compatible with your system's firmware. Not all firmware implementations handle third-party drivers in the same way.
-
Security Implications: Loading additional drivers can have security implications. Secure Boot may prevent unsigned drivers from loading. You may need to enroll the necessary keys or disable Secure Boot.
-
Maintenance: This setup can be more complex to maintain. Updates to the boot manager, drivers, or GRUB may require additional steps to keep everything functioning smoothly.
Alternative Approach:
- Using GRUB Directly with Btrfs Support:
- GRUB itself has native support for Btrfs. You can install GRUB directly on the ESP and configure it to load the kernel and initramfs from a Btrfs subvolume, without needing an additional boot manager or EFI filesystem driver.
- This approach is simpler and leverages GRUB's capabilities to read Btrfs filesystems directly.
In Summary:
While it is technically feasible to use a smaller boot manager to load a Btrfs EFI filesystem driver and chainload GRUB from a Btrfs subvolume, it adds complexity to the boot process. Unless there's a specific need for this setup (such as using features of Btrfs subvolumes for snapshotting the boot environment), it might be simpler to use GRUB's native Btrfs support or to keep the bootloader files on the ESP.
References:
Note: Make sure to back up your data before making changes to the boot process, as misconfiguration can render your system unbootable.