* 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.
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
* 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.
* util/misc.c (grub_util_warn): New function. Emmits a warning
unconditionally.
* include/grub/util/misc.h (grub_util_warn): New declaration.
* util/i386/pc/grub-install.in: Understand --force and pass it down
to grub-setup.
* util/i386/pc/grub-setup.c (main): Understand --force and pass it
down to setup().
(setup): Improve error messages and add warnings when requested to
install in odd layouts. Refuse to install using blocklists unless
--force was set.
* conf/i386-coreboot.rmk (sbin_SCRIPTS): Add `grub-install'.
(grub_install_SOURCES): New variable.
* util/i386/pc/grub-install.in: Add a few condition checks to make it
usable on coreboot.
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).
* 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.
* 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.
* 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.
* 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/i386/pc/grub-setup.c (setup): Write install_dos_part and
install_bsd_part immediately before core.img is embedded or
modified on disk. This fixes core.img verification if core.img
cannot be embedded.
* util/i386/pc/grub-install.in: If the drive is LVM or RAID, prepend
it in prefix.
* util/i386/pc/grub-setup.c (main): Don't handle prefix at all. Set
`must_embed' to 1 when root_dev is a RAID device. When dest_dev is
a RAID device, run setup() for all members independently on whether
LVM abstraction is being used.
(setup): Don't handle prefix at all; let grub-mkimage take care of it.
If grub-mkimage has set `*install_dos_part == -2', don't override this
value.
Perform *install_dos_part adjustments independently on whether
we're embedding or not.
Clarify error message when image is too big for embedding.
Remove duplicate *install_dos_part stanza.
* 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.
* util/grub-emu.c (grub_machine_init): Move code in this function from
here ...
(main): ... to here (before grub_util_biosdisk_init() call, to prevent
segfault in case grub_printf() is called).
* util/i386/pc/grub-install.in: Append `--device-map=${device_map}' to
grub_probe. Update all users not to explicitly add it again.
(grub_device): New variable; contains corresponding device for grubdir.
(fs_module, partmap_module, devabstraction_module): Pass
`--device ${grub_device}' to grub_probe to avoid traversing /dev
every time.
* util/update-grub_lib.in (make_system_path_relative_to_its_root):
Do not print a trailing slash (therefore, the root directory is an
empty string).
(convert_system_path_to_grub_path): Do not remove trailing slash
from make_system_path_relative_to_its_root() output.
* util/i386/pc/grub-install.in: Add trailing slash to output from
make_system_path_relative_to_its_root().
* util/grub-fstest.c (grub_refresh): Call `fflush (stdout)'. This
ensures that output lines aren't intermangled with those sent to
stderr (via grub_util_info()).
* util/grub-probe.c (grub_refresh): Likewise.
* util/i386/pc/grub-setup.c (grub_refresh): Likewise.
* util/i386/pc/grub-mkrescue.in: Add --emulation=floppy
to create a floppy emulation boot CD when non emulation mode
does not work.
Enable Joliet CD filesystem extension.
Revert grub/machine/init.h addition by Pavel (since it breaks on
i386-ieee1275 and others):
* util/i386/pc/misc.c: Remove grub/machine/init.h.
* util/powerpc/ieee1275/misc.c: Likewise.
* util/biosdisk.c: Include grub/util/biosdisk.h.
* util/grub-fstest.c (execute_command): Make static.
* util/grub-mkdevicemap.c (check_device): Likewise.
* util/i386/pc/misc.c: Include grub/machine/init.h.
* util/powerpc/ieee1275/misc.c: Likewise.
* util/lvm.c: Include grub/util/lvm.h.
* util/misc.c: Include grub/kernel.h, grub/misc.h and
grub/cache.h.
* util/raid.c: Include grub/util/raid.h.
(grub_util_getdiskname): Make static.
* 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.
* fs/udf.c (grub_udf_mount): Fix warning about a shadowing a
variable.
* include/grub/i386/loader.h: Change declaration of
grub_linux_boot() to match what grub_loader_set() expects.
* util/getroot.c (grub_guess_root_device): Return const char* to
fix a warning.
* util/grub-probe.c (probe): Fix a warning about uninitialized
abstraction_name variable.
* util/i386/get_disk_name.c (grub_util_get_disk_name): Mark
second argument as unused to fix a warning.
* partmap/gpt.c: Include `<grub/gpt_partition.h>'.
(grub_gpt_partition_type_empty): Redefine with macro from
`<grub/gpt_partition.h>'.
(gpt_partition_map_iterate): Adjust partition type comparison.
Export `entry' as partmap-specific `part.data' struct.
(grub_gpt_header, grub_gpt_partentry): Move from here ...
* include/grub/gpt_partition.h (grub_gpt_header)
(grub_gpt_partentry): ... to here (new file).
* util/i386/pc/grub-setup.c: Include `<grub/gpt_partition.h>'.
(grub_gpt_partition_type_bios_boot): New const variable, defined
with macro from `<grub/gpt_partition.h>'.
(setup): Replace `first_start' with `embed_region', which keeps
track of the embed region (and is partmap-agnostic).
Replace find_first_partition_start() with find_usable_region(),
which finds a usable region for embedding using partmap-specific
knowledge (supports PC/MSDOS and GPT).
Fix all assumptions that the embed region start at sector 1, using
`embed_region.start' from now on. Similarly, use `embed_region.end'
rather than `first_start' to calculate available size.
In grub_util_info() message, replace "into after the MBR" with an
indication of the specific sector our embed region starts at.
* util/i386/pc/grub-setup.c (setup): In find_first_partition_start(),
do not assume partition map is PC/MSDOS before performing checks that
are specific to that layout.
* configure.ac: Probe for `help2man'.
* Makefile.in (builddir): New variable.
(HELP2MAN): Likewise. Set to `true' when @HELP2MAN@ doesn't provide it,
or otherwise add a few flags/options to it.
(install-local): For every executable utility or script that is
installed, invoke $(HELP2MAN) to install a manpage based on --help
output.
* util/i386/pc/grub-install.in: Move down `update-grub_lib' sourcing, so
that it doesn't prevent --help from working in build tree.
* util/i386/pc/grub-mkrescue.in (usage): Replace `grub-devel@gnu.org'
with `bug-grub@gnu.org'.
* util/powerpc/ieee1275/grub-mkrescue.in (usage): Likewise.
* util/update-grub.in (usage): New function.
Implement proper argument check, with support for --help and --version
(as well as existing -y).
* util/grub-probe.c (main): When `verbosity > 1', set `debug'
environment variable to 'all' in order to obtain debug output from
non-util/ code.
* util/i386/pc/grub-setup.c (main): Likewise.
Make grub-setup handle a separate root device.
* util/i386/pc/grub-setup.c (setup): Always open the root device,
so that the root device can be compared with the destination
device.
When embedding the core image, if the root and destination devices
are different, set ROOT_DRIVE to ROOT_DEV->DISK->ID. Otherwise, to
0xFF.
When not embedding, set ROOT_DRIVE to 0xFF.
* 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-pc.rmk (GRUB_MEMORY_MACHINE_LINK_ADDR): New variable.
(kernel_img_LDFLAGS): Use `GRUB_MEMORY_MACHINE_LINK_ADDR' as link
address.
(grub_mkimage_CFLAGS): Propagate `GRUB_MEMORY_MACHINE_LINK_ADDR' as
a C macro.
* include/grub/i386/pc/memory.h (GRUB_MEMORY_MACHINE_UPPER): New macro.
Indicates start of upper memory.
* util/i386/pc/grub-mkimage.c: Include `<grub/machine/memory.h>'.
(generate_image): Abort when image size is big enough to corrupt
upper memory.
* include/grub/i386/pc/vga.h: Include `<grub/machine/memory.h>'.
(GRUB_MEMORY_MACHINE_VGA_ADDR): Alias for `GRUB_MEMORY_MACHINE_UPPER'.
* term/i386/pc/vga.c (VGA_MEM): Use `GRUB_MEMORY_MACHINE_VGA_ADDR'
instead of hardcoding 0xA0000.
* video/i386/pc/vbe.c: Include `<grub/machine/vga.h>'.
(grub_vbe_set_video_mode): Use `GRUB_MEMORY_MACHINE_VGA_ADDR'
instead of hardcoding 0xA0000.
* 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().
* 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).
* geninitheader.sh: Process file specified in first parameter rather
than hardcoding grub_modules_init.lst.
* geninit.sh: Likewise. Also, construct header name dynamicaly rather
than hardcoding grub_modules_init.h.
* conf/common.rmk: Rename grub_modules_init.[ch] files associated with
grub-emu to grub_emu_init.[ch]. Add rules to build analogous
grub_probe_init.[ch] and grub_setup_init.[ch].
* conf/powerpc-ieee1275.rmk (grub_emu_DEPENDENCIES): Replace
grub_modules_init.h with grub_emu_init.h.
(grub_probe_DEPENDENCIES, grub_probe_SOURCES): Add new
grub_probe_init.[ch] files.
* conf/i386-efi.rmk: Likewise.
* conf/i386-pc.rmk: Likewise.
(grub_setup_DEPENDENCIES, grub_setup_SOURCES): Add new
grub_setup_init.[ch] files.
* util/grub-emu.c: Replace grub_modules_init.h with grub_emu_init.h.
* util/grub-probe.c: Include grub_probe_init.h. Use grub_init_all()
to initialize modules rather than a list of hardcoded functions.
* util/i386/pc/grub-setup.c: Include grub_setup_init.h. Use
grub_init_all() to initialize modules rather than a list of hardcoded
functions.
* 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.
* 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.
* 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.
that I forgot to apply before.
* 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.
* include/grub/util/misc.h: Define DEFAULT_DIRECTORY and
DEFAULT_DEVICE_MAP.
* util/grub-emu.c: Use above definitions from misc.h instead of
defining them.
* util/grub-mkdevicemap.c: Likewise.
* util/i386/pc/grub-setup.c: Likewise.
* util/grub-probe.c: Likewise.
(probe): Abort with grub_util_error() when either
grub_guess_root_device or grub_util_get_grub_dev fails.
* util/i386/pc/grub-mkrescue.in: Add "set -e".
Add --pkglibdir=DIR option to override pkglibdir.
Mention --image-type=TYPE in help output.
Fix --grub-mkimage (it was a no-op).
Abort gracefuly when no parameter is given.
* util/getroot.c (grub_guess_root_device): Remove RAID and LVM
code, first search for device in /dev/mapper, then in /dev.
(grub_util_get_grub_dev): New function.
* include/grub/util/getroot.h (grub_util_get_grub_dev): Add
prototype.
* util/grub-probe.c (probe): Remove check for RAID, call
grub_util_get_grub_dev() instead of
grub_util_biosdisk_get_grub_dev().
* util/grub-emu.c (main): Call grub_util_get_grub_dev() instead of
grub_util_biosdisk_get_grub_dev().
* util/i386/pc/grub-setup.c (main): Likewise.
* DISTLIST: Update for the latest changes.
* conf/i386-pc.rmk: Use the new paths for util/getroot.c,
util/grub-mkdevicemap.c, util/grub-probe.c and util/biosdisk.c.
* util/grub-emu.c: Replace grub/i386/pc/util/biosdisk.h with
grub/util/biosdisk.h.
* util/i386/pc/grub-setup.c: Replace grub/machine/util/biosdisk.h with
grub/util/biosdisk.h.
* include/grub/i386/pc/util/biosdisk.h: Moved to ...
* include/grub/util/biosdisk.h: ... here.
* util/i386/pc/biosdisk.c: Moved to ...
* util/biosdisk.c: ... here.
* util/i386/pc/getroot.c: Moved to ...
* util/getroot.c: ... here.
* util/i386/pc/grub-mkdevicemap.c: Moved to ...
* util/grub-mkdevicemap.c: ... here.
* util/i386/pc/grub-probe.c: Moved to ...
* util/grub-probe.c: ... here.
* util/i386/pc/grub-probe.c: Add `grub-probe -t partmap' parameter to
determine partition map module.
* util/i386/pc/grub-install.in: Use this feature to decide which
partition module to load, instead of hardcoding pc and gpt.
* conf/i386-pc.rmk (grub_setup_SOURCES): Add partmap/gpt.c.
(grub_probe_SOURCES): Likewise.
* util/i386/pc/biosdisk.c (grub_util_biosdisk_get_grub_dev): Detect
GPT and initialize dos_part and bsd_part accordingly.
* util/i386/pc/grub-setup.c (setup): Ditto for install_dos_part and
install_bsd_part.
(main): Activate gpt module for use during partition identification,
and deactivate it afterwards.
* util/i386/pc/grub-install.in: Add gpt module to core.img.
* util/i386/pc/grub-probe.c (main): Activate gpt module for use during
partition identification, and deactivate it afterwards.
./configure --program-transform-name="s/grub/grub2/"
And the installed files (in this case for i386-pc) will be:
/usr/lib/grub2/i386-pc/*
/usr/local/sbin/grub2-emu
/usr/local/sbin/grub2-install
...etc
Also grub2-install place boot files in "/boot/grub2"
This allows easy integration into distributions as it allows grub2 to
sit side by side with a grub legacy install without.
* include/grub/err.h (grub_err_t): Add `GRUB_ERR_MENU'.
* kern/env.c (grub_env_unset): Don't free the member `value' when
the type is GRUB_ENV_VAR_DATA, in this case it's a user defined
pointer.
* normal/main.c (current_menu): Removed.
(free_menu): Unset the `menu' environment variable.
(grub_normal_menu_addentry): Make use of the environment variable
`menu', instead of using the global `current_menu'. Allocate
memory for the sourcecode of this entry.
(read_config_file): New argument `nested', changed all callers.
Only in the case of a new context, initialize a new menu. Set the
`menu' environment variable.
(grub_normal_execute): Don't set and unset the environment
variable `menu' here anymore. Only free the menu when leaving the
context.
* util/i386/pc/biosdisk.c (linux_find_partition): Fixed a memory
leak.
* kern/disk.c (grub_disk_read): When there is a read error, always
try to read only the necessary data.
* conf/i386-pc.rmk (grub_probe_SOURCES): Add disk/lvm.c and
disk/raid.c.
* include/grub/disk.h [GRUB_UTIL] (grub_raid_init): New
prototype.
[GRUB_UTIL] (grub_raid_fini): Likewise.
[GRUB_UTIL] (grub_lvm_init): Likewise.
[GRUB_UTIL] (grub_lvm_fini): Likewise.
* util/i386/pc/grub-probe.c (probe): Check whether DEVICE_NAME is
RAID device and copy DEVICE_NAME to DRIVE_NAME in that case.
(main): Call grub_raid_init(), grub_lvm_init(), grub_lvm_fini()
and grub_raid_fini().
* util/i386/pc/grub-probe.c (probe): Print DEVICE_NAME instead of
DRIVE_NAME when grub_util_biosdisk_get_grub_dev fails. Open
DRIVE_NAME instead of DEVICE_NAME. Make sure that DEVICE_NAME and
DRIVE_NAME are always freed.
* util/i386/pc/biosdisk.c (make_device_name): Add one into
DOS_PART, as a DOS partition is counted from one instead of zero
now. Reported by Robert Millan.
* util/i386/pc/getroot.c (grub_guess_root_device): Stop using
grub_util_biosdisk_get_grub_dev to convert system device to GRUB device.
* util/grub-emu.c (main): Use grub_util_biosdisk_get_grub_dev with the
string returned by grub_guess_root_device.
* util/i386/pc/grub-setup.c: Likewise.
* util/i386/pc/grub-probefs.c: Likewise.
* util/i386/pc/grub-probefs.c: Rename to ...
* util/i386/pc/grub-probe.c: ... this.
* DISTLIST: Remove grub-probefs, add grub-probe.
* conf/i386-efi.rmk: Likewise.
* conf/i386-pc.rmk: Likewise.
* util/i386/pc/grub-install.in: Likewise.
* util/i386/pc/grub-probe.c: Add --target=(fs|device|drive) option to
choose which information we want to print.