summaryrefslogtreecommitdiffstats
path: root/lib
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
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')
-rw-r--r--lib/param_list/param_list.c1
-rw-r--r--lib/pb-protocol/pb-protocol.c9
-rw-r--r--lib/types/types.h2
3 files changed, 12 insertions, 0 deletions
diff --git a/lib/param_list/param_list.c b/lib/param_list/param_list.c
index 9a01be6..9dc3228 100644
--- a/lib/param_list/param_list.c
+++ b/lib/param_list/param_list.c
@@ -23,6 +23,7 @@ const char **common_known_params(void)
"petitboot,http_proxy",
"petitboot,https_proxy",
"petitboot,password",
+ "petitboot,preboot-check",
NULL,
};
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:
diff --git a/lib/types/types.h b/lib/types/types.h
index c923d93..8018fde 100644
--- a/lib/types/types.h
+++ b/lib/types/types.h
@@ -187,6 +187,8 @@ struct config {
unsigned int autoboot_timeout_sec;
struct network_config network;
+ bool preboot_check_enabled;
+
struct autoboot_option *autoboot_opts;
unsigned int n_autoboot_opts;
OpenPOWER on IntegriCloud