X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=discover%2Fboot.c;h=5ca69b9f135f3cdbc032ccd7168311685e3adf5a;hb=b3539f1cf27f0cd1ddf26ec92d9ea4e6c0df7ea5;hp=d054d5d51c24733203fbc0706e0b06c527c8a06a;hpb=375c81a1b9aa8904dfdd0b1195fe99a1e4a2fa9d;p=petitboot diff --git a/discover/boot.c b/discover/boot.c index d054d5d..5ca69b9 100644 --- a/discover/boot.c +++ b/discover/boot.c @@ -94,6 +94,21 @@ static int kexec_reboot(int dry_run) if (result) pb_log("%s: failed: (%d)\n", __func__, result); + /* okay, kexec -e -f */ + if (result) { + p = argv; + *p++ = pb_system_apps.kexec; /* 1 */ + *p++ = "-e"; /* 2 */ + *p++ = "-f"; /* 3 */ + *p++ = NULL; /* 4 */ + + result = pb_run_cmd(argv, 1, 0); + } + + if (result) + pb_log("%s: failed: (%d)\n", __func__, result); + + return result; } @@ -125,7 +140,7 @@ int boot(void *ctx, struct discover_boot_option *opt, struct boot_command *cmd, initrd = NULL; args = NULL; - if (cmd->boot_image_file) { + if (cmd && cmd->boot_image_file) { image = pb_url_parse(opt, cmd->boot_image_file); } else if (opt && opt->boot_image) { image = opt->boot_image->url; @@ -134,13 +149,13 @@ int boot(void *ctx, struct discover_boot_option *opt, struct boot_command *cmd, return -1; } - if (cmd->initrd_file) { + if (cmd && cmd->initrd_file) { initrd = pb_url_parse(opt, cmd->initrd_file); } else if (opt && opt->initrd) { initrd = opt->initrd->url; } - if (cmd->boot_args) { + if (cmd && cmd->boot_args) { args = talloc_strdup(ctx, cmd->boot_args); } else if (opt && opt->option->boot_args) { args = talloc_strdup(ctx, opt->option->boot_args);