All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Millan <rmh@aybabtu.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: UUID-based boot (Re: [PATCH] Environment block support for grub2)
Date: Fri, 6 Jun 2008 18:43:00 +0200	[thread overview]
Message-ID: <20080606164300.GA14910@thorin> (raw)
In-Reply-To: <ca0f59980806032049i6ae386c0p33d82f793626d147@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1519 bytes --]

On Wed, Jun 04, 2008 at 11:49:14AM +0800, Bean wrote:
> On Wed, Jun 4, 2008 at 5:09 AM, Robert Millan <rmh@aybabtu.com> wrote:
> >
> > I've been thinking a bit more about this, and I think it should be
> > possible to solve the problem at hand without extending the existing
> > framework.  I'm concerned about finding a solution that is as simple
> > (and small) as possible.
> >
> > Do you mind waiting a few days?  I'll send a proposal tomorrow or so.
> 
> Ok, no hurry.

Sorry for the delay; it was quite a bit of work as I got hit by a number of
bugs here and there :-)

Considering that the problem was quite similar to the "boot from LVM" issue
we already knew about, I thought it'd be a good idea to start with that.

Although not directly related, the patch at in "boot from LVM / RAID" mail I
just sent would allow to easily boot via UUID as well.

If we add a UUID-based disk driver (see "disk/fs_uuid.c" mail), then it's just
a matter of increasing the grub_prefix size so that an UUID can fit in it, and
adjusting the install scripts to do it.

Here's a sample (untested) patch to illustrate it.

Then for the Vista use case, I suppose the remaining questions are if NTFS
supports UUIDs (or otherwise we have to ressort to labels?), and if we can
extract filesystem metadata from Windows (if possible without requiring that
a Cygwin installation is present).

-- 
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 /.)

[-- Attachment #2: uuid_boot.diff --]
[-- Type: text/x-diff, Size: 2359 bytes --]

diff -x ChangeLog -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../tmp.old/include/grub/i386/pc/kernel.h ./include/grub/i386/pc/kernel.h
--- ../tmp.old/include/grub/i386/pc/kernel.h	2008-06-06 18:29:28.000000000 +0200
+++ ./include/grub/i386/pc/kernel.h	2008-06-06 18:32:27.000000000 +0200
@@ -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.  */
 #define GRUB_KERNEL_MACHINE_RAW_SIZE		(GRUB_KERNEL_MACHINE_DATA_END + 0x450)
diff -x ChangeLog -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../tmp.old/util/i386/pc/grub-install.in ./util/i386/pc/grub-install.in
--- ../tmp.old/util/i386/pc/grub-install.in	2008-06-06 18:30:02.000000000 +0200
+++ ./util/i386/pc/grub-install.in	2008-06-06 18:33:26.000000000 +0200
@@ -232,13 +232,13 @@ partmap_module=`$grub_probe --target=par
 devabstraction_module=`$grub_probe --target=abstraction --device ${grub_device}`
 
 if [ "x${devabstraction_module}" = "x" ] ; then
-    prefix_drive=
+    prefix_drive=\(UUID=`$grub_probe --target=fs_uuid --device ${grub_device}`\)
 else
     prefix_drive=`$grub_probe --target=drive --device ${grub_device}`
 fi
 
 # _chain is often useful
-modules="$modules $fs_module $partmap_module biosdisk $devabstraction_module _chain"
+modules="$modules $fs_module $partmap_module biosdisk $devabstraction_module _chain fs_uuid"
 
 $grub_mkimage --output=${grubdir}/core.img \
     --prefix=${prefix_drive}`make_system_path_relative_to_its_root ${grubdir}`/ \
diff -x ChangeLog -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../tmp.old/util/i386/pc/grub-setup.c ./util/i386/pc/grub-setup.c
--- ../tmp.old/util/i386/pc/grub-setup.c	2008-06-06 18:30:02.000000000 +0200
+++ ./util/i386/pc/grub-setup.c	2008-06-06 18:32:27.000000000 +0200
@@ -300,7 +300,9 @@ setup (const char *prefix, const char *d
 	  block->segment = 0;
 
 	  /* Embed information about the installed location.  */
-	  if (must_embed)
+	  if (install_prefix[0] == '(')
+	    /* If we included a drive explicitly in prefix, force GRUB to use that instead
+	       of root_drive.  */
 	    *install_dos_part = *install_bsd_part = grub_cpu_to_le32 (-2);
 	  else if (root_dev->disk->partition)
 	    {

  reply	other threads:[~2008-06-06 16:43 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-30 20:27 [PATCH] Environment block support for grub2 Bean
2008-05-31 10:10 ` Robert Millan
2008-05-31 10:54   ` Bean
2008-05-31 11:39     ` Robert Millan
2008-05-31 12:09       ` Bean
2008-05-31 15:09         ` Bean
2008-06-03 21:09           ` Robert Millan
2008-06-04  3:49             ` Bean
2008-06-06 16:43               ` Robert Millan [this message]
2008-06-06 17:22                 ` UUID-based boot (Re: [PATCH] Environment block support for grub2) Bean
2008-06-06 22:03                   ` Robert Millan
2008-06-07  4:33                     ` Bean
2008-06-08 19:26                       ` Robert Millan
2008-06-07  7:24                     ` Vesa Jääskeläinen
2008-06-06 23:31                   ` [PATCH] ntfs UUIDs (Re: UUID-based boot (Re: [PATCH] Environment block support for grub2)) Robert Millan
2008-06-07  5:44                     ` Tomáš Ebenlendr
2008-06-08  3:34                       ` Pavel Roskin
2008-06-08 19:19                         ` Robert Millan
2008-05-31 15:21         ` [PATCH] Environment block support for grub2 Robert Millan
2008-06-13 22:48           ` Yoshinori K. Okuji
2008-06-14  3:41             ` Bean
2008-06-14 18:32               ` Robert Millan
2008-06-14 19:22                 ` Bean

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=20080606164300.GA14910@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.