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
This commit is contained in:
parent
a567b5b47b
commit
2a7fdfdbc5
|
|
@ -115,8 +115,14 @@ create_config_from_boot_loader_entries (OstreeBootloaderUboot *self,
|
||||||
cancellable, error))
|
cancellable, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* U-Boot doesn't support a menu so just pick the first one since the list is ordered */
|
for (int i = 0; i < boot_loader_configs->len; i++)
|
||||||
config = boot_loader_configs->pdata[0];
|
{
|
||||||
|
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");
|
val = ostree_bootconfig_parser_get (config, "linux");
|
||||||
if (!val)
|
if (!val)
|
||||||
|
|
@ -125,19 +131,21 @@ create_config_from_boot_loader_entries (OstreeBootloaderUboot *self,
|
||||||
"No \"linux\" key in bootloader config");
|
"No \"linux\" key in bootloader config");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
g_ptr_array_add (new_lines, g_strdup_printf ("kernel_image=%s", val));
|
g_ptr_array_add (new_lines, g_strdup_printf ("kernel_image%s=%s", index_suffix, val));
|
||||||
|
|
||||||
val = ostree_bootconfig_parser_get (config, "initrd");
|
val = ostree_bootconfig_parser_get (config, "initrd");
|
||||||
if (val)
|
if (val)
|
||||||
g_ptr_array_add (new_lines, g_strdup_printf ("ramdisk_image=%s", val));
|
g_ptr_array_add (new_lines, g_strdup_printf ("ramdisk_image%s=%s", index_suffix, val));
|
||||||
|
|
||||||
val = ostree_bootconfig_parser_get (config, "options");
|
val = ostree_bootconfig_parser_get (config, "options");
|
||||||
if (val)
|
if (val)
|
||||||
{
|
{
|
||||||
g_ptr_array_add (new_lines, g_strdup_printf ("bootargs=%s", 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))
|
if (!append_system_uenv (self, val, new_lines, cancellable, error))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,5 +42,7 @@ ${CMD_PREFIX} ostree --repo=testos-repo commit --tree=dir=osdata/ -b testos/buil
|
||||||
${CMD_PREFIX} ostree admin upgrade --os=testos
|
${CMD_PREFIX} ostree admin upgrade --os=testos
|
||||||
assert_file_has_content sysroot/boot/uEnv.txt "loadfdt="
|
assert_file_has_content sysroot/boot/uEnv.txt "loadfdt="
|
||||||
assert_file_has_content sysroot/boot/uEnv.txt "kernel_image="
|
assert_file_has_content sysroot/boot/uEnv.txt "kernel_image="
|
||||||
|
assert_file_has_content sysroot/boot/uEnv.txt "kernel_image2="
|
||||||
|
assert_file_has_content sysroot/boot/uEnv.txt "kernel_image3="
|
||||||
|
|
||||||
echo "ok merging uEnv.txt files"
|
echo "ok merging uEnv.txt files"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue