* term/i386/pc/at_keyboard.c (grub_keyboard_isr): #ifdef out
grub_dprintf calls, since they make "debug=all" mode unusable.
(grub_console_checkkey): Likewise.
* kern/i386/pc/init.c (make_install_device): When memdisk image is
present, "(memdisk)/boot/grub" becomes the default prefix.
* util/i386/pc/grub-mkrescue.in: Switch to a minimal core.img plus
a memdisk tarball with all the modules. Add --overlay=DIR option that
allows users to overlay additional files into the image.
* conf/i386-ieee1275.rmk (kernel_elf_SOURCES): Add `machine/loader.h'
and `machine/memory.h'.
(pkglib_MODULES): Add `multiboot.mod' and `_multiboot.mod'.
(_multiboot_mod_SOURCES): New variable.
(_multiboot_mod_CFLAGS): Likewise.
(_multiboot_mod_LDFLAGS): Likewise.
(multiboot_mod_SOURCES): Likewise.
(multiboot_mod_CFLAGS): Likewise.
(multiboot_mod_LDFLAGS): Likewise.
* include/grub/i386/ieee1275/loader.h: New file.
* include/grub/i386/ieee1275/machine.h: Likewise.
* include/grub/i386/ieee1275/memory.h: Likewise.
* include/grub/i386/pc/init.h (grub_os_area_addr): Remove (redundant)
variable declaration.
(grub_os_area_size): Likewise.
* kern/i386/ieee1275/init.c (grub_os_area_addr, grub_os_area_size)
(grub_lower_mem, grub_upper_mem): New variables.
(grub_stop_floppy): New function (just to make
grub_multiboot2_real_boot() happy).
* kern/i386/ieee1275/startup.S: Include `<grub/machine/memory.h>',
`<grub/cpu/linux.h>', `<multiboot.h>' and `<multiboot2.h>'.
(grub_stop): New function.
Include `"../realmode.S"' and `"../loader.S"'.
* loader/multiboot_loader.c: Include `<grub/machine/machine.h>'.
Replace `__i386__' #ifdefs with `GRUB_MACHINE_PCBIOS'.
* loader/powerpc/ieee1275/multiboot2.c (grub_mb2_arch_boot): On i386,
rely on grub_multiboot2_real_boot() for final boot.
* disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): When
`GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLY' flag is set, skip any
device that doesn't look like an SD card.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_flag): Add
`GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLY' flag.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_set_flag): Detect
OLPC laptop, and set `GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLY' when
found.
* conf/i386-pc.rmk (GRUB_MEMORY_MACHINE_LINK_ADDR): New variable.
(kernel_img_LDFLAGS): Use `GRUB_MEMORY_MACHINE_LINK_ADDR' as link
address.
(grub_mkimage_CFLAGS): Propagate `GRUB_MEMORY_MACHINE_LINK_ADDR' as
a C macro.
* include/grub/i386/pc/memory.h (GRUB_MEMORY_MACHINE_UPPER): New macro.
Indicates start of upper memory.
* util/i386/pc/grub-mkimage.c: Include `<grub/machine/memory.h>'.
(generate_image): Abort when image size is big enough to corrupt
upper memory.
* include/grub/i386/pc/vga.h: Include `<grub/machine/memory.h>'.
(GRUB_MEMORY_MACHINE_VGA_ADDR): Alias for `GRUB_MEMORY_MACHINE_UPPER'.
* term/i386/pc/vga.c (VGA_MEM): Use `GRUB_MEMORY_MACHINE_VGA_ADDR'
instead of hardcoding 0xA0000.
* video/i386/pc/vbe.c: Include `<grub/machine/vga.h>'.
(grub_vbe_set_video_mode): Use `GRUB_MEMORY_MACHINE_VGA_ADDR'
instead of hardcoding 0xA0000.
Fix detection of very small filesystems (like tar).
* fs/reiserfs.c (grub_reiserfs_mount): When disk is too small to
contain a ReiserFS, abort with GRUB_ERR_BAD_FS rather than
GRUB_ERR_OUT_OF_RANGE (which made the upper layer think there's
a problem with this disk).
* include/grub/i386/pc/kernel.h: Include `<grub/symbol.h>'.
* include/grub/kernel.h (grub_arch_memdisk_addr,
grub_arch_memdisk_size): Moved from here ...
* include/grub/i386/pc/kernel.h (grub_arch_memdisk_addr,
grub_arch_memdisk_size): ... to here.
Mostly based on bugfix from Bean.
* kern/elf.c (grub_elf32_phdr_iterate): Use `NESTED_FUNC_ATTR'
attribute with hook() parameter.
(grub_elf32_load): Use `NESTED_FUNC_ATTR' with grub_elf32_load_segment()
declaration.
(grub_elf64_phdr_iterate): Use `NESTED_FUNC_ATTR'
attribute with hook() parameter.
(grub_elf64_load): Use `NESTED_FUNC_ATTR' with grub_elf64_load_segment()
declaration.
* conf/i386-pc.rmk (kernel_img_HEADERS): Add `machine/kernel.h'.
(pkglib_MODULES): Add `memdisk.mod'.
(memdisk_mod_SOURCES): New variable.
(memdisk_mod_CFLAGS): Likewise.
(memdisk_mod_LDFLAGS): Likewise.
* disk/memdisk.c: New file.
* include/grub/disk.h (grub_disk_dev_id): Add
`GRUB_DISK_DEVICE_MEMDISK_ID'.
* include/grub/i386/pc/kernel.h
(GRUB_KERNEL_MACHINE_MEMDISK_IMAGE_SIZE): New macro.
(GRUB_KERNEL_MACHINE_PREFIX): Increment by 4.
(grub_kernel_image_size): New variable declaration.
(grub_total_module_size): Likewise.
(grub_memdisk_image_size): Likewise.
* include/grub/i386/pc/memory.h
(GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR): New macro.
* include/grub/kernel.h: Include `<grub/symbol.h>'.
(grub_arch_memdisk_addr): New variable declaration.
(grub_arch_memdisk_size): Likewise.
* kern/i386/pc/init.c (grub_arch_memdisk_addr): New function.
(grub_arch_memdisk_size): Likewise.
* kern/i386/pc/startup.S (grub_memdisk_image_size): New variable.
(codestart): Replace hardcoded `0x100000' with
`GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR' macro.
* util/i386/pc/grub-mkimage.c: Include `<grub/misc.h>'.
(generate_image): Add `memdisk_path' parameter. When `memdisk_path' is
not NULL, append the contents of the file it refers to, at the end of
the compressed kernel image. Initialize `grub_memdisk_image_size'
variable (at `GRUB_KERNEL_MACHINE_MEMDISK_IMAGE_SIZE' offset).
(options): Add "memdisk"|'m' option.
(main): Parse --memdisk|-m option, and pass user-provided path as
parameter to generate_image().
Fix detection of "real mode" when /options/real-mode? doesn't exist.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_mmu): New variable
declaration.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_mmu): New variable.
(grub_ieee1275_find_options): If `grub_ieee1275_mmu' is 0, set
`GRUB_IEEE1275_FLAG_REAL_MODE'.
(cmain): Intialize `grub_ieee1275_mmu' (using /chosen/mmu integer
property).
* kern/powerpc/ieee1275/openfw.c (grub_map): Rely on pre-initialized
`grub_ieee1275_mmu' rather than obtaining a handler on every call.
Get rid of confusing function (superceeded by
`grub_ieee1275_get_integer_property')
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_decode_int_4): Remove
prototype.
* kern/ieee1275/ieee1275.c (grub_ieee1275_decode_int_4): Remove
function.
* term/ieee1275/ofconsole.c (grub_ofconsole_init): Avoid use of
grub_ieee1275_decode_int_4(), by obtaining integer properties directly
in native endianess from grub_ieee1275_get_integer_property().
* kern/powerpc/ieee1275/openfw.c (grub_halt): Issue "power-off"
command after "shut-down", since implementations differ on which
the command for halt is.
PowerPC changes provided by Pavel Roskin.
* kern/powerpc/ieee1275/cmain.c (cmain): Don't take any arguments.
* kern/powerpc/ieee1275/crt0.S: Store r5 in grub_ieee1275_entry_fn,
don't rely on cmain() doing it.
* kern/i386/ieee1275/startup.S (_start): Store %eax in
grub_ieee1275_entry_fn, don't rely on cmain() doing it.
* include/grub/i386/linuxbios/memory.h
(GRUB_MEMORY_MACHINE_LINUXBIOS_TABLE_ADDR): Remove macro.
* kern/i386/linuxbios/table.c (grub_linuxbios_table_iterate): Do not
receive `table_header' as argument. Instead, probe for it in the
known memory ranges where it can be present.
(grub_available_iterate): Do not pass a fixed `table_header' address
to grub_linuxbios_table_iterate().
* include/grub/ieee1275/ieee1275.h
(grub_ieee1275_get_integer_property): New function prototype.
* kern/ieee1275/ieee1275.c: Include `<grub/types.h>'.
(grub_ieee1275_get_integer_property): New function. Wraps around
grub_ieee1275_get_property() to handle endianess.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_find_options): Replace
grub_ieee1275_get_property() with grub_ieee1275_get_integer_property()
where appropiate.
* kern/powerpc/ieee1275/openfw.c (grub_available_iterate): Likewise.
(grub_map): Likewise.
* kern/sparc64/ieee1275/openfw.c (grub_map): Likewise.
* normal/execute.c (grub_script_exec_argument_to_string): Check for undefined variable.
(grub_script_execute_cmdline): Reset grub_errno.
* normal/main.c (read_config_file): Reset grub_errno.
* normal/parse.y (script_init): New.
(script): Move function and menuentry here.
(delimiter): New.
(command): Add delimiter at the end of command.
(commands): Adjust to match the new command.
(commandblock): Remove grub_script_lexer_record_start.
(menuentry): Add grub_script_lexer_record_start, use the new commands.
(if): Use the new commands.
* conf/common.rmk (pkgdata_MODULES): Add echo.mod.
* normal/menu.c (run_menu): Move timeout message from here ...
(print_timeout): ... to here.
(run_menu): Use print_timeout() once during initial draw to print
the whole message, and again in every clock tick to update only
the number of seconds.
* kern/powerpc/ieee1275/openfw.c (grub_available_iterate): Obtain
actual size of `available' from grub_ieee1275_get_property(), and
restrict parsing to that bound.
* include/grub/util/getroot.h (grub_dev_abstraction_types): New enum.
(grub_util_get_dev_abstraction): New function prototype.
* util/getroot.c: Include `<grub/util/getroot.h>'
(grub_util_get_grub_dev): Move detection of abstraction type to ...
(grub_util_get_dev_abstraction): ... here (new function).
* util/grub-probe.c: Convert PRINT_* to an enum. Add
`PRINT_ABSTRACTION'.
(probe): Probe for abstraction type when requested.
(main): Understand `--target=abstraction'.
* util/i386/efi/grub-install.in: Add abstraction module to core
image when it is found to be necessary.
* util/i386/pc/grub-install.in: Likewise.
* util/powerpc/ieee1275/grub-install.in: Likewise.
* util/update-grub_lib.in (font_path): Return system path without
converting to GRUB path.
* util/update-grub.in: Convert system path returned by font_path()
to a GRUB path. Use `grub-probe -t abstraction' to determine what
abstraction module is needed for loading fonts (if any). Export
that as `GRUB_PRELOAD_MODULES'.
* util/grub.d/00_header.in: Process `GRUB_PRELOAD_MODULES' (print
insmod commands).
* util/update-grub_lib.in (grub_file_is_not_garbage): New function.
Determines if a file is garbage left by packaging systems, etc.
* util/update-grub.in: Use grub_file_is_not_garbage() as a condition
for processing /etc/grub.d scripts.
* util/grub.d/10_hurd.in: Fix `GRUB_DISTRIBUTOR' comparison.
* util/grub.d/10_linux.in: Likewise. Use grub_file_is_not_garbage()
as a condition for processing Linux images.
* kern/device.c (grub_device_iterate): Do not abort device iteration
when one of the devices cannot be opened.
* kern/disk.c (grub_disk_open): Do not account previous failures of
unrelated functions when grub_errno is checked for.
* loader/i386/pc/linux.c (grub_rescue_cmd_linux): For
`! grub_linux_is_bzimage', change order of address comparison to make
it more intuitive, and improve "too big zImage" error message.
* boot/i386/pc/boot.S (boot_drive_check): Add a comment indicating
which instruction is modified by grub-setup during installation
(since it wasn't obvious by only looking at this file).
* fs/reiserfs.c (grub_reiserfs_get_key_v2_type): Handle endianness
correctly.
(grub_reiserfs_get_key_offset): Likewise.
(grub_reiserfs_set_key_offset): Likewise.
(grub_reiserfs_set_key_type): Likewise.
(grub_reiserfs_iterate_dir): Return 1 if found, otheriwise 0.
(GRUB_REISERFS_KEYV2_BITFIELD): Undefined. Probably it would be
better to remove the bitfield version completely.
* fs/reiserfs.c (grub_reiserfs_iterate_dir): ENTRY_ITEM must be
allocated from the heap, due to the fshelp implementation.
(grub_reiserfs_dir): Free NODE, due to the same reason.
* include/grub/normal.h (grub_env_write_color_normal): New prototype.
(grub_env_write_color_highlight): Likewise.
(grub_wait_after_message): Likewise.
* normal/color.c: New file.
* conf/i386-pc.rmk (grub_emu_SOURCES): Add `normal/color.c'.
(normal_mod_DEPENDENCIES): Likewise.
* conf/i386-efi.rmk (grub_emu_SOURCES): Add `normal/color.c'.
(normal_mod_DEPENDENCIES): Likewise.
* conf/i386-linuxbios.rmk (grub_emu_SOURCES): Add `normal/color.c'.
(normal_mod_DEPENDENCIES): Likewise.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Add `normal/color.c'.
(normal_mod_DEPENDENCIES): Likewise.
* normal/menu_entry.c (run): Rely on grub_wait_after_message()
for waiting after a message is printed.
* normal/main.c (read_config_file): Likewise.
(grub_normal_init): Register grub_env_write_color_normal() and
grub_env_write_color_highlight() hooks. Mark `color_normal' and
`color_highlight' variables as global.
* normal/menu.c (grub_wait_after_message): New function.
(grub_color_menu_normal): New variable. Replaces ...
(GRUB_COLOR_MENU_NORMAL): ... this macro.
(grub_color_menu_highlight): New variable. Replaces ...
(GRUB_COLOR_MENU_HIGHLIGHT): ... this macro.
(draw_border): Set color state to `GRUB_TERM_COLOR_NORMAL' instead of
`GRUB_TERM_COLOR_STANDARD'.
(print_message): Use `grub_setcolorstate' to reload colors. Rename
`normal_code' and `highlight_code' to `old_color_normal' and
`old_color_highlight', respectively.
(grub_menu_init_page): Update colors when drawing the menu, based on
`menu_color_normal' and `menu_color_highlight' variables.
(grub_menu_run): Rely on grub_wait_after_message() for waiting after
a message is printed.
* kern/i386/linuxbios/init.c: Put "void" to all function
declarations with no arguments.
* kern/powerpc/ieee1275/init.c: Likewise.
* term/i386/pc/at_keyboard.c: Likewise.
* term/i386/pc/vga_text.c: Likewise.
* util/grub-mkdevicemap.c: Likewise.
* loader/i386/pc/multiboot.c (grub_multiboot_load_elf32): Improve error
message when loaded image is out of bounds.
(grub_multiboot_load_elf64): Likewise.
* include/grub/video.h: Added grub_video_unmap_color and
grub_video_get_active_render_target.
(grub_video_adapter): Added unmap_color and get_active_render_target.
* video/video.c: Added grub_video_unmap_color and
grub_video_get_active_render_target.
(grub_video_get_info): Changed method to accept NULL pointer as an
argument to allow detection of active video adapter.
* video/i386/pc/vbe.c: Renamed grub_video_vbe_unmap_color as
grub_video_vbe_unmap_color_int.
Added grub_video_vbe_unmap_color and
grub_video_vbe_get_active_render_target.
(grub_video_vbe_adapter): Added unmap_color and
get_active_render_target.
* video/i386/pc/vbeblit.c: Replaced grub_video_vbe_unmap_color usage
with grub_video_vbe_unmap_color_int.
* term/gfxterm.c (DEFAULT_STANDARD_COLOR): Added.
(DEFAULT_NORMAL_COLOR): Likewise.
(DEFAULT_HIGHLIGHT_COLOR) Likewise.
(DEFAULT_FG_COLOR): Removed.
(DEFAULT_BG_COLOR): Likewise.
(DEFAULT_CURSOR_COLOR): Changed value.
(grub_virtual_screen): Added standard_color_setting,
normal_color_setting, highlight_color_setting and term_color.
(grub_virtual_screen): Removed fg_color_setting and bg_color_setting.
(bitmap_width): Added.
(bitmap_height): Likewise.
(bitmap): Likewise.
(set_term_color): Likewise.
(grub_virtual_screen_setup): Changed to use new terminal coloring
settings.
(grub_gfxterm_init): Added init for bitmap.
(grub_gfxterm_fini): Added destroy for bitmap.
(redraw_screen_rect): Updated to use background bitmap and new
terminal coloring.
(scroll_up): Added optimization for case when there is no bitmap.
(grub_gfxterm_cls): Fixed to use correct background color.
(grub_virtual_screen_setcolorstate): Changed to use new terminal
coloring.
(grub_virtual_screen_setcolor): Likewise.
(grub_virtual_screen_getcolor): Added.
(grub_gfxterm_background_image_cmd): Likewise.
(grub_video_term): Added setcolor and getcolor.
(MOD_INIT): Added registration of background_image command.
(MOD_TERM): Added unregistration for background_image command.
* include/grub/term.h (struct grub_term): Add `getcolor' function.
(grub_getcolor): New function.
* kern/term.c (grub_getcolor): New function.
* normal/menu.c (GRUB_COLOR_MENU_NORMAL): New macro.
(GRUB_COLOR_MENU_HIGHLIGHT): New macro.
(print_entry): Set normal and highlight colors to
`GRUB_COLOR_MENU_NORMAL' and `GRUB_COLOR_MENU_HIGHLIGHT',
respectively, before printing and restore them to old
values afterwards.
(grub_menu_init_page): Likewise. Fill an additional colored space
that would otherwise be left blank.
* term/efi/console.c (grub_console_getcolor): New function.
(struct grub_console_term.getcolor): New variable.
* term/i386/pc/console.c (grub_console_getcolor): New function.
(struct grub_console_term.getcolor): New variable.
* term/ieee1275/ofconsole.c (grub_ofconsole_getcolor): New function.
(struct grub_console_term.getcolor): New variable.
* term/i386/pc/serial.c (grub_serial_setcolor): Remove function.
(struct grub_console_term.setcolor): Remove variable.
* term/i386/pc/vesafb.c (grub_virtual_screen_setcolor): Remove function.
(struct grub_console_term.setcolor): Remove variable.
* term/i386/pc/vga.c (grub_vga_setcolor): Remove function.
(struct grub_console_term.setcolor): Remove variable.
* term/gfxterm.c (grub_virtual_screen_setcolor): Remove function.
(struct grub_console_term.setcolor): Remove variable.
* configure.ac: Search for possible unifont.hex locations, and
define UNIFONT_HEX if found.
* Makefile.in (UNIFONT_HEX): Define variable.
(DATA): Rename to ...
(PKGLIB): ... this. Update all users.
(PKGDATA): New variable.
(pkgdata_IMAGES): Rename to ...
(pkglib_IMAGES): ... this. Update all users.
(pkgdata_MODULES): Rename to ...
(pkglib_MODULES): ... this. Update all users.
(pkgdata_PROGRAMS): Rename to ...
(pkglib_PROGRAMS): ... this. Update all users.
(pkgdata_DATA): Rename to ...
(pkglib_DATA): ... this. Update all users.
(CLEANFILES): Redefine to `$(pkglib_DATA) $(pkgdata_DATA)'.
(unicode.pff, ascii.pff): New rules.
(all-local): Add `$(PKGDATA)' dependency.
(install-local): Process `$(PKGDATA)'.
* util/update-grub_lib.in (font_path): Search for *.pff files in
a few more locations, including `${pkgdata}'.
* util/grub-mkdevicemap.c (make_device_map): Iterate up to 20 for
IDE disk check, since Linux is known to support 20 IDE disks.
Reported by Colin Watson.
linker. If yes, add it to TARGET_LDFLAGS. Build ID causes
objcopy to generate incorrect binary files (binutils
2.17.50.0.18-1 as shipped by Fedora 8).
* aclocal.m4 (grub_PROG_OBJCOPY_ABSOLUTE): Use LDFLAGS when
linking, so that build ID doesn't break the test.
* util/console.c (grub_ncurses_getkey): Change curses KEY_* mapping,
now return control chars instead of GRUB_CONSOLE_KEY_* constants.
This fixes the problem that function keys did not work in grub-emu.
* disk/host.c (grub_host_open): Remove attribute unused from
name parameter. Add check for "host". This fixes the problem
that grub-emu does not find partitions.
* include/grub/i386/efi/machine.h: New file.
* include/grub/i386/linuxbios/machine.h: Likewise.
* include/grub/i386/pc/machine.h: Likewise.
* include/grub/powerpc/ieee1275/machine.h: Likewise.
* include/grub/sparc64/ieee1275/machine.h: Likewise.
* term/i386/pc/serial.c: Include <grub/machine/machine.h>.
(serial_hw_io_addr): New variable.
(serial_hw_get_port): Obtain port address from `serial_hw_io_addr'
instead of `(unsigned short *) 0x400'.
* kern/disk.c (grub_disk_firmware_fini)
(grub_disk_firmware_is_tainted): New variables.
* include/grub/disk.h (grub_disk_firmware_fini)
(grub_disk_firmware_is_tainted): Likewise.
* disk/i386/pc/biosdisk.c (GRUB_MOD_FINI(biosdisk)): Moved from here ...
(grub_disk_biosdisk_fini): ... to here.
(GRUB_MOD_FINI(biosdisk)): Implement using grub_disk_biosdisk_fini().
(GRUB_MOD_INIT(biosdisk)): Abort when `grub_disk_firmware_is_tainted'
is set. Register grub_disk_biosdisk_fini() in
`grub_disk_firmware_fini'.
* disk/ata.c: Remove `<grub/machine/biosdisk.h>'.
(GRUB_MOD_INIT(ata)): Remove grub_biosdisk_fini() call.
Use `grub_disk_firmware_is_tainted' and `grub_disk_firmware_fini'
to finish existing firmware disk interface.
* conf/i386-linuxbios.rmk (pkgdata_MODULES): Add `ata.mod'.
(ata_mod_SOURCES): New variable.
(ata_mod_CFLAGS): Likewise.
(ata_mod_LDFLAGS): Likewise.
* term/i386/pc/vga_text.c: Include <grub/cpu/io.h>.
(CRTC_ADDR_PORT): New macro.
(CRTC_DATA_PORT): Likewise.
(CRTC_CURSOR): Likewise.
(CRTC_CURSOR_ADDR_HIGH): Likewise.
(CRTC_CURSOR_ADDR_LOW): Likewise.
(update_cursor): New function.
(grub_console_real_putchar): Call `update_cursor'.
(grub_console_gotoxy): Likewise.
(grub_console_cls): Set the default color when clearing the
screen.
(grub_console_setcursor): Implemented.
* disk/ata.c (grub_ata_pio_read): Don't wait for the command to
become activate.
(grub_ata_pio_write): Likewise.
(grub_atapi_identify): Wait after issuing an ATA command.
(grub_atapi_packet): Likewise.
(grub_ata_identify): Likewise.
(grub_ata_readwrite): Likewise.
* disk/ata.c (grub_ata_pio_read): Detect and return the error code.
(grub_ata_pio_write): Likewise.
(grub_ata_readwrite): Use `grub_error', instead of
returning `grub_errno'.
* include/grub/i386/pc/init.h (grub_lower_mem): Moved from here ...
* include/grub/i386/pc/memory.h (grub_lower_mem): ... to here.
* include/grub/i386/pc/init.h (grub_upper_mem): Moved from here ...
* include/grub/i386/pc/memory.h (grub_upper_mem): ... to here.
* include/grub/i386/pc/memory.h: Include `<grub/symbol.h>' and
`<grub/types.h>'.
* loader/i386/pc/multiboot.c: Include `<grub/machine/memory.h>'.
* genmk.rb (Image): Copy `extra_flags' from here ...
(PModule): ... to here. Use it in `#{obj}: #{src}' rule.
* commands/i386/cpuid.c (grub_cmd_cpuid): Add __attribute__ ((unused))
to `argc' and `args' arguments.
* kern/i386/loader.S: New file.
* kern/i386/pc/startup.S (grub_linux_prot_size): Moved from here ...
* kern/i386/loader.S (grub_linux_prot_size)... to here.
* kern/i386/pc/startup.S (grub_linux_tmp_addr): Moved from here ...
* kern/i386/loader.S (grub_linux_tmp_addr)... to here.
* kern/i386/pc/startup.S (grub_linux_real_addr): Moved from here ...
* kern/i386/loader.S (grub_linux_real_addr)... to here.
* kern/i386/pc/startup.S (grub_linux_boot_zimage): Moved from here ...
* kern/i386/loader.S (grub_linux_boot_zimage)... to here.
* kern/i386/pc/startup.S (grub_linux_boot_bzimage): Moved from here ...
* kern/i386/loader.S (grub_linux_boot_bzimage)... to here.
* kern/i386/pc/startup.S (grub_multiboot_real_boot): Moved from here ...
* kern/i386/loader.S (grub_multiboot_real_boot)... to here.
* kern/i386/pc/startup.S (grub_multiboot2_real_boot): Moved from here ...
* kern/i386/loader.S (grub_multiboot2_real_boot)... to here.
* kern/i386/realmode.S: New file.
* kern/i386/pc/startup.S (protstack): Moved from here ...
* kern/i386/realmode.S (protstack)... to here.
* kern/i386/pc/startup.S (gdt): Moved from here ...
* kern/i386/realmode.S (gdt)... to here.
* kern/i386/pc/startup.S (prot_to_real): Moved from here ...
* kern/i386/realmode.S (prot_to_real)... to here.
* kern/i386/pc/startup.S: Include `kern/i386/loader.S' and
`kern/i386/realmode.S'.
* normal/misc.c (grub_normal_print_device_info): Do not probe for
filesystem when dev->disk is unset.
Do probe for filesystem even when dev->disk->has_partitions is set.
In case a filesystem is found, always report it.
In case it isn't, if dev->disk->has_partitions is set, report that
a partition table was found instead of reporting that no filesystem
could be identified.
* kern/powerpc/ieee1275/init.c: Rename HEAP_LIMIT to HEAP_MAX_ADDR,
and make it easier to figure out.
Add HEAP_MIN_SIZE and HEAP_MAX_ADDR definitions.
(grub_claim_heap): Use HEAP_MAX_ADDR rather than taking a parameter.
Do not avoid claiming a region above HEAP_MAX_ADDR if that would
leave us with less than HEAP_MIN_SIZE total heap.
Avoid our total amount of heap to surpass HEAP_MAX_SIZE.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_test_flag): Detect
SmartFirmware version updates (as released by Sven Luther), and avoid
setting GRUB_IEEE1275_FLAG_NO_PARTITION_0 or
GRUB_IEEE1275_FLAG_0_BASED_PARTITIONS unless the running version is
known broken.
Do not use devices at boot in chainloading.
* loader/i386/pc/chainloader.c (boot_drive): New variable.
(boot_part_addr): Likewise.
(grub_chainloader_boot): Simply call grub_chainloader_real_boot
with BOOT_DRIVE and BOOT_PART_ADDR.
(grub_chainloader_cmd): Set BOOT_DRIVE and BOOT_PART_ADDR.
Reported by Hitoshi Ozeki <h-ozeki@ck2.so-net.ne.jp>.
Patch from Simon Peter <dn.tlp@gmx.net>:
* genmk.rb (Utility): Append $(#{src}_DEPENDENCIES) to #{obj} targets.
* conf/i386-pc.rmk: Replace grub-probe_DEPENDENCIES with
util/grub-probe.c_DEPENDENCIES. Replace grub-setup_DEPENDENCIES with
util/i386/pc/grub-setup.c_DEPENDENCIES.
* conf/i386-efi.rmk: Replace grub-probe_DEPENDENCIES with
util/grub-probe.c_DEPENDENCIES.
* conf/powerpc-ieee1275.rmk: Likewise.
for powerpc & i386-pc. This patch was more so started by Hollis
Blanchard getting multiboot 2 working for powerpc and I added to it
and cleaned it up.
One of the ideas with this patch is to keep everything under one
command for the user. So instead of having a "multiboot2" & "module2"
command, I created a proxy like mechanism so that you have only one
command for both multiboot 1 & 2 ... "multiboot". This is where
"loader/multiboot_loader.c" comes from. I could have integrated things
more but I figure the current approach will less likely break
anything.
So if your OS is multiboot 2 capable, the user would do the following
to load it up from a grub prompt:
grub> multiboot <location of kernel> <kernel args>
grub> module <some image> <multiboot tag> <image arguments>
grub> module <isome mage> <multiboot tag> <image arguments>
grub .....
The other thing that this patch does is it begins to make the
multiboot 1 code a bit more architecture agnostic so IF someone wanted
to implement it on another architecture they can.
A bit of file moving around and definition renaming is also apart of
this patch. I have also taken the time to make sure that it does not
break multiboot 1 loading on i386-pc. But mulitboot 2 may still need a
little more testing and work for i386-pc. Powerpc multiboot 2 has been
heavily tested and does work.
* geninitheader.sh: Process file specified in first parameter rather
than hardcoding grub_modules_init.lst.
* geninit.sh: Likewise. Also, construct header name dynamicaly rather
than hardcoding grub_modules_init.h.
* conf/common.rmk: Rename grub_modules_init.[ch] files associated with
grub-emu to grub_emu_init.[ch]. Add rules to build analogous
grub_probe_init.[ch] and grub_setup_init.[ch].
* conf/powerpc-ieee1275.rmk (grub_emu_DEPENDENCIES): Replace
grub_modules_init.h with grub_emu_init.h.
(grub_probe_DEPENDENCIES, grub_probe_SOURCES): Add new
grub_probe_init.[ch] files.
* conf/i386-efi.rmk: Likewise.
* conf/i386-pc.rmk: Likewise.
(grub_setup_DEPENDENCIES, grub_setup_SOURCES): Add new
grub_setup_init.[ch] files.
* util/grub-emu.c: Replace grub_modules_init.h with grub_emu_init.h.
* util/grub-probe.c: Include grub_probe_init.h. Use grub_init_all()
to initialize modules rather than a list of hardcoded functions.
* util/i386/pc/grub-setup.c: Include grub_setup_init.h. Use
grub_init_all() to initialize modules rather than a list of hardcoded
functions.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_flag): Add
GRUB_IEEE1275_FLAG_BROKEN_OUTPUT flag.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_find_options): Set this
flag when running on SmartFirmware.
* term/ieee1275/ofconsole.c (grub_ofconsole_init): Avoid running
"output-device output" command when GRUB_IEEE1275_FLAG_BROKEN_OUTPUT
was set.
* kern/powerpc/ieee1275/openfw.c (grub_ieee1275_encode_devname):
Increase partno when GRUB_IEEE1275_FLAG_0_BASED_PARTITIONS flag is set,
rather than decreasing it.
* util/i386/pc/grub-setup.c (setup): When embedding is required, but
there's not enough space to do it, fail in the same way as when it
can't be done because there are no partitions.
* util/powerpc/ieee1275/grub-install.in: Improve error message shown
when nvsetenv failed.
* conf/i386-pc.rmk (CLEANFILES): Removed for grub-mkrescue,
because this rule is automatically generated.
(grub-mkrescue): Removed for the same reason as above.
* util/i386/efi/grub-install.in: Allow `grub_probe --target=partmap'
invocation to fail, in order to support partition-less media.
* util/i386/pc/grub-install.in: Likewise.
* util/powerpc/ieee1275/grub-install.in: Use grub-probe to determine
which fs or partmap modules are needed (akin to its sister scripts).
Also use grub-probe to get rid of unportable /proc/mounts check.
Print the same informational message that the other scripts do, before
exitting.
* util/update-grub_lib.in (font_path): New function. Determine wether
a font file can be found and, if so, echo the GRUB path to it.
* util/update-grub.in: Handle multiple terminals depending on user
input, platform availability and font file presence. Propagate
variables of our findings to /etc/grub.d/ children.
* util/grub.d/00_header.in: Handle multiple terminals, based on
environment setup by update-grub.
* include/grub/i386/pc/kernel.h: Define GRUB_KERNEL_MACHINE_DATA_END to
indicate end of data section in kernel image.
* include/grub/i386/efi/kernel.h: Define GRUB_KERNEL_MACHINE_PREFIX and
GRUB_KERNEL_MACHINE_DATA_END.
* kern/i386/pc/startup.S: Do not initialize grub_prefix, only reserve
space for it.
* kern/i386/efi/startup.S: Likewise.
* util/i386/pc/grub-mkimage.c: Initialize grub_prefix to /boot/grub
during image generation. Implement --prefix option to override this
patch.
* util/i386/efi/grub-mkimage.c: Likewise.
* util/update-grub_lib.in (convert_system_path_to_grub_path): Split
code to make path relative to its root into a separate function.
* util/i386/pc/grub-install.in: Use newly provided
make_system_path_relative_to_its_root() to convert ${grubdir}, then
pass the result to grub-install --prefix.
* include/grub/util/misc.h: Define DEFAULT_DIRECTORY and
DEFAULT_DEVICE_MAP.
* util/grub-emu.c: Use above definitions from misc.h instead of
defining them.
* util/grub-mkdevicemap.c: Likewise.
* util/i386/pc/grub-setup.c: Likewise.
* util/grub-probe.c: Likewise.
(probe): Abort with grub_util_error() when either
grub_guess_root_device or grub_util_get_grub_dev fails.
* normal/command.c (grub_command_execute): Use NULL rather than 0 for
"pager" assignment.
* util/biosdisk.c (grub_util_biosdisk_get_grub_dev): Likewise for
"pcdata".
* util/grub-probe.c (probe): Likewise for "drive_name".
* util/i386/pc/grub-mkrescue.in: Add "set -e".
Add --pkglibdir=DIR option to override pkglibdir.
Mention --image-type=TYPE in help output.
Fix --grub-mkimage (it was a no-op).
Abort gracefuly when no parameter is given.
* util/update-grub_lib.in (convert_system_path_to_grub_path): Abort if
file doesn't exist, or if it is in a filesystem grub can't read.
* util/update-grub.in: Set fallback for GRUB_FS check to "unknown". Do
not abort if GRUB_DRIVE could not be defined. Rearrange generated
header comment to fit in 80 columns when the variables are resolved.
* util/grub.d/00_header.in: Only set root variable when GRUB_DRIVE
could be identified by update-grub. Remove redundant check for
unifont.pff existance (since convert_system_path_to_grub_path now
handles that).
* conf/powerpc-ieee1275.rmk: Enable grub-mkdevicemap and grub-probe.
* include/grub/partition.h: Declare grub_apple_partition_map_init and
grub_apple_partition_map_fini.
* util/biosdisk.c
(grub_util_biosdisk_open): Replace BLKGETSIZE with BLKGETSIZE64 (needed
to access >2 TiB disks).
Print disk->total_sectors with %llu instead of %lu, since this
variable is always 64-bit (prevents wrong disk size from being displayed
on either >2 TiB disk or big-endian CPU).
(grub_util_biosdisk_get_grub_dev): Convert gpt_partition_map handling
into a generic case that supports all (sane) partition maps.
Stop using grub_cpu_to_le32() on dos_part / bsd_part since it actually
breaks big-endian.
* util/grub-probe.c: Call grub_apple_partition_map_init() before probe()
and grub_apple_partition_map_fini() after that.
* util/update-grub_lib.in: New file.
* DISTLIST: Add update-grub_lib.in.
* conf/common.rmk: Generate update-grub_lib and install it in
$(lib_DATA).
* Makefile.in: Add install routine for $(lib_DATA).
* util/grub.d/00_header.in: Use convert_system_path_to_grub_path()
function provided by update-grub_lib to support arbitrary paths of
unifont.pff.
* util/update-grub.in: Use convert_system_path_to_grub_path() to
initialize GRUB_DRIVE_BOOT and GRUB_DRIVE_BOOT_GRUB variables.
* util/biosdisk.c (linux_find_partition): Allocate real_dev on the
stack instead of on the heap.
* kern/disk.c (grub_disk_read): Make sure tmp_buf is big enough
before doing a read on it.
* configure.ac: Only use -fno-stack-protector for the target
environment.
* util/getroot.c (grub_guess_root_device): Remove RAID and LVM
code, first search for device in /dev/mapper, then in /dev.
(grub_util_get_grub_dev): New function.
* include/grub/util/getroot.h (grub_util_get_grub_dev): Add
prototype.
* util/grub-probe.c (probe): Remove check for RAID, call
grub_util_get_grub_dev() instead of
grub_util_biosdisk_get_grub_dev().
* util/grub-emu.c (main): Call grub_util_get_grub_dev() instead of
grub_util_biosdisk_get_grub_dev().
* util/i386/pc/grub-setup.c (main): Likewise.
* DISTLIST: Update for the latest changes.
* conf/i386-pc.rmk: Use the new paths for util/getroot.c,
util/grub-mkdevicemap.c, util/grub-probe.c and util/biosdisk.c.
* util/grub-emu.c: Replace grub/i386/pc/util/biosdisk.h with
grub/util/biosdisk.h.
* util/i386/pc/grub-setup.c: Replace grub/machine/util/biosdisk.h with
grub/util/biosdisk.h.
* include/grub/i386/pc/util/biosdisk.h: Moved to ...
* include/grub/util/biosdisk.h: ... here.
* util/i386/pc/biosdisk.c: Moved to ...
* util/biosdisk.c: ... here.
* util/i386/pc/getroot.c: Moved to ...
* util/getroot.c: ... here.
* util/i386/pc/grub-mkdevicemap.c: Moved to ...
* util/grub-mkdevicemap.c: ... here.
* util/i386/pc/grub-probe.c: Moved to ...
* util/grub-probe.c: ... here.
* util/update-grub.in: Fix a few assumptions about the devices holding
/, /boot and /boot/grub being the same.
* util/grub.d/00_header.in: Likewise.
* util/grub.d/10_hurd.in: Likewise.
* util/grub.d/10_linux.in: Likewise.
* util/grub.d/10_linux.in: Implement Linux image sorting with arbitrary
patterns. Use that to define the `.old' suffix as older than `'.
* util/grub.d/00_header.in: Set default gfxmode to `800x600x16'.
* util/update-grub.in: Add a reference to ${sysconfdir}/default/grub in
the grub.cfg header message.
* util/update-grub.in: Create device.map if it doesn't already exist,
before attempting to run grub-probe.
Check for grub-probe and grub-mkdevicemap with the same code
grub-install is using.
Remove test mode.
* util/i386/pc/grub-probe.c: Add `grub-probe -t partmap' parameter to
determine partition map module.
* util/i386/pc/grub-install.in: Use this feature to decide which
partition module to load, instead of hardcoding pc and gpt.
* conf/i386-pc.rmk (grub_setup_SOURCES): Add partmap/gpt.c.
(grub_probe_SOURCES): Likewise.
* util/i386/pc/biosdisk.c (grub_util_biosdisk_get_grub_dev): Detect
GPT and initialize dos_part and bsd_part accordingly.
* util/i386/pc/grub-setup.c (setup): Ditto for install_dos_part and
install_bsd_part.
(main): Activate gpt module for use during partition identification,
and deactivate it afterwards.
* util/i386/pc/grub-install.in: Add gpt module to core.img.
* util/i386/pc/grub-probe.c (main): Activate gpt module for use during
partition identification, and deactivate it afterwards.
* util/grub-emu.c: Move initialization functions
grub_util_biosdisk_init() and grub_init_all() before
grub_util_biosdisk_get_grub_dev(), which relies on them.
./configure --program-transform-name="s/grub/grub2/"
And the installed files (in this case for i386-pc) will be:
/usr/lib/grub2/i386-pc/*
/usr/local/sbin/grub2-emu
/usr/local/sbin/grub2-install
...etc
Also grub2-install place boot files in "/boot/grub2"
This allows easy integration into distributions as it allows grub2 to
sit side by side with a grub legacy install without.
* fs/ext2.c (EXT2_GOOD_OLD_REVISION): New macro.
(EXT2_GOOD_OLD_INODE_SIZE): Likewise.
(EXT2_REVISION): Likewise.
(EXT2_INODE_SIZE): Likewise.
(struct grub_ext2_block_group): Added a missing member
"used_dirs".
(grub_ext2_read_inode): Divide by the inode size in a superblock
instead of 128 to obtain INODES_PER_BLOCK.
Use the macro EXT2_INODE_SIZE instead of directly using
SBLOCK->INODE_SIZE.
* fs/ext2.c (grub_ext2_read_inode): Use the inode size in a
superblock instead of the structure size to compute an
offset. This fixes the problem that GRUB could not read a
filesystem when inode size is different from 128-byte.
* conf/powerpc-ieee1275.rmk (kernel_elf_LDFLAGS): Link at 64KB.
* kern/powerpc/ieee1275/init.c (_end): Add declaration.
(_start): Likewise.
(grub_arch_modules_addr): Return address after `_end'.
* util/powerpc/ieee1275/grub-mkimage.c: Include grub/misc.h.
(load_modules): Use new parameter as `p_paddr' and `p_vaddr'.
(add_segments): Calculate `_end' from phdr size and location.
(ALIGN_UP): Moved to ...
* include/grub/misc.h: here.
* include/grub/powerpc/ieee1275/kernel.h (GRUB_IEEE1275_MOD_ALIGN):
New macro.
(GRUB_IEEE1275_MODULE_BASE): Removed.
* Makefile.in (enable_grub_emu): New variable.
* configure.ac (--enable-grub-emu): New option.
Do the checks for (n)curses only if `--enable-grub-emu' is requested.
* conf/i386-efi.rmk (sbin_UTILITIES): Add `grub-emu' only if requested.
* conf/i386-pc.rmk: Likewise.
* conf/powerpc-ieee1275.rmk: Likewise.
* conf/sparc64-ieee1275.rmk (bin_UTILITIES): Likewise.
* include/grub/err.h (grub_err_t): Add `GRUB_ERR_MENU'.
* kern/env.c (grub_env_unset): Don't free the member `value' when
the type is GRUB_ENV_VAR_DATA, in this case it's a user defined
pointer.
* normal/main.c (current_menu): Removed.
(free_menu): Unset the `menu' environment variable.
(grub_normal_menu_addentry): Make use of the environment variable
`menu', instead of using the global `current_menu'. Allocate
memory for the sourcecode of this entry.
(read_config_file): New argument `nested', changed all callers.
Only in the case of a new context, initialize a new menu. Set the
`menu' environment variable.
(grub_normal_execute): Don't set and unset the environment
variable `menu' here anymore. Only free the menu when leaving the
context.
* util/i386/pc/biosdisk.c (linux_find_partition): Fixed a memory
leak.
* kern/disk.c (grub_disk_read): When there is a read error, always
try to read only the necessary data.
* conf/i386-pc.rmk (grub_probe_SOURCES): Add disk/lvm.c and
disk/raid.c.
* include/grub/disk.h [GRUB_UTIL] (grub_raid_init): New
prototype.
[GRUB_UTIL] (grub_raid_fini): Likewise.
[GRUB_UTIL] (grub_lvm_init): Likewise.
[GRUB_UTIL] (grub_lvm_fini): Likewise.
* util/i386/pc/grub-probe.c (probe): Check whether DEVICE_NAME is
RAID device and copy DEVICE_NAME to DRIVE_NAME in that case.
(main): Call grub_raid_init(), grub_lvm_init(), grub_lvm_fini()
and grub_raid_fini().
* kern/elf.c (grub_elf_file): Call grub_file_seek. Call
grub_error_push and grub_error_pop in the error-handling path.
(grub_elf32_load_segment): Only call grub_file_read with non-zero
length.
2006-10-18 Jeroen Dekkers <jeroen@dekkers.cx>
* disk/lvm.c: Rename VGS to VG_LIST.
(grub_lvm_iterate): Change VGS->LV to VG-LV.
(grub_lvm_open): Likewise.
Thanks to Michael Guntsche for finding this bug.
* util/i386/pc/grub-probe.c (probe): Print DEVICE_NAME instead of
DRIVE_NAME when grub_util_biosdisk_get_grub_dev fails. Open
DRIVE_NAME instead of DEVICE_NAME. Make sure that DEVICE_NAME and
DRIVE_NAME are always freed.
* util/i386/pc/biosdisk.c (make_device_name): Add one into
DOS_PART, as a DOS partition is counted from one instead of zero
now. Reported by Robert Millan.
* util/i386/pc/getroot.c (grub_guess_root_device): Stop using
grub_util_biosdisk_get_grub_dev to convert system device to GRUB device.
* util/grub-emu.c (main): Use grub_util_biosdisk_get_grub_dev with the
string returned by grub_guess_root_device.
* util/i386/pc/grub-setup.c: Likewise.
* util/i386/pc/grub-probefs.c: Likewise.
* util/i386/pc/grub-probefs.c: Rename to ...
* util/i386/pc/grub-probe.c: ... this.
* DISTLIST: Remove grub-probefs, add grub-probe.
* conf/i386-efi.rmk: Likewise.
* conf/i386-pc.rmk: Likewise.
* util/i386/pc/grub-install.in: Likewise.
* util/i386/pc/grub-probe.c: Add --target=(fs|device|drive) option to
choose which information we want to print.
* DISTLIST: Added commands/echo.c, disk/lvm.c, disk/raid.c,
include/grub/bitmap.h, include/grub/lvm.h, include/grub/raid.h,
include/grub/i386/pc/vbeutil.h, include/grub/util/lvm.h,
include/grub/util/raid.h, util/lvm.c, util/raid.c, video/bitmap.c,
video/readers/tga.c and video/i386/pc/vbeutil.c.
2006-10-14 Jeroen Dekkers <jeroen@dekkers.cx>
Added support for RAID and LVM.
* disk/lvm.c: New file.
* disk/raid.c: Likewise.
* include/grub/lvm.h: Likewise.
* include/grub/raid.h: Likewise.
* include/grub/util/lvm.h: Likewise.
* include/grub/util/raid.h: Likewise.
* util/lvm.c: Likewise.
* util/raid.c: Likewise.
* include/grub/disk.h (grub_disk_dev_id): Add
GRUB_DISK_DEVICE_RAID_ID and GRUB_DISK_DEVICE_LVM_ID.
(grub_disk_get_size): New prototype.
* kern/disk.c (grub_disk_open): Check whether grub_partition_probe()
returns a partition.
(grub_disk_get_size): New function.
* kern/i386/pc/init.c (make_install_device): Copy the prefix
verbatim if grub_install_dos_part is -2.
* util/i386/pc/getroot.c (grub_guess_root_device): Support RAID
and LVM devices.
* util/i386/pc/grub-setup.c (setup): New argument
MUST_EMBED. Force embedding of GRUB when the argument is
true. Close FILE before returning.
(main): Add support for RAID and LVM.
* conf/common.rmk: Add RAID and LVM modules.
* conf/i386-pc.rmk (grub_setup_SOURCES): Add util/raid.c and
util/lvm.c.
(grub_emu_SOURCES): Add disk/raid.c and disk/lvm.c.
* kern/misc.c (grub_strstr): New function.
* include/grub/misc.h (grub_strstr): New prototype.
* include/grub/powerpc/libgcc.h (__floatdisf): New prototype.
(__cmpdi): Likewise.
* kern/powerpc/ieee1275/openfw.c (grub_devalias_iterate): Pass 0 as
`flags' to `grub_ieee1275_next_property'. Change `pathlen' to type
`grub_ssize_t'.
* kern/powerpc/ieee1275/cmain.c: include grub/misc.h.
* loader/powerpc/ieee1275/linux.c (grub_linux_boot): Change `actual'
to type `grub_ssize_t'.
(grub_rescue_cmd_linux): Cast -1 to `grub_off_t'.
Import from GRUB Legacy (lib/device.c):
* util/i386/pc/grub-mkdevicemap.c (get_i2o_disk_name): New function.
(init_device_map) [__linux__]: Add support for I2O devices.
* util/i386/pc/grub-install.in: Skip menu.lst when removing
/boot/grub/*.lst.
* util/i386/pc/getroot.c: Don't recurse into dotdirs (e.g. ".static").
* util/i386/pc/grub-mkdevicemap.c: Make sure the floppy device exists
before adding it to device.map.
* genmk.rb: Let GCC generate dependenceies the first time it
compiles a file; using the -MD option.
* conf/common.mk: Regenerate.
* conf/i386-pc.mk: Likewise.
* conf/i386-efi.mk: Likewise.
* conf/powerpc-ieee1275.mk: Likewise.
* conf/sparc64-ieee1275.mk: Likewise.
Move the prototypes of grub_setjmp and grub_longjmp to
cpu/setjmp.h, so that each architecture may specify different
attributes.
* include/grub/i386/setjmp.h (grub_setjmp): New prototype.
(grub_longjmp): Likewise.
* include/grub/powerpc/setjmp.h (grub_setjmp): Likewise..
(grub_longjmp): Likewise.
* include/grub/sparc64/setjmp.h (grub_setjmp): Likewise..
(grub_longjmp): Likewise.
* include/grub/setjmp.h [!GRUB_UTIL] (grub_setjmp): Removed.
[!GRUB_UTIL] (grub_longjmp): Removed.
* disk/i386/pc/biosdisk.c (struct grub_biosdisk_drp): Moved to ...
(struct grub_biosdisk_dap): Likewise.
* include/grub/i386/pc/biosdisk.h: ... to here. Also corrected
linkage settings for all functions.
* util/misc.c: Include config.h.
[!HAVE_MEMALIGN]: Do not include malloc.h.
(grub_memalign): Use posix_memalign, if present. Then, use
memalign, if present. Otherwise, emit an error.
* util/grub-emu.c: Do not include malloc.h.
* include/grub/util/misc.h: Include unistd.h. This is required for
FreeBSD, because off_t is defined in unistd.h. Reported by Harley
D. Eades III <hde@foobar-qux.org>.
* configure.ac (AC_GNU_SOURCE): Added.
(AC_CHECK_FUNCS): Check posix_memalign and memalign for the host
type.
* include/grub/types.h (grub_host_addr_t): Rename to
grub_target_addr_t.
(grub_host_off_t): Rename to grub_target_off_t.
(grub_host_size_t): Rename to grub_target_size_t.
(grub_host_ssize_t): Rename to grub_target_ssize_t.
Refer to GRUB_TARGET_SIZEOF_VOID_P to define those variables.
* include/grub/kernel.h (struct grub_module_header): Change type
of OFFSET to grub_target_off_t and type of SIZE to grub_target_size_t.
(grub_module_info): Likewise.
* loader/i386/pc/linux.c (grub_rescue_cmd_initrd): The conditional
of checking LINUX_MEM_SIZE was reverse. Reported by Jesus
Velazquez <jesus.velazquez@gmail.com>.
Count partitions from 1 instead of 0 in the string representation
of partitions. Still use 0-based internally.
* partmap/sun.c (grub_sun_is_valid): A cosmetic change.
(sun_partition_map_iterate): Use grub_partition_t instead of
struct grub_partition *. Cast DESC->START_CYLINDER to
grub_uint64_t after converting the endian.
(sun_partition_map_probe): Subtract 1 for PARTNUM.
(sun_partition_map_get_name): Add 1 to P->INDEX.
* partmap/pc.c (grub_partition_parse): Subtract 1 for
PCDATA->DOS_PART.
(pc_partition_map_get_name): Add 1 into PCDATA->DOS_PART.
* partmap/gpt.c (gpt_partition_map_iterate): Initialize PARTNO to
zero instead of one.
(gpt_partition_map_probe): Subtract 1 for PARTNUM.
(gpt_partition_map_get_name): Add 1 into P->INDEX.
* partmap/apple.c (apple_partition_map_iterate): Change the type
of POS to unsigned.
(apple_partition_map_probe): Subtract 1 for PARTNUM.
(apple_partition_map_get_name): Add 1 into P->INDEX.
* partmap/amiga.c (amiga_partition_map_iterate): Change the type
of POS to unsigned.
(amiga_partition_map_iterate): Cast NEXT to grub_off_t to
calculate the offset of a partition.
(amiga_partition_map_probe): Subtract 1 for PARTNUM.
(amiga_partition_map_get_name): Add 1 into P->INDEX.
* partmap/acorn.c (acorn_partition_map_find): Change the type of
SECTOR to grub_disk_addr_t.
(acorn_partition_map_iterate): Likewise.
(acorn_partition_map_probe): Subtract 1 for PARTNUM.
Change the type of SECTOR to grub_disk_addr_t. Declare P on the
top.
(acorn_partition_map_get_name): Add 1 into P->INDEX.
* kern/i386/pc/init.c (make_install_device): Add 1 into
GRUB_INSTALL_DOS_PART.
* fs/iso9660.c (grub_iso9660_mount): Fixed a reversed
conditional.
Clean up the code to support 64-bit addressing in disks and
files. This change is not enough for filesystems yet.
* util/i386/pc/grub-setup.c (struct boot_blocklist): Change the
type of "start" to grub_uint64_t.
(setup): Change the types of KERNEL_SECTOR and FIRST_SECTOR to
grub_disk_addr_t * and grub_disk_addr_t. Fix the format string in
save_first_sector and save_blocklists. Use grub_le_to_cpu64 to
convert addresses.
* util/i386/pc/biosdisk.c (open_device): Change the type of SECTOR
to grub_disk_addr_t.
* partmap/gpt.c (gpt_partition_map_iterate): Fix the format
string.
* partmap/pc.c (pc_partition_map_iterate): Likewise.
* partmap/amiga.c (amiga_partition_map_iterate): Cast RDSK.MAGIC
to char *.
* normal/script.c (grub_script_parse): Remove unused MEMFREE.
* normal/parser.y (YYLTYPE_IS_TRIVIAL): New macro.
* normal/lexer.c (grub_script_yyerror): Specify unused to LEX.
* loader/i386/pc/multiboot.c (grub_multiboot_load_elf64): Cast -1
to grub_off_t, to detect an error from grub_file_seek.
(grub_multiboot_load_elf32): Likewise.
* kern/misc.c (grub_strtoul): Use grub_strtoull. Return the
maximum unsigned long value when an overflow is detected.
(grub_strtoull): New function.
(grub_divmod64): Likewise.
(grub_lltoa): use grub_divmod64.
* kern/fs.c (struct grub_fs_block): Change the type of "offset" to
grub_disk_addr_t.
(grub_fs_blocklist_open): Increase P if P is not NULL to advance
the pointer to next character. Use grub_strtoull instead of
grub_strtoul.
(grub_fs_blocklist_read): Change the types of SECTOR, OFFSET and
SIZE to grub_disk_addr_t, grub_off_t and grub_size_t,
respectively.
* kern/file.c (grub_file_read): Prevent an oveflow of LEN, as the
return value is signed.
(grub_file_seek): Change the type of OLD to grub_off_t. Do not
test if OFFSET is less than zero, as OFFSET is unsigned now.
* kern/disk.c (struct grub_disk_cache): Change the type of
"sector" to grub_disk_addr_t.
(grub_disk_cache_get_index): Change the type of SECTOR to
grub_disk_addr_t. Calculate the hash with SECTOR casted to
unsigned after shifting.
(grub_disk_cache_invalidate): Change the type of SECTOR to
grub_disk_addr_t.
(grub_disk_cache_unlock): Likewise.
(grub_disk_cache_store): Likewise.
(grub_disk_check_range): Change the types of SECTOR, OFFSET, SIZE,
START and LEN to grub_disk_addr_t *, grub_off_t *, grub_size_t,
grub_disk_addr_t and grub_uint64_t, respectively.
(grub_disk_read): Use an unsigned variable REAL_OFFSET for the
body, as the value of OFFSET is tweaked by
grub_disk_check_range. Change the types of START_SECTOR, LEN and
POS to grub_disk_addr_t, grub_size_t and grub_size_t,
respectively.
(grub_disk_write): Use an unsigned variable REAL_OFFSET for the
body, as the value of OFFSET is tweaked by
grub_disk_check_range. Change the types of LEN and N to
grub_size_t.
* io/gzio.c (struct grub_gzio): Change the types of "data_offset"
and "saved_offset" to grub_off_t.
(test_header): Cast BUF to char *.
(get_byte): Cast GZIO->DATA_OFFSET to grub_off_t. Cast GZIO->INBUF
to char *.
(grub_gzio_read): Change the types of OFFSET and SIZE to
grub_off_t and grub_size_t, respectively.
* include/grub/i386/pc/boot.h (GRUB_BOOT_MACHINE_FORCE_LBA):
Removed.
(GRUB_BOOT_MACHINE_BOOT_DRIVE): Changed to 0x4c.
(GRUB_BOOT_MACHINE_KERNEL_ADDRESS): Changed to 0x40.
(GRUB_BOOT_MACHINE_KERNEL_SEGMENT): Changed to 0x42.
(GRUB_BOOT_MACHINE_DRIVE_CHECK): Changed to 0x4e.
(GRUB_BOOT_MACHINE_LIST_SIZE): Increased to 12.
* include/grub/types.h (grub_off_t): Unconditionally set to
grub_uint64_t.
(grub_disk_addr_t): Changed to grub_uint64_t.
* include/grub/partition.h (struct grub_partition): Change the
types of "start", "len" and "offset" to grub_disk_addr_t,
grub_uint64_t and grub_disk_addr_t, respectively.
(grub_partition_get_start): Return grub_disk_addr_t.
(grub_partition_get_len): Return grub_uint64_t.
* include/grub/misc.h (grub_strtoull): New prototype.
(grub_divmod64): Likewise.
* include/grub/fshelp.h (grub_fshelp_read_file): Change the types
of SECTOR, LEN and FILESIZE to grub_disk_addr_t, grub_size_t and
grub_off_t, respectively.
All callers and references changed.
* include/grub/fs.h (struct grub_fs): Change the type of LEN to
grub_size_t in "read".
All callers and references changed.
* include/grub/file.h (struct grub_file): Change the types of
"offset" and "size" to grub_off_t and grub_off_t,
respectively. Change the type of SECTOR to grub_disk_addr_t in
"read_hook".
(grub_file_read): Change the type of LEN to grub_size_t.
(grub_file_seek): Return grub_off_t. Change the type of OFFSET to
grub_off_t.
(grub_file_size): Return grub_off_t.
(grub_file_tell): Likewise.
All callers and references changed.
* include/grub/disk.h (struct grub_disk_dev): Change the types of
SECTOR and SIZE to grub_disk_addr_t and grub_size_t in "read" and
"write".
(struct grub_disk): Change the type of "total_sectors" to
grub_uint64_t. Change the type of SECTOR to grub_disk_addr_t in
"read_hook".
(grub_disk_read): Change the types of SECTOR, OFFSET and SIZE to
grub_disk_addr_t, grub_off_t and grub_size_t, respectively.
(grub_disk_write): Likewise.
All callers and references changed.
* fs/iso9660.c (grub_iso9660_susp_iterate): Cast parameters to
char * for grub_strncmp to silence gcc.
(grub_iso9660_mount): Likewise.
(grub_iso9660_mount): Likewise.
(grub_iso9660_read_symlink): Likewise. Also, remove the nonsense
return statement.
(grub_iso9660_iterate_dir): Likewise.
(grub_iso9660_label): Cast DATA->VOLDESC.VOLNAME to char *.
* fs/hfs.c (grub_hfs_read_file): Change the types of SECTOR and
LEN to grub_disk_addr_t and grub_size_t, respectively.
* fs/hfsplus.c (grub_hfsplus_read_file): Likewise.
* fs/jfs.c (grub_jfs_read_file): Likewise.
* fs/minix.c (grub_jfs_read_file): Likewise.
* fs/sfs.c (grub_jfs_read_file): Likewise.
* fs/ufs.c (grub_jfs_read_file): Likewise.
* fs/xfs.c (grub_jfs_read_file): Likewise.
* fs/fat.c (grub_fat_read_data): Change the types of SECTOR, LEN
and SIZE to grub_disk_addr_t, grub_size_t and grub_size_t,
respectively.
* fs/ext2.c (grub_ext2_read_block): When an error happens, set
BLKNR to -1 instead of returning GRUB_ERRNO.
(grub_ext2_read_file): Change the types of SECTOR and
LEN to grub_disk_addr_t and grub_size_t, respectively.
* fs/affs.c (grub_affs_read_file): Change the types of SECTOR and
LEN to grub_disk_addr_t and grub_size_t, respectively.
* font/manager.c (grub_font_get_glyph): Cast BITMAP to char * for
grub_file_read.
* disk/ieee1275/ofdisk.c (grub_ofdisk_read): Fix the format
string. Do not cast SECTOR explicitly.
* disk/i386/pc/biosdisk.c (grub_biosdisk_open): Change the type of
TOTAL_SECTORS to grub_uint64_t. Do not mask DRP->TOTAL_SECTORS.
(grub_biosdisk_rw): Change the types of SECTOR and SIZE to
grub_disk_addr_t and grub_size_t, respectively. If the sector is
over 2TB and LBA mode is not supported, raise an error.
(get_safe_sectors): New function.
(grub_biosdisk_read): Use get_safe_sectors.
(grub_biosdisk_write): Likewise.
* disk/efi/efidisk.c (grub_efidisk_read): Fix the format string.
(grub_efidisk_write): Likewise.
* disk/loopback.c (delete_loopback): Cosmetic changes.
(grub_cmd_loopback): Likewise. Also, test NEWDEV->FILENAME
correctly.
(grub_loopback_open): Likewise.
(grub_loopback_read): Likewise. Also, change the type of POS to
grub_off_t, and fix the usage of grub_memset.
* commands/i386/pc/play.c: Include grub/machine/time.h.
* commands/ls.c (grub_ls_list_files): Use "llu" instead of "d" to
print FILE->SIZE.
* commands/configfile.c: Include grub/env.h.
* commands/cmp.c (grub_cmd_cmp): Do not use ERR, but use
GRUB_ERRNO directly instead. Change the type of POS to
grub_off_t. Follow the coding standard.
* commands/blocklist.c: Include grub/partition.h.
(grub_cmd_blocklist): Return an error if the underlying device is
not a disk. Take the starting sector of a partition into account,
if a partition is used.
* boot/i386/pc/diskboot.S (bootloop): Adapted to the new offset of
a length field.
(lba_mode): Support 64-bit addresses.
(chs_mode): Likewise.
(copy_buffer): Adapted to the new offsets of a length field and a
segment field.
(blocklist_default_start): Allocate 64-bit space.
* boot/i386/pc/boot.S (force_lba): Removed.
(boot_drive): Moved to under KERNEL_SECTOR.
(kernel_sector): Moved to under KENREL_SEGMENT. Allocate 64-bit
space.
(real_start): Set %si earlier. Remove code for FORCE_LBA, since it
is useless.
(lba_mode): Refactored to support a 64-bit address. More size
optimization.
(setup_sectors): Likewise.
* conf/common.rmk (grub_modules_init.lst): Depends on
$(MODSRCFILES). Grep only the files in $(MODSRCFILES). Make sure
that the target does not exist before producing.
(grub_modules_init.h): Remove the target before generating.
(grub_emu_init.c): Likewise.
* genmk.rb (PModule::rule): Add source files into MODSRCFILES.