Add (non-atomic) support for GRUB2 + UEFI

We need basic support for UEFI - many newer servers don't support
BIOS compatibility mode anymore.

However, this patch only implements non-atomic because UEFI is FAT, and
we can't do the previous design for OSTree of atomic swap of
/boot/loader.

The Fedora/RHEL UEFI layout has the kernels on a "real" /boot
partition, and /boot/efi/EFI/$vendor just holds the grub2 UEFI binary
and grub.cfg.

Following this, /boot/loader is still on the OS boot partition, and we
still atomically swap it.  This potentially paves the way to atomic
upgrades in the future.

https://bugzilla.gnome.org/show_bug.cgi?id=724246
This commit is contained in:
Colin Walters committed 2014-10-23 21:42:30 -04:00
1 parent b43ce2329e
commit 0c89abee6d
10 files changed
+202 -42

No files matched your search

+36 -19
View File
@@ -846,29 +846,46 @@ ostree_sysroot_get_repo (OstreeSysroot *self,
/**
* ostree_sysroot_query_bootloader:
* @sysroot: Sysroot
*
* Returns: (transfer full): Currently active bootloader in @sysroot
* @out_bootloader: (out) (transfer full) (allow-none): Return location for bootloader, may be %NULL
* @cancellable: Cancellable
* @error: Error
*/
OstreeBootloader *
_ostree_sysroot_query_bootloader (OstreeSysroot *self)
gboolean
_ostree_sysroot_query_bootloader (OstreeSysroot *sysroot,
OstreeBootloader **out_bootloader,
GCancellable *cancellable,
GError **error)
{
OstreeBootloaderSyslinux *syslinux;
OstreeBootloaderUboot *uboot;
OstreeBootloaderGrub2 *grub2;
gboolean ret = FALSE;
gboolean is_active;
gs_unref_object OstreeBootloader *ret_loader = NULL;
syslinux = _ostree_bootloader_syslinux_new (self);
if (_ostree_bootloader_query ((OstreeBootloader*)syslinux))
return (OstreeBootloader*) (syslinux);
ret_loader = (OstreeBootloader*)_ostree_bootloader_syslinux_new (sysroot);
if (!_ostree_bootloader_query (ret_loader, &is_active,
cancellable, error))
goto out;
if (!is_active)
{
g_object_unref (ret_loader);
ret_loader = (OstreeBootloader*)_ostree_bootloader_grub2_new (sysroot);
if (!_ostree_bootloader_query (ret_loader, &is_active,
cancellable, error))
goto out;
}
if (!is_active)
{
g_object_unref (ret_loader);
ret_loader = (OstreeBootloader*)_ostree_bootloader_uboot_new (sysroot);
if (!_ostree_bootloader_query (ret_loader, &is_active, cancellable, error))
goto out;
}
if (!is_active)
g_clear_object (&ret_loader);
grub2 = _ostree_bootloader_grub2_new (self);
if (_ostree_bootloader_query ((OstreeBootloader*)grub2))
return (OstreeBootloader*) (grub2);
uboot = _ostree_bootloader_uboot_new (self);
if (_ostree_bootloader_query ((OstreeBootloader*)uboot))
return (OstreeBootloader*) (uboot);
return NULL;
ret = TRUE;
gs_transfer_out_value (out_bootloader, &ret_loader);
out:
return ret;
}
char *