* util//grub-mkconfig_lib.in (bindir): New variable.
(grub_mkrelpath): Likewise.
Properly set path variable. Use ${grub_mkrelpath} instead of
calling it directly.
2009-11-02 Felix Zielcke <fzielcke@z-51.de>
* util/probe.c (probe): Make the file path relative to its root.
Change a info message to use the GRUB path. Enable again the
check if we can read the file with GRUB facilities.
2009-11-01 Felix Zielcke <fzielcke@z-51.de>
* util/grub-mkrelpath.c: New file.
* conf/common.rmk (bin_UTILITIES): Add grub-mkrelpath.
(grub_mkrelpath_SOURCES): New variable.
* include/grub/util/misc.h: New function prototype.
* util/misc.c (make_system_path_relative_to_its_root): New function.
* util/grub-mkconfig_lib.in (make_system_path_relative_to_its_root):
Use grub-mkrelpath.
* configure.ac: Check for `__ashldi3', `__ashrdi3', `__lshrdi3',
`__trampoline_setup' and `__ucmpdi2'.
* include/grub/powerpc/libgcc.h: Only export symbols for functions
that libgcc provides.
Revert 2009-06-10 Pavel Roskin <proski@gnu.org>
* configure.ac: Put checks for __bswapsi2 and __bswapdi2.
* include/grub/powerpc/libgcc.h: Don't use weak attribute for all
exports.
* include/grub/sparc64/libgcc.h: Likewise. Use
preprocessor conditionals.
Fail gracefuly when attempting to load 64-bit kFreeBSD on IA32 CPU.
* include/grub/i386/cpuid.h: New file.
* commands/i386/cpuid.c: Include `<grub/i386/cpuid.h>'.
(has_longmode): Rename to ...
(grub_cpuid_has_longmode): ... this. Update all users. Remove
`static' attribute.
* loader/i386/bsd.c: Include `<grub/i386/cpuid.h>'.
(grub_bsd_load_elf): Fail if load of 64-bit kernel was requested
on a CPU that doesn't implement AMD64 instruction set.
* include/grub/kernel.h (struct grub_module_header): Remove
`grub_module_header_types'. Make `type' unsigned. Make `size'
32-bit on all platforms.
* util/elf/grub-mkimage.c (load_modules): Treat `type' as an
8-bit field. Use grub_host_to_target32() for `size'.
* util/i386/efi/grub-mkimage.c (make_mods_section): Likewise.
* util/i386/pc/grub-mkimage.c (generate_image): Likewise.
* util/sparc64/ieee1275/grub-mkimage.c (generate_image): Likewise.
Save space by inlining misc.c functions.
* kern/misc.c (grub_iswordseparator): Made static.
* kern/misc.c (grub_strcat): Moved from here ...
* include/grub/misc.h (grub_strcat): ... here. Inlined.
* kern/misc.c (grub_strncat): Moved from here ...
* include/grub/misc.h (grub_strncat): ... here. Inlined.
* kern/misc.c (grub_strcasecmp): Moved from here ...
* include/grub/misc.h (grub_strcasecmp): ... here. Inlined.
* kern/misc.c (grub_strncasecmp): Moved from here ...
* include/grub/misc.h (grub_strncasecmp): ... here. Inlined.
* kern/misc.c (grub_isalpha): Moved from here ...
* include/grub/misc.h (grub_isalpha): ... here. Inlined.
* kern/misc.c (grub_isdigit): Moved from here ...
* include/grub/misc.h (grub_isdigit): ... here. Inlined.
* kern/misc.c (grub_isgraph): Moved from here ...
* include/grub/misc.h (grub_isgraph): ... here. Inlined.
* kern/misc.c (grub_tolower): Moved from here ...
* include/grub/misc.h (grub_tolower): ... here. Inlined.
Support --no-smp and --no-acpi for NetBSD.
* include/grub/i386/bsd.h (NETBSD_AB_NOSMP): New definition.
(NETBSD_AB_NOACPI): Likewise.
* loader/i386/bsd.c (netbsd_opts): New entries no-smp and no-acpi.
(netbsd_flags): Add NETBSD_AB_NOSMP, NETBSD_AB_NOACPI.
Framebuffer split.
* commands/i386/pc/vbetest.c (grub_cmd_vbetest): Restore video
subsystem at the end.
* conf/common.rmk (pkglib_MODULES): Add video_fb.mod.
(video_fb_mod_SOURCES): New variable.
(video_fb_mod_CFLAGS): Likewise.
(video_fb_mod_LDFLAGS): Likewise.
* conf/i386-pc.rmk (vbe_mod_SOURCES): Remove video/i386/pc/vbeblit.c,
video/i386/pc/vbefill.c and video/i386/pc/vbeutil.c.
* video/i386/pc/vbeblit.c: Moved from here ...
* video/fb/fbblit.c: ..here. Replaced 'vbe' with 'fb'.
* video/i386/pc/vbefill.c: Moved from here ...
* video/fb/fbfill.c: ..here. Replaced 'vbe' with 'fb'.
* video/i386/pc/vbeutil.c: Moved from here ...
* video/fb/fbutil.c: ..here. Replaced 'vbe' with 'fb'.
* include/grub/i386/pc/vbeblit.h: Moved from here ...
* include/grub/fbblit.h: ... here. Replaced 'vbe' with 'fb'.
* include/grub/i386/pc/vbefill.h: Moved from here ...
* include/grub/fbfill.h: ... here. Replaced 'vbe' with 'fb'.
* include/grub/i386/pc/vbeutil.h: Moved from here ...
* include/grub/fbutil.h: ... here. Replaced 'vbe' with 'fb'.
* include/grub/i386/pc/vbe.h: Moved framebuffer part ...
* include/grub/video_fb.h: ... here. Replaced 'vbe' with 'fb'.
* include/grub/video.h (GRUB_VIDEO_RENDER_TARGET_FRONT_BUFFER): Removed.
(GRUB_VIDEO_RENDER_TARGET_BACK_BUFFER): Likewise.
(grub_video_adapter): Added 'get_info_and_fini'.
(grub_video_get_info_and_fini): New prototype.
(grub_video_set_mode): make modestring const char *.
* loader/i386/linux.c (grub_linux_setup_video): Use
grub_video_get_info_and_fini.
(grub_linux_boot): Move modesetting just before booting.
* loader/i386/pc/xnu.c (grub_xnu_set_video): Use
grub_video_get_info_and_fini.
* video/i386/pc/vbe.c: Moved framebuffer part ...
* video/fb/video_fb.c: ... here. Replaced 'vbe' with 'fb'.
* video/i386/pc/vbe.c (grub_vbe_set_video_mode): Use
grub_video_fbstd_colors and grub_video_fb_set_palette.
(grub_video_vbe_init): Clear 'framebuffer' variable and use
grub_video_fb_init.
(grub_video_vbe_fini): Use grub_video_fb_fini.
(grub_video_vbe_setup): Use framebuffer.render_target instead of
render_target and use grub_video_fb_set_active_render_target and
grub_video_fb_set_palette.
(grub_video_vbe_set_palette): Use grub_video_fb_set_palette.
(grub_video_vbe_set_viewport): Use grub_video_fb_set_viewport.
(grub_video_vbe_adapter): Use framebuffer.
* video/video.c (grub_video_get_info_and_fini): New function.
(grub_video_set_mode): Make modestring const char *.
(GRUB_MOD_INIT(video_video)): Don't set variables to 0 since these
values are already initialised.
* include/grub/i386/bsd.h (KERNEL_TYPE_NONE, KERNEL_TYPE_FREEBSD)
(KERNEL_TYPE_OPENBSD, KERNEL_TYPE_NETBSD): Convert to ...
(bsd_kernel_types): ... this enum.
* loader/i386/bsd.c (grub_cmd_freebsd_loadenv, grub_cmd_freebsd_module)
(grub_cmd_freebsd_module_elf): Abort with "You need to load the
kernel first." when `kernel_type' is set to KERNEL_TYPE_NONE.
(grub_bsd_load_aout, grub_bsd_load, grub_cmd_freebsd_loadenv)
(grub_cmd_freebsd_module, grub_cmd_freebsd_module_elf)
(GRUB_MOD_INIT (bsd)): Fix capitalization in a few error
messages.
Fix a bug resulting in black screen when loading Linux using a
packed video mode.
* kern/i386/pc/startup.S (grub_vbe_bios_getset_dac_palette_width): New
function.
* include/grub/i386/pc/vbe.h (GRUB_VBE_CAPABILITY_DACWIDTH): New macro.
(grub_vbe_bios_getset_dac_palette_width): New function.
(grub_vbe_bios_get_dac_palette_width)
(grub_vbe_bios_set_dac_palette_width): New macros (act as wrappers for
grub_vbe_bios_getset_dac_palette_width()).
* video/i386/pc/vbe.c (grub_vbe_probe): Use `GRUB_VBE_STATUS_OK' to
check for return status.
(grub_vbe_get_video_mode_info): When getting information for a packed
mode (<= 8 bpp), obtain DAC palette width using
grub_vbe_bios_getset_dac_palette_width(), and use that for initializing
{red,green,blue}_mark_size.
* disk/lvm.c (grub_lvm_scan_device): Ignore extra copy of metadata.
Don't change pv->disk if it's already set.
* disk/raid.c (grub_raid_scan_device): Merge this function into ...
(grub_raid_register): ... here.
(grub_raid_rescan): Removed.
* include/grub/raid.h (grub_raid_rescan): Removed.
* util/grub-fstest.c: Remove include file <grub/raid.h>.
(fstest): Replace grub_raid_rescan with module fini function followed
by init function.
* util/grub-probe.c: Add include file <grub/raid.h>.
(probe_raid_level): New function.
(probe): Detect abstraction by walking the disk device, support two
level of abstraction (LVM on RAID) when detecting partition map.
* include/grub/i386/pc/boot.h (GRUB_BOOT_MACHINE_BPB_END):
Increase to 0x5a to accommodate FAT32. Adjust other offsets
accordingly.
Original patch by Yves Blusseau <yves.grub-devel@zetam.org>
* include/grub/i386/linux.h (GRUB_VIDEO_TYPE_TEXT): New macro.
* loader/i386/linux.c [__i386__] (grub_linux_boot): Simplify inline
assembly in final jump, using register constraints.
(grub_linux_boot): For text mode, initialize `have_vga' using
GRUB_VIDEO_TYPE_TEXT rather than 0 (this changes its value to 1).
Initialize `video_cursor_x' and `video_cursor_y' as late as possible,
right before the final jump.
Set `video_mode' to 0x3.
Document initialization of `video_page', `video_mode' and
`video_ega_bx'.
* include/grub/i386/linux.h (GRUB_LINUX_FLAG_QUIET): New macro.
* loader/i386/linux.c (grub_cmd_linux): Recognize "quiet" option,
and set GRUB_LINUX_FLAG_QUIET appropiately.
Load BSD ELF modules
* conf/i386-pc.rmk (bsd_mod_SOURCES): Add loader/i386/bsd32.c
and loader/i386/bsd64.c
* include/grub/i386/bsd.h (FREEBSD_MODTYPE_MODULE): Remove
(FREEBSD_MODTYPE_ELF_MODULE): New definition
(FREEBSD_MODTYPE_ELF_MODULE_OBJ): Likewise
(grub_freebsd_load_elfmodule32): New declaration
(grub_freebsd_load_elfmoduleobj64): Likewise
(grub_freebsd_load_elf_meta32): Likewise
(grub_freebsd_load_elf_meta64): Likewise
(grub_freebsd_add_meta): Likewise
(grub_freebsd_add_meta_module): Likewise
* loader/i386/bsd.c (grub_freebsd_add_meta): Make global
(grub_freebsd_add_meta_module): Likewise and move module-specific
parts to grub_cmd_freebsd and grub_cmd_freebsd_module
(grub_cmd_freebsd): Add elf-kernel specific parts
based on grub_freebsd_add_meta_module
(grub_cmd_freebsd_module): Add type parsing moved from
grub_freebsd_add_meta_module
(grub_cmd_freebsd_module_elf): New function
(cmd_freebsd_module_elf): New variable
(GRUB_MOD_INIT): Register freebsd_module_elf
* loader/i386/bsd32.c: New file
* loader/i386/bsd64.c: Likewise
* loader/i386/bsdXX.c: Likewise
* kern/elf.c (grub_elf32_load): Let hook decide which pheaders to load
(grub_elf64_load): Likewise
* include/grub/elfload.h (grub_elf32_load_hook_t): New parameter do_load
All users updated
(grub_elf64_load_hook_t): Likewise
* include/grub/i386/loader.h (grub_linux_prot_size)
(grub_linux_tmp_addr, grub_linux_real_addr)
(grub_linux_is_bzimage, grub_linux16_boot): Declare only on
GRUB_MACHINE_PCBIOS.
* util/i386/pc/grub-mkimage.c (compress_kernel): Move
common grub_util_info() call to ...
(generate_image): ... here.
Fix use of uninitialized memory, comparison of signed with
unsigned integers and memory leak.
Remove bogus module address message.
* boot/i386/pc/boot.S: Remove root_drive. Assert offset of
boot_drive_check by using GRUB_BOOT_MACHINE_DRIVE_CHECK. Don't
save %dx, we only need %dl and we never change it.
* boot/i386/pc/cdboot.S: Don't set the root drive.
* boot/i386/pc/pxeboot.S: Likewise.
* include/grub/i386/pc/boot.h: Remove
GRUB_BOOT_MACHINE_ROOT_DRIVE, adjust
GRUB_BOOT_MACHINE_DRIVE_CHECK.
* include/grub/i386/pc/kernel.h: Remove grub_root_drive.
* kern/i386/pc/init.c (make_install_device): Remove references
to grub_root_drive.
* kern/i386/pc/startup.S: Likewise.
* util/i386/pc/grub-setup.c (setup): Don't set root_drive.
* include/grub/multiboot2.h: Provide compatibility defines for
multiboot2.h.
* include/multiboot2.h: Include stdint.h only if needed, using
angle brackets.
* loader/i386/pc/multiboot2.c: Include multiboot2.h after
grub/multiboot2.h.
* loader/ieee1275/multiboot2.c: Likewise.
* loader/multiboot2.c: Likewise.
* loader/multiboot_loader.c: Likewise.
* configure.ac: Remove checks for __bswapsi2 and __bswapdi2,
they fail without libc headers for the target.
* include/grub/powerpc/libgcc.h: Use weak attribute for all
exports.
* include/grub/sparc64/libgcc.h: Likewise. Don't use
preprocessor conditionals.
Avoid aliases when compiling with Apple's CC for PCBIOS machine
* kern/misc.c [APPLE_CC] (memcpy): new function
[APPLE_CC] (memmove): likewise
[APPLE_CC && !GRUB_UTIL] (grub_err_printf): likewise
(memcpy): define alias conditionaly on !APPLE_CC
(memset): likewise
(abort): likewise
* include/grub/misc.h (memove): don't define when both GRUB_UTIL and
APPLE_CC are defined
* include/grub/list.h [APPLE_CC] (grub_assert_fail): new function
(grub_assert_fail): make prototype conditional
Define segment as well as section when compiling with
Apple's CC
* efiemu/runtime/efiemu.c (PHYSICAL_ATTRIBUTE): new definition
(efiemu_set_virtual_address_map): declare with PHYSICAL_ATTRIBUTE
(efiemu_convert_pointer): likewise
(efiemu_set_virtual_address_map): likewise
(efiemu_convert_pointer): likewise
(efiemu_getcrc32): likewise
(init_crc32_table): likewise
(reflect): likewise
* include/grub/dl.h (GRUB_MOD_NAME): define segment with Apple's CC
(GRUB_MOD_DEP): likewise
Avoid clobbering %ebx/%rbx in inline assembly with Apple's CC
* efiemu/runtime/efiemu.c (write_cmos): use %cl instead of %bl as
temporary storage
* include/grub/i386/tsc.h (grub_get_tsc): restore %rbx/%ebx when
using Apple's CC
(grub_cpu_is_tsc_supported): likewise
* loader/i386/xnu.c (guessfsb): restore %rbx/%ebx in inline assembly
gfxpayload support
* commands/videotest.c (grub_cmd_videotest): use grub_video_set_mode
* include/grub/video.h (GRUB_VIDEO_MODE_TYPE_PURE_TEXT): new definition
(grub_video_setup): remove
(grub_video_set_mode): new prototype
* loader/i386/linux.c (DEFAULT_VIDEO_MODE): new definition
(vid_mode): remove
(linux_vesafb_res): compile only on PCBIOS
(grub_linux_boot): support gfxpayload
* loader/i386/pc/xnu.c (video_hook): new function
(grub_xnu_set_video): support gfxpayload
* term/gfxterm.c (DEFAULT_VIDEO_WIDTH): removed
(DEFAULT_VIDEO_HEIGHT): likewise
(DEFAULT_VIDEO_FLAGS): likewise
(DEFAULT_VIDEO_MODE): new definition
(video_hook): new function
(grub_gfxterm_init): use grub_video_set_mode
* util/grub.d/30_os-prober.in: remove explicit modesetting before
loading xnu
* video/video.c (grub_video_setup): removed
(grub_video_set_mode): new function based on grub_gfxterm_init and
grub_video_setup
Script fixes
* include/grub/script_sh.h (grub_script_cmdline): remove cmdline
(grub_lexer_param): add tokenonhold
(grub_script_create_cmdline): remove cmdline. All callers updated
(grub_script_function_create): make functionname
grub_script_arg. All callers updated
(grub_script_execute_argument_to_string): new prototype
* kern/parser.c (state_transitions): reorder
(grub_parser_cmdline_state): fix a bug and make more compact
* script/sh/execute.c (grub_script_execute_argument_to_string):
make global
(grub_script_execute_cmdline): use new format
* script/sh/function.c (grub_script_function_create): make functionname
grub_script_arg. All callers updated
* script/sh/lexer.c (grub_script_lexer_init): initilaize tokenonhold
(grub_script_yylex): remove
(grub_script_yylex2): renamed to ...
(grub_script_yylex): ...renamed
parse the expressions like a${b}c
* script/sh/parser.y (GRUB_PARSER_TOKEN_ARG): new typed terminal
(GRUB_PARSER_TOKEN_VAR): remove
(GRUB_PARSER_TOKEN_NAME): likewise
("if"): declare as typeless
("while"): likewise
("function"): likewise
("else"): likewise
("then"): likewise
("fi"): likewise
(text): remove
(argument): likewise
(script): accept empty scripts and make exit on error
(arguments): use GRUB_PARSER_TOKEN_ARG
(function): likewise
(command): move error handling to script
(menuentry): move grub_script_lexer_ref before
* script/sh/script.c (grub_script_create_cmdline): remove cmdline
argument. All callers updated
Cleaned up `include/grub/normal.h'. Grouped prototypes by
definition file, and functions defined in `normal/menu.c' have had
their prototypes moved to `include/grub/menu.h' for consistency.
* include/grub/menu.h (grub_menu_execute_callback): Added; moved
from normal.h.
(grub_menu_get_entry): Likewise.
(grub_menu_get_timeout): Likewise.
(grub_menu_set_timeout): Likewise.
(grub_menu_execute_entry): Likewise.
(grub_menu_execute_with_fallback): Likewise.
(grub_menu_entry_run): Likewise.
* include/grub/normal.h: Re-ordered and grouped function
prototypes by file that the function is defined in.
(grub_menu_execute_callback): Removed; moved to menu.h.
(grub_menu_get_entry): Likewise.
(grub_menu_get_timeout): Likewise.
(grub_menu_set_timeout): Likewise.
(grub_menu_execute_entry): Likewise.
(grub_menu_execute_with_fallback): Likewise.
(grub_menu_entry_run): Likewise.
(grub_menu_addentry): Renamed from this ...
(grub_normal_add_menu_entry): ... to this.
* normal/main.c (grub_menu_addentry): Renamed from this ...
(grub_normal_add_menu_entry): ... to this.
* script/sh/execute.c (grub_script_execute_menuentry): Update
reference to renamed grub_menu_addentry function.
trampoline for linux on 64-bit platform
* conf/x86_64-efi.rmk (linux_mod_SOURCES): added
loader/i386/efi/linux_trampoline.S
* include/grub/x86_64/efi/loader.h (grub_linux_real_boot): removed
declration
* kern/x86_64/efi/startup.S (grub_linux_real_boot): moved from here
* loader/i386/linux_trampoline.S: moved here
* loader/i386/efi/linux.c (allocate_pages): reserve space for trampoline
(jumpvector): removed
(grub_linux_trampoline_start): new declaration
(grub_linux_trampoline_end): likewise
(grub_linux_boot): use trampoline when on 64-bit platform
* loader/i386/linux.c: likewise
* include/grub/kernel.h (grub_module_header_types): Add type
OBJ_TYPE_CONFIG.
* kern/main.c (grub_load_config): New function.
(grub_main): Call grub_load_config to read boot config.
* grub-mkimage (generate_image): New parameter config_path.
(options): New option --config.
(main): Parse --config option, and pass it to generate_image.
* kernel/disk.c (grub_disk_read): Use void pointer for the
buffer.
(grub_disk_write): Use const void pointer for the buffer.
Adjust all callers. Remove unnecessary casts.
* include/grub/i386/linux.h (GRUB_LINUX_VID_MODE_VESA_START): Set
to 0x300.
* loader/i386/linux.c (vga_modes, linux_vesafb_res): Add a few
resolutions.
(linux_vesafb_modes): Add a lot of additional modes to the list (based
on documentation from Wikipedia).
* util/misc.c (grub_util_warn): New function. Emmits a warning
unconditionally.
* include/grub/util/misc.h (grub_util_warn): New declaration.
* util/i386/pc/grub-install.in: Understand --force and pass it down
to grub-setup.
* util/i386/pc/grub-setup.c (main): Understand --force and pass it
down to setup().
(setup): Improve error messages and add warnings when requested to
install in odd layouts. Refuse to install using blocklists unless
--force was set.
FreeBSD 64-bit support
* conf/i386-pc.rmk (bsd_mod_SOURCES): add loader/i386/bsd_helper.S
and loader/i386/bsd_trampoline.S
(bsd_mod_ASFLAGS): new variable
* include/grub/i386/bsd.h (FREEBSD_MODINFOMD_SMAP): new definition
(FREEBSD_MODTYPE_KERNEL64): likewise
(grub_bsd64_trampoline_start): likewise
(grub_bsd64_trampoline_end): likewise
(grub_bsd64_trampoline_selfjump): likewise
(grub_bsd64_trampoline_gdt): likewise
* include/grub/i386/loader.h (grub_unix_real_boot): moved from here ...
* include/grub/i386/bsd.h (grub_unix_real_boot): ... moved here
* kern/i386/loader.S (grub_unix_real_boot): moved from here ...
* loader/i386/bsd_helper.S (grub_unix_real_boot): moved here
* include/grub/gpt_partition.h (grub_gpt_partentry): Corrected the type
of "attrib" member
* loader/i386/bsd_pagetable.c: new file
* loader/i386/bsd_trampoline.S: likewise
* loader/i386/bsd.c (ALIGN_QWORD): new macro
(ALIGN_VAR): likewise
(entry_hi): new variable
(kern_end_mdofs): likewise
(is_64bit): likewise
(grub_freebsd_add_meta): use ALIGN_VAR
(grub_e820_mmap): new declaration
(grub_freebsd_add_mmap): new function
(grub_freebsd_add_meta_module): support 64 bit kernels
(grub_freebsd_list_modules): use ALIGN_VAR
(gdt_descriptor): new declaration
(grub_freebsd_boot): support 64 bit kernels
(grub_bsd_elf64_hook): new function
(grub_bsd_load_elf): support elf64
* 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.
Preboot hooks support
* commands/boot.c (struct grub_preboot_t): new declaration
(preboots_head): new variable
(preboots_tail): likewise
(grub_loader_register_preboot_hook): new function
(grub_loader_unregister_preboot_hook): likewise
(grub_loader_set): launch preboot hooks
* include/grub/loader.h (grub_loader_preboot_hook_prio_t): new type
(grub_loader_register_preboot_hook): new declaration
(grub_loader_unregister_preboot_hook): likewise
grub_devalias_iterate() result instead of unconditional 0.
* disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): Likewise.
Also, capture hook return value, either directly or via
grub_children_iterate(), and propagate to caller.
* include/grub/ieee1275/ieee1275.h (grub_devalias_iterate,
grub_children_iterate): Return value is now 'int' instead of
'grub_err_t'.
* kern/ieee1275/openfw.c (grub_children_iterate): Fix to behave
like a proper iterator, stopping when hooks return non-zero.
(grub_devalias_iterate): Likewise.
* 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.
* include/grub/types.h: Rename ULONG_MAX to GRUB_ULONG_MAX and
LONG_MAX to GRUB_LONG_MAX. Introduce GRUB_LONG_MIN. Update all
users of ULONG_MAX, LONG_MAX and LONG_MIN to use the new
definitions.
* util/hostdisk.c [__FreeBSD__]: Include sys/disk.h.
(grub_util_biosdisk_open) [__FreeBSD__]: Add support for
FreeBSD. Check if a device is a character device. Use
DIOCGMEDIASIZE to get the size.
(convert_system_partition_to_system_disk) [__FreeBSD__]: Add
support for FreeBSD.
(grub_util_biosdisk_get_grub_dev) [__FreeBSD__]: Check if OS_DEV
is a character device instead of a block device. Add support for
FreeBSD device names.
* util/getroot.c (find_root_device) [__FreeBSD__]: Check if ENT is
a character device instead of a block device.
(grub_util_check_char_device): New function.
* util/grub-probe.c (probe) [__FreeBSD__]: Check if DEVICE_NAME is
a character device instead of a block device.
* include/grub/util/getroot.h (grub_util_check_char_device): New
prototype.
slots are of type grub_ieee1275_cell_t.
(grub_nand_read): Likewise.
* kern/ieee1275/ieee1275.c (IEEE1275_PHANDLE_INVALID,
IEEE1275_IHANDLE_INVALID): Use grub_ieee1275_cell_t since these
macros are used to compare values in arg/ret block of the call.
(grub_ieee1275_finddevice, grub_ieee1275_get_property,
grub_ieee1275_next_property, grub_ieee1275_get_property_length,
grub_ieee1275_instance_to_package, grub_ieee1275_package_to_path,
grub_ieee1275_instance_to_path, grub_ieee1275_write,
grub_ieee1275_read, grub_ieee1275_seek, grub_ieee1275_peer,
grub_ieee1275_child, grub_ieee1275_parent, grub_ieee1275_open,
grub_ieee1275_close, grub_ieee1275_set_property,
grub_ieee1275_set_color): All ieee1275 call arg slots are of type
grub_ieee1275_cell_t.
* kern/ieee1275/openfw.c (grub_map): Likewise.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_ihandle_t,
grub_ieee1275_phandle_t): Define as grub_unit32_t type.
* include/grub/misc.h (ARRAY_SIZE): New macro.
* include/grub/i386/linux.h (GRUB_LINUX_VID_MODE_VESA_START):
New macro.
* loader/i386/linux.c (allocate_pages): Use free_pages().
(grub_linux_unload): Don't use free_pages().
(grub_linux_boot): Prevent accessing linux_vesafb_modes with a
wrong index. Treat all other modes as text modes.
(grub_cmd_linux): Initialize vid_mode unconditionally to
GRUB_LINUX_VID_MODE_NORMAL. Recognize and support "vga=ask".
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
Make the format of Environment Block plain text. The boot loader
part is not tested well yet.
* util/grub-editenv.c (DEFAULT_ENVBLK_SIZE): New macro.
(buffer): Removed.
(envblk): Likewise.
(usage): Remove "info" and "clear". Add "unset". Update the
description of "set", as this does not delete variables any
longer.
(create_envblk_file): Complete rewrite.
(open_envblk_file): Likewise.
(cmd_info): Removed.
(cmd_list): Likewise.
(cmd_set): Likewise.
(cmd_clear): Likewise.
(list_variables): New function.
(write_envblk): Likewise.
(set_variables): Likewise.
(unset_variables): Likewise.
(main): Complete rewrite.
* commands/loadenv.c (buffer): Removed.
(envblk): Likewise.
(open_envblk_file): New function.
(read_envblk_file): Complete rewrite.
(grub_cmd_load_env): Likewise.
(grub_cmd_list_env): Likewise.
(struct blocklist): New struct.
(free_blocklists): New function.
(check_blocklists): Likewise.
(write_blocklists): Likewise.
(grub_cmd_save_env): Complete rewrite.
* include/grub/lib/envblk.h (GRUB_ENVBLK_SIGNATURE): Replaced with
a plain text signature.
(GRUB_ENVBLK_MAXLEN): Removed.
(struct grub_envblk): Complete rewrite.
(grub_envblk_find): Removed.
(grub_envblk_insert): Likewise.
(grub_envblk_open): New prototype.
(grub_envblk_set): Likewise.
(grub_envblk_delete): Put const to VALUE.
(grub_envblk_iterate): Put const to NAME and VALUE.
(grub_envblk_close): New prototype.
(grub_envblk_buffer): New inline function.
(grub_envblk_size): Likewise.
* lib/envblk.c: Include grub/mm.h.
(grub_env_find): Removed.
(grub_envblk_open): New function.
(grub_envblk_close): Likewise.
(escaped_value_len): Likewise.
(find_next_line): Likewise.
(grub_envblk_insert): Removed.
(grub_envblk_set): New function.
(grub_envblk_delete): Complete rewrite.
(grub_envblk_iterate): Likewise.
* kern/env.c (grub_env_context_open): Added an argument to specify
whether a new context inherits exported variables from current
one. This is useful when making a sandbox to interpret a config
file.
All callers updated.
* include/grub/env.h (grub_env_context_open): Updated the prototype.
* normal/main.c (grub_normal_execute): Added an argument
BATCH to specify if an interactive interface should be provided
after reading a config file.
All callers updated.
(read_command_list): Prevent being executed twice.
(read_fs_list): Likewise.
* include/grub/normal.h (grub_normal_execute):
* include/multiboot.h (MULTIBOOT_INFO_ALIGN): New macro.
* loader/i386/pc/multiboot.c (grub_multiboot): Include the MBI
in our relocation, instead of using it directly from heap. Also
use `MULTIBOOT_INFO_ALIGN' to ensure it is aligned.
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.