2002-01-08 Yoshinori K. Okuji <okuji@gnu.org>

* grub/main.c (use_preset_menu): New variable.
	(OPT_PRESET_MENU): New macro.
	(longopts): Added an entry for "--preset-menu".
	(usage): Added a description for "--preset-menu". Also, change
	the first character of the description for "--device-map" to
	lower case for consistency.
	(main): Set USE_PRESET_MENU to 1 in the case of OPT_PRESET_MENU.
	* stage2/shared.h (use_preset_menu): Declared.
	* stage2/stage2.c [PRESET_MENU_STRING || SUPPORT_DISKLESS]
	(open_preset_menu) [GRUB_UTIL]: If USE_PRESET_MENU is false,
	return zero immediately.
This commit is contained in:
okuji 2002-01-08 03:19:23 +00:00
parent 843ddd9712
commit 4ea83d7811
6 changed files with 68 additions and 18 deletions

View file

@ -1,3 +1,17 @@
2002-01-08 Yoshinori K. Okuji <okuji@gnu.org>
* grub/main.c (use_preset_menu): New variable.
(OPT_PRESET_MENU): New macro.
(longopts): Added an entry for "--preset-menu".
(usage): Added a description for "--preset-menu". Also, change
the first character of the description for "--device-map" to
lower case for consistency.
(main): Set USE_PRESET_MENU to 1 in the case of OPT_PRESET_MENU.
* stage2/shared.h (use_preset_menu): Declared.
* stage2/stage2.c [PRESET_MENU_STRING || SUPPORT_DISKLESS]
(open_preset_menu) [GRUB_UTIL]: If USE_PRESET_MENU is false,
return zero immediately.
2002-01-08 Yoshinori K. Okuji <okuji@gnu.org>
* stage2/common.c [SUPPORT_DISKLESS]

17
NEWS
View file

@ -6,7 +6,22 @@ New in 0.91:
* The commands "hide" and "unhide" support logical partitions.
* The utility ``grub-install'' supports NetBSD.
* The network support is updated to Etherboot-5.0.5.
* Important bugfixes are made for ReiserFS, APM, TFTP, etc.
* The manner of handling the preset menu changes. In the previous
implementation, the preset menu is used only when opening the
configuration file failed. Now try to use the preset menu first. And,
if the configuration file is available, it is read after readoing the
preset menu. In this case, menu entries in the preset menu (if any)
are overrided by the configuration file.
* Diskless support is a bit changed. In the previous, GRUB set up a
network automatically via a special function. In the current, the
function is gone and the preset menu feature is used (i.e. just
execute the command "bootp" as if you specified it in the preset
menu). This has no impact against most users, but you should take care
if using the preset menu for your own purpose, because GRUB doesn't
call "bootp" implicitly when the preset menu is used explicitly. In
this case, you would probably need to insert commands to initialize a
network into your preset menu.
* Important bugfixes are made for ReiserFS, APM, TFTP, LBA, etc.
New in 0.90 - 2001-07-11:
* The command "setkey" resets key mappings, when no argument is

View file

@ -18,7 +18,7 @@ specify stage2 boot_drive [default=0x0]
specify stage2 config_file [default=/boot/grub/menu.lst]
.TP
\fB\-\-device\-map\fR=\fIFILE\fR
Use the device map file FILE
use the device map file FILE
.TP
\fB\-\-help\fR
display this message and exit
@ -38,6 +38,9 @@ do not use curses
\fB\-\-no\-floppy\fR
do not probe any floppy drive
.TP
\fB\-\-preset\-menu\fR
use the preset menu
.TP
\fB\-\-probe\-second\-floppy\fR
probe the second floppy drive
.TP

View file

