From: Robert Millan <rmh@aybabtu.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] use UUIDs for cross-disk installs (Re: Issue with boot != root and chainloading)
Date: Sun, 27 Jul 2008 20:27:53 +0200 [thread overview]
Message-ID: <20080727182753.GA16393@thorin> (raw)
In-Reply-To: <20080725221050.GA31179@thorin>
Aside from the discussion about removing / refurbishing make_install_device(),
is everybody ok with what this patch does?
If I don't hear any objections I'll commit it soon.
On Sat, Jul 26, 2008 at 12:10:50AM +0200, Robert Millan wrote:
> 2008-07-26 Robert Millan <rmh@aybabtu.com>
>
> * 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.
>
> Index: include/grub/i386/pc/kernel.h
> ===================================================================
> --- include/grub/i386/pc/kernel.h (revision 1733)
> +++ include/grub/i386/pc/kernel.h (working copy)
> @@ -41,7 +41,7 @@
> #define GRUB_KERNEL_MACHINE_PREFIX 0x20
>
> /* End of the data section. */
> -#define GRUB_KERNEL_MACHINE_DATA_END 0x50
> +#define GRUB_KERNEL_MACHINE_DATA_END 0x60
>
> /* The size of the first region which won't be compressed. */
> #if defined(ENABLE_LZO)
> Index: util/i386/pc/grub-install.in
> ===================================================================
> --- util/i386/pc/grub-install.in (revision 1733)
> +++ util/i386/pc/grub-install.in (working copy)
> @@ -233,15 +233,34 @@
> # Device abstraction module, if any (lvm, raid).
> devabstraction_module=`$grub_probe --target=abstraction --device ${grub_device}`
>
> +# The order in this list is critical. Be careful when modifying it.
> +modules="$modules $fs_module $partmap_module biosdisk $devabstraction_module"
> +
> +prefix_drive=
> if [ "x${devabstraction_module}" = "x" ] ; then
> - prefix_drive=
> + if echo "${install_device}" | grep -qx "(.*)" ; then
> + install_drive="${install_device}"
> + else
> + install_drive="`$grub_probe --target=drive --device ${install_device}`"
> + fi
> + grub_drive="`$grub_probe --target=drive --device ${grub_device}`"
> +
> + # Strip partition number
> + install_drive="`echo ${install_drive} | sed -e s/,[0-9]*//g`"
> + grub_drive="`echo ${grub_drive} | sed -e s/,[0-9]*//g`"
> + if [ "x${grub_drive}" != "x${install_drive}" ] ; then
> + uuid="`$grub_probe --target=fs_uuid --device ${grub_device}`"
> + if [ "x${uuid}" = "x" ] ; then
> + echo "You attempted a cross-disk install, but the filesystem containing ${grubdir} does not support UUIDs." 1>&2
> + exit 1
> + fi
> + prefix_drive="(UUID=${uuid})"
> + modules="$modules fs_uuid"
> + fi
> else
> prefix_drive=`$grub_probe --target=drive --device ${grub_device}`
> fi
>
> -# The order in this list is critical. Be careful when modifying it.
> -modules="$modules $fs_module $partmap_module biosdisk $devabstraction_module"
> -
> grub_prefix="${prefix_drive}`make_system_path_relative_to_its_root ${grubdir}`" || exit 1
>
> $grub_mkimage --output=${grubdir}/core.img --prefix=${grub_prefix}/ $modules || exit 1
> Index: util/i386/pc/grub-setup.c
> ===================================================================
> --- util/i386/pc/grub-setup.c (revision 1733)
> +++ util/i386/pc/grub-setup.c (working copy)
> @@ -339,18 +339,12 @@
> if (grub_disk_write (dest_dev->disk, embed_region.start, 0, core_size, core_img))
> grub_util_error ("%s", grub_errmsg);
>
> - /* The boot image and the core image are on the same drive,
> - so there is no need to specify the boot drive explicitly. */
> - *boot_drive = 0xff;
> + /* FIXME: can this be skipped? */
> + *boot_drive = 0xFF;
> + *root_drive = 0xFF;
> +
> *kernel_sector = grub_cpu_to_le64 (embed_region.start);
>
> - /* If the root device is different from the destination device,
> - it is necessary to embed the root drive explicitly. */
> - if (root_dev->disk->id != dest_dev->disk->id)
> - *root_drive = (grub_uint8_t) root_dev->disk->id;
> - else
> - *root_drive = 0xFF;
> -
> /* Write the boot image onto the disk. */
> if (grub_disk_write (dest_dev->disk, 0, 0, GRUB_DISK_SECTOR_SIZE,
> boot_img))
> @@ -480,15 +474,8 @@
>
> *kernel_sector = grub_cpu_to_le64 (first_sector);
>
> - /* If the destination device is different from the root device,
> - it is necessary to embed the boot drive explicitly. */
> - if (root_dev->disk->id != dest_dev->disk->id)
> - *boot_drive = (grub_uint8_t) root_dev->disk->id;
> - else
> - *boot_drive = 0xFF;
> -
> - /* When the core image is not embedded, the root device always follows
> - the boot device. */
> + /* FIXME: can this be skipped? */
> + *boot_drive = 0xFF;
> *root_drive = 0xFF;
>
> *install_dos_part = grub_cpu_to_le32 (dos_part);
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
--
Robert Millan
<GPLv2> I know my rights; I want my phone call!
<DRM> What good is a phone call… if you are unable to speak?
(as seen on /.)
next prev parent reply other threads:[~2008-07-27 19:57 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-22 13:34 Issue with boot != root and chainloading Andy Kittner
2008-07-22 13:50 ` Pavel Roskin
2008-07-22 14:01 ` Felix Zielcke
2008-07-22 23:58 ` Pavel Roskin
2008-07-24 9:12 ` Felix Zielcke
2008-07-24 10:25 ` Felix Zielcke
2008-07-24 11:00 ` Felix Zielcke
2008-07-24 16:49 ` Pavel Roskin
2008-07-25 21:08 ` Robert Millan
2008-07-25 21:47 ` Pavel Roskin
2008-07-25 22:10 ` [PATCH] use UUIDs for cross-disk installs (Re: Issue with boot != root and chainloading) Robert Millan
2008-07-26 1:08 ` Pavel Roskin
2008-07-27 12:19 ` Robert Millan
2008-07-27 16:29 ` Pavel Roskin
2008-07-27 18:37 ` Robert Millan
2008-07-27 19:28 ` UUID boot on ieee1275 (Re: [PATCH] use UUIDs for cross-disk installs (Re: Issue with boot != root and chainloading)) Robert Millan
2008-07-27 20:13 ` [PATCH] " Robert Millan
2008-07-27 20:36 ` Robert Millan
2008-07-30 10:41 ` Robert Millan
2008-08-03 11:09 ` [PATCH] use UUIDs for cross-disk installs (Re: Issue with boot != root and chainloading) Isaac Dupree
2008-08-03 12:08 ` Robert Millan
2008-08-03 12:23 ` Robert Millan
2008-08-03 17:04 ` Isaac Dupree
2008-08-03 19:19 ` Treacherous Computing (Re: [PATCH] use UUIDs for cross-disk installs) Robert Millan
2008-07-27 18:27 ` Robert Millan [this message]
2008-07-30 10:43 ` [PATCH] use UUIDs for cross-disk installs (Re: Issue with boot != root and chainloading) Robert Millan
2008-07-22 15:09 ` Issue with boot != root and chainloading Andy Kittner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080727182753.GA16393@thorin \
--to=rmh@aybabtu.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.