* 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.
* 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.
* 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.
* kern/powerpc/ieee1275/init.c (grub_get_rtc): Initialize `msecs'
to 0.
* term/ieee1275/ofconsole.c (grub_ofconsole_checkkey): Return -1 if
there are no pending characters.
* kern/powerpc/ieee1275/openfw.c (grub_ieee1275_get_devname): Use
`grub_strndup' to drop device arguments. Replace unnecessary
`grub_strndup' with `grub_strdup'.
From Timothy Baldwin:
* commands/ls.c (grub_ls_list_files): Close FILE with
grub_file_close.
* kern/misc.c (grub_vsprintf): Terminate the string S with NUL.
* 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.
* kern/file.c (grub_file_seek): Seeking to an offset equal to a
file size must be permitted.
* kern/i386/pc/startup.S (multiboot_trampoline): Fix a mistake
between %ah and %al.
* fs/xfs.c (grub_xfs_iterate_dir): Change the type of BLK to
grub_uint64_t.
Call the hook with a NUL-terminated filename.
(grub_xfs_mount): Use grub_be_to_cpu32 instead of
grub_cpu_to_be32.
* kern/term.c (cursor_state): New variable.
(grub_term_set_current): Reset the cursor state on a new
terminal.
(grub_setcursor): Rewritten to use CURSOR_STATE.
(grub_getcursor): New function.
* include/grub/term.h (grub_getcursor): New prototype.
* io/gzio.c (test_header): Align BUF for accessing it as 32-bit
integers on ARM. Reported by Timothy Baldwin
<T.E.Baldwin99@members.leeds.ac.uk>.
Make GRUB's kernel compliant to Multiboot Specification.
* kern/i386/pc/startup.S (multiboot_header): New label.
(multiboot_entry): Likewise.
(multiboot_trampoline): Likewise.
* include/grub/i386/pc/kernel.h (GRUB_KERNEL_MACHINE_RAW_SIZE):
Increased to 0x4A0.
* fs/xfs.c (grub_xfs_iterate_dir): Fix a syntax error. You may not
put parentheses after a question mark.
[!GRUB_UTIL] (my_mod): New variable.
* util/grub-emu.c (main): Call grub_xfs_init and grub_xfs_fini.
* DISTLIST: Replaced boot/powerpc/ieee1275/crt0.S and
boot/powerpc/ieee1275/cmain.c with kern/powerpc/ieee1275/crt0.S
and kern/powerpc/ieee1275/cmain.c, respectively.
* boot/powerpc/ieee1275/crt0.S: Moved to ...
* kern/powerpc/ieee1275/crt0.S: ... here.
* boot/powerpc/ieee1275/cmain.c: Moved to ...
* kern/powerpc/ieee1275/cmain.c: ... here.
* conf/powerpc-ieee1275.rmk (grubof_SOURCES): Use
kern/powerpc/ieee1275/crt0.S and kern/powerpc/ieee1275/cmain.c
instead of boot/powerpc/ieee1275/crt0.S and
boot/powerpc/ieee1275/cmain.c, respectively.
* boot/i386/pc/boot.S (lba_mode): Do not store the total number of
sectors. It was not used anyway.
* configure.ac: Add support for sparc64 host with ieee1275
firmware.
* configure: Generated from configure.ac.
* disk/ieee1275/ofdisk.c (grub_ofdisk_open): Use grub_ssize_t
instead of int.
(grub_ofdisk_read): Likewise.
(grub_ofdisk_open): Use %p to print pointer values, and cast the
pointers as (void *) to remove a warning.
(grub_ofdisk_close): Likewise.
(grub_ofdisk_read): Likewise.
* kern/ieee1275/ieee1275.c (grub_ieee1275_exit): This never
returns, so make it return void to remove a warning.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_exit):
Corresponding prototype change.
* kern/mm.c (grub_mm_init_region): Use %p to print pointer
values, and cast the pointers as (void *) to remove a warning.
(grub_mm_dump): Likewise.
* conf/sparc64-ieee1275.mk: New file.
* conf/sparc64-ieee1275.rmk: Likewise.
* include/grub/sparc64/setjmp.h: Likewise.
* include/grub/sparc64/types.h: Likewise.
* include/grub/sparc64/ieee1275/console.h: Likewise.
* include/grub/sparc64/ieee1275/ieee1275.h: Likewise.
* include/grub/sparc64/ieee1275/kernel.h: Likewise.
* include/grub/sparc64/ieee1275/time.h: Likewise.
* kern/sparc64/cache.c: Likewise.
* kern/sparc64/dl.c: Likewise.
* kern/sparc64/ieee1275/init.c: Likewise.
* kern/sparc64/ieee1275/openfw.c: Likewise.
* util/console.c (grub_ncurses_putchar): If C is greater than
0x7f, set C to a question mark.
(grub_ncurses_getcharwidth): New function.
(grub_ncurses_term): Specify grub_ncurses_getcharwidth as
getcharwidth.
* normal/menu.c (print_entry): Made aware of Unicode. First,
convert TITLE to UCS-4, and predict the cursor position by
grub_getcharwidth.
* include/grub/misc.h (grub_utf8_to_ucs4): Specify the qualifier
const to SRC.
* kern/misc.c (grub_utf16_to_utf8): Likewise.
* partmap/pc.c (pc_partition_map_iterate): Include the value of an
invalid magic in thre error.
* commands/search.c: New file.
* util/grub-emu.c (main): Call grub_search_init and
grub_search_fini.
* kern/rescue.c (grub_rescue_print_disks): Removed.
(grub_rescue_print_devices): New function.
(grub_rescue_cmd_ls): Use grub_device_iterate with
grub_rescue_print_devices instead of grub_disk_dev_iterate with
grub_rescue_print_disks.
* kern/partition.c (grub_partition_iterate): Return the result of
PARTMAP->ITERATE instead of GRUB_ERRNO.
* kern/device.c: Include grub/partition.h.
(grub_device_iterate): New function.
* include/grub/partition.h (grub_partition_iterate): Return int
instead of grub_err_t.
* include/grub/normal.h [GRUB_UTIL] (grub_search_init): New
prototype.
[GRUB_UTIL] (grub_search_fini): Likewise.
* include/grub/device.h (grub_device_iterate): New prototype.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Added
commands/search.c.
(pkgdata_MODULES): Added search.mod.
(search_mod_SOURCES): New variable.
(search_mod_CFLAGS): Likewise.
* conf/i386-pc.rmk (grub_emu_SOURCES): Added commands/search.c.
(pkgdata_MODULES): Added search.mod.
(search_mod_SOURCES): New variable.
(search_mod_CFLAGS): Likewise.
* commands/ls.c (grub_ls_list_disks): Renamed to ...
(grub_ls_list_devices): ... this, and use grub_device_iterate.
All callers changed.
* DISTLIST: Added commands/search.c.
* kern/term.c (grub_putchar): Use grub_utf8_to_ucs4 for the
conversion.
(grub_getcharwidth): New function.
* kern/misc.c (grub_utf8_to_ucs4): New function.
* include/grub/term.h (struct grub_term): Added a new member
"getcharwidth".
(grub_getcharwidth): New prototype.
* include/grub/misc.h (grub_utf8_to_ucs4): New prototype.
* term/i386/pc/console.c (map_char): New function. Segregated from
grub_console_putchar.
(grub_console_putchar): Use map_char.
(grub_console_getcharwidth): New function.
(grub_console_term): Specified grub_console_getcharwidth as
getcharwidth.
* term/i386/pc/vga.c (grub_vga_getcharwidth): New function.
(grub_vga_term): Specified grub_vga_getcharwidth as getcharwidth.
* term/i386/pc/vesafb.c (grub_virtual_screen_setup): Return
GRUB_ERRNO.
(grub_vesafb_init): Do not use RC. Instead, use GRUB_ERRNO. Rely
on grub_strtoul completely.
(write_char): Declare local variables in the beginning of the
function.
(grub_vesafb_getcharwidth): New function.
(grub_vesafb_term): Specified grub_vesafb_getcharwidth as
getcharwidth.
* normal/misc.c: New file.
* DISTLIST: Added normal/misc.c.
* partmap/amiga.c (amiga_partition_map_iterate): Add an argument
DISK to HOOK. Call HOOK with DISK.
* partmap/apple.c (apple_partition_map_iterate): Likewise.
* partmap/pc.c (pc_partition_map_iterate): Likewise.
* partmap/sun.c (sun_partition_map_iterate): Likewise.
* normal/menu_entry.c (struct screen): Added a new member
"completion_shown".
(completion_buffer): New global variable.
(make_screen): Set SCREEN->COMPLETION_SHOWN to zero.
(store_completion): New function.
(complete): Likewise.
(clear_completions): Likewise.
(grub_menu_entry_run): If SCREEN->COMPLETION_SHOWN is non-zero,
call clear_completions and reset SCREEN->COMPLETION_SHOWN. If C is
a tab, call complete.
* normal/completion.c (disk_dev): Removed.
(print_simple_completion): Likewise.
(print_partition_completion): Likewise.
(print_func): New global variable.
(add_completion): Do not take the arguments WHAT or PRINT any
longer. Added a new argument TYPE. Instead of printing directly,
call PRINT_FUNC if not NULL.
All callers changed.
(complete_device): Use a local variable DEV instead of
DISK_DEV. Do not move CURRENT_WORD to the end of a device name.
(grub_normal_do_completion): Take a new argument HOOK. Do not
initialize DISK_DEV. Initialize PRINT_FUNC to HOOK. If RET is an
empty string, return NULL instead.
All callers changed.
* normal/cmdline.c (print_completion): New function.
* kern/partition.c (grub_partition_iterate): Add an argument DISK
to HOOK.
All callers changed.
* kern/disk.c (grub_print_partinfo): Removed.
* include/grub/partition.h (struct grub_partition_map): Add a new
argument DISK into HOOK of ITERATE.
(grub_partition_iterate): Add a new argument DISK to HOOK.
* include/grub/normal.h (enum grub_completion_type): New enum.
(grub_completion_type_t): New type.
(GRUB_COMPLETION_TYPE_COMMAND): New constant.
(GRUB_COMPLETION_TYPE_DEVICE): Likewise.
(GRUB_COMPLETION_TYPE_PARTITION): Likewise.
(GRUB_COMPLETION_TYPE_FILE): Likewise.
(grub_normal_do_completion): Added a new argument HOOK.
(grub_normal_print_device_info): New prototype.
* include/grub/disk.h (grub_print_partinfo): Removed.
* conf/i386-pc.rmk (grub_emu_SOURCES): Added normal/misc.c.
(normal_mod_SOURCES): Likewise.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise.
(normal_mod_SOURCES): Likewise.
* commands/ls.c (grub_ls_list_disks): Use
grub_normal_print_device_info instead of grub_print_partinfo. Free
PNAME.
(grub_ls_list_files): Use grub_normal_print_device_info instead of
duplicating the code.
* DISTLIST: Added normal/completion.c.
* normal/completion.c: New file.
* term/i386/pc/console.c (grub_console_getwh): New function.
(grub_console_term): Assign grub_console_getwh to getwh.
* normal/cmdline.c (grub_tab_complete): Removed. Now the same
function is defined in normal/completion.c as
grub_normal_do_completion.
(grub_cmdline_get): Use grub_normal_do_completion instead of
grub_tab_complete.
* kern/partition.c (grub_partition_map_iterate): Return 1 if HOOK
returns non-zero, otherwise return 0.
(grub_partition_iterate): First, probe the partition map. Then,
call ITERATE only for this partition map.
* kern/misc.c (grub_strncmp): Rewritten.
* kern/disk.c (grub_disk_dev_iterate): Return 1 if P->ITERATE
returns non-zero. Otherwise return 0.
* include/grub/partition.h (grub_partition_map_iterate): Return
int instead of void.
* include/grub/normal.h (grub_normal_do_completion): New prototype.
* include/grub/misc.h (grub_strncmp): Change the type of N to
grub_size_t.
* include/grub/disk.h (grub_disk_dev_iterate): Return int instead
of void.
* normal/menu.c (draw_border): Cast GRUB_TERM_BORDER_WIDTH to
unsigned explictly before comparing it with I.
* kern/main.c (grub_env_write_root): Add the attribute unused into
VAR.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Added
normal/completion.c.
(normal_mod_SOURCES): Likewise.
* conf/i386-pc.rmk (grub_emu_SOURCES): Likewise.
(normal_mod_SOURCES): Likewise.
* normal/command.c (grub_iterate_commands): If ITERATE returns
non-zero, return one immediately.
* kern/rescue.c (grub_rescue_cmd_rmmod): If the reference count is
negative, unload the module.
* util/i386/pc/grub-setup.c (setup): The name of the PC partition
map is "pc_partition_map" but not "pc".
(usage): Fix the description. The options are --boot-image and
--core-image but not --boot-file or --core-file.
(main): If not specified explicitly, make BOOT_FILE and CORE_FILE
based on DEFAULT_BOOT_FILE and DEFAULT_CORE_FILE with DIR or
DEFAULT_DIRECTORY.
* util/i386/pc/grub-install.in: Do not specify --boot-file or
--core-file. Specify INSTALL_DEVICE as an argument.
* util/console.c: Include config.h.
[HAVE_NCURSeS_CURSES_H]: Include ncurses/curses.h.
[HAVE_NCURSES_H]: Include ncurses.h.
[HAVE_CURSES_H]: Include curses.h.
[!A_NORMAL] (A_NORMAL): Defined as zero.
[!A_STANDOUT] (A_STANDOUT): Likewise.
* conf/i386-pc.rmk (grub_emu_LDFLAGS): Use $(LIBCURSES) instead of
-lncurses.
* conf/powerpc-ieee1275.rmk (grub_emu_LDFLAGS): Likewise.
* configure.ac: Check for curses libraries and headers.
* Makefile.in (LIBCURSES): New variable.
* genmk.rb (Script::rule): Set the executable bits.
* util/i386/pc/biosdisk.c (grub_util_biosdisk_get_grub_dev): The
name of the PC partition map is "pc_partition_map" but not "pc".
* kern/term.c (grub_putcode): Use `grub_getwh' instead of
hardcoded value.
From Vincent Pelletier <subdino2004@yahoo.fr>
* include/grub/term.h (GRUB_TERM_WIDTH, GRUB_TERM_HEIGHT):
Redefined to use grub_getwh.
(grub_term): New member named getwh.
(grub_getwh): New prototype.
* kern/term.c (grub_getwh): New function.
* term/i386/pc/console.c (grub_console_getwh): New function.
(grub_console_term): New member `getwh'.
* term/i386/pc/vga.c (grub_vga_getwh): New function.
(grub_vga_term): New member `getwh'.
* term/sparc64/ofconsole.c (grub_ofconsole_readkey): Use
grub_ssize_t.
(grub_ofconsole_getw): New function.
(grub_ofconsole_init): Use grub_ssize_t and unsigned char.
(grub_ofconsole_term): New field named getwh and new initial
value.
* include/grub/powerpc/ieee1275/ieee1275.h: Move ...
* include/grub/ieee1275/ieee1275.h: ... to here. All users updated.
Move `abort', `grub_reboot', and `grub_halt' prototypes ...
* include/grub/powerpc/ieee1275/kernel.h: ... to here.
* commands/ieee1275/halt.c: Include <grub/machine/kernel.h> instead
of <grub/machine/ieee1275.h>.
* commands/ieee1275/reboot.c: Likewise.
* boot/powerpc/ieee1275/ieee1275.c: Move ...
* kern/ieee1275.c: ... to here. All users updated. Change all
parameter structs to use new type `grub_ieee1275_cell_t'.
* term/powerpc/ieee1275/ofconsole.c: Move ...
* term/ieee1275/ofconsole.c: ... to here. All users updated.
* disk/powerpc/ieee1275/ofdisk.c: Move ...
* disk/ieee1275/ofdisk.c: ... to here. All users updated.
* boot/powerpc/ieee1275/cmain.c: Change `grub_ieee1275_entry_fn' type
to return int.
* include/grub/i386/pc/console.h: Move to include/grub/console.h.
Remove unused prototypes. All users updated.
* include/grub/powerpc/ieee1275/console.h: Removed.
* include/grub/powerpc/ieee1275/ieee1275.h: Define
`grub_ieee1275_cell_t'.
* kern/powerpc/ieee1275/openfw.c: Include <grub/machine/kernel.h>.
Cast comparisons with -1 to the correct type.
* loader/powerpc/ieee1275/linux.c (kernel_entry_t): Change parameter
type to match `grub_ieee1275_entry_fn'.
* loader/i386/pc/multiboot.c (grub_multiboot_is_elf32): New
function.
(grub_multiboot_load_elf32): Likewise.
(grub_multiboot_is_elf64): Likewise.
(grub_multiboot_load_elf64): Likewise.
(grub_multiboot_load_elf): Likewise.
(grub_rescue_cmd_multiboot): Call grub_multiboot_load_elf to load
an ELF32 or ELF64 file.
This is based on a patch from Ruslan Nikolaev <nruslan@mail.com>.
From Serbinenko Vladimir <serbinenko.vova@list.ru>:
* kern/disk.c (grub_print_partinfo): Check if FS->LABEL is not
NULL before calling FS->LABEL.
* fs/fat.c (grub_fat_dir): Initialize DIRNAME to NULL.
* commands/ls.c (grub_ls_list_files): Show labels, if possible.
(grub_ls_list_disks): Check if FS and FS->LABEL are not NULL
before calling FS->LABEL.
Change the semantics of variable hooks. They now return strings
instead of error values.
* util/i386/pc/grub-setup.c: Include grub/env.h.
(setup): Use grub_device_set_root instead of grub_env_set.
* kern/rescue.c (grub_rescue_cmd_root): Use grub_env_set and
grub_env_get instead of grub_device_set_root and
grub_device_get_root, respectively.
* kern/main.c (grub_env_write_root): New function.
(grub_set_root_dev): Register grub_env_write_hook for "root". Use
grub_env_set instead of grub_device_set_root.
* kern/env.c (HASHSZ): Reduced to 13, because GRUB does not need
many variables.
(grub_env_set): Set ENV->VALUE to the result of ENV->WRITE_HOOK
rather than calling ENV->WRITE_HOOK afterwards.
(grub_env_get): Return the result of ENV->READ_HOOK rather than
passing a pointer of a pointer.
(grub_register_variable_hook): Change the types of "read_hook" and
"write_hook" to grub_env_read_hook_t and grub_env_write_hook_t,
respectively.
Allocate the default empty string on the heap, because this string
may be freed later.
* kern/device.c: Include grub/env.h.
(grub_device_set_root): Removed.
(grub_device_get_root): Likewise.
(grub_device_open): Use grub_env_get instead of
grub_device_get_root.
* include/grub/env.h (grub_env_read_hook_t): New type.
(grub_env_write_hook_t): Likewise.
(grub_env_var): Change the types of "read_hook" and "write_hook"
to grub_env_read_hook_t and grub_env_write_hook_t, respectively.
(grub_register_variable_hook): Likewise.
* include/grub/device.h (grub_device_set_root): Removed.
(grub_device_set_root): Likewise.
* fs/fat.c (grub_fat_dir): Make a copy of PATH in DIRNAME, and
make sure that DIRNAME terminates with '/', so that
grub_fat_find_dir will fail if PATH is not a directory.
* commands/ls.c (grub_ls_list_files): Remove the qualifier const
from DIRNAME.
Use the qualifier auto for print_files and print_files_long.
If FS->DIR sets GRUB_ERRNO to GRUB_ERR_BAD_FILE_TYPE, try DIRNAME
as a regular file.
Put a newline only if there is no error.
(grub_cmd_ls): Remove grub_ls_print_files, because this is not
used.
* kern/i386/pc/startup.S (gate_a20_try_system_control_port_a):
When turning off Gate A20, skip the check and return immediately,
because this is not fatal usually.