* util/grub.d/00_header.in: Be platform-agnostic. Probe for existence
of modules instead of assuming which platform provides what.
* util/update-grub.in: Likewise.
* 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.
* conf/common.rmk (pkglib_MODULES): Add bufio.mod.
(bufio_mod_SOURCES): New macro.
(bufio_mod_CFLAGS): Likewise.
(bufio_mod_LDFLAGS): Likewise.
* include/grub/bufio.h: New file.
* io/bufio.c: Likewise.
* video/png.c: Replace <grub/file.h> with <grub/bufio.h>.
(grub_video_reader_png): Use grub_buffile_open to open file.
* video/jpeg.c: Replace <grub/file.h> with <grub/bufio.h>.
(grub_video_reader_jpeg): Use grub_buffile_open to open file.
* video/tga.c: Replace <grub/file.h> with <grub/bufio.h>.
(grub_video_reader_tga): Use grub_buffile_open to open file.
* font/manager.c: Include <grub/bufio.h>.
(add_font): Use grub_buffile_open to open file.
* loader/i386/pc/multiboot.c (grub_multiboot_load_elf32): When loading
ELF segments, use a macro for arbitrarily accessing any of them instead
of preparing a pointer that allows access to one at a time.
(grub_multiboot_load_elf64): Likewise.
* include/grub/i386/pc/kernel.h (GRUB_KERNEL_MACHINE_DATA_END):
Increase from 0x50 to 0x60.
* util/i386/pc/grub-install.in: Detect cross-disk installs, and
use UUIDs to identify the root drive for them. If that's not
possible, abort.
* util/i386/pc/grub-setup.c (setup): Do not special-case, or even
check, for cross-disk installs.
* 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.
* term/i386/pc/vga_text.c (grub_console_cls): Use
grub_console_gotoxy() to go back to beginning of the screen.
Found by Patrick Georgi <patrick.georgi@coresystems.de>
* util/update-grub.in: Add a check for admin
group on Cygwin.
Remove old `grub.cfg.new' before creation.
Add `-f' to `mv' to handle the different filesystem
semantics of Windows.
* partmap/apple.c (GRUB_APPLE_HEADER_MAGIC): New macro.
(struct grub_apple_header): New struct. Describes the layout of
the partmap header.
(apple_partition_map_iterate): Check the header magic as well as the
partition magic (which was already being checked).
This prevents autoheader from being rerun by make if somebody changes
configure.ac or aclocal.m4 and runs autogen.sh.
Suggested by Christian Franke <Christian.Franke@t-online.de>
* disk/raid.c (grub_raid_scan_device): Do not abort when two disks
with the same number are found, just use issue a warning with
grub_dprintf(), as this error has been reported to be non-fatal.
* fs/xfs.c (grub_xfs_dir_header): Change field i8count back to
smallino, as it's more descriptive, and i8count can be confused with
the other field count.
(grub_xfs_iterate_dir): Adjust grub_xfs_dir_entry pointer for small
inode type.
* util/getroot.c (find_root_device): Skip devices that match
/dev/dm-[0-9]. This lets the real device be found for any type of
abstraction (LVM, EVMS, RAID..).
(grub_guess_root_device): Do not traverse /dev/mapper (for LVM)
and /dev/evms (for EVMS) before traversing /dev. If a /dev/dm-[0-9]
device is found first, find_root_device() will now skip it.
* util/i386/pc/grub-install.in: If `--debug' is specified,
pass `--verbose' to grub-setup.
Abort script if make_system_path_relative_to_its_root() fails.
* 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.
* Makefile.in (UNICODE_ARROWS, UNICODE_LINES): New variables (they
define the codes for arrows and lines used for the menu).
(ascii.pff): Generate fonts for $(UNICODE_ARROWS) and $(UNICODE_LINES)
as well.
* util/update-grub_lib.in (font_path): Prefer ascii.pff over complete
fonts, because the latter are too slow.
* 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.
* aclocal.m4 (grub_PROG_TARGET_CC): New macro. Check if the
target compiler is functional.
* configure.ac: Call grub_PROG_TARGET_CC once all target flags
are set up.
* configure.ac: Default to efi platform for x86_64-apple. Allow
powerpc64 CPU, default to ieee1275 platform for it. Split CPU
adjustments from the rest, only do them if target is not
explicitly given. Merge other adjustments with the final sanity
check. Remove an extraneous check for supported CPU. Be
specific which CPU and which platform is not supported.