* 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.
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
* 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.
* util/i386/efi/grub-mkimage.c (get_target_address): Return a
pointer, not an integer. This fixes a warning and prevents
precision loss on 64-bit systems.
(relocate_addresses): Remove unneeded cast.
* util/grub-fstest.c (cmd_cmp): Use fseeko(), not fseek(). The
later is obsolete, potentially dangerous and sets a bad example.
* util/i386/efi/grub-mkimage.c (make_header): Likewise.
* util/misc.c (grub_util_get_image_size): Likewise.
* include/grub/util/getroot.h (grub_dev_abstraction_types): New enum.
(grub_util_get_dev_abstraction): New function prototype.
* util/getroot.c: Include `<grub/util/getroot.h>'
(grub_util_get_grub_dev): Move detection of abstraction type to ...
(grub_util_get_dev_abstraction): ... here (new function).
* util/grub-probe.c: Convert PRINT_* to an enum. Add
`PRINT_ABSTRACTION'.
(probe): Probe for abstraction type when requested.
(main): Understand `--target=abstraction'.
* util/i386/efi/grub-install.in: Add abstraction module to core
image when it is found to be necessary.
* util/i386/pc/grub-install.in: Likewise.
* util/powerpc/ieee1275/grub-install.in: Likewise.
* util/update-grub_lib.in (font_path): Return system path without
converting to GRUB path.
* util/update-grub.in: Convert system path returned by font_path()
to a GRUB path. Use `grub-probe -t abstraction' to determine what
abstraction module is needed for loading fonts (if any). Export
that as `GRUB_PRELOAD_MODULES'.
* util/grub.d/00_header.in: Process `GRUB_PRELOAD_MODULES' (print
insmod commands).
* util/i386/efi/grub-install.in: Allow `grub_probe --target=partmap'
invocation to fail, in order to support partition-less media.
* util/i386/pc/grub-install.in: Likewise.
* util/powerpc/ieee1275/grub-install.in: Use grub-probe to determine
which fs or partmap modules are needed (akin to its sister scripts).
Also use grub-probe to get rid of unportable /proc/mounts check.
Print the same informational message that the other scripts do, before
exitting.
* 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.
Add --with-platform to configure. Use pkglibdir instead of
pkgdatadir. This is reported by Roger Leigh.
* util/powerpc/ieee1275/grub-install.in (datadir): Removed.
(host_vendor): Likewise.
(host_os): Likewise.
(pkgdatadir): Likewise.
(platform): New variable.
(pkglibdir): Likewise.
Use PKGLIBDIR instead of PKGDATADIR.
* util/i386/pc/grub-install.in (datadir): Removed.
(host_vendor): Likewise.
(host_os): Likewise.
(pkgdatadir): Likewise.
(platform): New variable.
(pkglibdir): Likewise.
Use PKGLIBDIR instead of PKGDATADIR.
* util/powerpc/ieee1275/grub-mkimage.c (usage): Use GRUB_LIBDIR
instead of GRUB_DATADIR.
(main): Likewise.
* util/i386/pc/grub-mkimage.c (usage): Likewise.
(main): Likewise.
* util/i386/efi/grub-mkimage.c (usage): Likewise.
(main): Likewise.
* configure.ac (--with-platform): New option.
Use PLATFORM instead of HOST_VENDOR to specify a platform.
* Makefile.in: Include a makefile based on PLATFORM instead of
HOST_VENDOR.
(pkgdatadir): Not appended by the machine type.
(pkglibdir): Appended by the machine type.
(host_vendor): Removed.
(platform): New variable.
(BUILD_CPPFLAGS): Specify GRUB_LIBDIR instead of GRUB_DATADIR.
(install-local): Use PKGLIBDIR instead of PKGDATADIR.
(uninstall): Likewise.
Add support for pre-loaded modules into the EFI port.
* util/i386/efi/grub-mkimage.c (make_mods_section): Rewritten
completely. Accept one more argument DIR. The caller has changed.
* kern/i386/efi/init.c (grub_arch_modules_addr): Removed.
* kern/efi/efi.c: Include grub/efi/pe32.h and grub/kernel.h.
(grub_efi_loaded_image_guid): New variable.
(grub_efi_get_loaded_image): New function.
(grub_arch_modules_addr): Likewise.
* include/grub/efi/efi.h (grub_efi_get_loaded_image): New
prototype.
* include/grub/efi/api.h (GRUB_EFI_LOADED_IMAGE_GUID): New macro.
(struct grub_efi_loaded_image): New structure.
(grub_efi_loaded_image_t): New type.