[PATCH 1/4] lib: Add system config option to enable kexec_file_load
Eric Richter
erichte at linux.vnet.ibm.com
Fri Mar 24 03:46:17 AEDT 2017
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 18edf57..a20bba9 100644
--- a/lib/pb-protocol/pb-protocol.c
+++ b/lib/pb-protocol/pb-protocol.c
@@ -322,6 +322,8 @@ int pb_protocol_config_len(const struct config *config)
len += 4; /* allow_writes */
+ len += 4; /* kexec_method */
+
len += 4; /* n_consoles */
for (i = 0; i < config->n_consoles; i++)
len += 4 + optional_strlen(config->consoles[i]);
@@ -582,6 +584,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_consoles);
pos += 4;
for (i = 0; i < config->n_consoles; i++)
@@ -1121,6 +1126,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_consoles))
goto out;
diff --git a/lib/types/types.h b/lib/types/types.h
index 7f4ae1f..b21b2b2 100644
--- a/lib/types/types.h
+++ b/lib/types/types.h
@@ -171,6 +171,8 @@ struct config {
bool allow_writes;
+ bool kexec_method;
+
char *boot_console;
bool manual_console;
char *lang;
--
2.7.4
More information about the Petitboot
mailing list