[RFC 1/3] lib: Add system config option to enable kexec_file_load

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


Currently, pb-discover only supports one method (syscall) for loading the
next kernel for kexec: kexec_load. This patch adds a system configuration
option for toggling between using kexec_load (false), and
kexec_file_load (true).

This will be used in subsequent patches for determining the argument to
kexec-lite/kexec-tools, and modified by a menu option.

Signed-off-by: Eric Richter <erichte at linux.vnet.ibm.com>
---
 lib/pb-protocol/pb-protocol.c | 9 +++++++++
 lib/types/types.h             | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c
index 1560ef7..e244e7d 100644
--- a/lib/pb-protocol/pb-protocol.c
+++ b/lib/pb-protocol/pb-protocol.c
@@ -316,6 +316,8 @@ int pb_protocol_config_len(const struct config *config)
 
 	len += 4; /* allow_writes */
 
+	len += 4; /* kexec_method */
+
 	len += 4; /* n_tty */
 	for (i = 0; i < config->n_tty; i++)
 		len += 4 + optional_strlen(config->tty_list[i]);
@@ -568,6 +570,9 @@ int pb_protocol_serialise_config(const struct config *config,
 	*(uint32_t *)pos = config->allow_writes;
 	pos += 4;
 
+	*(uint32_t *)pos = config->kexec_method;
+	pos += 4;
+
 	*(uint32_t *)pos = __cpu_to_be32(config->n_tty);
 	pos += 4;
 	for (i = 0; i < config->n_tty; i++)
@@ -1100,6 +1105,10 @@ int pb_protocol_deserialise_config(struct config *config,
 		goto out;
 	config->allow_writes = !!tmp;
 
+	if (read_u32(&pos, &len, &tmp))
+		goto out;
+	config->kexec_method = !!tmp;
+
 	if (read_u32(&pos, &len, &config->n_tty))
 		goto out;
 
diff --git a/lib/types/types.h b/lib/types/types.h
index 6b607cd..ff5897f 100644
--- a/lib/types/types.h
+++ b/lib/types/types.h
@@ -162,6 +162,8 @@ struct config {
 
 	bool			allow_writes;
 
+	bool			kexec_method;
+
 	char			*boot_tty;
 	char			*lang;
 
-- 
2.7.4



More information about the Petitboot mailing list