Message ID | 1490287580-21725-2-git-send-email-erichte@linux.vnet.ibm.com |
---|---|
State | Superseded |
Headers | show |
On Thu, 2017-03-23 at 11:46 -0500, Eric Richter wrote: > 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@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; A name like "kexec_secure" or "kexec_file_load" may be better - my "kexec_method" being "true" sounds a bit confusing. Patch 4 can probably also be squashed into this. > + > char *boot_console; > bool manual_console; > char *lang;
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;
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@linux.vnet.ibm.com> --- lib/pb-protocol/pb-protocol.c | 9 +++++++++ lib/types/types.h | 2 ++ 2 files changed, 11 insertions(+)