[coreboot] New patch to review: 207611a Make 'configfile' and 'root' commands be available from scripting mode.
Patrick Georgi (patrick@georgi-clan.de)
gerrit at coreboot.org
Mon Sep 5 13:40:14 CEST 2011
Patrick Georgi (patrick at georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/194
-gerrit
commit 207611a5910a4604c730658e5b919e93271b1ebc
Author: Mathias Krause <mathias.krause at secunet.com>
Date: Mon Mar 8 11:46:29 2010 +0100
Make 'configfile' and 'root' commands be available from scripting mode.
When a 'configfile' command is encountered, restart with that new config
file.
Change-Id: I042506e236b0fb7f10e20ea3f0f3764414167dce
Signed-off-by: Mathias Krause <mathias.krause at secunet.com>
Signed-off-by: Patrick Georgi <patrick.georgi at secunet.com>
---
main/grub/builtins.c | 9 +++++++--
main/grub/grub.c | 16 +++++++++++++++-
2 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/main/grub/builtins.c b/main/grub/builtins.c
index b09076a..79d237e 100644
--- a/main/grub/builtins.c
+++ b/main/grub/builtins.c
@@ -49,6 +49,9 @@ unsigned long install_partition = 0x20000;
unsigned long boot_drive = 0;
char config_file[128] = "\0";
+/* indicator if we encountered a 'configfile' command and have to restart */
+int reload_configfile = 0;
+
kernel_t kernel_type;
/* The fallback entry. */
@@ -91,6 +94,7 @@ void init_config(void)
fallback_entryno = -1;
fallback_entries[0] = -1;
grub_timeout = -1;
+ reload_configfile = 0;
}
int check_password(char *entered, char *expected, password_t type)
@@ -318,6 +322,7 @@ static int configfile_func(char *arg, int flags)
/* Force to load the configuration file. */
is_opened = 0;
keep_cmdline_running = 0;
+ reload_configfile = 1;
/* Make sure that the user will not be authoritative. */
auth = 0;
@@ -328,7 +333,7 @@ static int configfile_func(char *arg, int flags)
static struct builtin builtin_configfile = {
"configfile",
configfile_func,
- BUILTIN_CMDLINE | BUILTIN_HELP_LIST,
+ BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST,
"configfile FILE",
"Load FILE as the configuration file."
};
@@ -1269,7 +1274,7 @@ static int root_func(char *arg, int flags)
static struct builtin builtin_root = {
"root",
root_func,
- BUILTIN_CMDLINE | BUILTIN_HELP_LIST,
+ BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST,
"root [DEVICE]",
"Set the current \"root device\" to the device DEVICE."
};
diff --git a/main/grub/grub.c b/main/grub/grub.c
index 15f0ece..7881a98 100644
--- a/main/grub/grub.c
+++ b/main/grub/grub.c
@@ -28,6 +28,7 @@
#include <arch/timer.h>
extern char config_file[];
+extern int reload_configfile;
char PASSWORD_BUF[PASSWORD_BUFLEN]; /* The buffer for the password. */
char DEFAULT_FILE_BUF[DEFAULT_FILE_BUFLEN]; /* THe buffer for the filename of "/boot/grub/default". */
@@ -813,6 +814,11 @@ static void run_menu(char *menu_entries, char *config_entries, int num_entries,
break;
}
+ /* return to reload the config file */
+ if (reload_configfile) {
+ return;
+ }
+
show_menu = 1;
goto restart;
}
@@ -1004,9 +1010,12 @@ void grub_main(void)
/* Never return. */
for (;;) {
char buf[10]; /* This is good enough. */
- char *default_file = (char *) DEFAULT_FILE_BUF;
+ char *default_file;
int i;
+restart:
+ default_file = (char *) DEFAULT_FILE_BUF;
+
reset();
/* Here load the configuration file. */
@@ -1124,6 +1133,11 @@ void grub_main(void)
cmdline);
(builtin->func) (arg, BUILTIN_MENU);
errnum = 0;
+
+ /* if the command was configfile, restart */
+ if (reload_configfile) {
+ goto restart;
+ }
} else
/* Ignored. */
continue;
More information about the coreboot
mailing list