Skip to main content

install_via_bootupd

Function install_via_bootupd 

Source
pub(crate) fn install_via_bootupd(
    device: &Device,
    rootfs: &Utf8Path,
    configopts: &InstallConfigOpts,
    chroot_target: Option<&Utf8Path>,
    bind_boot_path: Option<&Utf8Path>,
) -> Result<()>
Expand description

Install the bootloader via bootupd.

When the target bootupd supports --filesystem we pass it pointing at a block-backed mount so that bootupd can resolve the backing device(s) itself via lsblk. When chroot_target is set, bootupctl is executed inside the given chroot root via ChrootCmd, with the physical root bind-mounted at /sysroot so lsblk can resolve a real block-backed path.

For older bootupd versions that lack --filesystem we fall back to the legacy --device <device_path> <rootfs> invocation.

If bind_boot_path is set, the given host path is bind-mounted onto /boot inside the chroot. Both the ostree and composefs backends use this to expose the physical root’s real /boot inside their respective chroots, since neither chroot target (an ostree deployment, or a mounted composefs image) has a /boot backed by the real root filesystem on its own. This matters because bootupd derives the UUID it writes for --write-uuid from whatever filesystem is mounted at <chroot>/boot, and looks for an empty boot/efi directory there to discover and mount the real ESP into.