[ostree/wip/grub2-efi: 1/3] wip grub2 efi



commit ad9e2bf7068413c3456f20ff75a0c67998ef7d98
Author: Colin Walters <walters verbum org>
Date:   Fri Oct 17 11:46:52 2014 -0400

    wip grub2 efi

 src/libostree/ostree-bootloader-grub2.c |   33 +++++++++++++++++++++++++++---
 1 files changed, 29 insertions(+), 4 deletions(-)
---
diff --git a/src/libostree/ostree-bootloader-grub2.c b/src/libostree/ostree-bootloader-grub2.c
index 8f4dcae..becfeb7 100644
--- a/src/libostree/ostree-bootloader-grub2.c
+++ b/src/libostree/ostree-bootloader-grub2.c
@@ -35,6 +35,9 @@ struct _OstreeBootloaderGrub2
 
   OstreeSysroot  *sysroot;
   GFile          *config_path_bios;
+  GFile          *config_path_efi_marker;
+  GFile          *config_path_efi_dest;
+  gboolean        is_efi;
 };
 
 typedef GObjectClass OstreeBootloaderGrub2Class;
@@ -48,7 +51,16 @@ _ostree_bootloader_grub2_query (OstreeBootloader *bootloader)
 {
   OstreeBootloaderGrub2 *self = OSTREE_BOOTLOADER_GRUB2 (bootloader);
 
-  return g_file_query_exists (self->config_path_bios, NULL);
+  if (g_file_query_exists (self->config_path_bios, NULL))
+    return TRUE;
+
+  if (g_file_query_exists (self->config_path_efi_marker, NULL))
+    {
+      self->is_efi = TRUE;
+      return TRUE;
+    }
+
+  return FALSE;
 }
 
 static const char *
@@ -127,7 +139,10 @@ _ostree_bootloader_grub2_generate_config (OstreeBootloaderGrub2         *self,
                        "No \"linux\" key in bootloader config");
           goto out;
         }
-      g_string_append (output, "linux16 ");
+      if (self->is_efi)
+        g_string_append (output, "linuxefi ");
+      else
+        g_string_append (output, "linux16 ");
       g_string_append (output, kernel);
 
       options = ostree_bootconfig_parser_get (config, "options");
@@ -141,7 +156,10 @@ _ostree_bootloader_grub2_generate_config (OstreeBootloaderGrub2         *self,
       initrd = ostree_bootconfig_parser_get (config, "initrd");
       if (initrd)
         {
-          g_string_append (output, "initrd16 ");
+          if (self->is_efi)
+            g_string_append (output, "initrdefi ");
+          else
+            g_string_append (output, "initrd16 ");
           g_string_append (output, initrd);
           g_string_append_c (output, '\n');
         }
@@ -206,6 +224,12 @@ rm -f ${grub_cfg}.new
   /* Now let's fdatasync() for the new file */
   if (!gs_file_sync_data (new_config_path, cancellable, error))
     goto out;
+
+  if (self->is_efi)
+    {
+      gs_unref_object GFile *config_efi_dest_dir = g_file_get_parent (self->config_path_efi_dest);
+      gs_unref_object GFile *config_efi_tmp = g_file_get_child (config_efi_dest_dir, "
+    }
   
   ret = TRUE;
  out:
@@ -215,7 +239,7 @@ rm -f ${grub_cfg}.new
 static gboolean
 _ostree_bootloader_grub2_is_atomic (OstreeBootloader      *bootloader) 
 {
-  return TRUE;
+  return !self->is_efi;
 }
 
 static void
@@ -257,5 +281,6 @@ _ostree_bootloader_grub2_new (OstreeSysroot *sysroot)
   OstreeBootloaderGrub2 *self = g_object_new (OSTREE_TYPE_BOOTLOADER_GRUB2, NULL);
   self->sysroot = g_object_ref (sysroot);
   self->config_path_bios = g_file_resolve_relative_path (self->sysroot->path, "boot/grub2/grub.cfg");
+  self->config_path_efi_marker = g_file_resolve_relative_path (self->sysroot->path, "etc/grub2-efi.cfg");
   return self;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]