Prevent accidental use of uninitialized libzfs_handle.
* util/grub-probe.c (main): Move grub_util_init_libzfs() call to ...
* kern/emu/getroot.c (find_root_device_from_libzfs): ... here.
* util/misc.c (grub_util_init_libzfs): Make this function idempotent.
Enable `grub-probe -t device' resolution on ZFS.
* configure.ac: Check for getfsstat(), libzfs and libnvpair.
* include/grub/util/libnvpair.h: New file.
* include/grub/util/libzfs.h: New file.
* kern/emu/getroot.c: Include `<assert.h>' and `<error.h>'.
[HAVE_LIBZFS && HAVE_LIBNVPAIR]: Include `<grub/util/libzfs.h>' and
`<grub/util/libnvpair.h>'.
[HAVE_GETFSSTAT]: Include `<sys/mount.h>'.
(find_mount_point_from_dir): New static function.
[HAVE_LIBZFS && HAVE_LIBNVPAIR] (find_root_device_from_libzfs): New
function.
[HAVE_LIBZFS && HAVE_LIBNVPAIR] (grub_guess_root_device): Use
find_root_device_from_libzfs() before ressorting to find_root_device().
* include/grub/util/misc.h (grub_util_init_libzfs): New function
prototype.
* util/misc.c: Include `<grub/util/libzfs.h>'.
(grub_util_init_libzfs): New function.
[HAVE_LIBZFS] (libzfs_handle): New global variable.
[HAVE_LIBZFS] (fini_libzfs): New static function.
(grub_util_init_libzfs): New function.
* util/grub-probe.c (main): Call grub_util_init_libzfs().
2010-07-20 Colin Watson <cjwatson@ubuntu.com>
Generate device.map in something closer to the old ordering.
* util/deviceiter.c (struct device): New declaration.
(compare_file_names): Rename to ...
(compare_devices): ... this. Sort by kernel name in preference to
the stable by-id name, but keep the latter as a fallback comparison.
Update header comment.
(grub_util_iterate_devices) [__linux__]: Construct and sort an array
of `struct device' rather than of plain file names.
Also-By: Colin Watson <cjwatson@ubuntu.com>
* disk/raid.c (insert_array): Use md/%s to name mdadm 1.x devices,
removing the homehost if present.
* kern/emu/getroot.c (get_mdadm_name) [__linux__]: New function.
(grub_util_get_grub_dev): Use md/%s to name mdadm 1.x devices,
removing the homehost if present.
(grub_util_get_grub_dev) [__linux__]: Get the array name from mdadm
if possible.
* util/i386/pc/grub-setup.c (main): Handle md/* devices.
* disk/dmraid_nvidia.c (grub_dmraid_nv_detect): Add start_sector
parameter. Set its pointer target to 0.
* disk/mdraid_linux.c (grub_mdraid_detect): Add start_sector
parameter. Set its pointer target to 0 for 0.9 metadata, or to the
`data_offset' value from the superblock for 1.x metadata.
* disk/raid.c (grub_raid_read): Offset reads by the start sector of
data on the device.
(insert_array): Record the start sector of data on the device.
(grub_raid_register): Pass start_sector parameters to
grub_raid_list->detect and insert_array.
* include/grub/raid.h (struct grub_raid_array): Add start_sector
member.
(struct grub_raid): Add start_sector parameter to `detect'.
* disk/mdraid_linux.c (struct grub_raid_super_1x): Remove
__attribute__ ((packed)), leaving a comment.
(grub_mdraid_detect): Split out 0.9 and 1.x detection to ...
(grub_mdraid_detect_09): ... here and ...
(grub_mdraid_detect_1x): ... here.
2010-07-20 Peter Henn <peter.henn@web.de>
* disk/mdraid_linux.c (grub_mdraid_detect): Fix calculation of 1.x
chunk size and disk size, which are already given as sector counts
as distinct from the 0.90 units. Fetch the correct device number
from the role table instead of using the table index.
2010-07-20 Felix Zielcke <fzielcke@z-51.de>
* disk/dmraid_nvidia.c (grub_dmraid_nv_detect): Set array->name to NULL.
* disk/mdraid_linux.c (grub_raid_super_1x): New structure.
(WriteMostly1): New macro.
Set array->name to NULL for metadata format 0.90. Add support for
metadata 1.x. Fix some comments.
* disk/raid.c (): Add support for name based RAID arrays. Fix a
few comments.
* util/getroot.c (grub_util_get_grub_dev): Add support for
/dev/md/name style devices.
Also-By: Peter Henn <peter.henn@web.de>
Also-By: Colin Watson <cjwatson@ubuntu.com>
removing the homehost if present.
* kern/emu/getroot.c (get_mdadm_name) [__linux__]: New function.
(grub_util_get_grub_dev): Use md/%s to name mdadm 1.x devices,
removing the homehost if present.
(grub_util_get_grub_dev) [__linux__]: Get the array name from mdadm
if possible.
* util/i386/pc/grub-setup.c (main): Handle md/* devices.
install_prefix, in line with install_dos_part and install_bsd_part.
Add new prefix variable, which is copied to install_prefix after
comparing core.img in memory with the one read from disk in the
no-embedding case, and use that rather than overwriting
install_prefix immediately when installing to a partition.
Fixes Debian bug #586621; based on patches by Matt Kraai and M. Vefa
Bicakci.
* util/grub-mkconfig.in: Export `GRUB_BADRAM' variable.
* util/grub.d/00_header.in: When `GRUB_BADRAM' is set, issue badram
command using ${GRUB_BADRAM} as parameter.
possible on Linux.
* util/deviceiter.c (check_device): Rename to ...
(check_device_readable_unique): ... this. Update all callers.
Maintain and check a list of which devices (by canonicalized name)
have already been seen.
(clear_seen_devices): New function.
(compare_file_names) [__linux__]: New function.
(grub_util_iterate_devices): Clear the list of seen devices on exit
and (just in case) on entry.
(grub_util_iterate_devices) [__linux__]: Iterate over non-partition
devices in /dev/disk/by-id/, in sorted order. Remove DM-RAID
seen-devices list, superseded by general code in check_device.
setting GRUB_VIDEO_BACKEND. Make it available as a user override
instead. Replace the gfxterm backend check with a check that
${GRUB_PREFIX}/video.lst is non-empty.
* util/grub.d/00_header.in: Use GRUB_PREFIX rather than computing it
again.
(load_video): New generated function. Call it before loading
gfxterm rather than loading ${GRUB_VIDEO_BACKEND}.
* util/grub.d/10_linux.in (linux_entry): Call load_video.
* util/grub.d/30_os-prober.in (osx_entry): Likewise.
* docs/grub.texi (Simple configuration): Document
GRUB_VIDEO_BACKEND.
Use video functions in linux and xnu loaders.
* conf/i386-pc.rmk (xnu_mod_SOURCES): Remove loader/i386/pc/xnu.c.
* conf/x86-efi.rmk (xnu_mod_SOURCES): Remove loader/i386/efi/xnu.c.
* include/grub/i386/xnu.h (grub_xnu_set_video): Removed.
* loader/i386/efi/linux.c (grub_linux_setup_video): Copied from
loader/i386/pc/linux.c.
(grub_linux_boot): Resynced with loader/i386/pc/linux.c.
(find_line_len): Removed.
(find_framebuf): Likewise.
(grub_cmd_linux): Declare grub_linux_boot as possibly returning.
* loader/i386/efi/xnu.c: Removed.
* loader/i386/pc/xnu.c: Moved from here...
* loader/i386/xnu.c: ...here.
Enable priorities in video drivers.
* include/grub/video.h (grub_video_adapter_prio_t): New type.
(grub_video_adapter): New field prio.
(grub_video_register): Respect prio when inserting.
* video/efi_gop.c (grub_video_gop_adapter): Add prio.
* video/efi_uga.c (grub_video_uga_adapter): Likewise.
* video/emu/sdl.c (grub_video_sdl_adapter): Likewise.
* video/i386/pc/vbe.c (grub_video_vbe_adapter): Likewise.
* video/i386/pc/vga.c (grub_video_vga_adapter): Likewise.
* video/ieee1275.c (grub_video_ieee1275_adapter): Likewise.
* video/sm712.c (grub_video_sm712_adapter): Likewise.
Fix SDL driver ID.
* include/grub/video.h (grub_video_driver_id_t): New value
GRUB_VIDEO_DRIVER_SDL.
* video/emu/sdl.c (grub_video_sdl_adapter): Add id.
Also-By: Vladimir Serbinenko <phcoder@gmail.com>
available as a user override instead. Replace the gfxterm backend
check with a check that ${GRUB_PREFIX}/video.lst is non-empty.
* util/grub.d/00_header.in (load_video): New generated function.
Call it before loading gfxterm rather than loading
${GRUB_VIDEO_BACKEND}.
* util/grub.d/10_linux.in (linux_entry): Call load_video.
* util/grub.d/30_os-prober.in (osx_entry): Likewise.
* docs/grub.texi (Simple configuration): Document
GRUB_VIDEO_BACKEND.
#585068). Note that the case where the core image is booted using
multiboot and relocated from its original location still requires
more work.
* kern/i386/pc/init.c (make_install_device): If the prefix starts
with "(,", fill the boot drive in between those two characters, but
expect that a full partition specification including partition map
names will follow.
* util/i386/pc/grub-setup.c (setup): Unless an explicit prefix was
specified, write a prefix without the drive name but including a
full partition specification.
compatibility with older versions (before 2010-06-12) which did the
same. In particular, this makes it easier to ship an update-grub
wrapper which is compatible with that used with GRUB Legacy (Debian
bug #586056).
* util/grub.d/00_header.in: Use GRUB_PREFIX rather than computing it
again.
* util/grub.d/10_linux.in (linux_entry): Load all video drivers,
which may be needed to allow the loader to program modes for the
kernel.