* kern/misc.c (grub_strcasecmp): New function.
(grub_strcasecmp): Use grub_size_t instead of int for length.
Fix return value.
* include/grub/misc.h: Update function prototypes.
* kern/misc.c (grub_vsprintf): Fix size and termination of `format2'
(precision) digit string. Allow `.format2' without `format1' (width).
Limit input chars for `%s' output to `format2' if specified. This is
compatible with standard printf ().
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.
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `term/i386/vga_common.c'.
* conf/i386.rmk (pkglib_MODULES): Add `vga_text.mod'.
(vga_text_mod_SOURCES, vga_text_mod_CFLAGS, vga_text_mod_LDFLAGS): New
variables.
* conf/i386-coreboot.rmk (kernel_elf_SOURCES): Replace
`term/i386/pc/console.c' with `term/i386/vga_common.c'.
* kern/i386/coreboot/init.c (grub_machine_init): Replace call to
grub_console_init() with call to grub_vga_text_init().
(grub_machine_fini): Replace call to
grub_console_fini() with call to grub_vga_text_fini() and
grub_at_keyboard_fini().
* include/grub/i386/pc/console.h: Include `<grub/term.h>'.
(grub_console_putchar, grub_console_getcharwidth, grub_console_getwh)
(grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): New function prototypes.
* term/i386/pc/vga_text.c: Include `<grub/dl.h>'.
(grub_vga_text_getxy, grub_vga_text_gotoxy, grub_vga_text_cls)
(grub_vga_text_setcursor): Static-ize.
(grub_vga_text_term): New structure.
(GRUB_MOD_INIT(vga_text), GRUB_MOD_FINI(vga_text)): New functions.
* term/i386/pc/console.c: Remove `<grub/machine/machine.h>'.
(grub_console_cur_color, grub_console_standard_color)
(grub_console_normal_color, grub_console_highlight_color)
(map_char, grub_console_putchar, grub_console_getcharwidth)
(grub_console_getwh, grub_console_setcolorstate, grub_console_setcolor)
(grub_console_getcolor): Move from here ...
* term/i386/vga_common.c: ... to here (same function names).
Use newly-added Multiboot support in coreboot.
* conf/i386-coreboot.rmk (kernel_elf_SOURCES): Replace
`kern/i386/coreboot/mmap.c' with `kern/i386/multiboot_mmap.c'.
* kern/i386/coreboot/startup.S: Enable Multiboot header, fix its
alignment, set `MULTIBOOT_MEMORY_INFO' flag.
(codestart): Store the MBI in `startup_multiboot_info' when we're
being loaded using Multiboot.
* kern/i386/coreboot/init.c (grub_machine_init): Move
grub_at_keyboard_init() call to beginning of function (useful for
debugging). Call grub_machine_mmap_init() before attempting to use
grub_machine_mmap_iterate().
(grub_lower_mem, grub_upper_mem): Move from here ...
* kern/i386/multiboot_mmap.c (grub_lower_mem, grub_upper_mem): ... to
here (new file).
* include/grub/i386/coreboot/memory.h (grub_machine_mmap_init): New
function prototype.
Fix a regression introduced by the at_keyboard.mod split. Because
some terminals are default on some platforms and non-default on
others, the first terminal being registered determines which is
going to be default.
* kern/term.c (grub_term_register_input): If this is the first
terminal being registered, set it as the current one.
(grub_term_register_output): Likewise.
* term/efi/console.c (grub_console_init): Do not call
grub_term_set_current_output() or grub_term_set_current_input().
* term/ieee1275/ofconsole.c (grub_console_init): Likewise.
* term/i386/pc/console.c (grub_console_init): Likewise.
(grub_console_fini): Do not call grub_term_set_current_input()
(but leave grub_term_set_current_output() to restore text mode).
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).
* kern/powerpc/ieee1275/crt0.S: Include grub/symbol.h and
grub/cpu/kernel.h. Add start label for consistency with other
platforms. Add grub_prefix immediately after start. Add jump
to the code after grub_prefix.
* include/grub/powerpc/kernel.h: Provide valid values for
GRUB_KERNEL_CPU_PREFIX and GRUB_KERNEL_CPU_DATA_END.
* conf/i386-pc.rmk (kernel_img_SOURCES): Add `kern/i386/pc/mmap.c'.
* include/grub/i386/pc/init.h (GRUB_MACHINE_MEMORY_AVAILABLE)
(GRUB_MACHINE_MEMORY_RESERVED): New macros.
(grub_machine_mmap_iterate): New function declaration.
* include/grub/multiboot.h (struct grub_multiboot_mmap_entry): New
structure.
(GRUB_MMAP_MEMORY_AVAILABLE, GRUB_MMAP_MEMORY_RESERVED): New
macros.
* kern/i386/pc/init.c (grub_machine_init): Replace hardcoded region
type check value with `GRUB_MACHINE_MEMORY_AVAILABLE'.
Move e820 parsing from here ...
* kern/i386/pc/mmap.c: New file.
(grub_machine_mmap_iterate): ... to here.
* include/grub/i386/coreboot/memory.h: Remove `<grub/err.h>'.
(GRUB_LINUXBIOS_MEMORY_AVAILABLE): Rename (for consistency) to ...
(GRUB_MACHINE_MEMORY_AVAILABLE): ... this. Update all users.
(grub_available_iterate): Redeclare to return `void', and redeclare
its hook to use grub_uint64_t as addr and size parameters, and rename
to ...
(grub_machine_mmap_iterate): ... this. Update all users.
* kern/i386/coreboot/mmap.c (grub_mmap_iterate): Simplify parser loop
to make it more readable. Rename to ...
(grub_machine_mmap_iterate): ... this.
* loader/i386/pc/multiboot.c (mmap_addr, mmap_length): New variables.
(grub_get_multiboot_mmap_len, grub_fill_multiboot_mmap): New functions.
(grub_multiboot): Allocate an extra region after the payload, and fill
it with a Multiboot memory map. Adjust a.out loader to calculate size
with the extra space.
(grub_multiboot_load_elf32): Adjust elf32 loader to calculate size
with the extra space.
* include/grub/err.h (grub_err_printf): New function prototype.
* util/misc.c (grub_err_printf): New function.
* kern/misc.c [! GRUB_UTIL] (grub_err_printf): New alias for
grub_printf.
* kern/err.c (grub_print_error): Use grub_err_printf.
* loader/i386/pc/multiboot.c (grub_multiboot_load_elf32): Move part
of the relocation code from here ...
(grub_multiboot): ... to here.
(forward_relocator, backward_relocator): Move from here ...
* kern/i386/loader.S (grub_multiboot_forward_relocator)
(grub_multiboot_backward_relocator): ... to here.
(grub_multiboot_real_boot): Use %edx for entry offset. Put Multiboot
magic in %eax. Use %ebp for jumping (so %edx is not trashed).
* include/grub/i386/loader.h (grub_multiboot_forward_relocator)
(grub_multiboot_forward_relocator_end)
(grub_multiboot_backward_relocator)
(grub_multiboot_backward_relocator_end): New variables.
* kern/i386/linuxbios/startup.S: Move from here ...
* kern/i386/coreboot/startup.S: ... to here.
* kern/i386/linuxbios/init.c: Move from here ...
* kern/i386/coreboot/init.c: ... to here.
* kern/i386/linuxbios/table.c: Move from here ...
* kern/i386/coreboot/mmap.c: ... to here.
* conf/i386-coreboot.rmk (kernel_elf_SOURCES): Update moved files.
* kern/disk.c: Replace `<grub/machine/time.h>' with `<grub/time.h>'.
(grub_last_time): Change type to grub_uint64_t.
(grub_disk_open): Migrate code from to using grub_get_time_ms().
(grub_disk_close): Likewise.
* normal/menu.c: Replace `<grub/machine/time.h>' with `<grub/time.h>'.
(run_menu): Migrate code from to using grub_get_time_ms().
* util/misc.c (grub_get_time_ms): New function.
* kern/i386/pit.c (TIMER2_SPEAKER): New define.
(TIMER2_GATE): Likewise.
(grub_pit_wait): Add enable/disable of the timer2 gate
bit of port 0x61. This fixes a possible infinite loop.
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.
* kern/i386/pc/init.c (make_install_device): Check for `grub_prefix'
instead of `grub_install_dos_part' to determine whether a drive needs
to be prepended to prefix (`grub_install_dos_part' is not reliable,
because it can be overriden when loading GRUB via Multiboot).
* 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.
* loader/i386/pc/multiboot.c (playground, forward_relocator)
(backward_relocator): New variables. Used to allocate and relocate
the payload, respectively.
(grub_multiboot_load_elf32): Load into heap instead of requested
address, install the appropiate relocator code in each bound of
the payload, and set the entry point such that
grub_multiboot_real_boot() will jump to one of them.
* kern/i386/loader.S (grub_multiboot_payload_size)
(grub_multiboot_payload_orig, grub_multiboot_payload_dest)
(grub_multiboot_payload_entry_offset): New variables.
(grub_multiboot_real_boot): Set cpu context to what the relocator
expects, and jump to the relocator instead of the payload.
* include/grub/i386/loader.h (grub_multiboot_payload_size)
(grub_multiboot_payload_orig, grub_multiboot_payload_dest)
(grub_multiboot_payload_entry_offset): Export.
* kern/ieee1275/init.c (grub_machine_set_prefix): If `grub_prefix'
is non-empty, use it to set the `prefix' environment variable instead
of the usual approach.
* kern/i386/linuxbios/init.c (make_install_device): Remove function.
(grub_machine_set_prefix): Use `grub_prefix' to set the `prefix'
environment variable instead of dummy make_install_device().
* kern/i386/ieee1275/startup.S: Include `<grub/machine/kernel.h>'.
(start): Insert a data section, with `grub_prefix' variable.
* kern/i386/linuxbios/startup.S: Likewise.
* include/grub/powerpc/ieee1275/kernel.h [!ASM_FILE] (grub_prefix):
New variable reference.
* include/grub/i386/ieee1275/kernel.h (GRUB_KERNEL_MACHINE_PREFIX):
New macro. Defines offset of `grub_prefix' within startup.S (relative
to `start').
(GRUB_KERNEL_MACHINE_DATA_END): New macro. Defines the end of data
section within startup.S (relative to `start').
* include/grub/i386/coreboot/kernel.h: Likewise.
* util/elf/grub-mkimage.c (add_segments): Receive `prefix' parameter.
Overwrite grub_prefix with its contents, at the beginning of the
first segment.
(main): Understand -p|--prefix.
* common.rmk (bin_UTILITIES): Add grub-pe2elf.
(grub_pe2elf_SOURCES): New macro.
(CLEANFILES): Add grub-pe2elf.
* include/grub/efi/pe32.h (GRUB_PE32_SCN_ALIGN_1BYTES): New constant.
(GRUB_PE32_SCN_ALIGN_2BYTES): Likewise.
(GRUB_PE32_SCN_ALIGN_4BYTES): Likewise.
(GRUB_PE32_SCN_ALIGN_8BYTES): Likewise.
(GRUB_PE32_SCN_ALIGN_16BYTES): Likewise.
(GRUB_PE32_SCN_ALIGN_32BYTES): Likewise.
(GRUB_PE32_SCN_ALIGN_64BYTES): Likewise.
(GRUB_PE32_SCN_ALIGN_SHIFT): Likewise.
(GRUB_PE32_SCN_ALIGN_MASK): Likewise.
(GRUB_PE32_SYM_CLASS_EXTERNAL): Likewise.
(GRUB_PE32_SYM_CLASS_STATIC): Likewise.
(GRUB_PE32_SYM_CLASS_FILE): Likewise.
(GRUB_PE32_DT_FUNCTION): Likewise.
(GRUB_PE32_REL_I386_DIR32): Likewise.
(GRUB_PE32_REL_I386_REL32): Likewise.
(grub_pe32_symbol): New structure.
(grub_pe32_reloc): Likewise.
* util/grub-pe2elf.c: New file.
* configure.ac: Set TARGET_OBJ2ELF if host os is cygwin. Don't test for
start symbol in non pc platform.
* genmk.rb: Use TARGET_OBJ2ELF to convert native object format to elf.
The following patches are from Christian Franke.
* include/grub/dl.h: Remove .previous, gas supports this only
for ELF format.
* include/grub/symbol.h [__CYGWIN__] (#define FUNCTION/VARIABLE):
Remove .type, gas supports this only for ELF format.
* kern/dl.c (grub_dl_resolve_dependencies): Add check for trailing
nullbytes in symbol table. This fixes an infinite loop if table is
zero filled.
* Makefile.in: Add autoconf replacements TARGET_IMG_LDSCRIPT,
TARGET_IMG_LDFLAGS and EXEEXT.
* aclocal.m4 (grub_PROG_OBJCOPY_ABSOLUTE): Replace -Wl,-N by
TARGET_IMG_LDFLAGS_AC.
(grub_CHECK_STACK_ARG_PROBE): New function.
* conf/i386-pc.rmk: Replace -Wl,-N by TARGET_IMG_LDFLAGS.
* conf/i386-pc-cygwin-ld-img.sc: New linker script.
* configure.ac: Add check for linker script "conf/${target}-img-ld.c"
to set TARGET_IMG_LD* accordingly.
Add check for Cygwin to set TARGET_MOD_OBJCOPY accordingly.
Add call to grub_CHECK_STACK_ARG_PROBE.
Use TARGET_IMG_LDFLAGS to check start, bss_start, end symbols.
* genkernsyms.sh.in: Handle HAVE_ASM_USCORE case.
* genmk.rb: Add EXEEXT to CLEANFILES.
* kern/dl.c: Go back to using GRUB_CPU_SIZEOF_VOID_P. We cannot
load foreign architecture modules correctly anyway. Keep
support for loading host architecture modules, whether we
compile them or not.
* kern/i386/linuxbios/init.c (grub_machine_init): Cast addr to
grub_addr_t before casting it to the void pointer to fix a
warning. Non-addressable regions are discarded earlier.
(grub_arch_modules_addr): Cast _end to grub_addr_t.
* kern/i386/linuxbios/table.c: Include grub/misc.h.
(check_signature): Don't shadow table_header.
(grub_linuxbios_table_iterate): Cast numeric constants to
grub_linuxbios_table_header_t.
* include/grub/i386/linuxbios/init.h: Add noreturn attribute to
grub_stop().
This fixes a performance issue when pc & gpt partmap iterators
didn't abort iteration even after our hook found what it was
looking for (often causing expensive probes of non-existant drives).
Some callers relied on previous buggy behaviour, since they would
rise an error when their own hooks caused early abortion of its
iteration.
* kern/device.c (grub_device_open): Improve error message.
* disk/lvm.c (grub_lvm_open): Likewise.
* disk/raid.c (grub_raid_open): Likewise.
* partmap/pc.c (pc_partition_map_iterate): Abort parent iteration
when hook requests it, independently of grub_errno.
(pc_partition_map_probe): Do not fail when find_func() caused
early abortion of pc_partition_map_iterate().
* partmap/gpt.c (gpt_partition_map_iterate): Abort parent iteration
when hook requests it, independently of grub_errno.
(gpt_partition_map_probe): Do not fail when find_func() caused
early abortion of gpt_partition_map_iterate().
* kern/partition.c (grub_partition_iterate): Abort parent iteration
when hook requests it, independently of grub_errno. Do not fail when
part_map_iterate_hook() caused early abortion of p->iterate().
* util/biosdisk.c (grub_util_biosdisk_get_grub_dev): Do not fail
when grub_partition_iterate() returned with non-zero.
* include/grub/ieee1275.h (grub_ieee1275_flag): New constant
GRUB_IEEE1275_FLAG_CANNOT_INTERPRET, GRUB_IEEE1275_FLAG_FORCE_CLAIM
and GRUB_IEEE1275_FLAG_NO_ANSI.
* kern/ieee1275/cmain.c (grub_ieee1275_find_options): Set flag
GRUB_IEEE1275_FLAG_CANNOT_INTERPRET, GRUB_IEEE1275_FLAG_FORCE_CLAIM
and GRUB_IEEE1275_FLAG_NO_ANSI for Open Hackware.
* kern/ieee1275/ieee1275.c (grub_ieee1275_interpret): Return
immediately if GRUB_IEEE1275_FLAG_CANNOT_INTERPRET is set.
* kern/ieee1275/init.c (grub_claim_heap): Claim memory directly if
GRUB_IEEE1275_FLAG_FORCE_CLAIM is set.
* term/ieee1275/ofconsole.c (grub_ofconsole_writeesc): Don't output
esc sequence on non ANSI terminal.
(grub_ofconsole_gotoxy): Emulate backspace key on non ANSI terminal.
* util/elf/grub-mkimage.c (add_segments): Move ELF header to the
beginning of file.
* commands/ls.c (grub_ls_list_files): Use integer calculations
for human readable format, avoid floating point use.
* kern/misc.c (grub_ftoa): Remove.
(grub_vsprintf): Remove floating point support.
* util/i386/pc/grub-mkimage.c (generate_image): If we included a drive
in our prefix, set install_{dos,bsd}_part = -2 to indicate this can be
skipped later.
(main): If a memdisk was requested, add "(memdisk)" drive explicitly to
the beginning of the prefix.
* kern/i386/pc/init.c (make_install_device): Remove memdisk check.
It is assumed that if we have a memdisk, grub-mkimage has set
grub_prefix to include the "(memdisk)" drive in it.
Based on description from Pavel:
* kern/disk.c (grub_disk_check_range): Rename to ...
(grub_disk_adjust_range): ... this. Add a comment explaining the
tasks performed by this function.
Ensure GRUB_KERNEL_MACHINE_DATA_END is always consistent with the
rest of GRUB, and breakage doesn't happen if its value were modified.
* include/grub/i386/pc/kernel.h (GRUB_KERNEL_MACHINE_RAW_SIZE):
Redefine as an offset from `GRUB_KERNEL_MACHINE_DATA_END' instead of
a constant (same value).
* kern/i386/pc/startup.S: Replace hardcoded `0x50' with
`GRUB_KERNEL_MACHINE_DATA_END' (same value).
* Makefile.in (RMKFILES): Add missing arch i386-ieee1275 and
i386-linuxbios.
* commands/hexdump.c (grub_cmd_hexdump): Support dumping of device,
change the buffer size to 4096 for cdrom device.
* conf/i386-ieee1275.rmk (pkglib_MODULES): Add _linux.mod, linux.mod
and nand.mod.
(_linux_mod_SOURCES): New variable.
(_linux_mod_CFLAGS): Likewise.
(_linux_mod_LDFLAGS): Likewise.
(linux_mod_SOURCES): Likewise.
(linux_mod_CFLAGS): Likewise.
(linux_mod_LDFLAGS): Likewise.
(nand_mod_SOURCES): Likewise.
(nand_mod_CFLAGS): Likewise.
(nand_mod_LDFLAGS): Likewise.
* disk/ieee1275/ofdisk.c (grub_ofdisk_open): Return
GRUB_ERR_UNKNOWN_DEVICE instead of GRUB_ERR_BAD_DEVICE if no device
type property. (nand device in olpc don't have this property)
* include/grub/disk.h (grub_disk_dev_id): New macro
GRUB_DISK_DEVICE_NAND_ID.
* include/grub/i386/ieee1275/loader.h (grub_rescue_cmd_linux): New
function prototype.
(grub_rescue_cmd_initrd): Likewise.
* include/grub/i386/linux.h (GRUB_LINUX_OFW_SIGNATURE): New macro.
(linux_kernel_params): Add new member ofw_signature, ofw_num_items,
ofw_cif_handler and ofw_idt, adjust padding number.
* include/grub/i386/pc/memory.h (grub_upper_mem): Export it if
GRUB_MACHINE_IEEE1275 is defined.
* include/grub/ieee1275/ieee1275.h (grub_available_iterate):
Use NESTED_FUNC_ATTR attribute on the hook parameter.
* kern/powerpc/ieee1275/init.c (grub_claim_heap): Use NESTED_FUNC_ATTR
on nested function heap_init.
(grub_upper_mem): New variable for i386-ieee1275.
(grub_get_extended_memory): New function for i386-ieee1275.
(grub_machine_init): Call grub_get_extended_memory for i386-ieee1275.
* kern/powerpc/ieee1275/openfw.c (grub_available_iterate): Use
NESTED_FUNC_ATTR on the hook parameter. Don't quit if no device type
property.
* loader/i386/ieee1275/linux.c: New file.
* loader/i386/ieee1275/linux_normal.c: New file.
* disk/ieee1275/nand.c: New file.
Restructures early code path on ieee1275 to unify grub_main() as
the first C function that is executed in every platform.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_init): New prototype.
* kern/i386/ieee1275/startup.S (_start): Jump to grub_main() instead of
cmain().
* kern/powerpc/ieee1275/crt0.S (_start): Likewise.
* kern/ieee1275/cmain.c (cmain): Rename to ...
* kern/ieee1275/cmain.c (grub_ieee1275_init): ... this.
* kern/ieee1275/init.c (grub_machine_init): Call grub_ieee1275_init()
at the beginning.
* kern/powerpc/ieee1275/init.c: Move from here ...
* kern/ieee1275/init.c: ... to here. Update all users.
* kern/powerpc/ieee1275/cmain.c: Move from here ...
* kern/ieee1275/cmain.c: ... to here. Update all users.
* kern/powerpc/ieee1275/openfw.c: Move from here ...
* kern/ieee1275/openfw.c: ... to here. Update all users.
* loader/powerpc/ieee1275/multiboot2.c: Move from here ...
* loader/ieee1275/multiboot2.c: ... to here. Update all users.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_find_options):
Fix signedness warnings.
* kern/powerpc/ieee1275/openfw.c (grub_available_iterate):
Likewise.
* util/ieee1275/get_disk_name.c: Include config.h so that
_GNU_SOURCE is defined and getline() is declared. Mark an
unused argument as such. Fix a signedness warning.
* kern/i386/pc/startup.S (real_to_prot): Use %cs prefix to load
GDT. This is more robust, as %ds can change.
(grub_biosdisk_rw_int13_extensions): Don't clear %ds before
calling real_to_prot().
(grub_biosdisk_get_diskinfo_int13_extensions): Likewise.
* kern/i386/pc/startup.S: Assert that uncompressed functions
don't spill beyond GRUB_KERNEL_MACHINE_RAW_SIZE.
* kern/i386/pc/lzo1x.S: Remove all .align directives in the
code, as they push parts of the code (error handlers) beyond
GRUB_KERNEL_MACHINE_RAW_SIZE. Speed is not as important in this
code as correctness and size.
* kern/i386/pc/startup.S
(grub_biosdisk_get_diskinfo_int13_extensions): When converting
data block address to the real mode, keep offset minimal. This
works around a bug in AWARD BIOS on old Athlon systems, which
makes CD detection hang.
* conf/i386-pc.rmk (pkglib_MODULES): Add aout.mod _bsd.mod and bsd.mod.
(aout_mod_SOURCES): New variable.
(aout_mod_CFLAGS): Likewise.
(aout_mod_LDFLAGS): Likewise.
(_bsd_mod_SOURCES): New variable.
(_bsd_mod_CFLAGS): Likewise.
(_bsd_mod_LDFLAGS): Likewise.
(bsd_mod_SOURCES): New variable.
(bsd_mod_CFLAGS): Likewise.
(bsd_mod_LDFLAGS): Likewise.
* include/grub/aout.h: New file.
* include/grub/i386/loader.h (grub_unix_real_boot): New function.
* include/grub/i386/bsd.h: New file.
* include/grub/i386/pc/init.h (grub_get_mmap_entry): Use EXPORT_FUNC
to make it public.
* kern/elf.c (grub_elf32_load): Get the physical address after the hook
function is called, so that it's possible to change it inside the hook.
(grub_elf64_load): Likewise.
(grub_elf_file): Don't close the file if elf header is not found.
(grub_elf_close): Close the file if grub_elf_file fails (The new
grub_elf_file won't close it).
(grub_elf32_size): Use NESTED_FUNC_ATTR for nested function calcsize.
(grub_elf64_size): Likewise.
* kern/i386/loader.S (grub_unix_real_boot): New function.
* loader/aout.c: New file.
* loader/i386/bsd.c: New file.
* loader/i386/bsd_normal.c: New file.
* loader/i386/pc/multiboot.c (grub_multiboot): Handle a.out format.
* loader/multiboot2.c (grub_multiboot2): Reset grub_errno so that it
can test othe formats.
* conf/i386-efi.rmk (grub_emu_SOURCES): Replace commands/i386/pc/halt.c and
reboot.c by commands/halt.c and reboot.c.
(grub_install_SOURCES): Add halt.mod and reboot.mod.
(halt_mod_SOURCES): New variable.
(halt_mod_CFLAGS): Likewise.
(halt_mod_LDFLAGS): Likewise.
(reboot_mod_SOURCES): Likewise.
(reboot_mod_CFLAGS): Likewise.
(reboot_mod_LDFLAGS): Likewise.
* conf/i386-ieee1275.rmk (grub_emu_SOURCES): Replace commands/ieee1275/halt.c
and reboot.c by commands/halt.c and reboot.c.
(halt_mod_SOURCES): Likewise.
(reboot_mod_SOURCES): Likewise.
* conf/i386-pc.rmk (grub_emu_SOURCES): Replace commands/i386/pc/reboot.c by
commands/reboot.c.
(reboot_mod_SOURCES): Likewise.
* commands/i386/pc/reboot.c: merge this file ...
* commands/ieee1275/reboot.c: ... and this file ...
* commands/reboot.c: ... to this file.
Add some precompiler directive to include the correct header for each
machine.
* commands/ieee1275/halt.c: move this file ...
* commands/halt.c: ... to here.
Add some precompiler directive to include the correct header for each
machine.
* include/grub/efi/efi.h (grub_reboot): New function declaration.
(grub_halt): Likewise.
* kern/efi/efi.c (grub_reboot): New function.
(grub_halt): Likewise.
* kern/main.c (grub_load_normal_mode): Do not reset `grub_errno'. Call
grub_print_error() instead. This will let user know why we're entering
rescue mode.
Based on suggestions from Sam Morris.
* disk/raid.c (grub_raid_open, grub_raid_scan_device): Add a few
grub_dprintf() calls.
* kern/disk.c (grub_disk_read): Include grub_errmsg in out of range
error message.
* include/grub/term.h (GRUB_TERM_LEFT, GRUB_TERM_RIGHT)
(GRUB_TERM_UP, GRUB_TERM_DOWN, GRUB_TERM_HOME, GRUB_TERM_END)
(GRUB_TERM_DC, GRUB_TERM_PPAGE, GRUB_TERM_NPAGE, GRUB_TERM_ESC)
(GRUB_TERM_TAB, GRUB_TERM_BACKSPACE): New macros.
* kern/i386/pc/startup.S: Include `<grub/term.h>'.
(translation_table): Replace hardcoded values with macros
provided by `<grub/term.h>'.
* term/i386/pc/at_keyboard.c: Include `<grub/term.h>'.
(keyboard_map): Correct/add a few values, with macros provided
by `<grub/term.h>'.
(keyboard_map_shift): Zero values that don't differ from their
`keyboard_map' equivalents.
(grub_console_checkkey): Optimize KEYBOARD_STATUS_CAPS_LOCK toggling.
Discard the second scan code that is always sent by Caps lock.
Only use `keyboard_map_shift' when it provides a non-zero value,
otherwise fallback to `keyboard_map'.
Add support for having a grub directory in a different drive. This
is still only the data handling part.
* kern/i386/pc/startup.S (multiboot_trampoline): Set %dh to 0xFF.
(codestart): Save %dh in GRUB_ROOT_DRIVE.
(grub_root_drive): New variable.
* kern/i386/pc/init.c (make_install_device): Use GRUB_ROOT_DRIVE
instead of GRUB_BOOT_DRIVE to construct a device name. Set
GRUB_ROOT_DRIVE to GRUB_BOOT_DRIVE if it is 0xFF, otherwise use it
as it was.
* include/grub/i386/pc/kernel.h (grub_root_drive): New prototype.
* include/grub/i386/pc/boot.h (GRUB_BOOT_MACHINE_ROOT_DRIVE): New
macro.
(GRUB_BOOT_MACHINE_DRIVE_CHECK): Set to 0x4f.
* boot/i386/pc/pxeboot.S (_start): Set %dh to 0xFF. For now, this
is bogus, because PXE booting does not specify any drive
correctly.
* boot/i386/pc/lnxboot.S (reg_edx): Set the second byte to 0xFF. I
am not sure if this is really correct.
* boot/i386/pc/cdboot.S: Set %dh to 0xFF, because the root drive
is always identical to the boot drive when booting from a CD.
* boot/i386/pc/boot.S (MOV_MEM_TO_AL): Removed. Not needed any
longer.
(root_drive): New variable.
(real_start): Unconditionally set %dh to ROOT_DRIVE.
(setup_sectors): Push %dx right after popping it, because %dh will
be modified later.
(copy_buffer): Restore %dx.
* a/kern/i386/pc/startup.S (grub_chainloader_real_boot): Pop
%edx and %esi from stack only after grub_gate_a20() is called.
grub_gate_a20() clobbers %edx.
* conf/i386-pc.rmk (pkglib_IMAGES): Add cdboot.img.
(cdboot_img_SOURCES): New variable.
(cdboot_img_ASFLAGS): New variable.
(cdboot_img_LDFLAGS): New variable.
* boot/i386/pc/cdboot.S: New file.
* disk/i386/pc/biosdisk.c (cd_start): New variable.
(cd_count): Likewise.
(grub_biosdisk_get_drive): Add support for cd device.
(grub_biosdisk_call_hook): Likewise.
(grub_biosdisk_iterate): Likewise.
(grub_biosdisk_open): Likewise.
(GRUB_BIOSDISK_CDROM_RETRY_COUNT): New macro.
(grub_biosdisk_rw): Support reading from cd device.
(GRUB_MOD_INIT): Iterate cd devices.
* include/grub/i386/pc/biosdisk.h (GRUB_BIOSDISK_FLAG_CDROM): New macro.
(GRUB_BIOSDISK_MACHINE_CDROM_START): Likewise.
(GRUB_BIOSDISK_MACHINE_CDROM_END): Likewise.
* kern/i386/pc/init.c (make_install_device): Check for cd device.
to create a gap between _end and the modules added to the image
with grub-mkrescue. That fixes "CLAIM failed" on PowerMAC.
* kern/powerpc/ieee1275/init.c: Use GRUB_MOD_GAP.
* util/elf/grub-mkimage.c (add_segments): Likewise.
that hang if GRUB tries to setup colors.
* term/ieee1275/ofconsole.c (grub_ofconsole_init): Don't set
colors for firmwares that don't support it.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_set_flag):
Recognize Open Hack'Ware, set flags to work around its
limitations.
* kern/i386/pc/init.c (make_install_device): When memdisk image is
present, "(memdisk)/boot/grub" becomes the default prefix.
* util/i386/pc/grub-mkrescue.in: Switch to a minimal core.img plus
a memdisk tarball with all the modules. Add --overlay=DIR option that
allows users to overlay additional files into the image.
* conf/i386-ieee1275.rmk (kernel_elf_SOURCES): Add `machine/loader.h'
and `machine/memory.h'.
(pkglib_MODULES): Add `multiboot.mod' and `_multiboot.mod'.
(_multiboot_mod_SOURCES): New variable.
(_multiboot_mod_CFLAGS): Likewise.
(_multiboot_mod_LDFLAGS): Likewise.
(multiboot_mod_SOURCES): Likewise.
(multiboot_mod_CFLAGS): Likewise.
(multiboot_mod_LDFLAGS): Likewise.
* include/grub/i386/ieee1275/loader.h: New file.
* include/grub/i386/ieee1275/machine.h: Likewise.
* include/grub/i386/ieee1275/memory.h: Likewise.
* include/grub/i386/pc/init.h (grub_os_area_addr): Remove (redundant)
variable declaration.
(grub_os_area_size): Likewise.
* kern/i386/ieee1275/init.c (grub_os_area_addr, grub_os_area_size)
(grub_lower_mem, grub_upper_mem): New variables.
(grub_stop_floppy): New function (just to make
grub_multiboot2_real_boot() happy).
* kern/i386/ieee1275/startup.S: Include `<grub/machine/memory.h>',
`<grub/cpu/linux.h>', `<multiboot.h>' and `<multiboot2.h>'.
(grub_stop): New function.
Include `"../realmode.S"' and `"../loader.S"'.
* loader/multiboot_loader.c: Include `<grub/machine/machine.h>'.
Replace `__i386__' #ifdefs with `GRUB_MACHINE_PCBIOS'.
* loader/powerpc/ieee1275/multiboot2.c (grub_mb2_arch_boot): On i386,
rely on grub_multiboot2_real_boot() for final boot.
* disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): When
`GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLY' flag is set, skip any
device that doesn't look like an SD card.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_flag): Add
`GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLY' flag.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_set_flag): Detect
OLPC laptop, and set `GRUB_IEEE1275_FLAG_OFDISK_SDCARD_ONLY' when
found.
Mostly based on bugfix from Bean.
* kern/elf.c (grub_elf32_phdr_iterate): Use `NESTED_FUNC_ATTR'
attribute with hook() parameter.
(grub_elf32_load): Use `NESTED_FUNC_ATTR' with grub_elf32_load_segment()
declaration.
(grub_elf64_phdr_iterate): Use `NESTED_FUNC_ATTR'
attribute with hook() parameter.
(grub_elf64_load): Use `NESTED_FUNC_ATTR' with grub_elf64_load_segment()
declaration.
* conf/i386-pc.rmk (kernel_img_HEADERS): Add `machine/kernel.h'.
(pkglib_MODULES): Add `memdisk.mod'.
(memdisk_mod_SOURCES): New variable.
(memdisk_mod_CFLAGS): Likewise.
(memdisk_mod_LDFLAGS): Likewise.
* disk/memdisk.c: New file.
* include/grub/disk.h (grub_disk_dev_id): Add
`GRUB_DISK_DEVICE_MEMDISK_ID'.
* include/grub/i386/pc/kernel.h
(GRUB_KERNEL_MACHINE_MEMDISK_IMAGE_SIZE): New macro.
(GRUB_KERNEL_MACHINE_PREFIX): Increment by 4.
(grub_kernel_image_size): New variable declaration.
(grub_total_module_size): Likewise.
(grub_memdisk_image_size): Likewise.
* include/grub/i386/pc/memory.h
(GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR): New macro.
* include/grub/kernel.h: Include `<grub/symbol.h>'.
(grub_arch_memdisk_addr): New variable declaration.
(grub_arch_memdisk_size): Likewise.
* kern/i386/pc/init.c (grub_arch_memdisk_addr): New function.
(grub_arch_memdisk_size): Likewise.
* kern/i386/pc/startup.S (grub_memdisk_image_size): New variable.
(codestart): Replace hardcoded `0x100000' with
`GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR' macro.
* util/i386/pc/grub-mkimage.c: Include `<grub/misc.h>'.
(generate_image): Add `memdisk_path' parameter. When `memdisk_path' is
not NULL, append the contents of the file it refers to, at the end of
the compressed kernel image. Initialize `grub_memdisk_image_size'
variable (at `GRUB_KERNEL_MACHINE_MEMDISK_IMAGE_SIZE' offset).
(options): Add "memdisk"|'m' option.
(main): Parse --memdisk|-m option, and pass user-provided path as
parameter to generate_image().
Fix detection of "real mode" when /options/real-mode? doesn't exist.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_mmu): New variable
declaration.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_mmu): New variable.
(grub_ieee1275_find_options): If `grub_ieee1275_mmu' is 0, set
`GRUB_IEEE1275_FLAG_REAL_MODE'.
(cmain): Intialize `grub_ieee1275_mmu' (using /chosen/mmu integer
property).
* kern/powerpc/ieee1275/openfw.c (grub_map): Rely on pre-initialized
`grub_ieee1275_mmu' rather than obtaining a handler on every call.
Get rid of confusing function (superceeded by
`grub_ieee1275_get_integer_property')
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_decode_int_4): Remove
prototype.
* kern/ieee1275/ieee1275.c (grub_ieee1275_decode_int_4): Remove
function.
* term/ieee1275/ofconsole.c (grub_ofconsole_init): Avoid use of
grub_ieee1275_decode_int_4(), by obtaining integer properties directly
in native endianess from grub_ieee1275_get_integer_property().
* kern/powerpc/ieee1275/openfw.c (grub_halt): Issue "power-off"
command after "shut-down", since implementations differ on which
the command for halt is.
PowerPC changes provided by Pavel Roskin.
* kern/powerpc/ieee1275/cmain.c (cmain): Don't take any arguments.
* kern/powerpc/ieee1275/crt0.S: Store r5 in grub_ieee1275_entry_fn,
don't rely on cmain() doing it.
* kern/i386/ieee1275/startup.S (_start): Store %eax in
grub_ieee1275_entry_fn, don't rely on cmain() doing it.
* include/grub/i386/linuxbios/memory.h
(GRUB_MEMORY_MACHINE_LINUXBIOS_TABLE_ADDR): Remove macro.
* kern/i386/linuxbios/table.c (grub_linuxbios_table_iterate): Do not
receive `table_header' as argument. Instead, probe for it in the
known memory ranges where it can be present.
(grub_available_iterate): Do not pass a fixed `table_header' address
to grub_linuxbios_table_iterate().
* include/grub/ieee1275/ieee1275.h
(grub_ieee1275_get_integer_property): New function prototype.
* kern/ieee1275/ieee1275.c: Include `<grub/types.h>'.
(grub_ieee1275_get_integer_property): New function. Wraps around
grub_ieee1275_get_property() to handle endianess.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_find_options): Replace
grub_ieee1275_get_property() with grub_ieee1275_get_integer_property()
where appropiate.
* kern/powerpc/ieee1275/openfw.c (grub_available_iterate): Likewise.
(grub_map): Likewise.
* kern/sparc64/ieee1275/openfw.c (grub_map): Likewise.
* kern/powerpc/ieee1275/openfw.c (grub_available_iterate): Obtain
actual size of `available' from grub_ieee1275_get_property(), and
restrict parsing to that bound.
* kern/device.c (grub_device_iterate): Do not abort device iteration
when one of the devices cannot be opened.
* kern/disk.c (grub_disk_open): Do not account previous failures of
unrelated functions when grub_errno is checked for.
* kern/i386/linuxbios/init.c: Put "void" to all function
declarations with no arguments.
* kern/powerpc/ieee1275/init.c: Likewise.
* term/i386/pc/at_keyboard.c: Likewise.
* term/i386/pc/vga_text.c: Likewise.
* util/grub-mkdevicemap.c: Likewise.
* include/grub/term.h (struct grub_term): Add `getcolor' function.
(grub_getcolor): New function.
* kern/term.c (grub_getcolor): New function.
* normal/menu.c (GRUB_COLOR_MENU_NORMAL): New macro.
(GRUB_COLOR_MENU_HIGHLIGHT): New macro.
(print_entry): Set normal and highlight colors to
`GRUB_COLOR_MENU_NORMAL' and `GRUB_COLOR_MENU_HIGHLIGHT',
respectively, before printing and restore them to old
values afterwards.
(grub_menu_init_page): Likewise. Fill an additional colored space
that would otherwise be left blank.
* term/efi/console.c (grub_console_getcolor): New function.
(struct grub_console_term.getcolor): New variable.
* term/i386/pc/console.c (grub_console_getcolor): New function.
(struct grub_console_term.getcolor): New variable.
* term/ieee1275/ofconsole.c (grub_ofconsole_getcolor): New function.
(struct grub_console_term.getcolor): New variable.
* term/i386/pc/serial.c (grub_serial_setcolor): Remove function.
(struct grub_console_term.setcolor): Remove variable.
* term/i386/pc/vesafb.c (grub_virtual_screen_setcolor): Remove function.
(struct grub_console_term.setcolor): Remove variable.
* term/i386/pc/vga.c (grub_vga_setcolor): Remove function.
(struct grub_console_term.setcolor): Remove variable.
* term/gfxterm.c (grub_virtual_screen_setcolor): Remove function.
(struct grub_console_term.setcolor): Remove variable.
* kern/disk.c (grub_disk_firmware_fini)
(grub_disk_firmware_is_tainted): New variables.
* include/grub/disk.h (grub_disk_firmware_fini)
(grub_disk_firmware_is_tainted): Likewise.
* disk/i386/pc/biosdisk.c (GRUB_MOD_FINI(biosdisk)): Moved from here ...
(grub_disk_biosdisk_fini): ... to here.
(GRUB_MOD_FINI(biosdisk)): Implement using grub_disk_biosdisk_fini().
(GRUB_MOD_INIT(biosdisk)): Abort when `grub_disk_firmware_is_tainted'
is set. Register grub_disk_biosdisk_fini() in
`grub_disk_firmware_fini'.
* disk/ata.c: Remove `<grub/machine/biosdisk.h>'.
(GRUB_MOD_INIT(ata)): Remove grub_biosdisk_fini() call.
Use `grub_disk_firmware_is_tainted' and `grub_disk_firmware_fini'
to finish existing firmware disk interface.
* conf/i386-linuxbios.rmk (pkgdata_MODULES): Add `ata.mod'.
(ata_mod_SOURCES): New variable.
(ata_mod_CFLAGS): Likewise.
(ata_mod_LDFLAGS): Likewise.
* kern/i386/loader.S: New file.
* kern/i386/pc/startup.S (grub_linux_prot_size): Moved from here ...
* kern/i386/loader.S (grub_linux_prot_size)... to here.
* kern/i386/pc/startup.S (grub_linux_tmp_addr): Moved from here ...
* kern/i386/loader.S (grub_linux_tmp_addr)... to here.
* kern/i386/pc/startup.S (grub_linux_real_addr): Moved from here ...
* kern/i386/loader.S (grub_linux_real_addr)... to here.
* kern/i386/pc/startup.S (grub_linux_boot_zimage): Moved from here ...
* kern/i386/loader.S (grub_linux_boot_zimage)... to here.
* kern/i386/pc/startup.S (grub_linux_boot_bzimage): Moved from here ...
* kern/i386/loader.S (grub_linux_boot_bzimage)... to here.
* kern/i386/pc/startup.S (grub_multiboot_real_boot): Moved from here ...
* kern/i386/loader.S (grub_multiboot_real_boot)... to here.
* kern/i386/pc/startup.S (grub_multiboot2_real_boot): Moved from here ...
* kern/i386/loader.S (grub_multiboot2_real_boot)... to here.
* kern/i386/realmode.S: New file.
* kern/i386/pc/startup.S (protstack): Moved from here ...
* kern/i386/realmode.S (protstack)... to here.
* kern/i386/pc/startup.S (gdt): Moved from here ...
* kern/i386/realmode.S (gdt)... to here.
* kern/i386/pc/startup.S (prot_to_real): Moved from here ...
* kern/i386/realmode.S (prot_to_real)... to here.
* kern/i386/pc/startup.S: Include `kern/i386/loader.S' and
`kern/i386/realmode.S'.
* kern/powerpc/ieee1275/init.c: Rename HEAP_LIMIT to HEAP_MAX_ADDR,
and make it easier to figure out.
Add HEAP_MIN_SIZE and HEAP_MAX_ADDR definitions.
(grub_claim_heap): Use HEAP_MAX_ADDR rather than taking a parameter.
Do not avoid claiming a region above HEAP_MAX_ADDR if that would
leave us with less than HEAP_MIN_SIZE total heap.
Avoid our total amount of heap to surpass HEAP_MAX_SIZE.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_test_flag): Detect
SmartFirmware version updates (as released by Sven Luther), and avoid
setting GRUB_IEEE1275_FLAG_NO_PARTITION_0 or
GRUB_IEEE1275_FLAG_0_BASED_PARTITIONS unless the running version is
known broken.
for powerpc & i386-pc. This patch was more so started by Hollis
Blanchard getting multiboot 2 working for powerpc and I added to it
and cleaned it up.
One of the ideas with this patch is to keep everything under one
command for the user. So instead of having a "multiboot2" & "module2"
command, I created a proxy like mechanism so that you have only one
command for both multiboot 1 & 2 ... "multiboot". This is where
"loader/multiboot_loader.c" comes from. I could have integrated things
more but I figure the current approach will less likely break
anything.
So if your OS is multiboot 2 capable, the user would do the following
to load it up from a grub prompt:
grub> multiboot <location of kernel> <kernel args>
grub> module <some image> <multiboot tag> <image arguments>
grub> module <isome mage> <multiboot tag> <image arguments>
grub .....
The other thing that this patch does is it begins to make the
multiboot 1 code a bit more architecture agnostic so IF someone wanted
to implement it on another architecture they can.
A bit of file moving around and definition renaming is also apart of
this patch. I have also taken the time to make sure that it does not
break multiboot 1 loading on i386-pc. But mulitboot 2 may still need a
little more testing and work for i386-pc. Powerpc multiboot 2 has been
heavily tested and does work.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_flag): Add
GRUB_IEEE1275_FLAG_BROKEN_OUTPUT flag.
* kern/powerpc/ieee1275/cmain.c (grub_ieee1275_find_options): Set this
flag when running on SmartFirmware.
* term/ieee1275/ofconsole.c (grub_ofconsole_init): Avoid running
"output-device output" command when GRUB_IEEE1275_FLAG_BROKEN_OUTPUT
was set.
* kern/powerpc/ieee1275/openfw.c (grub_ieee1275_encode_devname):
Increase partno when GRUB_IEEE1275_FLAG_0_BASED_PARTITIONS flag is set,
rather than decreasing it.
* util/i386/pc/grub-setup.c (setup): When embedding is required, but
there's not enough space to do it, fail in the same way as when it
can't be done because there are no partitions.
* util/powerpc/ieee1275/grub-install.in: Improve error message shown
when nvsetenv failed.
* include/grub/i386/pc/kernel.h: Define GRUB_KERNEL_MACHINE_DATA_END to
indicate end of data section in kernel image.
* include/grub/i386/efi/kernel.h: Define GRUB_KERNEL_MACHINE_PREFIX and
GRUB_KERNEL_MACHINE_DATA_END.
* kern/i386/pc/startup.S: Do not initialize grub_prefix, only reserve
space for it.
* kern/i386/efi/startup.S: Likewise.
* util/i386/pc/grub-mkimage.c: Initialize grub_prefix to /boot/grub
during image generation. Implement --prefix option to override this
patch.
* util/i386/efi/grub-mkimage.c: Likewise.
* util/update-grub_lib.in (convert_system_path_to_grub_path): Split
code to make path relative to its root into a separate function.
* util/i386/pc/grub-install.in: Use newly provided
make_system_path_relative_to_its_root() to convert ${grubdir}, then
pass the result to grub-install --prefix.
* util/biosdisk.c (linux_find_partition): Allocate real_dev on the
stack instead of on the heap.
* kern/disk.c (grub_disk_read): Make sure tmp_buf is big enough
before doing a read on it.
* configure.ac: Only use -fno-stack-protector for the target
environment.