2008-05-30 Robert Millan <rmh@aybabtu.com>

* commands/search.c (options): Add --fs_uuid option.
        (search_fs_uuid): New function.
        (grub_cmd_search): Fix --set argument passing.
        Use search_fs_uuid() when requested via --fs_uuid.
        (grub_search_init): Update help message.
        * fs/ext2.c (struct grub_ext2_sblock): Rename `unique_id' to `uuid'
        and redeclare it as an array of 16-bit words.
        (grub_ext2_uuid): New function.
        (grub_ext2_fs): Reference grub_ext2_uuid() in `uuid' struct member.
        * include/grub/fs.h (struct grub_fs): Add `uuid' struct member.
        * util/update-grub.in (GRUB_DEVICE_UUID, GRUB_DEVICE_BOOT)
        (GRUB_DEVICE_BOOT_UUID): New variables.
        (GRUB_DRIVE. GRUB_DRIVE_BOOT. GRUB_DRIVE_BOOT_GRUB): Remove.
        * util/grub.d/00_header.in: Set root using `search --fs_uuid' command
        whenever possible.
        * util/grub.d/10_hurd.in: Avoid explicit use of root drive.  Instead,
        just assume `root' variable has the right value.
        * util/grub.d/10_linux.in: Likewise.
        * util/grub-probe.c (probe): Probe for filesystem UUID when requested
        via PRINT_FS_UUID.
        (main): Recognise `-t fs_uuid' argument.
This commit is contained in:
robertmh 2008-05-30 11:04:08 +00:00
parent 01b73ec8eb
commit 6219127445
9 changed files with 159 additions and 37 deletions

View file

@ -38,8 +38,12 @@ set default=${GRUB_DEFAULT}
set timeout=${GRUB_TIMEOUT}
EOF
if [ "x${GRUB_DRIVE}" = "x" ] ; then : ; else
echo "set root=${GRUB_DRIVE}"
# If there's a filesystem UUID that GRUB is capable of identifiing, use it;
# otherwise set root as per value in device.map.
if [ "x${GRUB_DEVICE_BOOT_UUID}" = "x" ] ; then
echo "set root=`grub-probe --device ${GRUB_DEVICE_BOOT} --target=drive`"
else
echo "search --fs_uuid ${GRUB_DEVICE_BOOT_UUID} --set"
fi
case ${platform}:${GRUB_TERMINAL} in

View file

@ -31,9 +31,9 @@ for i in /boot/gnumach.gz /boot/gnumach ; do
if test -e $i ; then
basename=`basename $i`
dirname=`dirname $i`
grub_dirname=`echo ${dirname} | sed -e "s%^/boot%${GRUB_DRIVE_BOOT}%g"`
rel_dirname=`make_system_path_relative_to_its_root $dirname`
echo "Found GNU Mach: $i" >&2
kernel=${grub_dirname}/${basename}
kernel=${rel_dirname}/${basename}
at_least_one=true
fi
done

View file

@ -87,7 +87,7 @@ while [ "x$list" != "x" ] ; do
echo "Found linux image: $linux" >&2
basename=`basename $linux`
dirname=`dirname $linux`
grub_dirname=`echo ${dirname} | sed -e "s%^/boot%${GRUB_DRIVE_BOOT}%g"`
rel_dirname=`make_system_path_relative_to_its_root $dirname`
version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
alt_version=`echo $version | sed -e "s,\.old$,,g"`
@ -105,11 +105,11 @@ while [ "x$list" != "x" ] ; do
cat << EOF
menuentry "${OS}, linux ${version}" {
linux ${grub_dirname}/${basename} root=${GRUB_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}
linux ${rel_dirname}/${basename} root=${GRUB_DEVICE} ro ${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}
EOF
if test -n "${initrd}" ; then
cat << EOF
initrd ${grub_dirname}/${initrd}
initrd ${rel_dirname}/${initrd}
EOF
fi
cat << EOF
@ -118,11 +118,11 @@ EOF
cat << EOF
menuentry "${OS}, linux ${version} (single-user mode)" {
linux ${grub_dirname}/${basename} root=${GRUB_DEVICE} ro single ${GRUB_CMDLINE_LINUX}
linux ${rel_dirname}/${basename} root=${GRUB_DEVICE} ro single ${GRUB_CMDLINE_LINUX}
EOF
if test -n "${initrd}" ; then
cat << EOF
initrd ${grub_dirname}/${initrd}
initrd ${rel_dirname}/${initrd}
EOF
fi
cat << EOF