diff --git a/ChangeLog b/ChangeLog index e41b4f43e..4d34b21fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +1999-09-09 Gordon Matzigkeit + + * docs/grub.texi (Commands): Synchronize descriptions with + builtins.c. + + * stage2/builtins.c (hide_func): Use set_partition_hidden_flag. + (unhide_func): Likewise. + Many help message cleanups. From Pavel Roskin. + + * stage2/shared.h (set_partition_hidden_flag): Declare. + + * stage2/disk_io.c (set_partition_hidden_flag): New function + merged from hide_partition and unhide_partition. Make sure we OR + with the inverse of the flag bit rather than XORing to unhide the + partition. + 1999-09-10 OKUJI Yoshinori * grub/asmstub.c (_FILE_OFFSET_BITS): Defined. @@ -5,7 +21,7 @@ instead of int to lseek, and compare the return value with OFFSET. Reported by Pavel Roskin. (grub_stage2) [!__linux__ && !__GNU__]: Print a warning message. - + 1999-09-08 OKUJI Yoshinori * stage2/stage2.c (run_menu): If run_script is successfully @@ -14,13 +30,13 @@ zero. * stage2/cmdline.c (run_script): If ERRNUM is non-zero, wait an input character, whether FALLBACK is less than zero or not. - + 1999-09-06 OKUJI Yoshinori * stage2/builtins.c (configfile_func): New function. (builtin_configfile): New variable. (builtin_table): Added the pointer to BUILTIN_CONFIGFILE. - + 1999-09-06 OKUJI Yoshinori From Pavel Roskin: @@ -35,12 +51,12 @@ (imps_lapic_addr): Likewise. (imps_cpu_apic_map): Likewise. (imps_apic_cpu_map): Likewise. - + 1999-09-06 OKUJI Yoshinori * stage2/builtins.c (testload_func): Fix the typos: 0x2000000 -> 0x200000 and 0x3000000 -> 0x300000. - + 1999-09-06 OKUJI Yoshinori From Hisazumi Kenji : @@ -50,7 +66,7 @@ (MAPBUF_LEN): Likewise. (ffs_mount): Set MAPBLOCK_OFFSET to -1. (block_map): Added partial read support. - + 1999-09-06 OKUJI Yoshinori * stage2/cmdline.c (find_command): If COMMAND is less than @@ -72,7 +88,7 @@ (builtin_testload): Likewise. (builtin_unhide): Likewise. (builtin_uppermem): Likewise. - + 1999-09-05 OKUJI Yoshinori The internal of the command handling is heavily modified, and @@ -154,7 +170,7 @@ new builtin commands interface. Run enter_cmdline forever. If run_menu returns, restart the loop. - + 1999-09-04 Pavel Roskin * docs/menu.lst: More meaningful examples. Not using (0x80,0) @@ -167,26 +183,26 @@ stage2. * stage2/gunzip.c [NO_DECOMPRESSION]: Disable all code if decompression is disabled. - + 1999-09-03 OKUJI Yoshinori * stage2/boot.c (load_image): Use PHDR->P_PADDR instead of PHDR->P_VADDR. Reported by Ramon van Handel . - + 1999-09-03 OKUJI Yoshinori * docs/help2man: Upgraded to 1.013. * docs/grub.8: Regenerated. - + 1999-09-02 Pavel Roskin * stage2/cmdline.c (enter_cmdline) [GRUB_UTIL]: Add a space in the LBA warning message. - + 1999-09-02 OKUJI Yoshinori The character `=' after a command is now optional. - + * stage2/char_io.c (get_cmdline): Search for a space or a equal character after the first word in CMDLINE when TAB lists completions, instead of just searching for a eqaul character. @@ -195,26 +211,26 @@ (commands): Delete all the equal characters. * docs/menu.lst: Likewise. * docs/grub.texi: Likewise. - + 1999-09-01 OKUJI Yoshinori * grub/asmstub.c (env_for_exit): New variable. (grub_stage2): Do a setjmp in doit, and when it returns non-zero, set STATUS to 1 if ERRNUM is non-zero. (stop): Call longjmp instead of exit. - + 1999-08-31 Pavel Roskin * stage2/boot.c [GRUB_UTIL] (bsd_boot_entry): New function. (bsd_boot) [GRUB_UTIL]: Set ENTRY_ADDR to BSD_BOOT_ENTRY to fake the *BSD boot. - + 1999-08-31 OKUJI Yoshinori * stage2/fsys_fat.c (fat_create_blocklist): Cast FAT_BUF to unsigned short * instead of unsigned long *. Suggested by Pavel Roskin. - + 1999-08-30 OKUJI Yoshinori From Edward Killips : @@ -223,7 +239,7 @@ * stage2/disk_io.c (unhide_partition): New function. (hide_partition): Likewise. * stage2/pc_slice.h (PC_SLICE_TYPE_HIDDEN_FLAG): New macro. - + 1999-08-29 OKUJI Yoshinori From Pavel Roskin : @@ -233,7 +249,7 @@ MINIX_SUPER_MAGIC, and set NAMELEN to 30 if it is MINIX_SUPER_MAGIC2. (minix_dir): Use NAMELEN instead of MINIX_NAME_LEN. - + 1999-08-29 Pavel Roskin * grub/Makefile.am, stage1/Makefile.am, stage2/Makefile.am: @@ -244,7 +260,7 @@ * stage2/fsys_fat.c (fat_create_blocklist): Return 1 for the root directory on FAT12 and FAT16. - + 1999-08-27 OKUJI Yoshinori * stage2/boot.c (load_image): Accept two arguments, KERNEL and @@ -259,7 +275,7 @@ HEAP for the Multiboot command-line buffer. * stage2/shared.h (MB_CMDLINE_BUF): New macro. (MB_CMDLINE_BUFLEN): Likewise. - + 1999-08-26 OKUJI Yoshinori * docs/Makefile.am [GRUB_MAINT] (grub.8): The argument for the @@ -267,7 +283,7 @@ * docs/grub.8: Regenerated. * docs/grub.texi: Do not use the name "the Stage 2 emulator" any more. Use the name "the grub shell" instead. - + 1999-08-26 OKUJI Yoshinori From Klaus Reichl : @@ -291,7 +307,7 @@ STAGE2_ID_MINIX_STAGE1_5. * grub/Makefile.am (AM_CFLAGS): Added -DFSYS_MINIX=1. * configure.in (--disable-minix): New option. - + 1999-08-25 OKUJI Yoshinori From Jochen Hoenicke : @@ -316,7 +332,7 @@ (PC_SLICE_TYPE_FAT32_LBA): Likewise. (PC_SLICE_TYPE_FAT16_LBA): Likewise. (IS_PC_SLICE_TYPE_FAT): Likewise. - + 1999-08-25 OKUJI Yoshinori * stage2/fsys_ffs.c (ffs_mount): Do not shift the fs type @@ -324,12 +340,12 @@ . * stage2/fsys_fat.c (fat_mount): Do not shift the fs type FS_MSDOS. - + 1999-08-13 OKUJI Yoshinori Pavel Roskin's patch that adds new options to disable arbitrary filesystems is heavily modified and applied. - + * configure.in (--disable-ext2fs): New option. (--disable-fat): Likewise. (--disable-ffs): Likewise. @@ -338,14 +354,14 @@ -DFSYS_FAT=1 and -DFSYS_FFS=1. * stage2/Makefile.am (libgrub_a_CFLAGS): Likewise. (stage2_exec_CFLAGS): Added @FSYS_CFLAGS@. - * stage2/filesys.h + * stage2/filesys.h [!(FSYS_FFS || FSYS_FAT || FSYS_EXT2FS)] (FSYS_FFS): Deleted. [!(FSYS_FFS || FSYS_FAT || FSYS_EXT2FS)] (FSYS_FAT): Likewise. [!(FSYS_FFS || FSYS_FAT || FSYS_EXT2FS)] (FSYS_EXT2FS): Likewise. * stage2/fsys_ext2fs.c [!FSYS_EXT2FS]: Do not define anything. * stage2/fsys_fat.c [!FSYS_FAT]: Likewise. * stage2/fsys_ffs.c [!FSYS_FFS]: Likewise. - + 1999-08-12 OKUJI Yoshinori * stage1/stage1_lba.S: Use STAGE1_DRP_ADDR for the address of @@ -353,7 +369,7 @@ (drive_parameter): Deleted. * stage1/stage1.h (STAGE1_DRP_ADDR): New macro. (STAGE1_DRP_SIZE): Likewise. - + 1999-08-11 OKUJI Yoshinori * stage2/bios.c (get_diskinfo): In LBA mode, set TOTAL_SECTORS @@ -365,11 +381,11 @@ * stage2/shared.h (device_map): Declared. * grub/asmstub.c (device_map): Defined as a global variable instead of a local variable. - + 1999-08-10 OKUJI Yoshinori Support the NetBSD and OpenBSD partition slices. - + * stage2/pc_slice.h (PC_SLICE_TYPE_BSD): Deleted. (PC_SLICE_TYPE_FREEBSD): New macro. (PC_SLICE_TYPE_OPENBSD): Likewise. @@ -387,19 +403,19 @@ (real_open_partition): Use the macro IS_PC_SLICE_TYPE_BSD instead of checking if CURRENT_SLICE is equal to the BSD partition type directly. - + 1999-08-09 OKUJI Yoshinori * stage2/cmdline.c (commands): Added geometry. (enter_cmdline): If CUR_HEAP has the string "geometry", print out the information about a drive that the argument represents. - + 1999-08-09 OKUJI Yoshinori * stage2/stage2.c (run_menu): Terminate the string PASSWORD before checking if ENTERED is identical to PASSWORD. Reported by Mark Lundeberg . - + 1999-08-08 OKUJI Yoshinori * stage2/stage2.c (set_line_normal): New function. @@ -410,7 +426,7 @@ From Pavel Roskin: * stage2/stage2.c (run_menu) [GRUB_UTIL]: Quit when pushing the key `q'. - + 1999-08-05 OKUJI Yoshinori * acinclude.m4 (grub_ASM_PREFIX_REQUIREMENT): New function. @@ -418,35 +434,35 @@ ADDR32 and DATA32 based on the result. * stage2/asm.S: Replace addr32 and data32 prefixes with ADDR32 and DATA32 respectively. - + 1999-08-05 Pavel Roskin * stage2/boot.c (load_image): Use RAW_ADDR macro when loading an a.out kernel. - + 1999-08-04 OKUJI Yoshinori * stage2/asm.S: Make each of the addr32 and data32 prefixes appear in the same line as it modifies, as the gas manual in binutils-2.9.5.0.4 says "it must be in the same line". - + 1999-08-04 OKUJI Yoshinori * boot.c (load_image): Fix a strcmp test. Reported by Pavel Roskin . - + 1999-08-03 OKUJI Yoshinori From "Dan J. Walters" : * stage2/i386-elf.h (EI_BRAND): New macro. * stage2/boot.c (load_image): If the kernel is ELF, check if it - is a FreeBSD kernel as well as a Multiboot kernel, and if it is + is a FreeBSD kernel as well as a Multiboot kernel, and if it is a FreeBSD kernel, then mask ENTRY_ADDR since FreeBSD requires that. Likewise, mask MEMADDR. (bsd_boot): Set the bi_symtab and the bi_esymtab members of BI only if MBI.FLAGS has the flag MB_INFO_AOUT_SYMS. Otherwise, clear them. - + 1999-07-30 OKUJI Yoshinori From Pavel Roskin : @@ -458,13 +474,13 @@ * configure.in: Check for string.h and strings.h. * grub/asmstub.c (grub_stage2): Fix a misordering in the output format of the inline assembly. - + 1999-07-30 OKUJI Yoshinori From Pavel Roskin : * stage2/asm.S (get_diskinfo_standard): If the number of sectors returned is zero, then return an error code, even if non-carrier. - + 1999-07-15 Gordon Matzigkeit * docs/Makefile.am (grub.info): Use an ugly hack to downgrade @@ -478,7 +494,7 @@ * grub/main.c (main): Call printf instead of grub_printf. Reported by Klaus Reichl . - + 1999-07-15 OKUJI Yoshinori * stage2/cmdline.c (skip_to): Don't increase CMDLINE if the @@ -495,18 +511,18 @@ (VIRTUAL_TO_PHYS) (inb) (outb) (cmos_write_byte) (cmos_read_byte): ... here. * stage2/cmdline.c [!GRUB_UTIL]: Include apic.h and smp-imps.h. - + 1999-07-14 OKUJI Yoshinori The function ungetch is simulated so that the user can use a buggy curses. - + * grub/asmstub.c [HAVE_LIBCURSES] (save_char): New variable. (getkey) [HAVE_LIBCURSES]: If SAVE_CHAR is not ERR, return SAVE_CHAR and clear it. (checkkey) [HAVE_LIBCURSES]: If SAVE_CHAR is not ERR, return SAVE_CHAR. If C is not ERR, set SAVE_CHAR to C. - + 1999-07-14 Pavel Roskin * stage2/char_io.c (get_cmdline) [GRUB_UTIL]: Recognize @@ -515,18 +531,18 @@ * grub/asmstub.c (grub_stage2) [HAVE_LIBCURSES]: Call wtimeout instead of nodelay. (getkey) [HAVE_LIBCURSES]: Likewise. - + 1999-07-14 OKUJI Yoshinori * stage1/stage1_lba.S (probe_values): New variable. This is not used actually, but prevents `install' command from failing bogusly. - + 1999-07-14 OKUJI Yoshinori - + All constants in stage1s are moved to stage1.h and renamed appropriately, and include stage1.h instead. - + * grub/Makefile.am (AM_CFLAGS): Added the include path to stage1. * stage2/Makefile.am (INCLUDES): New variable. * stage1/Makefile.am (stage1_exec_SOURCES): Added stage1.h @@ -573,24 +589,24 @@ * stage1/stage1_lba.S: Fix a bug that incorrectly assigns the segment of buffer address. - + 1999-07-13 OKUJI Yoshinori * stage2/boot.c (load_image): When removing "vga=...", memmove the length of VGA_END plus one. - + 1999-07-12 OKUJI Yoshinori * stage2/bios.c (get_diskinfo): In LBA mode, compute TOTAL_SECTORS from DRP instead of GEOMETRY. Clear GEOMETRY->FLAGS first. - + * stage2/boot.c (load_image): Fix inverted lines. 1999-07-12 OKUJI Yoshinori Support Linux video mode selection. - + * stage2/shared.h (LINUX_VID_MODE_OFFSET): New macro. (LINUX_VID_MODE_NORMAL): Likewise. (LINUX_VID_MODE_EXTENDED): Likewise. @@ -599,7 +615,7 @@ (grub_strlen): Declared. * stage2/boot.c (load_image): Added Linux video mode selection. * stage2/char_io.c [!STAGE1_5] (grub_strlen): New function. - + 1999-07-12 OKUJI Yoshinori * stage2/char_io.c (print_error): Print ERRNUM in the format of @@ -626,7 +642,7 @@ (grub_memmove): Likewise. (grub_strstr): Likewise. (grub_strcmp): Likewise. - + 1999-07-11 OKUJI Yoshinori * stage1/stage1.S (sectors): Change the size to long. @@ -643,20 +659,20 @@ Call 32bits div instructions instead of 16bits div instructions. Update the position where to load data from at the end of this loop, instead of the beginning. - + * stage1/stage1_lba.S: New file. * stage1/Makefile.am (nodist_pkgdata_DATA): Added stage1_lba. (LDFLAGS): New variable. (noinst_PROGRAMS): Added stage1_lba.exec. (stage1_lba_exec_SOURCES): New variable. (%: %.exec): New rule. - + 1999-06-28 OKUJI Yoshinori * grub/main.c (main): The third argument for strtoul is changed to 0 in the case where an option is OPT_INSTALL_PARTIION. Reported by Pavel Roskin . - + 1999-06-27 OKUJI Yoshinori * stage2/shared.h (STAGE2_STAGE2_ID): New macro. @@ -675,7 +691,7 @@ (COMPAT_VERSION_MINOR): Set to 1. * stage2/asm.S (stage2_id): New variable. * stage1/stage1.S: Change the minor version to 1. - + 1999-06-27 OKUJI Yoshinori * configure.in (CFLAGS): Set to "-g", since only this flag is @@ -693,20 +709,20 @@ * stage2/asm.S (chain_stage2): Pass CURRENT_PARTITION and CURRENT_DRIVE, instead of INSTALL_PARTITION and BOOT_DRIVE. - + 1999-06-27 Pavel Roskin * configure.in: set CFLAGS to "-Os -g" for compilers which understand "-Os" if CFLAGS is not already set. Use "-O2 -fno-strength-reduce -fno-unroll-loops -g" for older gcc versions. - + 1999-06-25 OKUJI Yoshinori * stage2/disk_io.c (attempt_mount) [STAGE1_5]: Set FSYS_TYPE to 0, and set it to NUM_FSYS if mount fails. (real_open_partition): Call rawread in Stage 1.5 as well. - + 1999-06-24 OKUJI Yoshinori * Makefile.am (SUBDIRS): Change the order of the directories so @@ -716,12 +732,12 @@ * docs/help2man: Copied from help2man-1.012, which contains my previous change. * docs/grub.8: Regenerated. - + 1999-06-24 OKUJI Yoshinori Build process is cleaned up. Stage 2 and Stage 1.5's are all built in the directory stage2. - + From Pavel Roskin : * Makefile.am (SUBDIRS): e2fs_stage1_5, ffs_stage1_5, fat_stage1_5 and shared_src are removed. @@ -853,15 +869,15 @@ (ffs_stage1_5_exec_CFLAGS): Likewise. (ffs_stage1_5_exec_LDFLAGS): Likewise. (% : %.exec): New rule. - + * stage2/size_test: New file, for checking for the sizes of Stage 2 and Stage 1.5's. - + 1999-06-24 OKUJI Yoshinori * stage1/stage1.S: Call testb instead of andb when checking if the drive is a floppy. - + 1999-06-23 OKUJI Yoshinori * grub/asmstub.c [__linux__]: Include linux/fs.h for BLKFLSBUF. @@ -887,11 +903,11 @@ (opt_section): New variable. (section): Likewise. * docs/grub.8: Produced by help2man automatically. - + 1999-06-22 OKUJI Yoshinori * shared_src/char_io.c (get_cmdline): Add two missing `break's. - + * shared_src/cmdline.c (commands): Add quit. (enter_cmdline): Change the return type to cmdline_t, and return CMDLINE_OK if successful, otherwise CMDLINE_ERROR if fail. @@ -907,12 +923,12 @@ otherwise return MENU_OK. (cmain): If enter_cmdline aborts, then break the command-line loop and return. If run_menu aborts, then return. - + 1999-06-22 OKUJI Yoshinori * shared_src/Makefile.am (EXTRA_DIST): Add bios.c. Reported by Pavel Roskin . - + 1999-06-21 OKUJI Yoshinori * docs/Makefile.am (html): Deleted. @@ -931,7 +947,7 @@ * docs/commands.txt: Likewise. * docs/embedded_data.txt: Likewise. * docs/filesystem.txt: Likewise. - + 1999-06-21 OKUJI Yoshinori From Alexander K. Hudek : @@ -940,12 +956,12 @@ * shared_src/pc_slice.c (PC_SLICE_TYPE_WIN95_EXTENDED): New macro. * shared_src/bios.c (biosdisk): Clear the reserved member of DAP. - + 1999-06-08 OKUJI Yoshinori Color-menu support based on Peter Astrand 's patch. - + * shared_src/asm.S (nocursor): New function. * shared_src/cmdline.c (normal_color): New variable. (highlight_color): Likewise. @@ -962,12 +978,12 @@ (cmain): Initialize normal_color and highlight_color. Handle the color command in the same way as the command-line interface. - + 1999-06-07 OKUJI Yoshinori * e2fs_stage1_5/Makefile.am (IMPORTANT_SIZE_LIMIT): Set to 31744. * fat_stage1_5/Makefile.am (IMPORTANT_SIZE_LIMIT): Likewise. - + 1999-06-06 OKUJI Yoshinori The debug version of Stage 2 is removed. @@ -994,7 +1010,7 @@ * Makefile.am (SUBDIRS): stage2_debug is removed. * stage2_debug/Makefile.am: Deleted. * stage2_debug/Makefile.in: Likewise. - + 1999-06-02 OKUJI Yoshinori * grub/main.c (verbose): New variable. @@ -1006,7 +1022,7 @@ (main): Handle OPT_VERBOSE and OPT_READ_ONLY. If HOLD and VERBOSE are non-zero, then display the message about how to restart /sbin/grub. - + * shared_src/shared.h (verbose) [GRUB_UTIL]: Declared. (read_only) [GRUB_UTIL]: Likewise. @@ -1022,7 +1038,7 @@ * shared_src/disk_io.c (set_device) [STAGE1_5]: Eliminate completion code. - + 1999-06-01 OKUJI Yoshinori * grub/asmstub.c: Do not use I_AM_VERY_BRAVE any more. @@ -1033,7 +1049,7 @@ instead of 0, and check if it is equal to -1 instead of 0 when close it. (get_diskinfo): Treat -1 as non-caching state instead of 0. - + 1999-06-01 OKUJI Yoshinori Reported from Klaus Reichl : @@ -1059,12 +1075,12 @@ when the functon print_completion modifies CMDLINE. * shared_src/stage2.c (get_line_from_config): Fix LITERAL handling. - + 1999-05-25 OKUJI Yoshinori * grub/asmstub.c (grub_stage2): Fix a memory leak that FP is not closed. - + 1999-05-25 OKUJI Yoshinori * grub/main.c: Replace OPT_DISABLE_CONFIG_FILE and @@ -1076,7 +1092,7 @@ 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 ... @@ -1086,7 +1102,7 @@ * docs/COPYING: Removed. * docs/Makefile.am (EXTRA_DIST): Get rid of BUGS. * Makefile.am (EXTRA_DIST): Set to BUGS. - + 1999-05-17 OKUJI Yoshinori * acinclude.m4 (grub_ASM_EXT_C): Do not overrun the command @@ -1096,12 +1112,12 @@ * docs/Makefile.am (info_TEXINFOS): Added multiboot.texi. * docs/multiboot.texi: New file. From Kunihiro Ishiguro. - + 1999-05-12 OKUJI Yoshinori * grub/asmstub.c: Include . Reported by Kunihiro Ishiguro . - + 1999-05-11 OKUJI Yoshinori Reported by Brian Brunswick : @@ -1130,7 +1146,7 @@ * e2fs_stage1_5/Makefile.am (IMPORTANT_SIZE_LIMIT): Set to 81920. * fat_stage1_5/Makefile.am (IMPORTANT_SIZE_LIMIT): Likewise. * ffs_stage1_5/Makefile.am (IMPORTANT_SIZE_LIMIT): Set to 7168. - + 1999-05-03 Gordon Matzigkeit From Pavel Roskin: diff --git a/docs/grub.texi b/docs/grub.texi index 081431ae0..f640ec059 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -639,10 +639,6 @@ start, where they are ignored. Commands usable in configuration files only. @table @code -@item timeout @var{sec} -Set a timeout, in @var{sec} seconds, before automatically booting the -default entry (normally the first entry defined). - @item default @var{num} Set the default entry to entry number @var{num} (if not specified, it is 0, the first entry). @@ -651,8 +647,8 @@ Set the default entry to entry number @var{num} (if not specified, it is Go into unattended boot mode: if the default boot entry has any errors, instead of waiting for the user to do anything, it immediately starts over using the @var{num} entry (same numbering as the @code{default} -command). This obviously doesn't help if the machine was in the middle -of the boot process (after leaving GRUB's code) and rebooted. +command). This obviously won't help if the machine was rebooted by a +kernel that GRUB loaded. @item password @var{passwd} @var{new-config-file} Disable all interactive editing control (menu entry editor and @@ -660,6 +656,10 @@ command line). If the password @var{passwd} is entered, it loads the @var{new-config-file} as a new config file and restarts the GRUB Stage 2. +@item timeout @var{sec} +Set a timeout, in @var{sec} seconds, before automatically booting the +default entry (normally the first entry defined). + @item title @var{name}@dots{} Start a new boot entry, and set its name to the contents of the rest of the line, starting with the first non-space character. @@ -668,111 +668,19 @@ the line, starting with the first non-space character. Commands usable both interactively and in configuration files: @table @code -@item pause @var{message}@dots{} -Print the @var{message}, then wait until a key is pressed. Note that -placing @key{^G} (ASCII code 7) in the message will cause the speaker to -emit the standard beep sound, which is useful when prompting the user to -change floppies. - -@item uppermem @var{kbytes} -Force GRUB to ignore what it found during the autoprobe of the memory -available to the system, and to use @var{kbytes} as the number of -kilobytes of upper memory installed. Any address range maps of the -system are discarded. - -@strong{Caution:} This should be used with great caution, and should -only be necessary on some old machines. GRUB's BIOS probe can pick up -all @sc{ram} on all new machines the author has ever heard of. It can -also be used for debugging purposes to lie to an OS. - -@item root @var{device} [@var{hdbias}] -Set the current @dfn{root partition} to the device @var{device}, then -attempt to mount it to get the partition size (for passing the partition -descriptor in @code{ES:ESI}, used by some chain-loaded bootloaders), the -BSD drive-type (for booting BSD kernels using their native boot format), -and fix up automatic determination of the PC partition where a BSD -sub-partition is located. The optional @var{hdbias} parameter is a -number to tell a kernel which is using one of the BSD boot methodologies -how many BIOS drive numbers are on controllers before the current -one. An example is if there is an IDE disk and a SCSI disk, then set the -root partition normally, except for a kernel using a BSD boot -methodology (FreeBSD or NetBSD), then use a @samp{1} for @var{hdbias}. - -@item rootnoverify @var{device} [@var{hdbias}] -Similar to @command{root}, but don't attempt to mount the -partition. This is useful for when an OS is outside of the area of the -disk that GRUB can read, but setting the correct root partition is still -desired. Note that the items mentioned in @command{root} above which -derived from attempting the mount will NOT work correctly. - -@item chainloader @var{file} -Load @var{file} as a chain-loader. Like any other file loaded by the -filesystem code, it can use the blocklist notation to grab the first -sector of the current partition with @samp{+1}. - -@item kernel @var{file} @dots{} -Attempt to load the primary boot image (Multiboot a.out or @sc{elf}, -Linux zImage or bzImage, FreeBSD a.out, or NetBSD a.out) from -@var{file}. This command ignores the rest of the contents of the line, -except that the entire line starting with the kernel filename is passed -verbatim as the @dfn{kernel command line}. The module state is reset, -and so you must reload any modules. - -@item module @var{file} @dots{} -Load a boot module for a Multiboot format boot image (no interpretation -of the file contents are made, so that user of this command must know -what the kernel in question works with). The rest of the line is passed -as the @dfn{module command line} much like with the @command{kernel} -command. - -@item modulenounzip @var{file} @dots{} -Exactly like @command{module}, except that automatic decompression is -disabled. - -@item initrd @var{file} @dots{} -Load an initial ramdisk for a Linux format boot image and set the -appropriate parameters in the Linux setup area in memory. - -@item install @var{stage1-file} [d] @var{dest-device} @var{file} @var{addr} [p] [@var{config-file}] -This command is fairly complex, and for detailed examples one should -look at @ref{Automated install}. In short, it will perform a full -install presuming the stage2 or stage1.5@footnote{They're loaded the -same way, so we will refer to the stage1.5 as a stage2 from now on.} -is in its final install location. - -In slightly more detail, it will load @var{stage1-file}, validate that -it is a GRUB stage1 of the right version number, install a blocklist for -loading @var{file} as a stage2. If the option @samp{d} is present, the -stage1 will always look for the actual disk @var{file} was installed on, -rather than using the booting drive. The stage2 will be loaded at -address @var{addr}, which must be @samp{0x8000} for a true stage2, and -@samp{0x2000} for a stage1.5. It then writes the completed stage1 to -the first block of the device @var{dest-dev}. If the options @samp{p} or -@var{config-file} are present, then it reads the first block of stage2, -modifies it with the values of the partition @var{file} was found on -(for @samp{p}) or places the string @var{config-file} into the area -telling the stage2 where to look for a configuration file at boot time. -This command preserves the DOS BPB (and for hard disks, the partition -table) of the sector the stage1 is to be installed into. - -@item makeactive -Set the active partition on the root disk to GRUB's root partition (on a -floppy this has no effect). This is limited to working with @emph{primary} -PC partitions. - @item boot This boots the OS/chain-loader which has been loaded. Only necessary if running the fully interactive command line (it is implicit at the end of a config-file entry). @item color @var{normal} [@var{highlight}] -Change the menu colors. The color @var{normal} is used for the normal -line in the menu, and the color @var{highlight} is used to highlight the -line where the cursor points to. If you omit @var{highlight}, then the +Change the menu colors. The color @var{normal} is used for most +lines in the menu, and the color @var{highlight} is used to highlight the +line where the cursor points. If you omit @var{highlight}, then the inverted color of @var{normal} is used for the highlighted line. You -must specify an integer for a color value, and the 0-3 bits represents -the foreground color, the 4-6 bits represents the background color, and -the 7 bit represents that the foreground blinks. +must specify an integer for a color value, where bits 0-3 represent +the foreground color, bits 4-6 represent the background color, and +bit 7 indicates that the foreground blinks. These are the possible values and the meanings: @@ -845,18 +753,13 @@ title OS-BS like color 0x16 0x60 @end example -@item testload @var{file} -Read the entire contents of @var{file} in several different ways and -compares them, to test the filesystem code. The output is somewhat -cryptic , but if no errors are reported and the final @samp{i=@var{X}, -filepos=@var{Y}} reading has @var{X} and @var{Y} equal, then it is -definitely consistent, and very likely works correctly subject to a -consistent offset error. If this test succeeds, then a good next step is -to try loading a kernel with your code. +@item chainloader @var{file} +Load @var{file} as a chain-loader. Like any other file loaded by the +filesystem code, it can use the blocklist notation to grab the first +sector of the current partition with @samp{+1}. -@item read @var{addr} -Read a 32-bit unsigned value from memory at address @var{addr} and -displays it in hex format. +@item configfile @var{file} +Load @var{file} as the configuration file. @item displaymem Display what GRUB thinks the system address space map of the machine is, @@ -868,10 +771,6 @@ at 1MB and going up to the first chipset hole for @dfn{upper memory} (the standard PC @dfn{upper memory} interface is limited to reporting a maximum of 64MB). -@item impsprobe -Probe the Intel Multiprocessor Specification 1.1 or 1.4 configuration -table and boot the various CPUs which are found into a tight loop. - @item fstest Toggle filesystem test mode. @@ -885,9 +784,115 @@ requests from the disk. Filesystem test mode is turned off by any use of the @command{install} or @command{testload} commands. +@item hide @var{partition} +Hide @var{partition} by setting the @dfn{hidden} bit in its partition +type code. + +@item impsprobe +Probe the Intel Multiprocessor Specification 1.1 or 1.4 configuration +table and boot the various CPUs which are found into a tight loop. + +@item initrd @var{file} @dots{} +Load an initial ramdisk for a Linux format boot image and set the +appropriate parameters in the Linux setup area in memory. + +@item install @var{stage1-file} [d] @var{dest-device} @var{file} @var{addr} [p] [@var{config-file}] +This command is fairly complex, and for detailed examples one should +look at @ref{Automated install}. In short, it will perform a full +install presuming the stage2 or stage1.5@footnote{They're loaded the +same way, so we will refer to the stage1.5 as a stage2 from now on.} +is in its final install location. + +In slightly more detail, it will load @var{stage1-file}, validate that +it is a GRUB stage1 of the right version number, install a blocklist for +loading @var{file} as a stage2. If the option @samp{d} is present, the +stage1 will always look for the actual disk @var{file} was installed on, +rather than using the booting drive. The stage2 will be loaded at +address @var{addr}, which must be @samp{0x8000} for a true stage2, and +@samp{0x2000} for a stage1.5. It then writes the completed stage1 to +the first block of the device @var{dest-dev}. If the options @samp{p} or +@var{config-file} are present, then it reads the first block of stage2, +modifies it with the values of the partition @var{file} was found on +(for @samp{p}) or places the string @var{config-file} into the area +telling the stage2 where to look for a configuration file at boot time. +This command preserves the DOS BPB (and for hard disks, the partition +table) of the sector the stage1 is to be installed into. + +@item kernel @var{file} @dots{} +Attempt to load the primary boot image (Multiboot a.out or @sc{elf}, +Linux zImage or bzImage, FreeBSD a.out, or NetBSD a.out) from +@var{file}. The rest of the line is passed verbatim as the @dfn{kernel +command line}. Any modules must be reloaded after using this command. + +@item makeactive +Set the active partition on the root disk to GRUB's root partition. +This command is limited to @emph{primary} PC partitions on a hard disk. + +@item module @var{file} @dots{} +Load a boot module @var{file} for a Multiboot format boot image (no +interpretation of the file contents are made, so that user of this +command must know what the kernel in question expects). The rest of the +line is passed as the @dfn{module command line}, like the +@command{kernel} command. + +@item modulenounzip @var{file} @dots{} +The same as @command{module}, except that automatic decompression is +disabled. + +@item pause @var{message}@dots{} +Print the @var{message}, then wait until a key is pressed. Note that +placing @key{^G} (ASCII code 7) in the message will cause the speaker to +emit the standard beep sound, which is useful when prompting the user to +change floppies. + @item quit -Exit from the grub shell @command{grub} (@pxref{The grub shell}). This -is just ignored in the native Stage 2. +Exit from the GRUB shell @command{grub} (@pxref{The grub shell}). This +command is ignored in the native Stage 2. + +@item read @var{addr} +Read a 32-bit value from memory at address @var{addr} and +display it in hex format. + +@item root @var{device} [@var{hdbias}] +Set the current @dfn{root partition} to the device @var{device}, then +attempt to mount it to get the partition size (for passing the partition +descriptor in @code{ES:ESI}, used by some chain-loaded bootloaders), the +BSD drive-type (for booting BSD kernels using their native boot format), +and correctly determine the PC partition where a BSD sub-partition is +located. The optional @var{hdbias} parameter is a number to tell a BSD +kernel how many BIOS drive numbers are on controllers before the current +one. For example, if there is an IDE disk and a SCSI disk, and your +FreeBSD root partition is on the SCSI disk, then use a @samp{1} for +@var{hdbias}. + +@item rootnoverify @var{device} [@var{hdbias}] +Similar to @command{root}, but don't attempt to mount the +partition. This is useful for when an OS is outside of the area of the +disk that GRUB can read, but setting the correct root partition is still +desired. Note that the items mentioned in @command{root} above which +derived from attempting the mount will @emph{not} work correctly. + +@item testload @var{file} +Read the entire contents of @var{file} in several different ways and +compares them, to test the filesystem code. The output is somewhat +cryptic , but if no errors are reported and the final @samp{i=@var{X}, +filepos=@var{Y}} reading has @var{X} and @var{Y} equal, then it is +definitely consistent, and very likely works correctly subject to a +consistent offset error. If this test succeeds, then a good next step is +to try loading a kernel. + +@item unhide @var{partition} +Unhide @var{partition} by clearing the @dfn{hidden} bit in its partition +type code. + +@item uppermem @var{kbytes} +Force GRUB to assume that only @var{kbytes} kilobytes of upper memory +are installed. Any system address range maps are discarded. + +@strong{Caution:} This should be used with great caution, and should +only be necessary on some old machines. GRUB's BIOS probe can pick up +all @sc{ram} on all new machines the author has ever heard of. It can +also be used for debugging purposes to lie to an OS. @end table diff --git a/stage2/builtins.c b/stage2/builtins.c index d253c84d8..b825f9b3b 100644 --- a/stage2/builtins.c +++ b/stage2/builtins.c @@ -87,24 +87,24 @@ boot_func (char *arg, int flags) /* *BSD */ bsd_boot (kernel_type, bootdev, arg); break; - + case KERNEL_TYPE_LINUX: /* Linux */ linux_boot (); break; - + case KERNEL_TYPE_BIG_LINUX: /* Big Linux */ big_linux_boot (); break; - + case KERNEL_TYPE_CHAINLOADER: /* Chainloader */ gateA20 (0); boot_drive = saved_drive; chain_stage1 (0, BOOTSEC_LOCATION, BOOTSEC_LOCATION - 16); break; - + case KERNEL_TYPE_MULTIBOOT: /* Multiboot */ multi_boot ((int) entry_addr, (int) &mbi); @@ -114,7 +114,7 @@ boot_func (char *arg, int flags) errnum = ERR_BOOT_COMMAND; return 1; } - + return 0; } @@ -143,7 +143,7 @@ chainloader_func (char *arg, int flags) kernel_type = KERNEL_TYPE_NONE; return 1; } - + return 0; } @@ -187,13 +187,13 @@ static struct builtin builtin_color = color_func, BUILTIN_CMDLINE | BUILTIN_MENU, "color NORMAL [HIGHLIGHT]", - "Change the menu colors. The color NORMAL is used for the normal" - " line in the menu, and the color HIGHLIGHT is used to highlight the" - " line where the cursor points to. If you omit HIGHLIGHT, then the" + "Change the menu colors. The color NORMAL is used for most" + " lines in the menu, and the color HIGHLIGHT is used to highlight the" + " line where the cursor points. If you omit HIGHLIGHT, then the" " inverted color of NORMAL is used for the highlighted line. You" - " must specify an integer for a color value, and the 0-3 bits" - " represents the foreground color, the 4-6 bits represents the" - " background color, and the 7 bit represents that the foreground" + " must specify an integer for a color value, where bits 0-3" + " represent the foreground color, bits 4-6 represents the" + " background color, and bit 7 indicates that the foreground" " blinks." }; @@ -207,7 +207,7 @@ configfile_func (char *arg, int flags) /* Check if the file ARG is present. */ if (! grub_open (arg)) return 1; - + /* Copy ARG to CONFIG_FILE. */ while ((*new_config++ = *arg++) != 0) ; @@ -230,7 +230,7 @@ static struct builtin builtin_configfile = configfile_func, BUILTIN_CMDLINE, "configfile FILE", - "Load the file FILE as the configuration file." + "Load FILE as the configuration file." }; @@ -248,7 +248,7 @@ debug_func (char *arg, int flags) debug = 1; grub_printf (" Debug mode is turned on\n"); } - + return 0; } @@ -268,7 +268,7 @@ default_func (char *arg, int flags) { if (! safe_parse_maxint (&arg, &default_entry)) return 1; - + return 0; } @@ -294,22 +294,22 @@ displaymem_func (char *arg, int flags) if (get_mmap_entry ((void *) SCRATCHADDR, 0) != 0 || *((int *) SCRATCHADDR) != 0) grub_printf (" Address Map BIOS Interface is present\n"); - + grub_printf (" Lower memory: %uK, " "Upper memory (to first chipset hole): %uK\n", mbi.mem_lower, mbi.mem_upper); - + if (mbi.flags & MB_INFO_MEM_MAP) { struct AddrRangeDesc *map = (struct AddrRangeDesc *) mbi.mmap_addr; int end_addr = mbi.mmap_addr + mbi.mmap_length; - + grub_printf (" [Address Range Descriptor entries " "immediately follow (values are 64-bit)]\n"); while (end_addr > (int) map) { char *str; - + if (map->Type == MB_ARD_MEMORY) str = "Usable RAM"; else @@ -318,11 +318,11 @@ displaymem_func (char *arg, int flags) " Length: %u X 4GB + %u bytes\n", str, map->BaseAddrHigh, map->BaseAddrLow, map->LengthHigh, map->LengthLow); - + map = ((struct AddrRangeDesc *) (((int) map) + 4 + map->size)); } } - + return 0; } @@ -343,7 +343,7 @@ fallback_func (char *arg, int flags) { if (! safe_parse_maxint (&arg, &fallback_entry)) return 1; - + return 0; } @@ -357,9 +357,8 @@ static struct builtin builtin_fallback = "Go into unattended boot mode: if the default boot entry has any" " errors, instead of waiting for the user to do anything, it" " immediately starts over using the NUM entry (same numbering as the" - " `default=' command). This obviously doesn't help if the machine" - " was in the middle of the boot process (after leaving GRUB's code)" - " and rebooted." + " `default=' command). This obviously won't help if the machine" + " was rebooted by a kernel that GRUB loaded." #endif }; @@ -378,7 +377,7 @@ fstest_func (char *arg, int flags) debug_fs = debug_fs_print_func; printf (" Filesystem tracing is now on\n"); } - + return 0; } @@ -397,11 +396,11 @@ static int geometry_func (char *arg, int flags) { struct geometry geom; - + set_device (arg); if (errnum) return 1; - + if (get_diskinfo (current_drive, &geom)) { errnum = ERR_NO_DISK; @@ -410,7 +409,7 @@ geometry_func (char *arg, int flags) else { char *msg; - + #ifdef GRUB_UTIL msg = device_map[current_drive]; #else @@ -419,14 +418,14 @@ geometry_func (char *arg, int flags) else msg = "CHS"; #endif - + grub_printf ("drive 0x%x: C/H/S = %d/%d/%d, " "The number of sectors = %d, %s\n", current_drive, geom.cylinders, geom.heads, geom.sectors, geom.total_sectors, msg); } - + return 0; } @@ -452,12 +451,12 @@ help_func (char *arg, int flags) /* Invoked with no argument. Print the list of the short docs. */ struct builtin **builtin; int left = 1; - + for (builtin = builtin_table; *builtin != 0; builtin++) { int len; int i; - + /* If this cannot be run in the command-line interface, skip this. */ if (! ((*builtin)->flags & BUILTIN_CMDLINE)) @@ -496,13 +495,13 @@ help_func (char *arg, int flags) while (*ptr && *ptr != ' ') ptr++; *ptr = 0; - + for (builtin = builtin_table; *builtin; builtin++) { /* Skip this if this is only for the configuration file. */ if (! ((*builtin)->flags & BUILTIN_CMDLINE)) continue; - + if (substring (arg, (*builtin)->name) < 1) { char *doc = (*builtin)->long_doc; @@ -525,7 +524,7 @@ help_func (char *arg, int flags) if (doc[len - 1] == ' ') break; } - + grub_printf (" "); for (i = 0; i < len; i++) grub_putchar (*doc++); @@ -533,12 +532,12 @@ help_func (char *arg, int flags) } } } - + arg = next_arg; } while (*arg); } - + return 0; } @@ -550,7 +549,7 @@ static struct builtin builtin_help = "help [PATTERN ...]", "Display helpful information about builtin commands." }; - + /* hide */ static int @@ -561,9 +560,9 @@ hide_func (char *arg, int flags) saved_partition = current_partition; saved_drive = current_drive; - if (! hide_partition ()) + if (! set_partition_hidden_flag (1)) return 1; - + return 0; } @@ -572,8 +571,9 @@ static struct builtin builtin_hide = "hide", hide_func, BUILTIN_CMDLINE | BUILTIN_MENU, - "hide DRIVE", - "Hide the drive DRIVE by adding 0x10 into the partition type." + "hide PARTITION", + "Hide PARTITION by setting the \"hidden\" bit in" + " its partition type code." }; @@ -585,7 +585,7 @@ impsprobe_func (char *arg, int flags) if (!imps_probe ()) #endif printf (" No MPS information found or probe failed\n"); - + return 0; } @@ -617,7 +617,7 @@ initrd_func (char *arg, int flags) errnum = ERR_NEED_LX_KERNEL; return 1; } - + return 0; } @@ -653,13 +653,13 @@ install_func (char *arg, int flags) { if (debug) printf("[%d]", sector); - + if (*((unsigned long *) (installlist - 4)) + *((unsigned short *) installlist) != sector || installlist == BOOTSEC_LOCATION + STAGE1_FIRSTLIST + 4) { installlist -= 8; - + if (*((unsigned long *) (installlist - 8))) errnum = ERR_WONT_FIT; else @@ -668,7 +668,7 @@ install_func (char *arg, int flags) *((unsigned long *) (installlist - 4)) = sector; } } - + *((unsigned short *) installlist) += 1; installsect = sector; installaddr += 512; @@ -708,12 +708,12 @@ install_func (char *arg, int flags) /* Do not decompress Stage 2. */ no_decompression = 1; #endif - + /* copy possible DOS BPB, 59 bytes at byte offset 3 */ grub_memmove (buffer + BOOTSEC_BPB_OFFSET, old_sect + BOOTSEC_BPB_OFFSET, BOOTSEC_BPB_LENGTH); - + /* if for a hard disk, copy possible MBR/extended part table */ if ((dest_drive & 0x80) && current_partition == 0xFFFFFF) grub_memmove (buffer + BOOTSEC_PART_OFFSET, @@ -737,27 +737,27 @@ install_func (char *arg, int flags) /* Open Stage 2. */ if (! grub_open (file)) return 1; - + /* If STAGE1_FILE is the LBA version, do a sanity check. */ if (buffer[STAGE1_ID_OFFSET] == STAGE1_ID_LBA) { /* The geometry of the drive in which FILE is located. */ struct geometry load_geom; - + /* Check if CURRENT_DRIVE is a floppy disk. */ if (! (current_drive & 0x80)) { errnum = ERR_DEV_VALUES; return 1; } - + /* Get the geometry of CURRENT_DRIVE. */ if (get_diskinfo (current_drive, &load_geom)) { errnum = ERR_NO_DISK; return 1; } - + #ifdef GRUB_UTIL /* XXX Can we determine if LBA is supported in the grub shell as well? */ @@ -773,21 +773,21 @@ install_func (char *arg, int flags) } #endif } - + if (! new_drive) new_drive = current_drive; else if (current_drive != dest_drive) - grub_printf ("Warning: the option `d' is not found, but Stage 2 will" - "be install into a\ndifferent drive from a drive into" - " which is installed Stage 1.\n"); - + grub_printf ("Warning: the option `d' was not used, but the Stage 1 will" + "be installed on a\ndifferent drive than the drive where" + " the Stage 2 resides.\n"); + memmove ((char*) BOOTSEC_LOCATION, buffer, SECTOR_SIZE); - + *((unsigned char *) (BOOTSEC_LOCATION + STAGE1_FIRSTLIST)) = new_drive; *((unsigned short *) (BOOTSEC_LOCATION + STAGE1_INSTALLADDR)) = installaddr; - + i = BOOTSEC_LOCATION+STAGE1_FIRSTLIST - 4; while (*((unsigned long *) i)) { @@ -799,12 +799,12 @@ install_func (char *arg, int flags) errnum = ERR_BAD_VERSION; return 1; } - + *((int *) i) = 0; *((int *) (i - 4)) = 0; i -= 8; } - + installlist = BOOTSEC_LOCATION + STAGE1_FIRSTLIST + 4; debug_fs = debug_fs_blocklist_func; @@ -822,21 +822,21 @@ install_func (char *arg, int flags) debug_fs = 0; return 1; } - + stage2_sect = installsect; ptr = skip_to (0, addr); - + if (*ptr == 'p') { write_stage2_sect = 1; *((long *) (SCRATCHADDR + STAGE2_INSTALLPART)) = current_partition; ptr = skip_to (0, ptr); } - + if (*ptr) { char *str = ((char *) (SCRATCHADDR + STAGE2_VER_STR_OFFS)); - + write_stage2_sect = 1; /* Find a string for the configuration filename. */ while (*(str++)) @@ -855,7 +855,7 @@ install_func (char *arg, int flags) /* Clear the cache. */ buf_track = -1; - + if (biosdisk (BIOSDISK_WRITE, dest_drive, &dest_geom, dest_sector, 1, (BOOTSEC_LOCATION >> 4)) @@ -868,13 +868,13 @@ install_func (char *arg, int flags) debug_fs = 0; return 1; } - + debug_fs = 0; #ifndef NO_DECOMPRESSION no_decompression = 0; #endif - + return 0; } @@ -884,16 +884,15 @@ static struct builtin builtin_install = install_func, BUILTIN_CMDLINE, "install STAGE1 [d] DEVICE STAGE2 ADDR [p] [CONFIG_FILE]", - "Install STAGE1 into DEVICE, and install a blocklist for loading STAGE2" + "Install STAGE1 on DEVICE, and install a blocklist for loading STAGE2" " as a Stage 2. If the option `d' is present, the Stage 1 will always" - " look for the actual disk STAGE2 is installed on, rather than using" + " look for the disk where STAGE2 was installed, rather than using" " the booting drive. The Stage 2 will be loaded at address ADDR, which" " must be 0x8000 for a true Stage 2, and 0x2000 for a Stage 1.5. If" - " the option `p' or CONFIG_FILE are present, then it reads the first" - " block of Stage 2, modifies it with the values of the partition STAGE2" - " was found on for `p' or places the string CONFIG_FILE into the area" - " telling the Stage 2 where to look for a configuration file at boot" - " time." + " the option `p' or CONFIG_FILE is present, then the first block" + " of Stage 2 is patched with new values of the partition and name" + " of the configuration file used by the true Stage 2 (for a Stage 1.5," + " this is the name of the true Stage 2) at boot time." }; @@ -902,7 +901,7 @@ static int kernel_func (char *arg, int flags) { int len = grub_strlen (arg); - + /* Reset MB_CMDLINE. */ mb_cmdline = (char *) MB_CMDLINE_BUF; if (len + 1 > MB_CMDLINE_BUFLEN) @@ -910,13 +909,13 @@ kernel_func (char *arg, int flags) errnum = ERR_WONT_FIT; return 1; } - + /* Copy the command-line to MB_CMDLINE. */ grub_memmove (mb_cmdline, arg, len + 1); kernel_type = load_image (arg, mb_cmdline); if (kernel_type == KERNEL_TYPE_NONE) return 1; - + mb_cmdline += len + 1; return 0; } @@ -929,10 +928,9 @@ static struct builtin builtin_kernel = "kernel FILE [ARG ...]", "Attempt to load the primary boot image (Multiboot a.out or ELF," " Linux zImage or bzImage, FreeBSD a.out, or NetBSD a.out) from" - " FILE. This command ignores the rest of the contents of the line," - " except that the entire line starting with FILE is" - " passed verbatim as the \"kernel command line\". The module state is" - " reset, and so you must reload any modules." + " FILE. The rest of the line is passed verbatim as the" + " \"kernel command line\". Any modules must be reloaded after" + " using this command." }; @@ -942,7 +940,7 @@ makeactive_func (char *arg, int flags) { if (! make_saved_active ()) return 1; - + return 0; } @@ -952,9 +950,8 @@ static struct builtin builtin_makeactive = makeactive_func, BUILTIN_CMDLINE, "makeactive", - "Set the active partition on the root disk to GRUB's root partition" - " (on a floppy this has no effect). This is limited to working with" - " _primary_ PC partitions." + "Set the active partition on the root disk to GRUB's root partition." + " This command is limited to _primary_ PC partitions on a hard disk." }; @@ -963,7 +960,7 @@ static int module_func (char *arg, int flags) { int len = grub_strlen (arg); - + switch (kernel_type) { case KERNEL_TYPE_MULTIBOOT: @@ -988,7 +985,7 @@ module_func (char *arg, int flags) errnum = ERR_NEED_MB_KERNEL; return 1; } - + return 0; } @@ -999,10 +996,10 @@ static struct builtin builtin_module = BUILTIN_CMDLINE, "module FILE [ARG ...]", "Load a boot module FILE for a Multiboot format boot image (no" - " interpretation of the file contents are made, so that user of this" - " command must know what the kernel in question works with). The" - " rest of the line is passed as the \"module command line\" much like" - " with the `kernel=' command." + " interpretation of the file contents is made, so users of this" + " command must know what the kernel in question expects). The" + " rest of the line is passed as the \"module command line\", like" + " the `kernel=' command." }; @@ -1011,7 +1008,7 @@ static int modulenounzip_func (char *arg, int flags) { int ret; - + #ifndef NO_DECOMPRESSION no_decompression = 1; #endif @@ -1021,7 +1018,7 @@ modulenounzip_func (char *arg, int flags) #ifndef NO_DECOMPRESSION no_decompression = 0; #endif - + return ret; } @@ -1031,7 +1028,7 @@ static struct builtin builtin_modulenounzip = modulenounzip_func, BUILTIN_CMDLINE, "modulenounzip FILE [ARG ...]", - "Exactly like `module=', except that automatic decompression is" + "The same as `module=', except that automatic decompression is" " disabled." }; @@ -1047,7 +1044,7 @@ password_func (char *arg, int flags) errnum = ERR_WONT_FIT; return 1; } - + password = (char *) PASSWORD_BUF; grub_memmove (password, arg, len + 1); return 0; @@ -1065,7 +1062,7 @@ static struct builtin builtin_password = " FILE as a new config file and restarts the GRUB Stage 2." #endif }; - + /* pause */ static int @@ -1074,7 +1071,7 @@ pause_func (char *arg, int flags) /* If ESC is returned, then abort this entry. */ if (ASCII_CHAR (getkey ()) == 27) return 1; - + return 0; } @@ -1109,7 +1106,7 @@ static struct builtin builtin_quit = quit_func, BUILTIN_CMDLINE, "quit", - "Exit from the grub shell." + "Exit from the GRUB shell." }; @@ -1132,8 +1129,8 @@ static struct builtin builtin_read = read_func, BUILTIN_CMDLINE, "read ADDR", - "Read a 32-bit unsigned value from memory at address ADDR and" - " displays it in hex format." + "Read a 32-bit value from memory at address ADDR and" + " display it in hex format." }; @@ -1157,7 +1154,7 @@ root_func (char *arg, int flags) errnum = 0; saved_partition = current_partition; saved_drive = current_drive; - + /* BSD and chainloading evil hacks !! */ biasptr = skip_to (0, next); safe_parse_maxint (&biasptr, &hdbias); @@ -1166,7 +1163,7 @@ root_func (char *arg, int flags) /* Print the type of the filesystem. */ print_fsys_type (); - + return 0; } @@ -1180,14 +1177,12 @@ static struct builtin builtin_root = " attempt to mount it to get the partition size (for passing the" " partition descriptor in `ES:ESI', used by some chain-loaded" " bootloaders), the BSD drive-type (for booting BSD kernels using" - " their native boot format), and fix up automatic determination of" + " their native boot format), and correctly determine " " the PC partition where a BSD sub-partition is located. The" - " optional HDBIAS parameter is a number to tell a kernel which is" - " using one of the BSD boot methodologies how many BIOS drive" - " numbers are on controllers before the current one. An example is" - " if there is an IDE disk and a SCSI disk, then set the root" - " partition normally, except for a kernel using a BSD boot" - " methodology (FreeBSD or NetBSD), then use a `1' for HDBIAS." + " optional HDBIAS parameter is a number to tell a BSD kernel" + " how many BIOS drive numbers are on controllers before the current" + " one. For example, if there is an IDE disk and a SCSI disk, and your" + " FreeBSD root partition is on the SCSI disk, then use a `1' for HDBIAS." }; @@ -1223,31 +1218,31 @@ static int testload_func (char *arg, int flags) { int i; - + kernel_type = KERNEL_TYPE_NONE; - + if (! grub_open (arg)) return 1; - + debug_fs = debug_fs_print_func; - + /* Perform filesystem test on the specified file. */ /* Read whole file first. */ grub_printf ("Whole file: "); - + grub_read ((char *) RAW_ADDR (0x100000), -1); - + /* Now compare two sections of the file read differently. */ - + for (i = 0; i < 0x10ac0; i++) { *((unsigned char *) RAW_ADDR (0x200000 + i)) = 0; *((unsigned char *) RAW_ADDR (0x300000 + i)) = 1; } - + /* First partial read. */ grub_printf ("\nPartial read 1: "); - + filepos = 0; grub_read ((char *) RAW_ADDR (0x200000), 0x7); grub_read ((char *) RAW_ADDR (0x200007), 0x100); @@ -1255,10 +1250,10 @@ testload_func (char *arg, int flags) grub_read ((char *) RAW_ADDR (0x200117), 0x999); grub_read ((char *) RAW_ADDR (0x200ab0), 0x10); grub_read ((char *) RAW_ADDR (0x200ac0), 0x10000); - + /* Second partial read. */ grub_printf ("\nPartial read 2: "); - + filepos = 0; grub_read ((char *) RAW_ADDR (0x300000), 0x10000); grub_read ((char *) RAW_ADDR (0x310000), 0x10); @@ -1266,13 +1261,13 @@ testload_func (char *arg, int flags) grub_read ((char *) RAW_ADDR (0x310017), 0x10); grub_read ((char *) RAW_ADDR (0x310027), 0x999); grub_read ((char *) RAW_ADDR (0x3109c0), 0x100); - + grub_printf ("\nHeader1 = 0x%x, next = 0x%x, next = 0x%x, next = 0x%x\n", *((int *) RAW_ADDR (0x200000)), *((int *) RAW_ADDR (0x200004)), *((int *) RAW_ADDR (0x200008)), *((int *) RAW_ADDR (0x20000c))); - + grub_printf ("Header2 = 0x%x, next = 0x%x, next = 0x%x, next = 0x%x\n", *((int *) RAW_ADDR (0x300000)), *((int *) RAW_ADDR (0x300004)), @@ -1283,7 +1278,7 @@ testload_func (char *arg, int flags) if (*((unsigned char *) RAW_ADDR (0x200000 + i)) != *((unsigned char *) RAW_ADDR (0x300000 + i))) break; - + grub_printf ("Max is 0x10ac0: i=0x%x, filepos=0x%x\n", i, filepos); debug_fs = 0; return 0; @@ -1301,7 +1296,7 @@ static struct builtin builtin_testload = " filepos=Y' reading has X and Y equal, then it is definitely" " consistent, and very likely works correctly subject to a" " consistent offset error. If this test succeeds, then a good next" - " step is to try loading a kernel with your code." + " step is to try loading a kernel." }; @@ -1311,7 +1306,7 @@ timeout_func (char *arg, int flags) { if (! safe_parse_maxint (&arg, &grub_timeout)) return 1; - + return 0; } @@ -1358,7 +1353,7 @@ unhide_func (char *arg, int flags) saved_partition = current_partition; saved_drive = current_drive; - if (! unhide_partition ()) + if (! set_partition_hidden_flag (0)) return 1; return 0; @@ -1369,8 +1364,9 @@ static struct builtin builtin_unhide = "unhide", unhide_func, BUILTIN_CMDLINE | BUILTIN_MENU, - "unhide DRIVE", - "Unhide the drive DRIVE by subtracting 0x10 from the partition type." + "unhide PARTITION", + "Unhide PARTITION by clearing the \"hidden\" bit in its" + " partition type code." }; @@ -1391,10 +1387,8 @@ static struct builtin builtin_uppermem = uppermem_func, BUILTIN_CMDLINE, "uppermem KBYTES", - "Force GRUB to ignore what it found during the autoprobe of the" - " memory available to the system, and to use KBYTES as the number of" - " kilobytes of upper memory installed. Any address range maps of the" - " system are discarded." + "Force GRUB to assume that only KBYTES kilobytes of upper memory are" + " installed. Any system address range maps are discarded." }; diff --git a/stage2/disk_io.c b/stage2/disk_io.c index 8aca807f7..7afa1fc52 100644 --- a/stage2/disk_io.c +++ b/stage2/disk_io.c @@ -312,24 +312,28 @@ make_saved_active (void) } int -unhide_partition (void) +set_partition_hidden_flag (int hidden) { if (saved_drive) { int part = saved_partition >> 16; - + if (part > 3) { errnum = ERR_NO_PART; return 0; } - + if (! rawread (saved_drive, 0, 0, SECTOR_SIZE, (char *) SCRATCHADDR)) return 0; - + if (PC_SLICE_TYPE (SCRATCHADDR, part) & PC_SLICE_TYPE_HIDDEN_FLAG) { - PC_SLICE_TYPE (SCRATCHADDR, part) ^= PC_SLICE_TYPE_HIDDEN_FLAG; + if (hidden) + PC_SLICE_TYPE (SCRATCHADDR, part) |= PC_SLICE_TYPE_HIDDEN_FLAG; + else + PC_SLICE_TYPE (SCRATCHADDR, part) &= ~PC_SLICE_TYPE_HIDDEN_FLAG; + buf_track = -1; if (biosdisk (BIOSDISK_WRITE, saved_drive, &buf_geom, 0, 1, SCRATCHSEG)) @@ -339,41 +343,10 @@ unhide_partition (void) } } } - + return 1; } -int -hide_partition (void) -{ - if (saved_drive) - { - int part = saved_partition >> 16; - - if (part > 3) - { - errnum = ERR_NO_PART; - return 0; - } - - if (! rawread (saved_drive, 0, 0, SECTOR_SIZE, (char *) SCRATCHADDR)) - return 0; - - if (! (PC_SLICE_TYPE (SCRATCHADDR, part) & PC_SLICE_TYPE_HIDDEN_FLAG)) - { - PC_SLICE_TYPE (SCRATCHADDR, part) |= PC_SLICE_TYPE_HIDDEN_FLAG; - buf_track = -1; - if (biosdisk (BIOSDISK_WRITE, saved_drive, &buf_geom, - 0, 1, SCRATCHSEG)) - { - errnum = ERR_WRITE; - return 0; - } - } - } - - return 1; -} static void check_and_print_mount (void) @@ -472,7 +445,7 @@ real_open_partition (int flags) if (! sane_partition ()) return 0; #endif - + /* * The "rawread" is probably unnecessary here, but it is good to * know it works. @@ -653,7 +626,7 @@ open_partition (void) static int incomplete, disk_choice; #ifndef STAGE1_5 static int unique; -static char unique_string[128]; /* XXX Don't know yet */ +static char unique_string[128]; /* XXX Don't know yet */ #endif static enum { @@ -681,7 +654,7 @@ set_device (char *device) /* user has given '(' only, let disk_choice handle what disks we have */ return device + 1; #endif - + if (*device == '(' && *(++device)) { if (*device != ',' && *device != ')') @@ -691,7 +664,7 @@ set_device (char *device) #ifndef STAGE1_5 if (*device == 'f' || *device == 'h') { - /* user has given '([fh]', check for resp. add 'd' and + /* user has given '([fh]', check for resp. add 'd' and let disk_choice handle what disks we have */ if (!*(device + 1)) { @@ -704,7 +677,7 @@ set_device (char *device) return device + 2; } #endif - + if ((*device == 'f' || *device == 'h') && (device += 2, (*(device - 1) != 'd'))) errnum = ERR_NUMBER_PARSING; @@ -993,7 +966,7 @@ print_a_completion (char *filename) { char *f = filename; char *u = unique_string; - + if (! *u && unique == 0) { /* copy first string, this is unique. */ @@ -1008,7 +981,7 @@ print_a_completion (char *filename) *u = '\0'; } unique++; - + printf (" %s", filename); } @@ -1024,7 +997,7 @@ print_completions (char *filename) *unique_string = '\0'; unique = 0; - + if (*filename == '/' || (ptr = set_device (filename)) || incomplete) { errnum = 0; @@ -1039,8 +1012,8 @@ print_completions (char *filename) printf (" Possible disks are: "); - for (i = (ptr && (*(ptr-2) == 'h' && *(ptr-1) == 'd') ? 1 : 0); - i < (ptr && (*(ptr-2) == 'f' && *(ptr-1) == 'd') ? 1 : 2); + for (i = (ptr && (*(ptr-2) == 'h' && *(ptr-1) == 'd') ? 1 : 0); + i < (ptr && (*(ptr-2) == 'f' && *(ptr-1) == 'd') ? 1 : 2); i++) { for (j = 0; j < 8; j++) @@ -1077,7 +1050,7 @@ print_completions (char *filename) if ((*(ptr - 2) == 'f') && (*(ptr - 1) == 'd') && ('0' <= *ptr && *ptr <= '8')) *(ptr + 1) = ')', *(ptr + 2) = '\0'; - + putchar ('\n'); } else @@ -1113,7 +1086,7 @@ print_completions (char *filename) dir (filename); { char *u = unique_string; - + if (*u) { while (*ptr++) diff --git a/stage2/shared.h b/stage2/shared.h index fe85ed0a9..542eb21f9 100644 --- a/stage2/shared.h +++ b/stage2/shared.h @@ -598,11 +598,8 @@ int open_partition (void); /* Sets device to the one represented by the SAVED_* parameters. */ int make_saved_active (void); -/* Hide a partition. */ -int hide_partition (void); - -/* Unhide a partition. */ -int unhide_partition (void); +/* Set or clear the current root partition's hidden flag. */ +int set_partition_hidden_flag (int hidden); /* Open a file or directory on the active device, using GRUB's internal filesystem support. */