* 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().
* 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'.
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.
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.
* include/grub/script.h (grub_script_cmdif): Renamed field 'bool' to
'exec_to_evaluate'. Renamed field 'true' to 'exec_on_true'. Renamed
field 'false' to 'exec_on_false'.
(grub_script_create_cmdif): Renamed argument names to reflect above
changes.
* normal/execute.c (grub_script_execute_cmdif): Likewise.
* normal/script.c (grub_script_create_cmdif): Likewise.
* fs/hfsplus.c (grub_hfsplus_btree_recoffset): Moved to near the
top.
(grub_hfsplus_btree_recptr): Likewise.
(grub_hfsplus_find_block): Do not take RETRY any longer. Use
FILEBLOCK both to pass a block number and store next block
number.
(grub_hfsplus_read_block): Rewritten heavily to support an extent
overflow file correctly. Specify errors appropriately, because
fshelp expects that GRUB_ERRNO is set when fails. Reuse
grub_hfsplus_btree_recptr to get the pointer to a found key.
(grub_hfsplus_btree_search): Return 1 instead of 0 when no match
is found.
* conf/i386-efi.rmk (pkgdata_MODULES): Added _linux.mod and
linux.mod.
(_linux_mod_SOURCES): New variable.
(_linux_mod_CFLAGS): Likewise.
(_linux_mod_LDFLAGS): Likewise.
(linux_mod_SOURCES): Likewise.
(linux_mod_CFLAGS): Likewise.
(linux_mod_LDFLAGS): Likewise.
* DISTLIST: Added loader/i386/efi/linux.c,
loader/i386/efi/linux_normal.c and
include/grub/i386/efi/loader.h.
* loader/i386/efi/linux.c: New file.
* loader/i386/efi/linux_normal.c: Likewise.
* include/grub/i386/efi/loader.h: Likewise.
* commands/blocklist.c: New file.
* DISTLIST: Added commands/blocklist.c.
* term/efi/console.c (grub_console_highlight_color): Use a lighter
color for the background, and a daker color for the foreground.
(grub_console_checkkey): Return READ_KEY.
(grub_console_cls): Set the background to
GRUB_EFI_BACKGROUND_BLACK temporarily to clean out the screen.
* kern/efi/efi.c (grub_efi_exit_boot_services): New function.
* include/grub/i386/linux.h (struct linux_kernel_params): Fixed
the size of "padding5", "hd0_drive_info" and "hd1_drive_info".
* include/grub/efi/efi.h (grub_efi_exit_boot_services): New
prototype.
* include/grub/efi/api.h (GRUB_EFI_TEXT_ATTR): Do not shift
BG. The spec is wrong again.
* include/grub/normal.h [GRUB_UTIL] (grub_blocklist_init): New
prototype.
[GRUB_UTIL] (grub_blocklist_fini): Likewise.
* conf/i386-pc.rmk (grub_emu_SOURCES): Added
commands/blocklist.c.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise.
* conf/common.rmk (pkgdata_MODULES): Added blocklist.mod.
(blocklist_mod_SOURCES): New variable.
(blocklist_mod_CFLAGS): Likewise.
(blocklist_mod_LDFLAGS): Likewise.
* kern/i386/pc/startup.S: Include grub/cpu/linux.h instead of
grub/machine/linux.h
* loader/i386/pc/linux.c: Likewise.
* include/grub/i386/pc/linux.h: Moved to ...
* include/grub/i386/linux.h: ... here.
* include/grub/i386/linux.h (struct linux_kernel_params): New
struct.
Use the environment context in the menu. Remove the commands
"default" and "timeout", and use variables instead.
* normal/menu.c: Include grub/env.h.
(print_entry): Cast TITLE to silence gcc.
(get_timeout): New function.
(set_timeout): Likewise.
(get_entry_number): Likewise.
(run_menu): Use a default entry, a fallback entry and a timeout
in the environment variables "default", "fallback" and
"timeout". Also, tweak the default entry if it is not within the
current menu entries.
(grub_menu_run): Use a fallback entry in the environment variable
"fallback".
* normal/main.c (read_config_file): Do not initialize
NEWMENU->DEFAULT_ENTRY, NEWMENU->FALLBACK_ENTRY or
NEWMENU->TIMEOUT.
(grub_normal_execute): Use a data slot to store the menu.
* include/grub/normal.h (struct grub_menu): Removed default_entry,
fallback_entry and timeout.
(struct grub_menu_list): Removed.
(grub_menu_list_t): Likewise.
(struct grub_context): Likewise.
(grub_context_t): Likewise.
(grub_context_get): Likewise.
(grub_context_get_current_menu): Likewise.
(grub_context_push_menu): Likewise.
(grub_context_pop_menu): Likewise.
(grub_default_init): Likewise.
(grub_default_fini): Likewise.
(grub_timeout_init): Likewise.
(grub_timeout_fini): Likewise.
* conf/sparc64-ieee1275.rmk (pkgdata_MODULES): Removed default.mod
and timeout.mod.
(normal_mod_SOURCES): Removed normal/context.c.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Removed
commands/default.c, commands/timeout.c and normal/context.c.
(normal_mod_SOURCES): Removed normal/context.c.
* conf/i386-pc.rmk (grub_emu_SOURCES): Removed commands/default.c,
commands/timeout.c and normal/context.c.
(normal_mod_SOURCES): Removed normal/context.c.
* conf/i386-efi.rmk (grub_emu_SOURCES): Removed
commands/default.c, commands/timeout.c and normal/context.c.
(normal_mod_SOURCES): Removed normal/context.c.
* conf/common.rmk (pkgdata_MODULES): Removed default.mod and
timeout.mod.
(default_mod_SOURCES): Removed.
(default_mod_CFLAGS): Likewise.
(default_mod_LDFLAGS): Likewise.
(timeout_mod_SOURCES): Removed.
(timeout_mod_CFLAGS): Likewise.
(timeout_mod_LDFLAGS): Likewise.
* DISTLIST: Removed commands/default.c, commands/timeout.c and
normal/context.c.
* commands/default.c: Removed.
* commands/timeout.c: Likewise.
* normal/context.c: Likewise.
* kern/env.c (struct grub_env_context): Removed "sorted". Renamed
"next" to "prev" for readability.
(struct grub_env_sorted_var): New struct.
(grub_env_context): Renamed to ...
(initial_context): ... this.
(grub_env_var_context): Renamed to ...
(current_context): ... this.
(grub_env_find): Look only at CURRENT_CONTEXT.
(grub_env_context_open): Rewritten to copy exported variables from
previous context.
(grub_env_context_close): Rewritten according to the new
scheme. Also, add an assertion to prevent the initial context from
removed.
(grub_env_insert): Removed the code for the sorted list.
(grub_env_remove): Likewise.
(grub_env_export): Simply mark the variable with
GRUB_ENV_VAR_GLOBAL.
(grub_env_set): A cosmetic change for naming consistency.
(grub_env_get): Likewise.
(grub_env_unset): Likewise.
(grub_env_iterate): Rewritten to sort variables within this
function.
(grub_register_variable_hook): Fixed for naming consistency. Call
grub_env_find again, only if NAME is not found at the first time.
(mangle_data_slot_name): New function.
(grub_env_set_data_slot): Likewise.
(grub_env_get_data_slot): Likewise.
(grub_env_unset_data_slot): Likewise.
* include/grub/env.h (grub_env_var_type): New enum.
(GRUB_ENV_VAR_LOCAL): New constant.
(GRUB_ENV_VAR_GLOBAL): Likewise.
(GRUB_ENV_VAR_DATA): Likewise.
(struct grub_env_var): Removed "sort_next" and "sort_prevp". Added
"type".
(grub_env_set): Replace VAR with NAME for consistency.
(grub_register_variable_hook): Likewise.
(grub_env_export): Specify the name of the argument.
(grub_env_set_data_slot): New prototype.
(grub_env_get_data_slot): Likewise.
(grub_env_unset_data_slot): Likewise.
Extend the loader so that GRUB can accept a loader which comes
back to GRUB when a loaded image exits. Also, this change adds
support for a chainloader on EFI.
* term/efi/console.c: Include grub/misc.h.
(grub_console_checkkey): Display a scan code on the top for
debugging. This will be removed once the EFI port gets stable.
Correct the scan code mapping.
* kern/efi/mm.c (sort_memory_map): Sort in a descending order to
allocate memory from larger regions, in order to reduce the number
of allocated regions. Otherwise, the MacOSX loader panics.
(filter_memory_map): Avoid less than 1MB for compatibility with
other loaders.
(add_memory_regions): Allocate from the tail of a region, if
possible, to avoid allocating a region near to 1MB, for the MacOSX
loader.
* kern/efi/init.c (grub_efi_set_prefix): Specify
GRUB_EFI_IMAGE_HANDLE to grub_efi_get_loaded_image.
* kern/efi/efi.c (grub_efi_get_loaded_image): Accept a new
argument IMAGE_HANDLE and specify it to get a loaded image.
(grub_arch_modules_addr): Specify GRUB_EFI_IMAGE_HANDLE to
grub_efi_get_loaded_image.
(grub_efi_get_filename): Divide the legnth by the size of
grub_efi_char16_t.
(grub_efi_get_device_path): New function.
(grub_efi_print_device_path): Print End Device Path nodes. Divide
the length by the size of grub_efi_char16_t for a file path device
path node.
* kern/loader.c (grub_loader_noreturn): New variable.
(grub_loader_set): Accept a new argument NORETURN. Set
GRUB_LOADER_NORETURN to NORETURN.
All callers changed.
(grub_loader_boot): If GRUB_LOADER_NORETURN is false, do not call
grub_machine_fini.
* include/grub/efi/efi.h (grub_efi_get_device_path): New
prototype.
(grub_efi_get_loaded_image): Take an argument to specify an image
handle.
* include/grub/loader.h (grub_loader_set): Added one more argument
NORETURN.
* disk/efi/efidisk.c (make_devices): Use grub_efi_get_device_path
instead of grub_efi_open_protocol.
(grub_efidisk_get_device_name): Likewise.
(grub_efidisk_close): Print a newline.
(grub_efidisk_get_device_handle): Fixed to use
GRUB_EFI_DEVICE_PATH_SUBTYPE instead of
GRUB_EFI_DEVICE_PATH_TYPE.
* disk/efi/efidisk.c (device_path_guid): Moved to ...
* kern/efi/efi.c (device_path_guid): ... here.
* conf/i386-efi.rmk (pkgdata_MODULES): Added _chain.mod and
chain.mod.
(kernel_mod_HEADERS): Added efi/disk.h.
(_chain_mod_SOURCES): New variable.
(_chain_mod_CFLAGS): Likewise.
(_chain_mod_LDFLAGS): Likewise.
(chain_mod_SOURCES): Likewise.
(chain_mod_CFLAGS): Likewise.
(chain_mod_LDFLAGS): Likewise.
* DISTLIST: Added include/grub/efi/chainloader.h,
loader/efi/chainloader.c and loader/efi/chainloader_normal.c.
* include/grub/efi/chainloader.h: New file.
* loader/efi/chainloader.c: Likewise.
* loader/efi/chainloader_normal.c: Likewise.
* commands/configfile.c (grub_cmd_configfile): Execute the
configfile within its own context.
* include/grub/env.h (grub_env_context_open): New prototype.
(grub_env_context_close): Likewise.
* kern/env.c (grub_env): Removed.
(grub_env_sorted): Likewise.
(grub_env_context): New variable.
(grub_env_var_context): Likewise.
(grub_env_find): Search both the active context and the global
context.
(grub_env_context_open): New function.
(grub_env_context_close): Likewise.
(grub_env_insert): Likewise.
(grub_env_remove): Likewise.
(grub_env_export): Likewise.
(grub_env_set): Changed to use helper functions to avoid code
duplication.
(grub_env_iterate): Rewritten so both the current context and the
global context are being used.
* normal/command.c (export_command): New function.
(grub_command_init): Register the `export' function.
A new machine-specific function "grub_machine_set_prefix" is
defined. This is called after loading modules, so that a prefix
initialization can use modules. Also, this change adds an
intensive debugging feature for the memory manager via the
configure option "--enable-mm-debug".
* partmap/gpt.c (gpt_partition_map_iterate): Add one more into
PART.LEN.
* kern/sparc64/ieee1275/init.c (abort): Removed.
(grub_stop): Likewise.
(grub_exit): New function.
(grub_set_prefix): Renamed to ...
(grub_machine_set_prefix): ... this.
(grub_machine_init): Do not call grub_set_prefix.
* kern/powerpc/ieee1275/init.c (grub_set_prefix): Renamed to ...
(grub_machine_set_prefix): ... this.
(grub_machine_init): Do not call grub_set_prefix.
* kern/i386/pc/init.c (grub_machine_set_prefix): New function.
(grub_machine_init): Do not set the prefix here.
* kern/i386/efi/init.c (grub_machine_set_prefix): New function.
* kern/efi/init.c: Include grub/mm.h.
(grub_efi_set_prefix): New function.
* kern/efi/efi.c (grub_exit): Call grub_efi_fini.
(grub_efi_get_filename): New function.
(grub_print_device_path): Renamed to ...
(grub_efi_print_device_path): ... this.
* kern/mm.c [MM_DEBUG] (grub_malloc): Undefined.
[MM_DEBUG] (grub_realloc): Likewise.
[MM_DEBUG] (grub_free): Likewise.
[MM_DEBUG] (grub_memalign): Likewise.
[MM_DEBUG] (grub_mm_debug): New variable.
[MM_DEBUG] (grub_debug_malloc): New function.
[MM_DEBUG] (grub_debug_free): New function.
[MM_DEBUG] (grub_debug_realloc): New function.
[MM_DEBUG] (grub_debug_memalign): New function.
* kern/misc.c (grub_abort): Print a newline to distinguish
the message.
* kern/main.c (grub_main): Call grub_machine_set_prefix and
grub_set_root_dev after loading modules. This is necessary when
setting a prefix depends on modules.
* include/grub/efi/efi.h (grub_print_device_path): Renamed to ...
(grub_efi_print_device_path): ... this.
(grub_efi_get_filename): New prototype.
(grub_efi_set_prefix): Likewise.
* include/grub/efi/disk.h: Include grub/efi/api.h, grub/symbol.h
and grub/disk.h.
(grub_efidisk_get_device_handle): New prototype.
(grub_efidisk_get_device_name): Likewise.
* include/grub/mm.h: Include config.h.
(MM_DEBUG): Removed.
[MM_DEBUG && !GRUB_UTIL] (grub_mm_debug): New prototype.
[MM_DEBUG && !GRUB_UTIL] (grub_malloc): New macro.
[MM_DEBUG && !GRUB_UTIL] (grub_realloc): Likewise.
[MM_DEBUG && !GRUB_UTIL] (grub_memalign): Likewise.
[MM_DEBUG && !GRUB_UTIL] (grub_free): Likewise.
[MM_DEBUG && !GRUB_UTIL] (grub_debug_malloc): New prototype.
[MM_DEBUG && !GRUB_UTIL] (grub_debug_realloc): New prototype.
[MM_DEBUG && !GRUB_UTIL] (grub_debug_memalign): New prototype.
[MM_DEBUG && !GRUB_UTIL] (grub_debug_free): New prototype.
* include/grub/kernel.h (grub_machine_set_prefix): New prototype.
* disk/efi/efidisk.c: Include grub/partition.h.
(iterate_child_devices): New function.
(add_device): First, compare only last device path nodes, so that
devices are sorted by the types.
(grub_efidisk_get_device_handle): New function.
(grub_efidisk_get_device_name): Likewise.
* configure.ac (--enable-mm-debug): New option to enable the
memory manager debugging feature. This makes the binary much
bigger, so is disabled by default.
Use grub_abort instead of grub_stop, and grub_exit must be
define in each architecture now. Also, this change adds support
for EFI disks.
* util/i386/pc/grub-probefs.c: Include grub/term.h.
(grub_getkey): New function.
(grub_term_get_current): Likewise.
* util/i386/pc/grub-setup.c: Include grub/term.h.
(grub_getkey): New function.
(grub_term_get_current): Likewise.
* util/misc.c (grub_stop): Renamed to ...
(grub_exit): ... this.
* kern/powerpc/ieee1275/init.c (abort): Renamed to ...
(grub_exit): ... this.
(grub_machine_init): Use grub_abort instead of abort.
(grub_stop): Removed.
* kern/powerpc/ieee1275/cmain.c (cmain): Use grub_abort instead of
abort.
* kern/i386/pc/startup.S (grub_exit): New function.
(cold_reboot): New label.
* kern/efi/init.c: Include grub/efi/disk.h and grub/env.h.
(grub_efi_init): Call grub_efidisk_init.
(grub_efi_fini): Call grub_efidisk_fini.
* kern/efi/efi.c: Include grub/mm.h.
(grub_efi_console_control_guid): Renamed to ...
(console_control_guid): ... this.
(grub_efi_loaded_image_guid): Renamed to ...
(loaded_image_guid): ... this.
(grub_efi_locate_handle): New function.
(grub_efi_open_protocol): Likewise.
(grub_efi_set_text_mode): Use CONSOLE_CONTROL_GUID instead of
GRUB_EFI_CONSOLE_CONTROL_GUID.
(grub_efi_exit): Removed.
(grub_stop): Likewise.
(grub_efi_get_loaded_image): Use grub_efi_open_protocol.
(grub_exit): New function.
(grub_print_device_path): Likewise.
* kern/rescue.c (grub_rescue_cmd_exit): New function.
(grub_enter_rescue_mode): Register "exit".
* kern/misc.c (grub_real_dprintf): A cosmetic change.
(grub_abort): New function.
* kern/err.c (grub_fatal): Use grub_abort instead of grub_stop.
* include/grub/sparc64/ieee1275/kernel.h (abort): Removed.
* include/grub/powerpc/ieee1275/kernel.h (abort): Removed.
* include/grub/efi/efi.h (grub_efi_exit): Removed.
(grub_print_device_path): New prototype.
(grub_efi_locate_handle): Likewise.
(grub_efi_open_protocol): Likewise.
* include/grub/efi/disk.h (grub_efidisk_fini): New file.
* disk/efi/efidisk.c: Likewise.
* DISTLIST: Added disk/efi/efidisk.c and include/grub/efi/disk.h.
* include/grub/efi/console_control.h
(GRUB_EFI_CONSOLE_CONTROL_GUID): Use an array for the last 8 bytes.
* include/grub/efi/api.h (GRUB_EFI_LOADED_IMAGE_GUID): Specify the
last 8 bytes as an array.
(GRUB_EFI_DISK_IO_GUID): New macro.
(GRUB_EFI_BLOCK_IO_GUID): Likewise.
(GRUB_EFI_DEVICE_PATH_GUID): Likewise.
(grub_efi_ipv6_address_t): Change the type to grub_uint16_t from
grub_uint8_t.
(struct grub_efi_guid): Use an array to specify the last 8 bytes.
(struct grub_efi_device_path): Rename the member "sub_type" to
"subtype".
(GRUB_EFI_DEVICE_PATH_TYPE): New macro.
(GRUB_EFI_DEVICE_PATH_SUBTYPE): Likewise.
(GRUB_EFI_DEVICE_PATH_LENGTH): Likewise.
(GRUB_EFI_END_DEVICE_PATH_TYPE): Likewise.
(GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE): Likewise.
(GRUB_EFI_END_THIS_DEVICE_PATH_SUBTYPE): Likewise.
(GRUB_EFI_END_ENTIRE_DEVICE_PATH): Likewise.
(GRUB_EFI_NEXT_DEVICE_PATH): Likewise.
(GRUB_EFI_HARDWARE_DEVICE_PATH_TYPE): Likewise.
(GRUB_EFI_PCI_DEVICE_PATH_SUBTYPE): Likewise.
(struct grub_efi_pci_device_path): New structure.
(grub_efi_pci_device_path_t): New type.
(GRUB_EFI_PCCARD_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_pccard_device_path): New structure.
(grub_efi_pccard_device_path_t): New type.
(GRUB_EFI_MEMORY_MAPPED_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_memory_mapped_device_path): New structure.
(grub_efi_memory_mapped_device_path_t): New type.
(GRUB_EFI_VENDOR_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_vendor_device_path): New structure.
(grub_efi_vendor_device_path_t): New type.
(GRUB_EFI_CONTROLLER_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_controller_device_path): New structure.
(grub_efi_controller_device_path_t): New type.
(GRUB_EFI_ACPI_DEVICE_PATH_TYPE): New macro.
(GRUB_EFI_ACPI_DEVICE_PATH_SUBTYPE): Likewise.
(struct grub_efi_acpi_device_path): New structure.
(grub_efi_acpi_device_path_t): New type.
(GRUB_EFI_EXPANDED_ACPI_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_expanded_acpi_device_path): New structure.
(grub_efi_expanded_acpi_device_path_t): New type.
(GRUB_EFI_EXPANDED_ACPI_HIDSTR): New macro.
(GRUB_EFI_EXPANDED_ACPI_UIDSTR): Likewise.
(GRUB_EFI_EXPANDED_ACPI_CIDSTR): Likewise.
(GRUB_EFI_MESSAGING_DEVICE_PATH_TYPE): Likewise.
(GRUB_EFI_ATAPI_DEVICE_PATH_SUBTYPE): Likewise.
(struct grub_efi_atapi_device_path): New structure.
(grub_efi_atapi_device_path_t): New type.
(GRUB_EFI_FIBRE_CHANNEL_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_fibre_channel_device_path): New structure.
(grub_efi_fibre_channel_device_path_t): New type.
(GRUB_EFI_1394_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_1394_device_path): New structure.
(grub_efi_1394_device_path_t): New type.
(GRUB_EFI_USB_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_usb_device_path): New structure.
(grub_efi_usb_device_path_t): New type.
(GRUB_EFI_USB_CLASS_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_usb_class_device_path): New structure.
(grub_efi_usb_class_device_path_t): New type.
(GRUB_EFI_I2O_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_i2o_device_path): New structure.
(grub_efi_i2o_device_path_t): New type.
(GRUB_EFI_MAC_ADDRESS_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_mac_address_device_path): New structure.
(grub_efi_mac_address_device_path_t): New type.
(GRUB_EFI_IPV4_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_ipv4_device_path): New structure.
(grub_efi_ipv4_device_path_t): New type.
(GRUB_EFI_IPV6_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_ipv6_device_path): New structure.
(grub_efi_ipv6_device_path_t): New type.
(GRUB_EFI_INFINIBAND_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_infiniband_device_path): New structure.
(grub_efi_infiniband_device_path_t): New type.
(GRUB_EFI_UART_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_uart_device_path): New structure.
(grub_efi_uart_device_path_t): New type.
(GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_vendor_messaging_device_path): New structure.
(grub_efi_vendor_messaging_device_path_t): New type.
(GRUB_EFI_MEDIA_DEVICE_PATH_TYPE): New macro.
(GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE): Likewise.
(struct grub_efi_hard_drive_device_path): New structure.
(grub_efi_hard_drive_device_path_t): New type.
(GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_cdrom_device_path): New structure.
(grub_efi_cdrom_device_path_t): New type.
(GRUB_EFI_VENDOR_MEDIA_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_vendor_media_device_path): New structure.
(grub_efi_vendor_media_device_path_t): New type.
(GRUB_EFI_FILE_PATH_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_file_path_device_path): New structure.
(grub_efi_file_path_device_path_t): New type.
(GRUB_EFI_PROTOCOL_DEVICE_PATH_SUBTYPE): New macro.
(struct grub_efi_protocol_device_path): New structure.
(grub_efi_protocol_device_path_t): New type.
(GRUB_EFI_BIOS_DEVICE_PATH_TYPE): New macro.
(GRUB_EFI_BIOS_DEVICE_PATH_SUBTYPE): Likewise.
(struct grub_efi_bios_device_path): New structure.
(grub_efi_bios_device_path_t): New type.
(struct grub_efi_disk_io): New structure.
(grub_efi_disk_io_t): New type.
(struct grub_efi_block_io_media): New structure.
(grub_efi_block_io_media_t): New type.
(struct grub_efi_block_io): New structure.
(grub_efi_block_io_t): New type.
* include/grub/misc.h (grub_stop): Removed.
(grub_exit): New prototype.
(grub_abort): Likewise.
* include/grub/disk.h (enum grub_disk_dev_id): Added
GRUB_DISK_DEVICE_EFIDISK_ID.
* conf/i386-efi.rmk (kernel_mod_SOURCES): Added
disk/efi/efidisk.c.
(kernel_syms.lst): Remove the target if an error occurs.
Add support for pre-loaded modules into the EFI port.
* util/i386/efi/grub-mkimage.c (make_mods_section): Rewritten
completely. Accept one more argument DIR. The caller has changed.
* kern/i386/efi/init.c (grub_arch_modules_addr): Removed.
* kern/efi/efi.c: Include grub/efi/pe32.h and grub/kernel.h.
(grub_efi_loaded_image_guid): New variable.
(grub_efi_get_loaded_image): New function.
(grub_arch_modules_addr): Likewise.
* include/grub/efi/efi.h (grub_efi_get_loaded_image): New
prototype.
* include/grub/efi/api.h (GRUB_EFI_LOADED_IMAGE_GUID): New macro.
(struct grub_efi_loaded_image): New structure.
(grub_efi_loaded_image_t): New type.
* DISTLIST: Added include/grub/i386/pc/vbeblit.h,
include/grub/i386/pc/vbefill.h, video/i386/pc/vbeblit.c,
video/i386/pc/vbefill.c.
* conf/i386-pc.rmk (vbe_mod_SOURCES): Added video/i386/pc/vbeblit.c,
video/i386/pc/vbefill.c.
* include/grub/video.h (grub_video_blit_format): New enum.
(grub_video_mode_info): Added new member blit_format.
(grub_video_get_blit_format): New function prototype.
* include/grub/i386/pc/vbe.h (grub_video_vbe_get_video_ptr): New
function prototype.
(grub_video_vbe_map_rgb): Likewise.
(grub_video_vbe_unmap_color): Likewise.
* include/grub/i386/pc/vbeblit.h: New file.
* include/grub/i386/pc/vbefill.h: New file.
* video/video.c (grub_video_get_blit_format): New function.
(grub_video_vbe_get_video_ptr): Re-declared as non-static.
(grub_video_vbe_map_rgb): Likewise.
(grub_video_vbe_unmap_color): Likewise.
* video/i386/pc/vbe.c (grub_video_vbe_fill_rect): Changed to use more
optimized fills.
(grub_video_vbe_blit_render_target): Changed to use more optimized
blits.
(grub_video_vbe_setup): Added detection for optimized settings.
(grub_video_vbe_create_render_target): Likewise.
* video/i386/pc/vbeblit.c: New file.
* video/i386/pc/vbefill.c: New file.
* include/grub/normal.h: Include <grub/script.h>.
(grub_command_list): Removed struct.
(grub_command_list_t): Removed type.
(grub_menu_entry): Remove members `num' and `command_list'. Add
members `commands' and `sourcecode'.
* include/grub/script.h: Add inclusion guards.
(grub_script_cmd_menuentry): New struct.
(grub_script_execute_menuentry): New prototype.
(grub_script_lexer_record_start): Likewise.
(grub_script_lexer_record_stop): Likewise.
* normal/execute.c (grub_script_execute_menuentry): New function.
* normal/lexer.c (record, recording, recordpos, recordlen): New
variables.
(grub_script_lexer_record_start): New function.
(grub_script_lexer_record_stop): Likewise.
(recordchar): Likewise.
(nextchar): Likewise.
(grub_script_yylex): Use `nextchar' to fetch new characters. Use
2048 as the buffer size. Add the tokens `menuentry' and `@'.
* normal/main.c: Include <grub/parser.h> and <grub/script.h>
(current_menu): New variable.
(free_menu): Mainly rewritten.
(grub_normal_menu_addentry): New function.
(read_config_file): Rewritten.
* normal/menu.c (run_menu_entry): Mainly rewritten.
* normal/menu_entry.c (make_screen): Rewritten te code to insert
the menu entry.
(run): Mainly rewritten.
* normal/parser.y (menu_entry): New variable.
(GRUB_PARSER_TOKEN_MENUENTRY): New token.
(menuentry): New rule.
(command): Add `menuentry'.
(if_statement): Allow additional returns before `fi'.
* normal/script.c (grub_script_create_cmdmenu): New function.
* fs/hfs.c: Include <grub/hfs.h>. Added reference to the official
documentation.
(GRUB_HFS_EMBED_HFSPLUS_SIG): New macro.
(grub_hfs_mount): Grammar fix in error. Make sure this is not an
embedded HFS+ filesystem.
(GRUB_HFS_MAGIC, grub_hfs_extent, grub_hfs_datarecord_t)
(grub_hfs_sblock): Move from here...
* include/grub/hfs.h: To here... New file.
* fs/hfsplus.c: Include <grub/hfs.h>. Added reference to the official
documentation.
(GRUB_HFSPLUS_MAGIC, GRUB_HFSPLUSX_MAGIC, GRUB_HFSPLUS_SBLOCK):
New macros.
(grub_hfsplus_volheader): Change type of member `magic' to
`grub_uint16_t'.
(grub_hfsplus_data): Add new member `embedded_offset'.
(grub_hfsplus_read_block): Add the HFS+ wrapper offset to the
returned block.
(grub_hfsplus_mount): Read the HFS+ wrapper if it exists.
Calculate the offset.
* kern/err.c (grub_error_push): Added new function to support error
stacks.
(grub_error_pop): Likewise.
(grub_error_stack_items): New local variable to support error stacks.
(grub_error_stack_pos): Likewise.
(grub_error_stack_assert): Likewise.
(GRUB_ERROR_STACK_SIZE): Added new define to configure maximum error
stack depth.
(grub_print_error): Added support to print errors from error stack.
* include/grub/err.h (grub_error_push): Added function prototype.
(grub_error_pop): Likewise.
* conf/common.rmk (grub_modules_init.lst): Use `-printf "%P\n"'
and `cd' to make sure the filename is not prefixed with a
directory name.
(pkgdata_MODULES): Add `gpt.mod'.
(gpt_mod_SOURCES): New variable.
(gpt_mod_CFLAGS): Likewise.
(gpt_mod_LDFLAGS): Likewise.
* conf/i386-pc.rmk (grub_emu_SOURCES): Add `partmap/gpt.c'.
* include/grub/pc_partition.h (GRUB_PC_PARTITION_TYPE_GPT_DISK):
New macro.
* partmap/gpt.c: New file.
* partmap/pc.c (pc_partition_map_iterate): Don't continue when a
GPT partition map is detected.
* include/grub/parser.h: New file.
* kern/parser.c: Likewise.
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `kern/parser.c'.
(grub_setup_SOURCES): Likewise.
(grub_probefs_SOURCES): Likewise.
(grub_emu_SOURCES): Likewise.
(kernel_img_HEADERS): Add `parser.h'.
* conf/powerpc-ieee1275.rmk (grubof_HEADERS): Add `parser.h'.
(grub_emu_SOURCES): Add `kern/parser.c'.
(grubof_SOURCES): Likewise.
* conf/sparc64-ieee1275.rmk (grubof_HEADERS): Add `parser.h'.
(grubof_SOURCES): Add `kern/parser.c'.
* include/grub/misc.h (grub_split_cmdline): Removed prototype.
* kern/misc.c (grub_split_cmdline): Removed function.
* kern/rescue.c: Include <grub/parser.h>.
(grub_enter_rescue_mode): Use `grub_parser_split_cmdline' instead
of `grub_split_cmdline'.
* normal/command.c: Include <grub/parser.h>.
(grub_command_execute): Use `grub_parser_split_cmdline' instead
of `grub_split_cmdline'.
* normal/completion.c: Include <grub/parser.h>.
(cmdline_state): New variable.
(iterate_dir): End the filename with a quote depending on the
command line state.
(get_state): new function.
(grub_normal_do_completion): Use `grub_parser_split_cmdline' to
split the arguments and determine the current argument. When the
argument string is not quoted, escape all spaces.
* include/grub/sparc64/libgcc.h: New file.
* conf/sparc64-ieee1275.rmk (COMMON_ASFLAGS): Remove -Av9.
(normal_mod_SOURCES): Use normal/sparc64/setjmp.S instead of
normal/sparc64/setjmp.c.