* conf/common.rmk (grub_script.tab.c): Change normal/parser.y to
script/sh/parser.y.
(pkglib_MODULES): Add normal.mod and sh.mod.
(normal_SOURCES): New variable.
(normal_mod_CFLAGS): Likewise.
(normal_mod_LDFLAGS): Likewise.
(sh_mod_SOURCES): Likewise.
(sh_mod_CFLAGS): Likewise.
(sh_mod_LDFLAGS): Likewise.
* conf/i386-pc.rmk (normal/lexer.c_DEPENDENCIES): Changed to
script/sh/lexer.c_DEPENDENCIES.
(kernel_img_SOURCES): Remove kern/rescue.c, and kern/reader.c,
kern/rescue_reader.c and kern/rescue_parser.c.
(kernel_img_HEADERS): Remove rescue.h, add reader.h.
(grub_emu_SOURCES): Change source files.
(pkglib_MODULES): Remove normal.mod.
(normal_SOURCES): Removed.
(normal_mod_CFLAGS): Likewise.
(normal_mod_LDFLAGS): Likewise.
* conf/i386-coreboot.rmk: Likewise.
* conf/i386-efi.rmk: Likewise.
* conf/i386-ieee1276.rmk: Likewise.
* conf/powerpc-ieee1275.rmk: Likewise.
* conf/sparc64-ieee1275.rmk: Likewise.
* conf/x86_64-efi.rmk: Likewise.
* include/grub/command.h (grub_command_execute): New inline function.
* include/grub/menu.h (grub_menu_entry): Removed commands field.
* include/grub/normal.h: Remove <grub/setjmp.h>.
(grub_fs_module_list): Moved to normal/autofs.c.
(grub_exit_env): Removed.
(grub_command_execute): Likewise.
(grub_normal_menu_addentry): Renamed to grub_menu_addentry, removed
parameter script.
(read_command_list): New function declaration.
(read_fs_list): Likewise.
* include/parser.h: Include <grub/reader.h>.
(grub_parser_split_cmdline): Change type of getline parameter.
(grub_parser): New structure.
(grub_parser_class): New variable.
(grub_parser_execute): New function declaration.
(grub_register_rescue_parser): Likewise.
(grub_parser_register): New inline function.
(grub_parser_unregister): Likewise.
(grub_parser_get_current): Likewise.
(grub_parser_set_current): Likewise.
* include/grub/reader.h: New file.
* kern/reader.c: Likewise.
* kern/rescue_parser.c: Likewise.
* kern/rescue_reader.c: Likewise.
* normal/autofs.c: Likewise.
* normal/dyncmd.c: Likewise.
* include/grub/rescue.h: Removed.
* normal/command.h: Likewise.
* include/grub/script.h: Moved to ...
* include/grub/script_sh.h: ... Moved here.
* normal/execute.c: Moved to ...
* script/sh/execute.c: ... Moved here.
* normal/function.c: Moved to ...
* script/sh/function.c: ... Moved here.
* normal/lexer.c: Moved to ...
* script/sh/lexer.c: ... Moved here.
* normal/parser.y: Moved to ...
* script/sh/parser.y: ... Moved here.
* normal/script.c: Moved to ...
* script/sh/script.c: ... Moved here.
* normal/main.c: Remove <grub/rescue.h> and <grub/script.h>, include
<grub/reader.h>.
(grub_exit_env): Removed.
(fs_module_list): Moved to normal/autofs.c.
(grub_file_getline): Don't handle comment here.
(free_menu): Skip removed field entry->commands.
(grub_normal_menu_addentry): Removed as grub_menu_entry, removed
script parameter.
(read_config_file): Removed nested parameter, change getline function.
(grub_enter_normal_mode): Removed.
(grub_dyncmd_dispatcher): Moved to normal/dyncmd.c.
(read_command_list): Likewise.
(autoload_fs_module): Moved to normal/autofs.c.
(read_fs_list): Likewise.
(reader_nested): New variable.
(grub_normal_execute): Run parser.sh to switch to sh parser.
(grub_cmd_rescue): Removed.
(cmd_normal): Removed.
(grub_cmd_normal): Unregister itself at the beginning. Don't register
rescue command.
(grub_cmdline_run): New function.
(grub_normal_reader_init): Likewise.
(grub_normal_read_line): Likewise.
(grub_env_write_pager): Likewise.
(cmdline): New variable.
(grub_normal_reader): Likewise.
(GRUB_MOD_INIT): Register normal reader and set as current, register
pager hook, register normal command with grub_register_command_prio,
so that it won't show up in command.lst.
(GRUB_MOD_FINI): Unregister normal reader, unhook pager, clear
grub_fs_autoload_hook.
* normal/menu.c: Remove <grub/script.h>, add <grub/command.h>.
(grub_menu_execute_entry): Replace grub_script_execute with
grub_parser_execute, change parameter to grub_command_execute.
* normal/menu_text.c: Remove <grub/script.h>.
* normal/menu_entry.c: Remove <grub/script.h>, add <grub/command.h>
and <grub/parser.h>.
(run): Change editor_getline to use new parser interface. Change
parameter to grub_command_execute.
* kern/main.c: Remove <grub/rescue.h>, include <grub/command.h>,
<grub/reader.h> and <grub/parser.h>.
(grub_load_normal_mode): Execute normal command.
(grub_main): Call grub_register_core_commands,
grub_register_rescue_parser and grub_register_rescue_reader, use
grub_reader_loop to enter input loop.
* kern/parser.c (grub_parser_spli_cmdline): Change type of getline
parameter.
(grub_parser_class): New variable.
(grub_parser_execute): New function.
* loader/i386/multiboot.c: Remove <grub/rescue.h>.
* loader/multiboot2.c: Likewise.
* loader/sparc64/ieee1275/linux.c: Likewise.
* util/grub-emu.c (read_command_list): New dummy function.
* util/sparc64/ieee1275/grub-setup.c: New file.
* util/sparc64/ieee1275/grub-ofpathname.c: New file.
* util/sparc64/ieee1275/grub-mkimage.c: New file.
* util/sparc64/ieee1275/grub-install.in: New file.
* util/ieee1275/ofpath.c: New file.
* util/ieee1275/devicemap.c: New file.
* util/devicemap.c: New file.
* util/deviceiter.c: New file.
* kern/sparc64/ieee1275/init.c: New file.
* include/grub/util/ofpath.h: New file.
* include/grub/util/deviceiter.h: New file.
* util/grub-mkdevicemap.c: Include deviceiter.h.
Implement using grub_util_emit_devicemap_entry and
grub_util_iterate_devices.
* conf/i386-corebook.rmk: Build util/deviceiter.c and
util/devicemap.c into grub-mkdevicemap
* conf/i386-efi.rmk: Likewise.
* conf/i386-ieee1275.rmk: Likewise.
* conf/i386-pc.rmk: Likewise.
* conf/powerpc-ieee1275.rmk: Likewise.
* conf/sparc64-ieee1275.rmk: Add rules to build boot block
images and installation utilities. Build kernel as image
instead of as elf binary. Use common rules as much as possible.
Support for mtime and further expandability of dir command
* include/grub/lib/datetime.h: moved to ...
* include/grub/datetime.h: ... moved here and added
declaration of grub_unixtime2datetime. All users updated
* include/grub/fs.h: new syntax for dir and mtime functionin
struct grub_fs
* include/grub/fshelp.h: new declarations of GRUB_FSHELP_TYPE_MASK
and GRUB_FSHELP_FLAGS_MASK
* commands/ls.c (grub_ls_list_files): Write mtime in long format
* fs/ext2.c (grub_ext2_dir): use new dir syntax and supply mtime
(grub_ext2_mtime): new function
* fs/hfsplus.c (grub_hfsplus_dir): use new dir syntax and supply mtime
(grub_hfsplus_mtime): new function
* fs/ufs.c (GRUB_UFS_ATTR_TYPE): new definition
(GRUB_UFS_ATTR_FILE): likewise
(GRUB_UFS_ATTR_LNK): likewise
(struct grub_ufs_sblock): new fields mtime
(grub_ufs_read_inode): new parameter to read inode to a separate buffer
all users updated
(grub_ufs_dir): mtime support
(grub_ufs_mtime): new function
* fs/affs.c (grub_affs_dir): use new dir syntax
* fs/afs.c (grub_afs_dir): likewise
* fs/cpio.c (grub_cpio_dir): likewise
* fs/fat.c (grub_fat_find_dir): likewise
* fs/hfs.c (grub_hfs_dir): likewise
* fs/iso9660.c (grub_iso9660_dir): likewise
* fs/jfs.c (grub_jfs_dir): likewise
* fs/minix.c (grub_minix_dir): likewise
* fs/ntfs.c (grub_ntfs_dir): likewise
* fs/reiserfs.c (grub_reiserfs_dir): likewise
* fs/sfs.c (grub_sfs_dir): likewise
* fs/xfs.c (grub_xfs_dir): likewise
* util/hostfs.c (grub_hostfs_dir): likewise
* lib/datetime.c: moved to ...
* normal/datetime.c: ... moved here
(grub_unixtime2datetime): new function
* kern/rescue.c (grub_rescue_print_files): use new dir syntax
* normal/completition.c (iterate_dir): use new dir syntax
* normal/misc.c (grub_normal_print_device_info): tell the
last modification time of a volume
* kern/fs.c (grub_fs_probe): updated dummy function to use new syntax
* conf/common.rmk: added lib/datetime.c to ls.mod
* conf/i386-coreboot.rmk (grub_emu_SOURCES): add normal/datetime.c
(normal_mod_SOURCES): likewise
(datetime_mod_SOURCES): Removed lib/datetime.c
* conf/i386-efi.rmk: likewise
* conf/i386-ieee1275.rmk: likewise
* conf/i386-pc.rmk: likewise
* conf/powerpc-ieee1275.rmk: likewise
* conf/sparc64-ieee1275.rmk: likewise
* conf/x86_64-efi.rmk: likewise
Support multiple fallback entries, and provide an API to support
executing default+fallback menu entries. Renamed the `terminal' menu
viewer to `text'.
* include/grub/normal.h (grub_normal_text_menu_viewer): New global
variable declaration.
(grub_menu_execute_callback): New structure declaration.
(grub_menu_execute_callback_t): New typedef.
(grub_menu_execute_with_fallback): New function declaration.
(grub_menu_get_entry): Likewise.
(grub_menu_get_timeout): Likewise.
(grub_menu_set_timeout): Likewise.
* normal/main.c (GRUB_MOD_INIT(normal)): Refer to new variable name.
* normal/menu.c (grub_wait_after_message): Moved to
`normal/menu_text.c'.
(draw_border): Likewise.
(print_message): Likewise.
(print_entry): Likewise.
(print_entries): Likewise.
(grub_menu_init_page): Likewise.
(get_entry_number): Likewise.
(print_timeout): Likewise.
(run_menu): Likewise.
(grub_menu_execute_entry): Likewise.
(show_text_menu): Likewise.
(get_and_remove_first_entry_number): New function.
(grub_menu_execute_with_fallback): Likewise.
(get_entry): Renamed to ...
(grub_menu_get_entry): .. this and made it global.
(get_timeout): Renamed to ...
(grub_menu_get_timeout): ... this and made it global.
(set_timeout): Renamed to ...
(grub_menu_set_timeout): ... this and made it global.
(grub_normal_terminal_menu_viewer): Renamed to ...
(grub_normal_text_menu_viewer): ... this.
* normal/menu_text.c: New file. Extracted text-menu-specific code
from normal/menu.c.
* conf/i386-coreboot.rmk (grub_emu_SOURCES): Add `normal/menu_text.c'.
(normal_mod_SOURCES): Likewise.
* conf/i386-efi.rmk (grub_emu_SOURCES): Likewise.
(normal_mod_SOURCES): Likewise.
* conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise.
(normal_mod_SOURCES): Likewise.
* conf/i386-pc.rmk, (grub_emu_SOURCES): Likewise.
(normal_mod_SOURCES): Likewise.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise.
(normal_mod_SOURCES): Likewise.
* conf/sparc64-ieee1275.rmk (grub_emu_SOURCES): Likewise.
(normal_mod_SOURCES): Likewise.
* conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise.
(normal_mod_SOURCES): Likewise.
* normal/main.c: Add include to grub/menu_viewer.h.
(free_menu_entry_classes): Added.
(grub_normal_menu_addentry): Added class property handling.
(grub_normal_execute): Changed to use new menu viewer for menu viewing.
(GRUB_MOD_INIT(normal)): Added register for text based menu viewer.
* normal/menu_viewer.c: New file.
* normal/menu.c (run_menu_entry): Renamed to ...
(grub_menu_execute_entry): ... this and made it as global.
(grub_menu_run): Renamed to ...
(show_text_menu): ... this and made it local.
(show_text_menu): Adapt to new function names.
(grub_normal_terminal_menu_viewer): New global variable.
* include/grub/menu.h: New file.
* include/grub/menu_viewer.h: New file.
* include/grub/normal.h: Added include to grub/menu.h.
(grub_menu_entry): Moved to include/grub/menu.h.
(grub_menu_entry_t): Likewise.
(grub_menu): Likewise.
(grub_menu_t): Likewise.
(grub_normal_terminal_menu_viewer): Added.
(grub_menu_execute_entry): Likewise.
(grub_menu_run): Removed.
* DISTLIST: Added include/grub/menu.h.
Added include/grub/menu_viewer.h.
Added normal/menu_viewer.c.
2009-01-31 Vesa Jääskeläinen <chaac@nic.fi>
* normal/execute.c (grub_script_execute_menuentry): Changed to use
arglist for menutitle arguments.
* normal/main.c (grub_normal_menu_addentry): Likewise.
* normal/parser.y (menuentry): Likewise.
* normal/script.c (grub_script_create_cmdmenu): Likewise.
* include/grub/script.h (grub_script_cmd_menuentry): Likewise.
(grub_script_create_cmdmenu): Likewise.
* include/grub/normal.h (grub_normal_menu_addentry): Likewise.
* conf/i386-pc.rmk (normal_mod_SOURCES): Adapt Colin D Bennett's
changes.
* conf/x86_64-efi.rmk (normal_mod_SOURCES): Likewise.
* conf/i386-coreboot.rmk (normal_mod_SOURCES): Likewise.
* conf/i386-efi.rmk (normal_mod_SOURCES): Likewise.
* conf/i386-ieee1275.rmk (normal_mod_SOURCES): Likewise.
* conf/powerpc-ieee1275.rmk (normal_mod_SOURCES): Likewise.
* conf/sparc64-ieee1275.rmk (normal_mod_SOURCES): Likewise.
grub_machine_mmap_iterate() interface (fixes a recently-introduced
build problem on i386-ieee1275):
* kern/ieee1275/openfw.c (grub_available_iterate): Moved from here ...
* kern/ieee1275/mmap.c (grub_machine_mmap_iterate): ... here. Add third
parameter `type'. Update all users of this function.
* conf/i386-ieee1275.rmk (kernel_elf_SOURCES): Add
`kern/ieee1275/mmap.c'.
* kern/ieee1275/init.c
* include/grub/ieee1275/ieee1275.h (grub_available_iterate): Replace
with ...
(grub_machine_mmap_iterate): ... this.
* include/grub/i386/pc/memory.h (grub_machine_mmap_iterate): Change
return type to `grub_err_t'. Update all implementations of this
function prototype.
* include/grub/i386/coreboot/memory.h (grub_machine_mmap_iterate):
Likewise.
Modularize at_keyboard.mod:
* conf/i386.rmk (pkglib_MODULES): Add `at_keyboard.mod'.
(at_keyboard_mod_SOURCES, at_keyboard_mod_CFLAGS)
(at_keyboard_mod_LDFLAGS): New variables.
Actual terminal split:
* include/grub/term.h (struct grub_term): Split in ...
(struct grub_term_input): ... this, and ...
(struct grub_term_output): ... this. Update all users.
(grub_term_set_current): Split in ...
(grub_term_set_current_input): ... this, and ...
(grub_term_set_current_output): ... this.
(grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
(grub_term_register): Split in ...
(grub_term_register_input): ... this, and ...
(grub_term_register_output): ... this.
(grub_term_unregister): Split in ...
(grub_term_unregister_input): ... this, and ...
(grub_term_unregister_output): ... this.
(grub_term_iterate): Split in ...
(grub_term_iterate_input): ... this, and ...
(grub_term_iterate_output): ... this.
* kern/term.c (grub_term_list): Split in ...
(grub_term_list_input): ... this, and ...
(grub_term_list_output): ... this. Update all users.
(grub_cur_term): Split in ...
(grub_cur_term_input): ... this, and ...
(grub_cur_term_output): ... this. Update all users.
(grub_term_set_current): Split in ...
(grub_term_set_current_input): ... this, and ...
(grub_term_set_current_output): ... this.
(grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
(grub_term_register): Split in ...
(grub_term_register_input): ... this, and ...
(grub_term_register_output): ... this.
(grub_term_unregister): Split in ...
(grub_term_unregister_input): ... this, and ...
(grub_term_unregister_output): ... this.
(grub_term_iterate): Split in ...
(grub_term_iterate_input): ... this, and ...
(grub_term_iterate_output): ... this.
* kern/misc.c (grub_abort): Split use of grub_term_get_current() into
a check for input and one for output (and only attempt to get keys
from user when input works).
* util/grub-probe.c (grub_term_get_current): Split in ...
(grub_term_get_current_input): ... this, and ...
(grub_term_get_current_output): ... this.
* util/grub-fstest.c: Likewise.
* util/i386/pc/grub-setup.c: Likewise.
* util/grub-editenv.c: Likewise.
Portability adjustments:
* conf/i386-ieee1275.rmk (kernel_elf_SOURCES): Remove
`term/i386/pc/at_keyboard.c'.
* kern/ieee1275/init.c [__i386__] (grub_machine_init): Remove call to
grub_keyboard_controller_init() (now handled by terminal .init).
* kern/i386/coreboot/init.c (grub_machine_init): Add call to
grub_at_keyboard_init().
* include/grub/i386/ieee1275/console.h (grub_keyboard_controller_init)
(grub_console_checkkey, grub_console_getkey): Remove (now provided by
at_keyboard.mod via input terminal interface).
* include/grub/i386/coreboot/console.h: Convert into a stub for
`<grub/i386/pc/console.h>'.
Migrate full terminals to new API:
* term/efi/console.c (grub_console_term): Split into ...
(grub_console_term_input): ... this, and ...
(grub_console_term_output): ... this. Update all users.
* term/ieee1275/ofconsole.c: Remove __i386__ hack.
(grub_ofconsole_init): Split into ...
(grub_ofconsole_init_input): ... this, and ...
(grub_ofconsole_init_output): ... this.
(grub_ofconsole_term): Split into ...
(grub_ofconsole_term_input): ... this, and ...
(grub_ofconsole_term_output): ... this. Update all users.
* term/i386/pc/serial.c (grub_serial_term): Split into ...
(grub_serial_term_input): ... this, and ...
(grub_serial_term_output): ... this. Update all users.
* term/i386/pc/console.c (grub_console_term): Split into ...
(grub_console_term_input): ... this, and ...
(grub_console_term_output): ... this. Update all users.
(grub_console_term_input): Only enable it on PC/BIOS platform.
(grub_console_init): Remove grub_keyboard_controller_init() call.
Migrate input terminals to new API:
* term/i386/pc/at_keyboard.c: Replace `cpu' and `machine' with
`i386' and `i386/pc' to enable build on x86_64 (this driver is
i386-specific anyway).
(grub_console_checkkey): Rename to ...
(grub_at_keyboard_checkkey): ... this. Static-ize. Update all
users.
(grub_keyboard_controller_orig): New variable.
(grub_console_getkey): Rename to ...
(grub_at_keyboard_getkey): ... this. Static-ize. Update all
users.
(grub_keyboard_controller_init): Static-ize. Save original
controller value so that it can be restored ...
(grub_keyboard_controller_fini): ... here (new function).
(grub_at_keyboard_term): New structure.
(GRUB_MOD_INIT(at_keyboard), GRUB_MOD_FINI(at_keyboard)): New
functions.
Migrate output terminals to new API:
* term/i386/pc/vga.c (grub_vga_term): Change type to
`struct grub_term_output'. Remove `.checkkey' and `.getkey'
members. Update all users.
* term/gfxterm.c (grub_video_term): Change type to
`struct grub_term_output'. Remove `.checkkey' and `.getkey'
members. Update all users.
* include/grub/i386/pc/console.h (grub_console_checkkey)
(grub_console_getkey): Do not export (no longer needed by gfxterm,
etc).
Migrate `terminal' command and userland tools to new API:
* commands/terminal.c (grub_cmd_terminal): Split into ...
(grub_cmd_terminal_input): ... this, and ...
(grub_cmd_terminal_output): ... this.
(GRUB_MOD_INIT(terminal)): Split `terminal' command in two commands:
`terminal_input' and `terminal_output'.
* util/grub.d/00_header.in: Adjust `terminal' calls to new
`terminal_input' / `terminal_output' API.
* util/grub-mkconfig.in: Export ${GRUB_TERMINAL_INPUT} and
${GRUB_TERMINAL_OUTPUT} instead of ${GRUB_TERMINAL} (and if user
provided ${GRUB_TERMINAL}, convert it).
* conf/common.rmk (grub_probe_SOURCES): Add disk/mdraid_linux.c.
(grub_fstest_SOURCES): Add disk/raid5_recover.c, disk/raid6_recover.c,
disk/mdraid_linux.c and disk/dmraid_nvidia.c and lib/crc.c.
(pkglib_MODULES): Add raid5rec.mod, raid6rec.mod, mdraid.mod and
dm_nv.mod.
(raid5rec_mod_SOURCES): New macro.
(raid5rec_mod_CFLAGS): Likewise.
(raid5rec_mod_LDFLAGS): Likewise.
(raid6rec_mod_SOURCES): Likewise.
(raid6rec_mod_CFLAGS): Likewise.
(raid6rec_mod_LDFLAGS): Likewise.
(mdraid_mod_SOURCES): Likewise.
(mdraid_mod_CFLAGS): Likewise.
(mdraid_mod_LDFLAGS): Likewise.
(dm_nv_mod_SOURCES): Likewise.
(dm_nv_mod_CFLAGS): Likewise.
(dm_nv_mod_LDFLAGS): Likewise.
* conf/i386-pc.rmk (grub_setup_SOURCES): Add disk/mdraid_linux.c.
(grub_emu_SOURCES): Add disk/raid5_recover.c, disk/raid6_recover.c,
disk/mdraid_linux.c and disk/dmraid_nvidia.c.
* conf/i386-coreboot.rmk (grub_emu_SOURCES): Add disk/raid5_recover.c,
disk/raid6_recover.c, disk/mdraid_linux.c and disk/dmraid_nvidia.c.
* conf/i386-efi.rmk (grub_emu_SOURCES): Likewise.
* conf/x86_64-efi.rmk (grub_emu_SOURCES): Likewise.
* conf/i386-ieee1275.rmk (grub_emu_SOURCES): Likewise.
* conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Likewise.
* disk/raid5_recover.c: New file.
* disk/raid6_recover.c: Likewise.
* disk/mdraid_linux.c: Likewise.
* disk/dmraid_nvidia.c: Likewise.
* disk/i386/pc/biosdisk.c: Set total_sectors of cdrom device to
ULONG_MAX.
* disk/raid.c (grub_raid_open): Use the size of the smallest disk to
calculate the size of raid device.
(grub_raid_read): Simplify raid0 code. Support raid4, raid6 and four
different layout of raid5.
(grub_raid_scan_device): Remove code specific to mdraid.
(grub_raid_list): New variable.
(free_array): New function.
(grub_raid_register): Likewise.
(grub_raid_unregister): Likewise.
(grub_raid_rescan): Likewise.
(GRUB_MOD_INIT): Don't iterate device here.
(GRUB_MOD_FINI): Use free_array to release resource.
* include/grub/raid.h: Remove macro and structure specific to mdraid.
(grub_raid5_recover_func_t): New function variable type.
(grub_raid6_recover_func_t): Likewise.
(grub_raid5_recover_func): New variable.
(grub_raid6_recover_func): Likewise.
(grub_raid_register): New function.
(grub_raid_unregister): Likewise.
(grub_raid_rescan): Likewise.
(grub_raid_block_xor): Likewise.
* util/grub-fstest.c: Add #include <grub/raid.h> and <grub/lib/crc.h>.
(CMD_CRC): New macro.
(part): Removed.
(read_file): Handle device as well as file.
(cmd_crc): New function.
(fstest): Handle multiple disks.
(options): Remove part, raw and long, add root and diskcount.
(usage): Add crc, remove -p, -r, -l, add -r and -c.
(main): Find the first non option entry and ignore subsequence options,
add handling for the new options, support multiple disks.
* util/grub-probe.c (probe): Add mdraid to abstraction_name.
High resolution timer support. Implemented for x86 CPUs using TSC.
Extracted generic grub_millisleep() so it's linked in only as needed.
This requires a Pentium compatible CPU; if the RDTSC instruction is
not supported, then it falls back on the generic grub_get_time_ms()
implementation that uses the machine's RTC.
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `kern/time.c',
`kern/i386/tsc.c', `kern/generic/rtc_get_time_ms.c' and
`kern/generic/millisleep.c'.
* conf/i386-efi.rmk (kernel_mod_SOURCES): Add `kern/i386/tsc.c',
`kern/generic/rtc_get_time_ms.c' and `kern/generic/millisleep.c'.
* conf/x86_64-efi.rml (kernel_mod_SOURCES): Add
`kern/generic/millisleep.c' and `kern/generic/rtc_get_time_ms.c'.
* conf/sparc64-ieee1275.rmk (kernel_elf_SOURCES): Likewise.
* conf/powerpc-ieee1275.rmk (kernel_elf_SOURCES): Add
`kern/generic/millisleep.c'.
* conf/i386-ieee1275.rmk (kernel_elf_SOURCES): Likewise.
* conf/i386-coreboot.rmk (kernel_elf_SOURCES): Add `kern/time.c'.
* kern/generic/rtc_get_time_ms.c: New file.
* kern/generic/millisleep.c: New file.
* kern/misc.c: Don't include
<kern/time.h> anymore.
(grub_millisleep_generic): Removed.
* commands/sleep.c (grub_interruptible_millisleep): Uses
grub_get_time_ms() instead of grub_get_rtc().
* include/grub/i386/tsc.h (grub_get_tsc): New file. New inline
function.
(grub_cpu_is_cpuid_supported): New inline function.
(grub_cpu_is_tsc_supported): New inline function.
(grub_tsc_init): New function prototype.
(grub_tsc_get_time_ms): New function prototype.
* kern/i386/tsc.c (grub_get_time_ms): New file.
* include/grub/time.h: Include <grub/types.h.
(grub_millisleep_generic): Removed.
(grub_get_time_ms): New prototype.
(grub_install_get_time_ms): New prototype.
(grub_rtc_get_time_ms): New prototype.
* kern/time.c (grub_get_time_ms): New function.
(grub_install_get_time_ms): New function.
* kern/i386/efi/init.c: Include <grub/cpu/tsc.h>. Don't include
<grub/time.h> anymore.
(grub_millisleep): Removed.
(grub_machine_init): Call grub_tsc_init.
* kern/i386/linuxbios/init.c (grub_machine_init): Install the RTC
get_time_ms() implementation.
* kern/sparc64/ieee1275/init.c (grub_millisleep): Removed.
(ieee1275_get_time_ms): New function.
(grub_machine_init): Install get_time_ms() implementation.
* kern/i386/pc/init.c: Include <grub/cpu/tsc.h>.
(grub_machine_init): Call grub_tsc_init().
(grub_millisleep): Removed.
* kern/ieee1275/init.c (grub_millisleep): Removed.
(grub_machine_init): Install ieee1275_get_time_ms()
implementation.
(ieee1275_get_time_ms): New function.
(grub_get_rtc): Now calls ieee1275_get_time_ms(), which does the
real work.
* disk/memdisk.c (memdisk_size): Don't initialize.
(GRUB_MOD_INIT(memdisk)): Find memdisk using grub_module_iterate().
* include/grub/i386/pc/kernel.h
(GRUB_KERNEL_MACHINE_MEMDISK_IMAGE_SIZE): Remove macro.
(GRUB_KERNEL_MACHINE_PREFIX, GRUB_KERNEL_MACHINE_DATA_END): Shift.
(grub_memdisk_image_size, grub_arch_memdisk_addr)
(grub_arch_memdisk_size): Remove.
* include/grub/kernel.h (struct grub_module_header): Remove `offset'
field (was only used to transfer a constant). Add `type' field to
support multiple module types.
(grub_module_iterate): New function.
* kern/device.c (grub_device_open): Do not hide error messages
when grub_disk_open() fails. Use grub_print_error() instead.
* kern/i386/pc/init.c (grub_arch_modules_addr)
(grub_arch_memdisk_size): Remove functions.
(grub_arch_modules_addr): Return the module address in high memory
(now that it isn't copied anymore).
* kern/i386/pc/startup.S (grub_memdisk_image_size): Remove variable.
(codestart): Don't add grub_memdisk_image_size to %ecx in LZMA
decompression routine (grub_total_module_size already includes that
now). Don't copy modules back to low memory.
* kern/main.c: Include `<grub/mm.h>'.
(grub_load_modules): Split out (and use) ...
(grub_module_iterate): ... this function, which iterates through
module objects and runs a hook.
Comment out grub_mm_init_region() call, as it would cause non-ELF
modules to be overwritten.
* util/i386/pc/grub-mkimage.c (generate_image): Instead of appending
the memdisk image in its own region, make it part of the module list.
* util/elf/grub-mkimage.c (options): Add "memdisk"|'m' option.
(main): Parse --memdisk|-m option, and pass user-provided path as
parameter to generate_image().
(add_segments): Pass `memdisk_path' down to load_modules().
(load_modules): Embed memdisk image in module section when requested.
* util/i386/efi/grub-mkimage.c (make_mods_section): Initialize
`header.type' instead of `header.offset'.
* conf/powerpc-ieee1275.rmk (pkglib_MODULES): Add `memdisk.mod'.
(memdisk_mod_SOURCES, memdisk_mod_CFLAGS)
(memdisk_mod_LDFLAGS): New variables.
* conf/i386-coreboot.rmk: Likewise.
* conf/i386-ieee1275.rmk: Likewise.
* conf/i386-efi.rmk: Recompile grub-mkimage.c if Makefile has
changed. This is needed in case GRUB_LIBDIR changes.
* conf/i386-ieee1275.rmk: Likewise.
* conf/i386-linuxbios.rmk: Likewise.
* conf/i386-pc.rmk: Likewise.
* conf/powerpc-ieee1275.rmk: Likewise.