Add support for explicitly requesting any specific bootloader type
authorWilliam Manley <will@stb-tester.com>
Mon, 6 Jul 2020 15:12:29 +0000 (16:12 +0100)
committerWilliam Manley <will@stb-tester.com>
Mon, 26 Oct 2020 23:51:11 +0000 (23:51 +0000)
...with the `sysroot.bootloader` configuration option.  This can be useful
when converting a system to use `ostree` which doesn't currently have a
bootloader configuration that `ostree` can automatically detect, and is
also useful in combination with the `--sysroot` option when provisioning a
rootfs for systems other than the one you're running `ostree admin deploy`
on.

man/ostree.repo-config.xml
src/libostree/ostree-repo-private.h
src/libostree/ostree-sysroot.c

index e4984430b912bbc73913ec5d644881f464e4c313..6fead168f32f32aae001f9c9f6c8a39365fd0229 100644 (file)
@@ -373,7 +373,9 @@ Boston, MA 02111-1307, USA.
         <term><varname>bootloader</varname></term>
         <listitem><para>Configure the bootloader that OSTree uses when
         deploying the sysroot.  This may take the values
-        <literal>bootloader=none</literal> or <literal>bootloader=auto</literal>.
+        <literal>bootloader=none</literal>, <literal>bootloader=auto</literal>,
+        <literal>bootloader=grub2</literal>, <literal>bootloader=syslinux</literal>,
+        <literal>bootloader=uboot</literal> or <literal>bootloader=zipl</literal>.
         Default is <literal>auto</literal>.
         </para>
         <para>
@@ -388,6 +390,11 @@ Boston, MA 02111-1307, USA.
           then OSTree will generate a config for the bootloader found.  For
           example, <literal>grub2-mkconfig</literal> is run for the grub2 case.
         </para>
+        <para>
+          A specific bootloader type may also be explicitly requested by choosing
+          <literal>grub2</literal>, <literal>syslinux</literal>, <literal>uboot</literal> or
+          <literal>zipl</literal>.
+        </para>
         </listitem>
       </varlistentry>
 
index 14e2f753d8e7184196b213254ad5eb0dab56313f..628f2b469a7c76c7b388733399a8820b09b9cc49 100644 (file)
@@ -114,6 +114,9 @@ typedef enum {
 typedef enum {
   CFG_SYSROOT_BOOTLOADER_OPT_AUTO = 0,
   CFG_SYSROOT_BOOTLOADER_OPT_NONE,
+  CFG_SYSROOT_BOOTLOADER_OPT_GRUB2,
+  CFG_SYSROOT_BOOTLOADER_OPT_SYSLINUX,
+  CFG_SYSROOT_BOOTLOADER_OPT_UBOOT,
   CFG_SYSROOT_BOOTLOADER_OPT_ZIPL,
   /* Non-exhaustive */
 } OstreeCfgSysrootBootloaderOpt;
@@ -122,6 +125,9 @@ static const char* const CFG_SYSROOT_BOOTLOADER_OPTS_STR[] = {
   /* This must be kept in the same order as the enum */
   "auto",
   "none",
+  "grub2",
+  "syslinux",
+  "uboot",
   "zipl",
   NULL,
 };
index 63065fb95eb97975a7a1519e552ae39116c9690f..265d39d1c16c667adbe340b4e122353b94c24c72 100644 (file)
@@ -1352,6 +1352,15 @@ _ostree_sysroot_query_bootloader (OstreeSysroot     *sysroot,
       /* No bootloader specified; do not query bootloaders to run. */
       ret_loader = NULL;
       break;
+    case CFG_SYSROOT_BOOTLOADER_OPT_GRUB2:
+      ret_loader = (OstreeBootloader*) _ostree_bootloader_grub2_new (sysroot);
+      break;
+    case CFG_SYSROOT_BOOTLOADER_OPT_SYSLINUX:
+      ret_loader = (OstreeBootloader*) _ostree_bootloader_syslinux_new (sysroot);
+      break;
+    case CFG_SYSROOT_BOOTLOADER_OPT_UBOOT:
+      ret_loader = (OstreeBootloader*) _ostree_bootloader_uboot_new (sysroot);
+      break;
     case CFG_SYSROOT_BOOTLOADER_OPT_ZIPL:
       /* We never consider zipl as active by default, so it can only be created
        * if it's explicitly requested in the config */