diff mbox

[2/4] boot/pb-discover: Use kexec_method config option to determine kexec syscall

Message ID 1490287580-21725-3-git-send-email-erichte@linux.vnet.ibm.com
State Superseded
Headers show

Commit Message

Eric Richter March 23, 2017, 4:46 p.m. UTC
Adds a kexec_method boolean to the boot_task struct to control which
syscall is used for kexec loading. If set to true, the parameter for
kexec_file_load (-s) is passed to kexec-{tools,lite} instead of the default
parameter for kexec_load (-l).

Signed-off-by: Eric Richter <erichte@linux.vnet.ibm.com>
---
 discover/boot.c | 4 +++-
 discover/boot.h | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/discover/boot.c b/discover/boot.c
index fab4b61..108f9ae 100644
--- a/discover/boot.c
+++ b/discover/boot.c
@@ -105,7 +105,7 @@  static int kexec_load(struct boot_task *boot_task)
 
 	p = argv;
 	*p++ = pb_system_apps.kexec;	/* 1 */
-	*p++ = "-l";			/* 2 */
+	*p++ = (boot_task->kexec_method) ? "-s" : "-l";		/* 2 */
 
 	if (local_initrd) {
 		s_initrd = talloc_asprintf(boot_task, "--initrd=%s",
@@ -597,6 +597,8 @@  struct boot_task *boot(void *ctx, struct discover_boot_option *opt,
 		boot_task->args = NULL;
 	}
 
+	boot_task->kexec_method = config->kexec_method;
+
 	if (cmd && cmd->console && !config->manual_console)
 		boot_task->boot_console = talloc_strdup(boot_task, cmd->console);
 	else
diff --git a/discover/boot.h b/discover/boot.h
index 69643bf..f508944 100644
--- a/discover/boot.h
+++ b/discover/boot.h
@@ -33,6 +33,7 @@  struct boot_task {
 	bool cancelled;
 	bool verify_signature;
 	bool decrypt_files;
+	bool kexec_method;
 	struct load_url_result *image_signature;
 	struct load_url_result *initrd_signature;
 	struct load_url_result *dtb_signature;