* loader/i386/linux.c (grub_cmd_linux): Use ',' rather than ';' as
separator for the suggested gfxpayload string (';' collides with the
parser and needs escaping).
* loader/i386/multiboot_helper.S (grub_multiboot_backward_relocator):
Clear direction flag before jumping to OS.
(grub_multiboot2_real_boot): Likewise.
* commands/xnu_uuid.c (transform): Use GRUB_CPU_WORDS_BIGENDIAN
instead of WORDS_BIGENDIAN. Use grub_le_to_cpu32(), so that the
case of little endian words becomes just an optimization.
Respect const modifier.
(md5_final): Use code that doesn't depend on endianess.
Add symlink, mtime and label support to AtheFS.
* fs/afs.c (grub_afs_sblock): Declare `name' as char.
(grub_afs_iterate_dir): Handle symlinks.
(grub_afs_open): Use grub_afs_read_symlink.
(grub_afs_dir): Likewise.
Pass mtime.
(grub_afs_label): New function.
(grub_afs_fs): Add grub_afs_label.
(grub_afs_read_symlink): New function.
Enable all targets that can be built by default
* configure.ac: enable efiemu runtime, grub-emu, grub-emu-usb,
grub-mkfont and grub-fstest if they can be built
Fix libusb
* Makefile.in (LIBUSB): new macro
* genmk.rb (Utility/print_tail): new method
(Utility/rule): use intermediary variable #{prefix}_OBJECTS
(top level): call util.print_tail at the end.
* 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>
* kern/device.c (grub_device_iterate): Change struct part_ent to
hold the name, not a pointer to it. Use one grub_malloc() per
partition, not two. Free partition_name if grub_malloc() fails.
Set ents to NULL only before grub_partition_iterate() is called.
2009-07-10 Robert Millan <rmh.grub@aybabtu.com>
* kern/ieee1275/openfw.c (grub_children_iterate)
(grub_devalias_iterate): Fix size evaluation for property or path
strings, which was broken since r2132.
* commands/search.c (search_file): Merge into ...
(search_fs): ... this. Accept search type as argument.
(grub_cmd_search): Pass search type to search_fs().
* lib/arg.c (find_long_option): Remove.
(find_long): Add `len' argument, make `s' const char *.
(grub_arg_parse): Parse long options in place, not in a
temporary buffer.
* 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.
* kern/i386/pc/startup.S (real_to_prot): Access `gdtdesc' using
segment 0x0 unconditionally, because the reference generated by
GAS is an absolute address.
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
* util/grub-mkconfig.in (GRUB_DISABLE_LINUX_RECOVERY): Export
variable.
* util/grub.d/10_linux.in: If GRUB_DISABLE_LINUX_RECOVERY is true,
don't write a menu entry for recovery mode.
* 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.
Fix build with Apple's toolchain. Part 1
* commands/i386/pc/drivemap_int13h.S: use assembly-time constants
for long calls
* configure.ac: remove a leftover AC_MSG_RESULT
(CFLAGS): don't add -Wl,--defsym,___main=0x8100 when building with
Apple's toolchain
* conf/i386-coreboot.rmk (kernel_elf_SOURCES): Remove
term/i386/pc/at_keyboard.c, it doesn't need to be compiled into
the kernel.
* kern/i386/coreboot/init.c: Don't call grub_at_keyboard_init()
and grub_at_keyboard_fini(), it's done on module load and
unload.
* util/elf/grub-mkimage.c (usage): Prefix each option line with two
spaces, for the benefit of help2man.
* util/i386/efi/grub-mkimage.c (usage): Likewise.
* 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.
* Makefile.in: Rename lib_DATA to lib_SCRIPTS, move it from
PKGLIB to SCRIPTS. This fixes installation of grub-mkconfig_lib
and update-grub_lib in two places.
* conf/common.rmk: Rename lib_DATA to lib_SCRIPTS.
* util/grub.d/30_os-prober.in: Fix a comment. Source
${libdir}/grub/grub-mkconfig_lib. Use prepare_grub_to_access_device
to set the root device. Place drivemap command in the generated
chain entry.
* term/i386/pc/serial.c (serial_translate_key_sequence): Avoid
casts to short - they are not portable and cause warnings. Fix
use of uninitialized values in input_buf. Use ARRAY_SIZE.
* io/gzio.c (test_header): Don't reuse one buffer for all data.
Use separate variables. Read only the file size at the end, but
not the checksum that we don't use.
* gendistlist.sh (EXTRA_DISTFILES): Add `genhandlerlist.sh' and
`genparttoollist.sh'.
(DISTDIRS): Add `efiemu', `mmap', `parttool' and `script'.
Add `*.sh' to the list find searches for and change `mdate.sh'
to `mdate-sh'.
* 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.
* bus/usb/ohci.c (grub_ohci_pci_iter): Define the Class,
Subclass and Programming Interface fields in terms of the 3 byte
Class Code register.
* bus/usb/uhci.c (grub_uhci_pci_iter): Likewise.
* bus/usb/ohci.c (grub_ohci_pci_iter): Check that programming
interface is OHCI. Add grub_dprintf for symmetry with
bus/usb/uhci.c.
* bus/usb/uhci.c (grub_uhci_pci_iter): Check that programming
interface is UHCI. Add interf variable for programming
interface. Print interface with class/subclass.
Not fail if unable to retrieve C/H/S on LBA disks
* disk/i386/pc/biosdisk.c (grub_biosdisk_open): behave gracefully
if unable to retrieve C/H/S on LBA disks
Optimized font character lookup using binary search instead of linear
search. Fonts now are required to have the character index ordered by
code point.
* font/font.c (load_font_index): Verify that fonts have ordered
character indices.
(find_glyph): Use binary search instead of linear search to find a
character in a font.
* fs/hfsplus.c (grub_hfsplus_mount): Determine if the filesystem
uses case sensitive btree.
(grub_hfsplus_iterate_dir): Use GRUB_FSHELP_CASE_INSENSITIVE
only for case insensitive filesystems.
Address in trampolines based on 32-bit registers when compiled
with Apple's CC
* loader/i386/xnu_helper.S [APPLE_CC]: use 32-bit registers
for addresses
* loader/i386/linux_trampoline.S [APPLE_CC]: likewise
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
Use grub-macho2img when compiling with Apple's CC for PCBIOS machine
* conf/common.rmk (bin_UTILITIES): add (on false on condition)
grub-macho2img
(CLEANFILES): add grub-macho2img
(grub_macho2img_SOURCES): new variable
* kern/i386/pc/startup.S (bss_start): new variable
(bss_end): likewise
* genmk.rb: use grub-macho2img for *.img when compiled with Apple's CC
* util/grub-macho2img.c: new file
Use objconv when compiling with Apple's CC
* conf/i386-pc.rmk (efiemu32.o): use OBJCONV if defined
(efiemu64.o): likewise
(efiemu64_c.o): omit -mcmodel=large and add -DAPPLE_CC=1
when compiling with Apple's CC
(efiemu64_s.o): likewise
* configure.ac: check for objconv when compiling with Apple's CC
* genmk.rb: use objconv for modules when compiled with Apple's CC
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
Allow a compilation without -mcmodel=large
* kern/efi/mm.c (grub_efi_allocate_pages): don't allocate >4GiB
when compiled without -mcmodel=large
(filter_memory_map): remove memory post 4 GiB when compiled
without -mcmodel=large
* configure.ac: fail gracefully and add -DMCMODEL_SMALL=1 to
TARGET_CFLAGS when -mcmodel=large isn't supported
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
Absolute addressing through constant with Apple's cc
* kern/i386/pc/startup.S: Define necessary constants
and address through it when using ABS with Apple's CC
* boot/i386/pc/diskboot.S: likewise
* boot/i386/pc/boot.S: likewise
* boot/i386/pc/lnxboot.S: likewise
* boot/i386/pc/cdboot.S: likewise
* mmap/i386/pc/mmap_helper.S: likewise
* commands/i386/pc/drivemap_int13h.S: likewise
Check if compiler is apple cc
* Makefile.in (ASFLAGS): new variable
(TARGET_ASFLAGS): likewise
(TARGET_MODULE_FORMAT): likewise
(TARGET_APPLE_CC): likewise
(OBJCONV): likewise
(TARGET_IMG_CFLAGS): likewise
(TARGET_CPPFLAGS): add includedir
* configure.ac: call grub_apple_cc and grub_apple_target_cc
(TARGET_IMG_LDFLAGS): Add -Wl,-Ttext,. All users updated
Check for linker script only if compiler isn't Apple's CC
(TARGET_MODULE_FORMAT): set
(TARGET_APPLE_CC): likewise
(TARGET_ASFLAGS): likewise
(ASFLAGS): likewise
Check for objcopy only if compiler isn't Apple's CC
Check for BSS symbol only if compiler isn't Apple's CC
* genmk.rb: adapt nm options if we use Apple's utils
* aclocal.m4 (grub_apple_cc): new test
(grub_apple_target_cc): likewise
Simplify sed expressions and improve awk
* Makefile.in (install-local): simplify sed expression
* gencmdlist.sh: likewise
* genmoddep.awk: avoid adding module as a dependency of itself
Fix wrong assumptions with grub-mkimage on EFI
* i386/efi/grub-mkimage.c (read_kernel_module): don't write prefox here
(relocate_addresses): consider both r_addend and value at offset
(make_mods_section): zerofill modinfo and header
(convert_elf): write prefix here
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
Avoid calling biosdisk in drivemap
* commands/i386/pc/drivemap.c (parse_biosdisk): remove
(revparse_biosdisk): likewise
(list_mappings): derive name from id directly
(grub_cmd_drivemap): use tryparse_diskstring
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
Prevent GRUB from probing floppies during boot.
* conf/common.rmk (search_mod_CFLAGS): Use `-Werror -Wall'.
* commands/search.c (options): Add --no-floppy.
(search_fs, search_file, grub_cmd_search): Support --no-floppy.
* util/grub-mkconfig_lib.in (prepare_grub_to_access_device): Use
--no-floppy when searching for UUIDs.
Simplify the code duplication in commands/search.c.
* commands/search.c (search_label, search_fs_uuid): Merge into ...
(search_fs): ... this. Update all users.
* Makefile.in: Don't use "cp -d", it doesn't work on FreeBSD.
Remove the original symlink explicitly.
* fs/hfs.c (grub_hfs_find_dir): Skip sequences of slashes, not
just one slash. That's how grub_fshelp_find_file() does it.
* disk/ata.c (grub_ata_wait_not_busy): Add debug output of status
register.
(grub_atapi_identify): Add wait after drive select.
(grub_ata_identify): Do more strict status register check before
calling grub_atapi_identify (). Suppress error message if status
register is 0x00 after command failure. Add status register
check after PIO read to avoid bogus identify due to stuck DRQ.
Thanks to Pavel Roskin for testing.
(grub_device_initialize): Remove unsafe status register check.
Thanks to 'phcoder' for problem report and patch.
Prevent sign extension in debug message.
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.
* aclocal.m4 (grub_I386_CHECK_REGPARM_BUG): Remove.
* configure.ac: Don't call grub_I386_CHECK_REGPARM_BUG. Define
NESTED_FUNC_ATTR using AH_BOTTOM. Use regparm(1) only when
compiling for the i386 targets, but not for the utilities.
Display error messages when parsing a Lua statement fails. Previously,
executing a syntactically invalid statement like ")foo" or "bar;" would
silently fail.
* script/lua/grub_main.c (handle_lua_error): New function.
(grub_lua_parse_line): Improved reporting of Lua parser and execution
errors.
Remove -Werror which causes build to fail on some systems
* conf/i386-pc.rmk (xnu_mod_CFLAGS): Remove -Werror -Wall
* conf/i386-efi.rmk (xnu_mod_CFLAGS): Likewise
* conf/x86_64-efi.rmk (xnu_mod_CFLAGS): Likewise
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
* script/lua/grub_lib.c (grub_lua_getenv): Make name and value
const to avoid a warning.
(grub_lua_setenv): Likewise.
* script/lua/grub_main.c (grub_lua_parse_line): Use size_t for
lmsg to fix a warning.
(setjmp_mod_ASFLAGS): ... this. Set to $(COMMON_ASFLAGS).
* conf/powerpc-ieee1275.rmk (setjmp_mod_CFLAGS): Rename to ...
(setjmp_mod_ASFLAGS): ... this. Set to $(COMMON_ASFLAGS).
* conf/sparc64-ieee1275.rmk (setjmp_mod_CFLAGS): Rename to ...
(setjmp_mod_ASFLAGS): ... this. Set to $(COMMON_ASFLAGS).
* 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.
* loader/i386/linux.c (allocate_pages): When assigning
real_mode_mem, cast through grub_size_t to fix a warning. The
code already makes sure that the value would fit a pointer.
(grub_linux_setup_video): Cast render_target->data to
grub_size_t to fix a warning.
* fs/cpio.c: Use the same name "struct head" for tar and cpio to
facilitate code reuse.
(grub_cpio_mount): Use "struct head", not a char buffer. This
fixes a warning reported by gcc 4.4.
* 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.
* disk/raid6_recover.c (grub_raid6_recover): Fix warnings about
uninitialized err[0] and err[1]. Rename them to bad1 and bad2.
Initialize them with -1. Add sanity check for bad1. Eliminate
nerr variable.