[4/4] petitboot-powerpc: persist kexec_method option via nvram
diff mbox

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

Commit Message

Eric Richter March 23, 2017, 4:46 p.m. UTC
When the kernel is running in a secure mode, a regular kexec_load should
be disabled. To avoid having to tick the box in the system config menu
for every single boot, this patch introduces an nvram field for storing
the state of the "Use file_load" config option across reboots.

Signed-off-by: Eric Richter <erichte@linux.vnet.ibm.com>
---
 discover/platform-powerpc.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Patch
diff mbox

diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c
index b5ad682..d1899be 100644
--- a/discover/platform-powerpc.c
+++ b/discover/platform-powerpc.c
@@ -61,6 +61,7 @@  static const char *known_params[] = {
 	"petitboot,console",
 	"petitboot,http_proxy",
 	"petitboot,https_proxy",
+	"petitboot,fileload?",
 	NULL,
 };
 
@@ -550,6 +551,11 @@  static void populate_config(struct platform_powerpc *platform,
 	val = get_param(platform, "petitboot,console");
 	if (val)
 		config->boot_console = talloc_strdup(config, val);
+
+	val = get_param(platform, "petitboot,fileload?");
+	if (val)
+		config->kexec_method = !!strcmp(val, "false");
+
 	/* If a full path is already set we don't want to override it */
 	config->manual_console = config->boot_console &&
 					!strchr(config->boot_console, '[');
@@ -742,6 +748,9 @@  static int update_config(struct platform_powerpc *platform,
 	update_string_config(platform, "petitboot,https_proxy", val);
 	set_proxy_variables(config);
 
+	val = config->kexec_method ? "true" : "false";
+	update_string_config(platform, "petitboot,fileload?", val);
+
 	update_network_config(platform, config);
 
 	update_bootdev_config(platform, config);