summaryrefslogtreecommitdiffstats
path: root/ui/ncurses/nc-config.c
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 /ui/ncurses/nc-config.c
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 'ui/ncurses/nc-config.c')
-rw-r--r--ui/ncurses/nc-config.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/ui/ncurses/nc-config.c b/ui/ncurses/nc-config.c
index 943ee8a..e231f4b 100644
--- a/ui/ncurses/nc-config.c
+++ b/ui/ncurses/nc-config.c
@@ -34,7 +34,7 @@
#include "nc-config.h"
#include "nc-widgets.h"
-#define N_FIELDS 51
+#define N_FIELDS 53
extern struct help_text config_help_text;
@@ -70,6 +70,8 @@ struct config_screen {
bool ipmi_mailbox;
bool net_override;
+ bool preboot_check_enabled;
+
struct {
struct nc_widget_label *autoboot_l;
struct nc_widget_select *autoboot_f;
@@ -124,6 +126,9 @@ struct config_screen {
struct nc_widget_button *update_password_l;
+ struct nc_widget_label *preboot_check_l;
+ struct nc_widget_select *preboot_check_f;
+
struct nc_widget_label *net_override_l;
struct nc_widget_label *safe_mode;
struct nc_widget_button *ok_b;
@@ -364,6 +369,9 @@ static int screen_process_form(struct config_screen *screen)
}
}
+ config->preboot_check_enabled = widget_select_get_value(
+ screen->widgets.preboot_check_f);
+
config->safe_mode = false;
rc = cui_send_config(screen->cui, config);
talloc_free(config);
@@ -735,6 +743,17 @@ static void config_screen_layout_widgets(struct config_screen *screen)
y += 1;
}
+ wl = widget_label_base(screen->widgets.preboot_check_l);
+ widget_set_visible(wl, true);
+ widget_move(wl, y, screen->label_x);
+
+ wf = widget_select_base(screen->widgets.preboot_check_f);
+ widget_set_visible(wf, true);
+ widget_move(wf, y, screen->field_x);
+ y += widget_height(wf);
+
+ y += 1;
+
widget_move(widget_button_base(screen->widgets.ok_b),
y, screen->field_x);
widget_move(widget_button_base(screen->widgets.help_b),
@@ -770,6 +789,15 @@ static void config_screen_autoboot_change(void *arg, int value)
widgetset_post(screen->widgetset);
}
+static void config_screen_preboot_check_change(void *arg, int value)
+{
+ struct config_screen *screen = arg;
+ screen->preboot_check_enabled = !!value;
+ widgetset_unpost(screen->widgetset);
+ config_screen_layout_widgets(screen);
+ widgetset_post(screen->widgetset);
+}
+
static void config_screen_add_device(void *arg)
{
struct config_screen *screen = arg;
@@ -1196,6 +1224,20 @@ static void config_screen_setup_widgets(struct config_screen *screen,
_("Update system password"), password_click, screen);
#endif
+ screen->preboot_check_enabled = config->preboot_check_enabled;
+ screen->widgets.preboot_check_l = widget_new_label(set, 0, 0,
+ _("Pre-boot check:"));
+ screen->widgets.preboot_check_f = widget_new_select(set, 0, 0,
+ COLS - screen->field_x - 1);
+
+ widget_select_add_option(screen->widgets.preboot_check_f, 0, _("Disabled"),
+ !screen->preboot_check_enabled);
+ widget_select_add_option(screen->widgets.preboot_check_f, 1, _("Enabled"),
+ screen->preboot_check_enabled);
+
+ widget_select_on_change(screen->widgets.preboot_check_f,
+ config_screen_preboot_check_change, screen);
+
screen->widgets.ok_b = widget_new_button(set, 0, 0, 10, _("OK"),
ok_click, screen);
screen->widgets.help_b = widget_new_button(set, 0, 0, 10, _("Help"),
OpenPOWER on IntegriCloud