Hi, I send attached a patch that shows a warning when Grub it's falling back to the command line if grub.cfg is not found (so user knows why the menu is not showed).
I'm not 100% that this is the best way to handle it, mainly because I'm not used about the Grub execution workflow. The changes are: a) in normal/main.c, grub_normal_execute I've changed grub_cmdline_run (nested) by grub_cmdlin_run (-1) (I don't see any bad consequence of it) b) in normal/cmdline.c in grub_cmdline_run if I receive a nested == -1 I show the warning Any better way to do it? Or I will write the ChangeLog. Thanks, PS: warning_with_function_names.patch includes the function names that I've changed. -- Carles Pina i Estany GPG id: 0x17756391 http://pinux.info
Index: normal/cmdline.c =================================================================== --- normal/cmdline.c (revision 1826) +++ normal/cmdline.c (working copy) @@ -137,12 +137,17 @@ { grub_normal_init_page (); grub_setcursor (1); + + if ( nested == -1 ) + grub_printf ("\n\ + WARNING: GNU GRUB couldn't open /boot/grub/grub.cfg\n\ + Falling back to GNU GRUB Command Line\n\n"); grub_printf ("\ [ Minimal BASH-like line editing is supported. For the first word, TAB\n\ lists possible command completions. Anywhere else TAB lists possible\n\ device/file completions.%s ]\n\n", - nested ? " ESC at any time exits." : ""); + nested !=- 1 ? " ESC at any time exits." : ""); while (1) { @@ -153,7 +158,7 @@ cmdline[0] = '\0'; if (! grub_cmdline_get ("grub> ", cmdline, sizeof (cmdline), 0, 1) - && nested) + && nested > 0) return; if (! *cmdline) Index: normal/main.c =================================================================== --- normal/main.c (revision 1826) +++ normal/main.c (working copy) @@ -481,7 +481,7 @@ free_menu (menu); } else - grub_cmdline_run (nested); + grub_cmdline_run (-1); } /* Enter normal mode from rescue mode. */
Index: normal/cmdline.c =================================================================== --- normal/cmdline.c (revision 1826) +++ normal/cmdline.c (working copy) @@ -137,12 +137,17 @@ grub_cmdline_run (int nested) { grub_normal_init_page (); grub_setcursor (1); + + if ( nested == -1 ) + grub_printf ("\n\ + WARNING: GNU GRUB couldn't open /boot/grub/grub.cfg\n\ + Falling back to GNU GRUB Command Line\n\n"); grub_printf ("\ [ Minimal BASH-like line editing is supported. For the first word, TAB\n\ lists possible command completions. Anywhere else TAB lists possible\n\ device/file completions.%s ]\n\n", - nested ? " ESC at any time exits." : ""); + nested !=- 1 ? " ESC at any time exits." : ""); while (1) { @@ -153,7 +158,7 @@ grub_cmdline_run (int nested) cmdline[0] = '\0'; if (! grub_cmdline_get ("grub> ", cmdline, sizeof (cmdline), 0, 1) - && nested) + && nested > 0) return; if (! *cmdline) Index: normal/main.c =================================================================== --- normal/main.c (revision 1826) +++ normal/main.c (working copy) @@ -481,7 +481,7 @@ grub_normal_execute (const char *config, free_menu (menu); } else - grub_cmdline_run (nested); + grub_cmdline_run (-1); } /* Enter normal mode from rescue mode. */
_______________________________________________ Grub-devel mailing list Grub-devel@gnu.org http://lists.gnu.org/mailman/listinfo/grub-devel