summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorGeoff Levand <geoffrey.levand@am.sony.com>2009-07-09 10:40:43 -0700
committerGeoff Levand <geoffrey.levand@am.sony.com>2009-07-09 10:40:43 -0700
commit93b3fb6196709a0de77059b6b2bb7b8e27530477 (patch)
tree5376b8c770b8aa5b7ef84cff3dd052e1c14dfe2d /ui
parent35c5bcebf36d468705761930967a97f0fcbea665 (diff)
downloadtalos-petitboot-93b3fb6196709a0de77059b6b2bb7b8e27530477.tar.gz
talos-petitboot-93b3fb6196709a0de77059b6b2bb7b8e27530477.zip
Fix kexec call
Fix the preparation of kexec call args. kexec wants the param and value in the same arg. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/common/ui-system.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/ui/common/ui-system.c b/ui/common/ui-system.c
index 3f54191..b252e9a 100644
--- a/ui/common/ui-system.c
+++ b/ui/common/ui-system.c
@@ -43,20 +43,24 @@ static int run_kexec_local(const char *l_image, const char *l_initrd,
const char *args)
{
int result;
- const char *argv[8];
+ const char *argv[6];
const char **p;
+ char *s_initrd = NULL;
+ char *s_args = NULL;
p = argv;
*p++ = pb_system_apps.kexec; /* 1 */
if (l_initrd) {
- *p++ = "--initrd"; /* 2 */
- *p++ = l_initrd; /* 3 */
+ s_initrd = talloc_asprintf(NULL, "--initrd=%s", l_initrd);
+ assert(s_initrd);
+ *p++ = s_initrd; /* 2 */
}
if (args) {
- *p++ = "--append"; /* 4 */
- *p++ = args; /* 5 */
+ s_args = talloc_asprintf(NULL, "--append=%s", args);
+ assert(s_args);
+ *p++ = s_args; /* 3 */
}
/* First try by telling kexec to run shutdown */
@@ -70,9 +74,9 @@ static int run_kexec_local(const char *l_image, const char *l_initrd,
/* On error, force a kexec with the -f option */
if (result) {
- *(p + 0) = "-f"; /* 6 */
- *(p + 1) = l_image; /* 7 */
- *(p + 2) = NULL; /* 8 */
+ *(p + 0) = "-f"; /* 4 */
+ *(p + 1) = l_image; /* 5 */
+ *(p + 2) = NULL; /* 6 */
result = pb_run_cmd(argv);
}
@@ -80,6 +84,9 @@ static int run_kexec_local(const char *l_image, const char *l_initrd,
if (result)
pb_log("%s: failed: (%d)\n", __func__, result);
+ talloc_free(s_initrd);
+ talloc_free(s_args);
+
return result;
}
OpenPOWER on IntegriCloud