@ -1,7 +1,7 @@
/* main.c - experimental GRUB stage2 that runs under Unix */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
* Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -34,6 +34,7 @@ int grub_stage2 (void);
char *program_name = 0;
int use_config_file = 1;
int use_preset_menu = 0;
int use_curses = 1;
int verbose = 0;
int read_only = 0;
@ -43,20 +44,21 @@ static int default_boot_drive;
static int default_install_partition;
static char *default_config_file;
#define OPT_HELP -2
#define OPT_VERSION -3
#define OPT_HOLD -4
#define OPT_CONFIG_FILE -5
#define OPT_INSTALL_PARTITION -6
#define OPT_BOOT_DRIVE -7
#define OPT_NO_CONFIG_FILE -8
#define OPT_NO_CURSES -9
#define OPT_BATCH -10
#define OPT_VERBOSE -11
#define OPT_READ_ONLY -12
#define OPT_PROBE_SECOND_FLOPPY -13
#define OPT_NO_FLOPPY -14
#define OPT_DEVICE_MAP -15
#define OPT_HELP -2
#define OPT_VERSION -3
#define OPT_HOLD -4
#define OPT_CONFIG_FILE -5
#define OPT_INSTALL_PARTITION -6
#define OPT_BOOT_DRIVE -7
#define OPT_NO_CONFIG_FILE -8
#define OPT_NO_CURSES -9
#define OPT_BATCH -10
#define OPT_VERBOSE -11
#define OPT_READ_ONLY -12
#define OPT_PROBE_SECOND_FLOPPY -13
#define OPT_NO_FLOPPY -14
#define OPT_DEVICE_MAP -15
#define OPT_PRESET_MENU -16
#define OPTSTRING ""
static struct option longopts[] =
@ -71,6 +73,7 @@ static struct option longopts[] =
{"no-config-file", no_argument, 0, OPT_NO_CONFIG_FILE},
{"no-curses", no_argument, 0, OPT_NO_CURSES},
{"no-floppy", no_argument, 0, OPT_NO_FLOPPY},
{"preset-menu", no_argument, 0, OPT_PRESET_MENU},
{"probe-second-floppy", no_argument, 0, OPT_PROBE_SECOND_FLOPPY},
{"read-only", no_argument, 0, OPT_READ_ONLY},
{"verbose", no_argument, 0, OPT_VERBOSE},
@ -93,13 +96,14 @@ Enter the GRand Unified Bootloader command shell.\n\
--batch turn on batch mode for non-interactive use\n\
--boot-drive=DRIVE specify stage2 boot_drive [default=0x%x]\n\
--config-file=FILE specify stage2 config_file [default=%s]\n\
--device-map=FILE Use the device map file FILE\n\
--device-map=FILE use the device map file FILE\n\
--help display this message and exit\n\
--hold wait until a debugger will attach\n\
--install-partition=PAR specify stage2 install_partition [default=0x%x]\n\
--no-config-file do not use the config file\n\
--no-curses do not use curses\n\
--no-floppy do not probe any floppy drive\n\
--preset-menu use the preset menu\n\
--probe-second-floppy probe the second floppy drive\n\
--read-only do not write anything to devices\n\
--verbose print verbose messages\n\
@ -215,6 +219,10 @@ main (int argc, char **argv)
case OPT_DEVICE_MAP:
device_map_file = strdup (optarg);
break;
case OPT_PRESET_MENU:
use_preset_menu = 1;
break;
default:
usage (1);

View file

@ -568,6 +568,9 @@ extern unsigned long linux_text_len;
/* If not using config file, this variable is set to zero,
otherwise non-zero. */
extern int use_config_file;
/* If using the preset menu, this variable is set to non-zero,
otherwise zero. */
extern int use_preset_menu;
/* If not using curses, this variable is set to zero, otherwise non-zero. */
extern int use_curses;
/* The flag for verbose messages. */

View file

@ -35,6 +35,13 @@ static int preset_menu_offset;
static int
open_preset_menu (void)
{
#ifdef GRUB_UTIL
/* Unless the user explicitly requests to use the preset menu,
always opening the preset menu fails in the grub shell. */
if (! use_preset_menu)
return 0;
#endif /* GRUB_UTIL */
preset_menu_offset = 0;
return preset_menu != 0;
}