Patrick Georgi ([email protected]) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/194
-gerrit commit 9518da06954afafe1c6929096e4e3f2311bd13d9 Author: Mathias Krause <[email protected]> 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 <[email protected]> Signed-off-by: Patrick Georgi <[email protected]> --- 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 6b10202..c926b7d 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." }; @@ -1333,7 +1338,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; -- coreboot mailing list: [email protected] http://www.coreboot.org/mailman/listinfo/coreboot

