* 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.
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.
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.
* 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.
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.
* 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/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/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.
* 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.
* 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.
* conf/powerpc-ieee1275.rmk (kernel_elf_LDFLAGS): Link at 64KB.
* kern/powerpc/ieee1275/init.c (_end): Add declaration.
(_start): Likewise.
(grub_arch_modules_addr): Return address after `_end'.
* util/powerpc/ieee1275/grub-mkimage.c: Include grub/misc.h.
(load_modules): Use new parameter as `p_paddr' and `p_vaddr'.
(add_segments): Calculate `_end' from phdr size and location.
(ALIGN_UP): Moved to ...
* include/grub/misc.h: here.
* include/grub/powerpc/ieee1275/kernel.h (GRUB_IEEE1275_MOD_ALIGN):
New macro.
(GRUB_IEEE1275_MODULE_BASE): Removed.
* include/grub/powerpc/libgcc.h (__floatdisf): New prototype.
(__cmpdi): Likewise.
* kern/powerpc/ieee1275/openfw.c (grub_devalias_iterate): Pass 0 as
`flags' to `grub_ieee1275_next_property'. Change `pathlen' to type
`grub_ssize_t'.
* kern/powerpc/ieee1275/cmain.c: include grub/misc.h.
* loader/powerpc/ieee1275/linux.c (grub_linux_boot): Change `actual'
to type `grub_ssize_t'.
(grub_rescue_cmd_linux): Cast -1 to `grub_off_t'.
A new machine-specific function "grub_machine_set_prefix" is
defined. This is called after loading modules, so that a prefix
initialization can use modules. Also, this change adds an
intensive debugging feature for the memory manager via the
configure option "--enable-mm-debug".
* partmap/gpt.c (gpt_partition_map_iterate): Add one more into
PART.LEN.
* kern/sparc64/ieee1275/init.c (abort): Removed.
(grub_stop): Likewise.
(grub_exit): New function.
(grub_set_prefix): Renamed to ...
(grub_machine_set_prefix): ... this.
(grub_machine_init): Do not call grub_set_prefix.
* kern/powerpc/ieee1275/init.c (grub_set_prefix): Renamed to ...
(grub_machine_set_prefix): ... this.
(grub_machine_init): Do not call grub_set_prefix.
* kern/i386/pc/init.c (grub_machine_set_prefix): New function.
(grub_machine_init): Do not set the prefix here.
* kern/i386/efi/init.c (grub_machine_set_prefix): New function.
* kern/efi/init.c: Include grub/mm.h.
(grub_efi_set_prefix): New function.
* kern/efi/efi.c (grub_exit): Call grub_efi_fini.
(grub_efi_get_filename): New function.
(grub_print_device_path): Renamed to ...
(grub_efi_print_device_path): ... this.
* kern/mm.c [MM_DEBUG] (grub_malloc): Undefined.
[MM_DEBUG] (grub_realloc): Likewise.
[MM_DEBUG] (grub_free): Likewise.
[MM_DEBUG] (grub_memalign): Likewise.
[MM_DEBUG] (grub_mm_debug): New variable.
[MM_DEBUG] (grub_debug_malloc): New function.
[MM_DEBUG] (grub_debug_free): New function.
[MM_DEBUG] (grub_debug_realloc): New function.
[MM_DEBUG] (grub_debug_memalign): New function.
* kern/misc.c (grub_abort): Print a newline to distinguish
the message.
* kern/main.c (grub_main): Call grub_machine_set_prefix and
grub_set_root_dev after loading modules. This is necessary when
setting a prefix depends on modules.
* include/grub/efi/efi.h (grub_print_device_path): Renamed to ...
(grub_efi_print_device_path): ... this.
(grub_efi_get_filename): New prototype.
(grub_efi_set_prefix): Likewise.
* include/grub/efi/disk.h: Include grub/efi/api.h, grub/symbol.h
and grub/disk.h.
(grub_efidisk_get_device_handle): New prototype.
(grub_efidisk_get_device_name): Likewise.
* include/grub/mm.h: Include config.h.
(MM_DEBUG): Removed.
[MM_DEBUG && !GRUB_UTIL] (grub_mm_debug): New prototype.
[MM_DEBUG && !GRUB_UTIL] (grub_malloc): New macro.
[MM_DEBUG && !GRUB_UTIL] (grub_realloc): Likewise.
[MM_DEBUG && !GRUB_UTIL] (grub_memalign): Likewise.
[MM_DEBUG && !GRUB_UTIL] (grub_free): Likewise.
[MM_DEBUG && !GRUB_UTIL] (grub_debug_malloc): New prototype.
[MM_DEBUG && !GRUB_UTIL] (grub_debug_realloc): New prototype.
[MM_DEBUG && !GRUB_UTIL] (grub_debug_memalign): New prototype.
[MM_DEBUG && !GRUB_UTIL] (grub_debug_free): New prototype.
* include/grub/kernel.h (grub_machine_set_prefix): New prototype.
* disk/efi/efidisk.c: Include grub/partition.h.
(iterate_child_devices): New function.
(add_device): First, compare only last device path nodes, so that
devices are sorted by the types.
(grub_efidisk_get_device_handle): New function.
(grub_efidisk_get_device_name): Likewise.
* configure.ac (--enable-mm-debug): New option to enable the
memory manager debugging feature. This makes the binary much
bigger, so is disabled by default.