From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1K4f2F-0004G1-BG for mharc-grub-devel@gnu.org; Fri, 06 Jun 2008 12:43:27 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K4f2D-0004Cx-HG for grub-devel@gnu.org; Fri, 06 Jun 2008 12:43:25 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K4f2C-0004BQ-Hn for grub-devel@gnu.org; Fri, 06 Jun 2008 12:43:24 -0400 Received: from [199.232.76.173] (port=43685 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K4f2C-0004B2-Da for grub-devel@gnu.org; Fri, 06 Jun 2008 12:43:24 -0400 Received: from aybabtu.com ([69.60.117.155]:46772) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1K4f2A-0007bK-Eh for grub-devel@gnu.org; Fri, 06 Jun 2008 12:43:23 -0400 Received: from [192.168.10.10] (helo=thorin) by aybabtu.com with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1K4f0t-0005rN-Lk for grub-devel@gnu.org; Fri, 06 Jun 2008 18:42:04 +0200 Received: from rmh by thorin with local (Exim 4.63) (envelope-from ) id 1K4f1o-0003wH-EK for grub-devel@gnu.org; Fri, 06 Jun 2008 18:43:00 +0200 Date: Fri, 6 Jun 2008 18:43:00 +0200 From: Robert Millan To: The development of GRUB 2 Message-ID: <20080606164300.GA14910@thorin> References: <20080531101042.GF6619@thorin> <20080531113901.GA20946@thorin> <20080603210925.GA10712@thorin> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="7AUc2qLy4jB3hD7Z" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Organization: free as in freedom X-Message-Flag: Worried about Outlook viruses? Switch to Thunderbird! www.mozilla.com/thunderbird X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.13 (2006-08-11) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: UUID-based boot (Re: [PATCH] Environment block support for grub2) X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Jun 2008 16:43:25 -0000 --7AUc2qLy4jB3hD7Z Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Wed, Jun 04, 2008 at 11:49:14AM +0800, Bean wrote: > On Wed, Jun 4, 2008 at 5:09 AM, Robert Millan 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 I know my rights; I want my phone call! What good is a phone call… if you are unable to speak? (as seen on /.) --7AUc2qLy4jB3hD7Z Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="uuid_boot.diff" 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) { --7AUc2qLy4jB3hD7Z--