diff --git a/ChangeLog b/ChangeLog index 7d996365a..3c3079d28 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +1999-05-25 OKUJI Yoshinori + + * grub/main.c: Replace OPT_DISABLE_CONFIG_FILE and + OPT_DISABLE_CURSES with OPT_NO_CONFIG_FILE and OPT_NO_CURSES + respectively. + (longopts): Rename from "disable-config-file" to + "no-config-file", and from "disable-curses" to "no-curses". + (usage): Use "grub" instead of ARGV[0], read the standards. + Change the help message according to the changes above. + (main): Handle OPT_NO_CONFIG_FILE and OPT_NO_CURSES, instead + of OPT_DISABLE_CONFIG_FILE and OPT_DISABLE_CURSES. + 1999-05-21 OKUJI Yoshinori * docs/TODO: Moved to ... diff --git a/docs/grub.texi b/docs/grub.texi index a174a892d..8b28727ed 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -2131,7 +2131,60 @@ current media. @node MBR @section The structure of Master Boot Record -PC_partitioning.txt +A Master Boot Record (@dfn{MBR}) is the sector at cylinder 0, head 0, +sector 1 of a hard disk. A MBR-like structure must be created in each of +partitions by the FDISK program. + +At the completion of your system's Power On Self Test (@dfn{POST}), INT +19H is called. Usually INT 19 tries to read a boot sector from the first +floppy drive@footnote{Which drive is read first depends on your BIOS +settings.}. If a boot sector is found on the floppy disk, that boot +sector is read into memory at location 0000:7C00 and INT 19H jumps to +memory location 0000:7C00. However, if no boot sector is found on the +first floppy drive, INT 19H tries to read the MBR from the first hard +drive. If an MBR is found it is read into memory at location 0000:7C00 +and INT 19H jumps to memory location 0000:7C00. The small program in the +MBR will atempt to locate an active (bootable) partition in its +partition table@footnote{This behavior is DOS MBR's, and GRUB ignores +the active flag.}. The small program in the boot sector must locate the +first part of the operating system's kernel loader program (or perhaps +the kernel itself or perhaps a @dfn{boot manager program}) and read that +into memory. + +INT 19H is also called when the @key{CTRL}-@key{ALT}-@key{DEL} keys are +used. On most systems, @key{CTRL}-@key{ALT}-@key{DEL} causes an short +version of the POST to be executed before INT 19H is called. + +The stuff is: + +@table @asis +@item Offset 0000 +The address where the MBR code starts. + +@item Offset 01BE +The address where the partition table starts (@pxref{Partition table}). + +@item Offset 01FE +The signature, AA55. +@end table + +However, the first 62 bytes of a boot sector are known as the BIOS +Parameter Block (@dfn{BPB}), so GRUB cannot use these bytes for its own +purpose. + +If an active partition is found, that partition's boot record is read +into 0000:7C00 and the MBR code jumps to 0000:7C00 with @code{SI} +pointing to the partition table entry that describes the partition being +booted. The boot record program uses this data to determine the drive +being booted from and the location of the partition on the disk. + +The first byte of an active partition table entry is 80. This byte is +loaded into the @code{DL} register before INT 13H is called to read the +boot sector. When INT 13H is called, @code{DL} is the BIOS device +number. Because of this, the boot sector read by this MBR program can +only be read from BIOS device number 80 (the first hard disk). This is +one of the reasons why it is usually not possible to boot from any other +hard disk. @node Partition table diff --git a/grub/main.c b/grub/main.c index 92cd6bf2b..218fcdf5e 100644 --- a/grub/main.c +++ b/grub/main.c @@ -44,8 +44,8 @@ static char *default_config_file; #define OPT_CONFIG_FILE -5 #define OPT_INSTALL_PARTITION -6 #define OPT_BOOT_DRIVE -7 -#define OPT_DISABLE_CONFIG_FILE -8 -#define OPT_DISABLE_CURSES -9 +#define OPT_NO_CONFIG_FILE -8 +#define OPT_NO_CURSES -9 #define OPT_BATCH -10 #define OPTSTRING "" @@ -57,8 +57,8 @@ static struct option longopts[] = {"config-file", required_argument, 0, OPT_CONFIG_FILE}, {"install-partition", required_argument, 0, OPT_INSTALL_PARTITION}, {"boot-drive", required_argument, 0, OPT_BOOT_DRIVE}, - {"disable-config-file", no_argument, 0, OPT_DISABLE_CONFIG_FILE}, - {"disable-curses", no_argument, 0, OPT_DISABLE_CURSES}, + {"no-config-file", no_argument, 0, OPT_NO_CONFIG_FILE}, + {"no-curses", no_argument, 0, OPT_NO_CURSES}, {"batch", no_argument, 0, OPT_BATCH}, {0}, }; @@ -68,25 +68,26 @@ static void usage (int status) { if (status) - fprintf (stderr, "Try ``%s --help'' for more information.\n", - program_name); + fprintf (stderr, "Try ``grub --help'' for more information.\n"); else printf ("\ -Usage: %s [OPTION]...\n\ +Usage: grub [OPTION]...\n\ \n\ Enter the GRand Unified Bootloader command shell.\n\ \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\ - --disable-config-file disable to use the config file\n\ - --disable-curses disable to use curses\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\ --version print version information and exit\n\ +\n\ +Report bugs to bug-grub@gnu.org\n\ ", - program_name, default_boot_drive, default_config_file, + default_boot_drive, default_config_file, default_install_partition); exit (status); @@ -152,16 +153,16 @@ main (int argc, char **argv) } break; - case OPT_DISABLE_CONFIG_FILE: + case OPT_NO_CONFIG_FILE: use_config_file = 0; break; - case OPT_DISABLE_CURSES: + case OPT_NO_CURSES: use_curses = 0; break; case OPT_BATCH: - /* This is the same as "--disable-config-file --disable-curses". */ + /* This is the same as "--no-config-file --no-curses". */ use_config_file = 0; use_curses = 0; break;