summaryrefslogtreecommitdiffstats
path: root/lib/pb-protocol
diff options
context:
space:
mode:
authorMaxiwell S. Garcia <maxiwell@linux.ibm.com>2019-09-23 19:30:23 -0300
committerJeremy Kerr <jk@ozlabs.org>2020-01-25 11:54:27 +0800
commit3513c7f934d97b1db34c5e4e1ce9c995844764bd (patch)
tree53c2ab648087f79f4aa67d4bb50d329e98b2fdab /lib/pb-protocol
parent0c074025ef345c64af088c78c7f8f0e14a51f700 (diff)
downloadtalos-petitboot-3513c7f934d97b1db34c5e4e1ce9c995844764bd.tar.gz
talos-petitboot-3513c7f934d97b1db34c5e4e1ce9c995844764bd.zip
ui/ncurses: Add preboot check option in the config screen
Petitboot might run some checks to validate the kernel images before call the kexec load. This patch adds both 'preboot check' option in the config UI screen and a NVRAM variable 'petitboot,preboot-check' to make the user choice persistent. The 'preboot check' is enabled by default. The 'petitboot,preboot-check' is created on NVRAM only when 'preboot check' is disabled by the user. NVRAM property changed to preboot-check, small label changes and help text added by Jeremy Kerr <jk@ozlabs.org>. Signed-off-by: Maxiwell S. Garcia <maxiwell@linux.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'lib/pb-protocol')
-rw-r--r--lib/pb-protocol/pb-protocol.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c
index 06c81f2..aff1946 100644
--- a/lib/pb-protocol/pb-protocol.c
+++ b/lib/pb-protocol/pb-protocol.c
@@ -344,6 +344,8 @@ int pb_protocol_config_len(const struct config *config)
len += 4 + optional_strlen(config->lang);
+ len += 4; /* preboot check */
+
return len;
}
@@ -677,6 +679,9 @@ int pb_protocol_serialise_config(const struct config *config,
pos += pb_protocol_serialise_string(pos, config->lang);
+ *(uint32_t *)pos = config->preboot_check_enabled;
+ pos += 4;
+
assert(pos <= buf + buf_len);
return (pos <= buf + buf_len) ? 0 : -1;
@@ -1335,6 +1340,10 @@ int pb_protocol_deserialise_config(struct config *config,
config->lang = str;
+ if (read_u32(&pos, &len, &tmp))
+ goto out;
+ config->preboot_check_enabled = !!tmp;
+
rc = 0;
out:
OpenPOWER on IntegriCloud