Add a workaround for buggy BIOSes which don't pass boot drive
correctly. The idea is that GRUB forces the fixed disk flag
when booted from a hard disk. When BIOS loads GRUB directly,
the boot drive must be either of 0x00 and 0x80, so this should
work, if those BIOSes always pass zero to %dl. AFAIK, this
assumption is always correct.
* stage2/builtins.c (install_func): Store the fixed disk flag of
the destination drive in BOOT_DRIVE_MASK in Stage 1.
* stage1/stage1.h (STAGE1_BOOT_DRIVE_MASK): New macro.
* stage1/stage1.S (boot_drive_mask): New variable. It is or'ed
to %dl.
* stage2/char_io.c (init_page): Change the software name from
"GRUB" to "GNU GRUB". This was inaccurate. Reported by Ciaran
O'Riordan <coriordan@compsoc.com>.
Change the terminal structure a bit, to turn the cursor state
explicitly. Suggested by Pavel Roskin.
* stage2/term.h (struct term_entry): Remove the member
`nocursor' and add `setcursor'.
[!STAGE1_5] (console_setcursor): New prototype.
[SUPPORT_HERCULES] (hercules_setcursor): Likewise.
[!STAGE1_5] (console_nocursor): Removed.
[SUPPORT_HERCULES] (hercules_nocursor): Likewise.
* stage2/stage2.c (run_menu): Call setcursor instead of
nocursor.
Call setcursor with 1 before starting a boot entry.
* stage2/shared.h (nocursor): Removed.
(setcursor): New prototype.
* stage2/hercules.c (herc_cursor_state): New variable.
(herc_turn_cursor): Removed.
(hercules_nocursor): Likewise.
(hercules_setcursor): New function.
* stage2/char_io.c (get_cmdline): Turn on the cursor at the
beginning, and restore it before returning.
(nocursor): Removed.
(setcursor): New function.
* stage2/asm.S (console_cursor_state): New variable.
(console_cursor_shape): Likewise.
(console_setcursor): New function.
(console_nocursor): Removed.
* grub/asmstub.c (console_setcursor): New function.
(hercules_setcursor): Likewise.
(console_nocursor): Removed.
(hercules_nocursor): Likewise.
From Alexander Langer <alex@big.endian.de>:
* stage2/freebsd.h (RB_GDB): New macro.
(RB_MUTE): Likewise.
(RB_MULTIPLE): Likewise.
* stage2/boot.c (bsd_boot): Set the bits of RB_MULTIPLE, RB_GDB
and RB_MUTE when "-D", "-g" and "-m" are specified,
respectively.
* stage2/disk_io.c (rawread): Make sure that SECTOR is valid.
If not, set ERRNUM to ERR_GEOM and return zero. This check is
critical when a partition table is corrupted.
* stage2/asm.S (console_cls): Write spaces to the entire screen
instead of getting/setting the video mode, because this flickers
the screen and is quite annoying, if using a LCD.
* grub/asmstub.c (console_translate_key): Deal with KEY_PPAGE
and KEY_NPAGE.
* stage2/serial.c (serial_translate_key_sequence): Added two new
codes for Page Up and Page Down.
* stage2/asm.S (translation_table): Added entries for KEY_PPAGE
and KEY_NPAGE.
* stage2/stage2.c (run_menu): Deal with Page Up and Page Down.
Also recognize the right key for the selection of a boot entry.
Suggested by Adam Lackorzynski <adam@os.inf.tu-dresden.de>.
* stage2/asm.S (gateA20): Output a dummy command (0xff), as a
workaround for USB keyboard hanging problem. Suggested by
Hidetoshi Nishimaki <nishimaki@mxs.nes.nec.co.jp>.
* configure.in (falign_loop_flag): New variable. Set to if GCC
supports `-falign-*'. If true, use `-falign-jumps',
`-falign-loops' and `-falign-functions' instead of
`-malign-jumps', `-malign-loops' and `-malign-functions',
because `-malign-*' are obsolete in GCC 3.x. Reported by Jeremy
Katz.
The state was 0 - normal or 1 - highlight.
The state is now defined using an enum called color_state.
* stage2/term.h (color_state): New enum.
(COLOR_STATE_STANDARD): Standard color to use when not using user defined.
(COLOR_STATE_NORMAL): User defined normal color.
(COLOR_STATE_HIGHLIGHT): User defined highlight color.
(console_highlight): Renamed to console_setcolorstate.
(serial_highlight): Renamed to serial_setcolorstate.
(hercules_highlight): Renamed to hercules_setcolorstate.
* stage2/hercules.c (herc_highlight_state): Removed.
(herc_standard_color): New variable.
(herc_color_state): Likewise.
(herc_highlight): Renamed to herc_setcolorstate.
(herc_setcolorstate): Added switch to handle new states.
* stage2/console.c (console_highlight_state): Removed.
(console_standard_color): New variable.
(console_color_state): Likewise.
(console_highlight): Renamed to console_setcolorstate.
(console_setcolorstate): Added switch to handle new states.
* stage2/serial.c (serial_highlight): Renamed to serial_setcolorstate.
(serial_setcolorstate): Adjusted 'if' to suit new states.
* grub/asmstub.c (console_highlight): Renamed to console_setcolorstate.
(console_setcolorstate): Adjusted 'if' to suit new states.
* stage2/stage2.c (print_entry): Set color states using new states.
(print_border): Likewise.
* stage2/stage2.c (run_menu): Reverse if (!) to if () for uniformitty.
* stage2/boot.c (load_image): Rewrite the Linux booting support
radically. Now it should work even on a machine having, say,
only 128KB, theoretically. Of course, GRUB itself doesn't work
on such a system, though.
(load_initrd): Initialize LH based on CUR_ADDR, because the
location becomes dynamic.
* stage2/shared.h (LINUX_MAX_SETUP_SECTS): Set to 64.
(LINUX_HEAP_END_OFFSET): Set to (0x9000 - 0x200).
(LINUX_STAGING_AREA): Removed.
(LINUX_SETUP): Likewise.
(LINUX_KERNEL): Likewise.
(LINUX_KERNEL_MAXLEN): Likewise.
(LINUX_SETUP_SEG): Likewise.
(LINUX_INIT_SEG): Likewise.
(LINUX_SETUP_STACK): Set to 0x9000.
(LINUX_BZIMAGE_ADDR): New macro.
(LINUX_ZIMAGE_ADDR): Likewise.
(LINUX_OLD_REAL_MODE_ADDR): Likewise.
(CL_MY_LOCATION): Removed.
(CL_MY_END_ADDR): Likewise.
(CL_BASE_ADDR): Likewise.
(CL_MAGIC): Renamed to ...
(LINUX_CL_MAGIC): ... this.
(LINUX_CL_OFFSET): New macro.
(LINUX_CL_END_OFFSET): Likewise.
(LINUX_SETUP_MOVE_SIZE): Likewise.
(struct linux_kernel_header): Change the type of the member
"cmd_line_ptr" to char *.
(linux_data_tmp_addr): Declared.
(linux_data_real_addr): Likewise.
* stage2/asm.S [!STAGE1_5] (linux_data_tmp_addr): New variable.
[!STAGE1_5] (linux_data_real_addr): Likewise.
[!STAGE1_5] (big_linux_boot): Copy the real mode part from
LINUX_DATA_TMP_ADDR to LINUX_DATA_REAL_ADDR.
* grub/asmstub.c (linux_data_tmp_addr): New variable.
(linux_data_real_addr): Likewise.
From Mark Kettenis <kettenis@chello.nl>:
* stage2/boot.c (load_image): Recognize newer FreeBSD kernels.
* stage2/i386-elf.h (EI_OSABI): New macro.
(EI_ABIVERSION): Likewise.
(ELFOSABI_FREEBSD): Likewise.
(EI_PAD): Set to 9.
* stage2/shared.h (boot_part_offset): Removed.
* stage2/disk_io.c (set_bootdev): Copy the partition information
here. Now this function can call rawread, so it can fail.
(boot_part_offset): Removed.
* stage2/builtins.c (boot_func): Don't copy the partition
information here.
(real_root_func): Check ERRNUM after calling set_bootdev.
* stage2/serial.c [!GRUB_UTIL] (inb): Added a delay into this
function itself.
[!GRUB_UTIL] (outb): Likewise.
[!GRUB_UTIL] (serial_hw_put): Increase the timeout value, and
don't call serial_hw_delay explicitly any longer.
(fill_input_buf): Increase the maximum number of retries, reset
the counter to zero after getting a valid character, and don't
call serial_hw_delay explicitly any longer.
* stage2/builtins.c [SUPPORT_SERIAL || SUPPORT_HERCULES]
(terminal_func): Set CURRENT_TERM to each of selected terminals
before calling grub_printf, and restore CURRENT_TERM after it.
Reported by Ilguiz Latypov.
Prepend a carriage return to the prompting message, because it
is ugly that the same messages fulfill the whole screen.
* stage2/disk_io.c [SUPPORT_NETBOOT] (GRUB): Defined.
[SUPPORT_NETBOOT]: Include etherboot.h.
[!STAGE1_5] (print_completions) [SUPPORT_NETBOOT]: When
completing a disk name, if NETWORK_READY is true, add "nd" as a
completion.
* netboot/main.c (ifconfig): If GW is specified, clear out the
ARP entry for the gateway. If SVR is specified, clear out the
ARP entry for the server. Reported by Uwe Dannowski
<ud3@ira.uka.de>.
* util/grub-md5-crypt.in: Prompt to retype a password, and check
if the passwords matches. Suggested by Matt Perry
<matt@primefactor.com>.
Also, don't use Perl any longer, because *BSD's sh and GNU
support ``read -r'', and GRUB doesn't support any other
operating system anyway.
* stage2/builtins.c (boot_func): Load the boot partition
information, only if the address of the boot partition entry is
set appropriately.
(real_root_func): If ATTEMPT_MOUNT is false, call open_partition
and if successful, call set_bootdev, to set the offset of the
boot partition and the address of the boot paetition entry.
IF ATTEMPT_MOUNT is false, don't set BOOTDEV. The BSD evil hack
is useless with the command "rootnoverify" anyway.
* stage2/disk_io.c (boot_part_addr): Initialized with zero
explicitly, to emphasize that it is invalid.