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

Eric Richter erichte at linux.vnet.ibm.com
Sat Sep 10 05:26:11 AEST 2016


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 at linux.vnet.ibm.com>
---
 discover/boot.c | 6 ++++--
 discover/boot.h | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/discover/boot.c b/discover/boot.c
index c25627d..118f57c 100644
--- a/discover/boot.c
+++ b/discover/boot.c
@@ -72,7 +72,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",
@@ -574,10 +574,12 @@ struct boot_task *boot(void *ctx, struct discover_boot_option *opt,
 		boot_task->args = NULL;
 	}
 
+	config = config_get();
+	boot_task->kexec_method = config->kexec_method;
+
 	if (cmd && cmd->tty)
 		boot_task->boot_tty = talloc_strdup(boot_task, cmd->tty);
 	else {
-		config = config_get();
 		boot_task->boot_tty = config ? config->boot_tty : NULL;
 	}
 
diff --git a/discover/boot.h b/discover/boot.h
index 2d99b7f..dc1c5f0 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;
-- 
2.7.4



More information about the Petitboot mailing list