diff options
author | Guy Shapiro <guy.shapiro@mobi-wize.com> | 2017-09-05 15:59:35 +0300 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2017-09-08 00:58:08 +0000 |
commit | 2a7fdfdbc578eb704476f0fa734eff55864e74f2 (patch) | |
tree | f85e0f43e91ba22f124039f8e22ffbe77d67e3ae /src/libostree/ostree-bootloader-uboot.c | |
parent | a567b5b47bb2d32d16d202db0d5fbe4035a0e086 (diff) | |
download | ostree-2a7fdfdbc578eb704476f0fa734eff55864e74f2.tar.gz |
uboot: add non-default deployments to uEnv.txt
Include non-default deployments in the uEnv.txt file imported by
U-Boot. All the configurations beside the defaults will have
numerical suffix E.G. "kernel_image2" or "bootargs2".
Those U-Boot environment variables may be used from interactive boot
prompt or from "altbootcmd" script.
Closes: #1138
Approved by: cgwalters
Diffstat (limited to 'src/libostree/ostree-bootloader-uboot.c')
-rw-r--r-- | src/libostree/ostree-bootloader-uboot.c | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/src/libostree/ostree-bootloader-uboot.c b/src/libostree/ostree-bootloader-uboot.c index 2fe0f8b6..ce5d516c 100644 --- a/src/libostree/ostree-bootloader-uboot.c +++ b/src/libostree/ostree-bootloader-uboot.c @@ -115,28 +115,36 @@ create_config_from_boot_loader_entries (OstreeBootloaderUboot *self, cancellable, error)) return FALSE; - /* U-Boot doesn't support a menu so just pick the first one since the list is ordered */ - config = boot_loader_configs->pdata[0]; - - val = ostree_bootconfig_parser_get (config, "linux"); - if (!val) + for (int i = 0; i < boot_loader_configs->len; i++) { - g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, - "No \"linux\" key in bootloader config"); - return FALSE; - } - g_ptr_array_add (new_lines, g_strdup_printf ("kernel_image=%s", val)); + g_autofree char *index_suffix = NULL; + if (i == 0) + index_suffix = g_strdup (""); + else + index_suffix = g_strdup_printf ("%d", i+1); + config = boot_loader_configs->pdata[i]; + + val = ostree_bootconfig_parser_get (config, "linux"); + if (!val) + { + g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, + "No \"linux\" key in bootloader config"); + return FALSE; + } + g_ptr_array_add (new_lines, g_strdup_printf ("kernel_image%s=%s", index_suffix, val)); - val = ostree_bootconfig_parser_get (config, "initrd"); - if (val) - g_ptr_array_add (new_lines, g_strdup_printf ("ramdisk_image=%s", val)); + val = ostree_bootconfig_parser_get (config, "initrd"); + if (val) + g_ptr_array_add (new_lines, g_strdup_printf ("ramdisk_image%s=%s", index_suffix, val)); - val = ostree_bootconfig_parser_get (config, "options"); - if (val) - { - g_ptr_array_add (new_lines, g_strdup_printf ("bootargs=%s", val)); - if (!append_system_uenv (self, val, new_lines, cancellable, error)) - return FALSE; + val = ostree_bootconfig_parser_get (config, "options"); + if (val) + { + g_ptr_array_add (new_lines, g_strdup_printf ("bootargs%s=%s", index_suffix, val)); + if (i == 0) + if (!append_system_uenv (self, val, new_lines, cancellable, error)) + return FALSE; + } } return TRUE; |