- argv[0] = name;
- argv[1] = NULL;
-
- result = pb_run_cmd(argv, 0, 0);
-
- talloc_free(name);
-
- if (result)
- pb_log("%s: failed: (%d)\n", __func__, result);
-
- return result;
-}
-
-/**
- * kexec_load - kexec load helper.
- * @l_image: The local image file for kexec to execute.
- * @l_initrd: Optional local initrd file for kexec --initrd, can be NULL.
- * @args: Optional command line args for kexec --append, can be NULL.
- */
-
-static int kexec_load(const char *l_image, const char *l_initrd,
- const char *args, int dry_run)
-{
- int result;
- const char *argv[6];
- const char **p;
- char *s_initrd = NULL;
- char *s_args = NULL;
-
- p = argv;
- *p++ = pb_system_apps.kexec; /* 1 */
- *p++ = "-l"; /* 2 */
-
- if (l_initrd) {
- s_initrd = talloc_asprintf(NULL, "--initrd=%s", l_initrd);
- assert(s_initrd);
- *p++ = s_initrd; /* 3 */
- }
-
- if (args) {
- s_args = talloc_asprintf(NULL, "--append=%s", args);
- assert(s_args);
- *p++ = s_args; /* 4 */
- }
-
- *p++ = l_image; /* 5 */
- *p++ = NULL; /* 6 */
-
- result = pb_run_cmd(argv, 1, dry_run);
-
- if (result)
- pb_log("%s: failed: (%d)\n", __func__, result);
-
- talloc_free(s_initrd);
- talloc_free(s_args);
-
- return result;
-}
-
-/**
- * kexec_reboot - Helper to boot the new kernel.
- *
- * Must only be called after a successful call to kexec_load().
- */