* GPT on PC/BIOS computers
@ 2007-05-01 19:18 Robert Millan
2007-05-03 13:33 ` Javier Rodríguez Sánchez
2007-05-04 8:40 ` Marco Gerards
0 siblings, 2 replies; 14+ messages in thread
From: Robert Millan @ 2007-05-01 19:18 UTC (permalink / raw)
To: grub-devel; +Cc: Michael Renner
[-- Attachment #1: Type: text/plain, Size: 536 bytes --]
Here's a patch to enable GPT support for PC/BIOS systems. Need for GPT is
increasingly common due availability of > 2 TiB hard drives.
Please let me know if everything is correct.
Some testing would be welcome, too (but be careful, earlier versions of my
patch had a "feature" that fucked up your partition table - hopefuly fixed
now, at least Works For Me [tm]).
--
Robert Millan
My spam trap is honeypot@aybabtu.com. Note: this address is only intended
for spam harvesters. Writing to it will get you added to my black list.
[-- Attachment #2: gpt.diff --]
[-- Type: text/x-diff, Size: 9132 bytes --]
2007-05-01 Robert Millan <rmh@aybabtu.com>
* conf/i386-pc.rmk (grub_setup_SOURCES): Add partmap/gpt.c.
(grub_probe_SOURCES): Likewise.
* conf/i386-pc.mk: Regenerate.
* util/i386/pc/biosdisk.c (grub_util_biosdisk_get_grub_dev): Detect
GPT and initialize dos_part and bsd_part accordingly.
* util/i386/pc/grub-setup.c: Ditto for install_dos_part and
install_bsd_part.
* util/i386/pc/grub-install.in: Add gpt module to core.img.
* util/i386/pc/grub-probe.c: Activate gpt module for use during
partition identification, and deactivate it afterwards.
* util/i386/pc/grub-setup.c: Ditto.
Index: conf/i386-pc.rmk
===================================================================
RCS file: /sources/grub/grub2/conf/i386-pc.rmk,v
retrieving revision 1.75
diff -u -r1.75 i386-pc.rmk
--- conf/i386-pc.rmk 13 Dec 2006 22:30:19 -0000 1.75
+++ conf/i386-pc.rmk 1 May 2007 18:56:07 -0000
@@ -65,9 +65,10 @@
grub_setup_SOURCES = util/i386/pc/grub-setup.c util/i386/pc/biosdisk.c \
util/misc.c util/i386/pc/getroot.c kern/device.c kern/disk.c \
kern/err.c kern/misc.c fs/fat.c fs/ext2.c fs/xfs.c fs/affs.c \
- fs/sfs.c kern/parser.c kern/partition.c partmap/pc.c \
- fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c fs/hfsplus.c kern/file.c \
- kern/fs.c kern/env.c fs/fshelp.c util/raid.c util/lvm.c
+ fs/sfs.c kern/parser.c kern/partition.c partmap/pc.c \
+ partmap/gpt.c fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c \
+ fs/hfsplus.c kern/file.c kern/fs.c kern/env.c fs/fshelp.c \
+ util/raid.c util/lvm.c
# For grub-mkdevicemap.
grub_mkdevicemap_SOURCES = util/i386/pc/grub-mkdevicemap.c util/misc.c
@@ -76,9 +77,10 @@
grub_probe_SOURCES = util/i386/pc/grub-probe.c \
util/i386/pc/biosdisk.c util/misc.c util/i386/pc/getroot.c \
kern/device.c kern/disk.c kern/err.c kern/misc.c fs/fat.c \
- fs/ext2.c kern/parser.c kern/partition.c partmap/pc.c fs/ufs.c \
- fs/minix.c fs/hfs.c fs/jfs.c kern/fs.c kern/env.c fs/fshelp.c \
- fs/xfs.c fs/affs.c fs/sfs.c fs/hfsplus.c disk/lvm.c disk/raid.c
+ fs/ext2.c kern/parser.c kern/partition.c partmap/pc.c \
+ partmap/gpt.c fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c kern/fs.c \
+ kern/env.c fs/fshelp.c fs/xfs.c fs/affs.c fs/sfs.c fs/hfsplus.c \
+ disk/lvm.c disk/raid.c
# For grub-emu.
grub_emu_DEPENDENCIES = grub_script.tab.c grub_script.tab.h \
Index: util/i386/pc/biosdisk.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/biosdisk.c,v
retrieving revision 1.14
diff -u -r1.14 biosdisk.c
--- util/i386/pc/biosdisk.c 12 Dec 2006 00:13:55 -0000 1.14
+++ util/i386/pc/biosdisk.c 1 May 2007 18:56:07 -0000
@@ -1,7 +1,7 @@
/* biosdisk.c - emulate biosdisk */
/*
* GRUB -- GRand Unified Bootloader
- * Copyright (C) 1999,2000,2001,2002,2003,2004,2006 Free Software Foundation, Inc.
+ * Copyright (C) 1999,2000,2001,2002,2003,2004,2006,2007 Free Software Foundation, Inc.
*
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -743,9 +743,12 @@
const grub_partition_t partition)
{
struct grub_pc_partition *pcdata = 0;
+ int gpt = 0;
if (strcmp (partition->partmap->name, "pc_partition_map") == 0)
pcdata = partition->data;
+ else if (strcmp (partition->partmap->name, "gpt_partition_map") == 0)
+ gpt = 1;
if (pcdata)
{
@@ -757,6 +760,11 @@
pcdata->dos_part, pcdata->bsd_part + 'a',
partition->start);
}
+ else if (gpt)
+ {
+ grub_util_info ("GPT partition %d starts from %lu",
+ partition->index, partition->start);
+ }
if (hdg.start == partition->start)
{
@@ -765,6 +773,11 @@
dos_part = pcdata->dos_part;
bsd_part = pcdata->bsd_part;
}
+ else if (gpt)
+ {
+ dos_part = grub_cpu_to_le32 (partition->index);
+ bsd_part = grub_cpu_to_le32 (-1);
+ }
else
{
dos_part = 0;
Index: util/i386/pc/grub-install.in
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-install.in,v
retrieving revision 1.11
diff -u -r1.11 grub-install.in
--- util/i386/pc/grub-install.in 10 Apr 2007 21:38:26 -0000 1.11
+++ util/i386/pc/grub-install.in 1 May 2007 18:56:07 -0000
@@ -216,8 +216,8 @@
exit 1
fi
-# Typically, _chain and pc are required.
-modules="$modules $fs_module _chain pc"
+# Typically, _chain, pc and gpt are required.
+modules="$modules $fs_module _chain pc gpt"
$grub_mkimage --output=${grubdir}/core.img $modules || exit 1
Index: util/i386/pc/grub-probe.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-probe.c,v
retrieving revision 1.3
diff -u -r1.3 grub-probe.c
--- util/i386/pc/grub-probe.c 10 Nov 2006 23:31:55 -0000 1.3
+++ util/i386/pc/grub-probe.c 1 May 2007 18:56:07 -0000
@@ -244,6 +244,7 @@
/* Initialize the emulated biosdisk driver. */
grub_util_biosdisk_init (dev_map ? : DEFAULT_DEVICE_MAP);
grub_pc_partition_map_init ();
+ grub_gpt_partition_map_init ();
grub_raid_init ();
grub_lvm_init ();
@@ -268,6 +269,7 @@
grub_lvm_fini ();
grub_raid_fini ();
+ grub_gpt_partition_map_fini ();
grub_pc_partition_map_fini ();
grub_util_biosdisk_fini ();
Index: util/i386/pc/grub-setup.c
===================================================================
RCS file: /sources/grub/grub2/util/i386/pc/grub-setup.c,v
retrieving revision 1.20
diff -u -r1.20 grub-setup.c
--- util/i386/pc/grub-setup.c 14 Oct 2006 18:59:34 -0000 1.20
+++ util/i386/pc/grub-setup.c 1 May 2007 18:56:07 -0000
@@ -1,7 +1,7 @@
/* grub-setup.c - make GRUB usable */
/*
* GRUB -- GRand Unified Bootloader
- * Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006 Free Software Foundation, Inc.
+ * Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
*
* GRUB is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -289,21 +289,32 @@
*install_dos_part = *install_bsd_part = grub_cpu_to_le32 (-2);
else if (root_dev->disk->partition)
{
- struct grub_pc_partition *pcdata =
- root_dev->disk->partition->data;
-
if (strcmp (root_dev->disk->partition->partmap->name,
- "pc_partition_map") != 0)
+ "pc_partition_map") == 0)
+ {
+ struct grub_pc_partition *pcdata =
+ root_dev->disk->partition->data;
+ *install_dos_part
+ = grub_cpu_to_le32 (pcdata->dos_part);
+ *install_bsd_part
+ = grub_cpu_to_le32 (pcdata->bsd_part);
+ }
+ else if (strcmp (root_dev->disk->partition->partmap->name,
+ "gpt_partition_map") == 0)
+ {
+ *install_dos_part = grub_cpu_to_le32 (root_dev->disk->partition->index);
+ *install_bsd_part = grub_cpu_to_le32 (-1);
+ }
+ else
grub_util_error ("No PC style partitions found");
-
- *install_dos_part
- = grub_cpu_to_le32 (pcdata->dos_part);
- *install_bsd_part
- = grub_cpu_to_le32 (pcdata->bsd_part);
}
else
*install_dos_part = *install_bsd_part = grub_cpu_to_le32 (-1);
+ grub_util_info ("dos partition is %d, bsd partition is %d, prefix is %s",
+ grub_le_to_cpu32 (*install_dos_part),
+ grub_le_to_cpu32 (*install_bsd_part),
+ prefix);
strcpy (install_prefix, prefix);
/* Write the core image onto the disk. */
@@ -452,19 +463,27 @@
struct grub_pc_partition *pcdata =
root_dev->disk->partition->data;
- if (strcmp (root_dev->disk->partition->partmap->name,
- "pc_partition_map") != 0)
- grub_util_error ("No PC style partitions found");
-
- *install_dos_part
- = grub_cpu_to_le32 (pcdata->dos_part);
- *install_bsd_part
- = grub_cpu_to_le32 (pcdata->bsd_part);
+ if (strcmp (root_dev->disk->partition->partmap->name,
+ "pc_partition_map") == 0)
+ {
+ *install_dos_part
+ = grub_cpu_to_le32 (pcdata->dos_part);
+ *install_bsd_part
+ = grub_cpu_to_le32 (pcdata->bsd_part);
+ }
+ else if (strcmp (root_dev->disk->partition->partmap->name,
+ "gpt_partition_map") == 0)
+ {
+ *install_dos_part = grub_cpu_to_le32 (root_dev->disk->partition->index);
+ *install_bsd_part = grub_cpu_to_le32 (-1);
+ }
+ else
+ grub_util_error ("No PC style partitions found");
}
else
*install_dos_part = *install_bsd_part = grub_cpu_to_le32 (-1);
-
- grub_util_info ("dos partition is %u, bsd partition is %u, prefix is %s",
+
+ grub_util_info ("dos partition is %d, bsd partition is %d, prefix is %s",
grub_le_to_cpu32 (*install_dos_part),
grub_le_to_cpu32 (*install_bsd_part),
prefix);
@@ -644,6 +663,7 @@
/* Initialize the emulated biosdisk driver. */
grub_util_biosdisk_init (dev_map ? : DEFAULT_DEVICE_MAP);
grub_pc_partition_map_init ();
+ grub_gpt_partition_map_init ();
dest_dev = get_device_name (argv[optind]);
if (! dest_dev)
@@ -745,6 +765,7 @@
grub_hfs_fini ();
grub_jfs_fini ();
+ grub_gpt_partition_map_fini ();
grub_pc_partition_map_fini ();
grub_util_biosdisk_fini ();
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: GPT on PC/BIOS computers
2007-05-01 19:18 GPT on PC/BIOS computers Robert Millan
@ 2007-05-03 13:33 ` Javier Rodríguez Sánchez
2007-05-03 14:17 ` Robert Millan
2007-05-04 8:40 ` Marco Gerards
1 sibling, 1 reply; 14+ messages in thread
From: Javier Rodríguez Sánchez @ 2007-05-03 13:33 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 1312 bytes --]
Hello Robert,
I have applied the patch to the latest CVS rev. but when I compile grub2 I
get this error:
grub_setup-util_i386_pc_grub_setup.o: In function `main':
/usr/src/grub2/util/i386/pc/grub-setup.c:666: undefined reference to
`grub_gpt_partition_map_init'
/usr/src/grub2/util/i386/pc/grub-setup.c:768: undefined reference to
`grub_gpt_partition_map_fini'
collect2: ld returned 1 exit status
make: *** [grub-setup] Error 1
I think that both functions are not declared, it is?
If you want I can test with the new versions you made.
Thanks
2007/5/1, Robert Millan <rmh@aybabtu.com>:
>
>
> Here's a patch to enable GPT support for PC/BIOS systems. Need for GPT is
> increasingly common due availability of > 2 TiB hard drives.
>
> Please let me know if everything is correct.
>
> Some testing would be welcome, too (but be careful, earlier versions of my
> patch had a "feature" that fucked up your partition table - hopefuly fixed
> now, at least Works For Me [tm]).
>
> --
> Robert Millan
>
> My spam trap is honeypot@aybabtu.com. Note: this address is only intended
> for spam harvesters. Writing to it will get you added to my black list.
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
>
>
[-- Attachment #2: Type: text/html, Size: 1836 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: GPT on PC/BIOS computers
2007-05-03 13:33 ` Javier Rodríguez Sánchez
@ 2007-05-03 14:17 ` Robert Millan
2007-05-03 14:27 ` Javier Rodríguez Sánchez
0 siblings, 1 reply; 14+ messages in thread
From: Robert Millan @ 2007-05-03 14:17 UTC (permalink / raw)
To: The development of GRUB 2
On Thu, May 03, 2007 at 03:33:58PM +0200, Javier Rodríguez Sánchez wrote:
> Hello Robert,
>
> I have applied the patch to the latest CVS rev. but when I compile grub2 I
> get this error:
>
> grub_setup-util_i386_pc_grub_setup.o: In function `main':
> /usr/src/grub2/util/i386/pc/grub-setup.c:666: undefined reference to
> `grub_gpt_partition_map_init'
> /usr/src/grub2/util/i386/pc/grub-setup.c:768: undefined reference to
> `grub_gpt_partition_map_fini'
> collect2: ld returned 1 exit status
> make: *** [grub-setup] Error 1
Did you regenerate conf/i386-pc.mk ?
ruby genmk.rb < conf/i386-pc.rmk > conf/i386-pc.mk
--
Robert Millan
My spam trap is honeypot@aybabtu.com. Note: this address is only intended
for spam harvesters. Writing to it will get you added to my black list.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: GPT on PC/BIOS computers
2007-05-03 14:17 ` Robert Millan
@ 2007-05-03 14:27 ` Javier Rodríguez Sánchez
2007-05-04 20:32 ` Javier Rodríguez Sánchez
0 siblings, 1 reply; 14+ messages in thread
From: Javier Rodríguez Sánchez @ 2007-05-03 14:27 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 1201 bytes --]
Great!, now It compile, when I return to home, I will try it on my
MacBookPro. When I have the results I will post them here.
Thanks
2007/5/3, Robert Millan <rmh@aybabtu.com>:
>
> On Thu, May 03, 2007 at 03:33:58PM +0200, Javier Rodríguez Sánchez wrote:
> > Hello Robert,
> >
> > I have applied the patch to the latest CVS rev. but when I compile grub2
> I
> > get this error:
> >
> > grub_setup-util_i386_pc_grub_setup.o: In function `main':
> > /usr/src/grub2/util/i386/pc/grub-setup.c:666: undefined reference to
> > `grub_gpt_partition_map_init'
> > /usr/src/grub2/util/i386/pc/grub-setup.c:768: undefined reference to
> > `grub_gpt_partition_map_fini'
> > collect2: ld returned 1 exit status
> > make: *** [grub-setup] Error 1
>
> Did you regenerate conf/i386-pc.mk ?
>
> ruby genmk.rb < conf/i386-pc.rmk > conf/i386-pc.mk
>
> --
> Robert Millan
>
> My spam trap is honeypot@aybabtu.com. Note: this address is only intended
> for spam harvesters. Writing to it will get you added to my black list.
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
[-- Attachment #2: Type: text/html, Size: 1735 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: GPT on PC/BIOS computers
2007-05-03 14:27 ` Javier Rodríguez Sánchez
@ 2007-05-04 20:32 ` Javier Rodríguez Sánchez
2007-05-04 22:15 ` Robert Millan
2007-05-05 13:13 ` Marco Gerards
0 siblings, 2 replies; 14+ messages in thread
From: Javier Rodríguez Sánchez @ 2007-05-04 20:32 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 1672 bytes --]
Hello, I have tried the patch and it works well, but I have one question.
It's necessary to be a MBR partition scheme? because I need a MBR
emulation from the GPT scheme to Grub2 loader works. If I only let the GPT
scheme with the EFI protective partition on MBR, grub doesn't find any
bootable device.
Bye
2007/5/3, Javier Rodríguez Sánchez <jyckcrl@gmail.com>:
>
> Great!, now It compile, when I return to home, I will try it on my
> MacBookPro. When I have the results I will post them here.
>
> Thanks
>
> 2007/5/3, Robert Millan < rmh@aybabtu.com>:
> >
> > On Thu, May 03, 2007 at 03:33:58PM +0200, Javier Rodríguez Sánchez
> > wrote:
> > > Hello Robert,
> > >
> > > I have applied the patch to the latest CVS rev. but when I compile
> > grub2 I
> > > get this error:
> > >
> > > grub_setup-util_i386_pc_grub_setup.o: In function `main':
> > > /usr/src/grub2/util/i386/pc/grub- setup.c:666: undefined reference to
> > > `grub_gpt_partition_map_init'
> > > /usr/src/grub2/util/i386/pc/grub-setup.c:768: undefined reference to
> > > `grub_gpt_partition_map_fini'
> > > collect2: ld returned 1 exit status
> > > make: *** [grub-setup] Error 1
> >
> > Did you regenerate conf/i386-pc.mk ?
> >
> > ruby genmk.rb < conf/i386-pc.rmk > conf/i386-pc.mk
> >
> > --
> > Robert Millan
> >
> > My spam trap is honeypot@aybabtu.com. Note: this address is only
> > intended
> > for spam harvesters. Writing to it will get you added to my black list.
> >
> >
> > _______________________________________________
> > Grub-devel mailing list
> > Grub-devel@gnu.org
> > http://lists.gnu.org/mailman/listinfo/grub-devel
> >
>
>
[-- Attachment #2: Type: text/html, Size: 2866 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: GPT on PC/BIOS computers
2007-05-04 20:32 ` Javier Rodríguez Sánchez
@ 2007-05-04 22:15 ` Robert Millan
2007-05-05 13:13 ` Marco Gerards
1 sibling, 0 replies; 14+ messages in thread
From: Robert Millan @ 2007-05-04 22:15 UTC (permalink / raw)
To: The development of GRUB 2
On Fri, May 04, 2007 at 10:32:00PM +0200, Javier Rodríguez Sánchez wrote:
> Hello, I have tried the patch and it works well, but I have one question.
> It's necessary to be a MBR partition scheme? because I need a MBR
> emulation from the GPT scheme to Grub2 loader works. If I only let the GPT
> scheme with the EFI protective partition on MBR, grub doesn't find any
> bootable device.
This patch is intended for systems using PC/BIOS/MBR boot system, whose
"standard" partition layout is msdos-style, but have opted to use GPT instead
for the partitions.
GPT is the standard in EFI, but this patch shouldn't have any effect on EFI
systems (these already have GPT support).
--
Robert Millan
My spam trap is honeypot@aybabtu.com. Note: this address is only intended
for spam harvesters. Writing to it will get you added to my black list.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: GPT on PC/BIOS computers
2007-05-04 20:32 ` Javier Rodríguez Sánchez
2007-05-04 22:15 ` Robert Millan
@ 2007-05-05 13:13 ` Marco Gerards
2007-05-06 7:02 ` Javier Rodríguez Sánchez
1 sibling, 1 reply; 14+ messages in thread
From: Marco Gerards @ 2007-05-05 13:13 UTC (permalink / raw)
To: The development of GRUB 2
"Javier Rodríguez Sánchez" <jyckcrl@gmail.com> writes:
> Hello, I have tried the patch and it works well, but I have one question.
> It's necessary to be a MBR partition scheme? because I need a MBR
> emulation from the GPT scheme to Grub2 loader works. If I only let the GPT
> scheme with the EFI protective partition on MBR, grub doesn't find any
> bootable device.
What do you mean? You do not need MBR emulation or so. I assume you
mean that there are a few partitions in the MBR that match the GPT
partitions? Or can you be more precise?
--
Marco
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: GPT on PC/BIOS computers
2007-05-05 13:13 ` Marco Gerards
@ 2007-05-06 7:02 ` Javier Rodríguez Sánchez
0 siblings, 0 replies; 14+ messages in thread
From: Javier Rodríguez Sánchez @ 2007-05-06 7:02 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 1101 bytes --]
Hello, curently to make grub2 works, I need a MBR emulation with the same
partition as GPT scheme.
If grub2 doesn't found any partition in MBR table it doesn't. Then, It's
necessary to be in MBR the
partitions that match with GPT scheme?
Thx
PD:Sorry for my english
2007/5/5, Marco Gerards <mgerards@xs4all.nl>:
>
> "Javier Rodríguez Sánchez" <jyckcrl@gmail.com> writes:
>
> > Hello, I have tried the patch and it works well, but I have one
> question.
> > It's necessary to be a MBR partition scheme? because I need a MBR
> > emulation from the GPT scheme to Grub2 loader works. If I only let the
> GPT
> > scheme with the EFI protective partition on MBR, grub doesn't find any
> > bootable device.
>
> What do you mean? You do not need MBR emulation or so. I assume you
> mean that there are a few partitions in the MBR that match the GPT
> partitions? Or can you be more precise?
>
> --
> Marco
>
>
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> http://lists.gnu.org/mailman/listinfo/grub-devel
>
[-- Attachment #2: Type: text/html, Size: 1601 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: GPT on PC/BIOS computers
2007-05-01 19:18 GPT on PC/BIOS computers Robert Millan
2007-05-03 13:33 ` Javier Rodríguez Sánchez
@ 2007-05-04 8:40 ` Marco Gerards
2007-05-04 23:05 ` Robert Millan
1 sibling, 1 reply; 14+ messages in thread
From: Marco Gerards @ 2007-05-04 8:40 UTC (permalink / raw)
To: The development of GRUB 2; +Cc: Michael Renner
Robert Millan <rmh@aybabtu.com> writes:
> Here's a patch to enable GPT support for PC/BIOS systems. Need for GPT is
> increasingly common due availability of > 2 TiB hard drives.
>
> Please let me know if everything is correct.
>
> Some testing would be welcome, too (but be careful, earlier versions of my
> patch had a "feature" that fucked up your partition table - hopefuly fixed
> now, at least Works For Me [tm]).
Have you tested it on MBR?
> --
> Robert Millan
>
> My spam trap is honeypot@aybabtu.com. Note: this address is only intended
> for spam harvesters. Writing to it will get you added to my black list.
>
> 2007-05-01 Robert Millan <rmh@aybabtu.com>
>
> * conf/i386-pc.rmk (grub_setup_SOURCES): Add partmap/gpt.c.
> (grub_probe_SOURCES): Likewise.
> * conf/i386-pc.mk: Regenerate.
No need to mention this.
> * util/i386/pc/biosdisk.c (grub_util_biosdisk_get_grub_dev): Detect
> GPT and initialize dos_part and bsd_part accordingly.
> * util/i386/pc/grub-setup.c: Ditto for install_dos_part and
> install_bsd_part.
> * util/i386/pc/grub-install.in: Add gpt module to core.img.
> * util/i386/pc/grub-probe.c: Activate gpt module for use during
> partition identification, and deactivate it afterwards.
> * util/i386/pc/grub-setup.c: Ditto.
You don't mention in which function you do these things, just the
files. Can you correct this? I personally would prefer if you do not
split up the changelog entries for one file, perhaps it is not even
allowed by the GCS.
> Index: util/i386/pc/grub-install.in
> ===================================================================
> RCS file: /sources/grub/grub2/util/i386/pc/grub-install.in,v
> retrieving revision 1.11
> diff -u -r1.11 grub-install.in
> --- util/i386/pc/grub-install.in 10 Apr 2007 21:38:26 -0000 1.11
> +++ util/i386/pc/grub-install.in 1 May 2007 18:56:07 -0000
> @@ -216,8 +216,8 @@
> exit 1
> fi
>
> -# Typically, _chain and pc are required.
> -modules="$modules $fs_module _chain pc"
> +# Typically, _chain, pc and gpt are required.
> +modules="$modules $fs_module _chain pc gpt"
It would be nice if we were able to use grub-probe to determine
this... But for now this is fine, I think.
--
Marco
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: GPT on PC/BIOS computers
2007-05-04 8:40 ` Marco Gerards
@ 2007-05-04 23:05 ` Robert Millan
2007-05-05 13:21 ` Marco Gerards
0 siblings, 1 reply; 14+ messages in thread
From: Robert Millan @ 2007-05-04 23:05 UTC (permalink / raw)
To: The development of GRUB 2
On Fri, May 04, 2007 at 10:40:17AM +0200, Marco Gerards wrote:
> Robert Millan <rmh@aybabtu.com> writes:
>
> > Here's a patch to enable GPT support for PC/BIOS systems. Need for GPT is
> > increasingly common due availability of > 2 TiB hard drives.
> >
> > Please let me know if everything is correct.
> >
> > Some testing would be welcome, too (but be careful, earlier versions of my
> > patch had a "feature" that fucked up your partition table - hopefuly fixed
> > now, at least Works For Me [tm]).
>
> Have you tested it on MBR?
Good idea. I have now, and seems to work fine.
> > * conf/i386-pc.mk: Regenerate.
>
> No need to mention this.
Ok, removed.
> You don't mention in which function you do these things, just the
> files. Can you correct this? I personally would prefer if you do not
> split up the changelog entries for one file, perhaps it is not even
> allowed by the GCS.
The later adds a bit of redundancy, but as you prefer. All these are corrected.
> > -# Typically, _chain and pc are required.
> > -modules="$modules $fs_module _chain pc"
> > +# Typically, _chain, pc and gpt are required.
> > +modules="$modules $fs_module _chain pc gpt"
>
> It would be nice if we were able to use grub-probe to determine
> this... But for now this is fine, I think.
I've looked into this, but I need some advice. What's the simplest way to
obtain the corresponding grub_partition_t structure for a partition by knowing
its drive name?
--
Robert Millan
My spam trap is honeypot@aybabtu.com. Note: this address is only intended
for spam harvesters. Writing to it will get you added to my black list.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: GPT on PC/BIOS computers
2007-05-04 23:05 ` Robert Millan
@ 2007-05-05 13:21 ` Marco Gerards
2007-05-07 9:17 ` Robert Millan
0 siblings, 1 reply; 14+ messages in thread
From: Marco Gerards @ 2007-05-05 13:21 UTC (permalink / raw)
To: The development of GRUB 2
Robert Millan <rmh@aybabtu.com> writes:
[...]
> I've looked into this, but I need some advice. What's the simplest way to
> obtain the corresponding grub_partition_t structure for a partition by knowing
> its drive name?
You can use grub_partition_iterate. Or open the disk and use
->partition. You can read the name of the partitioning scheme. The
is also done in grub-setup.c, in the code you altered.
--
Marco
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: GPT on PC/BIOS computers
2007-05-05 13:21 ` Marco Gerards
@ 2007-05-07 9:17 ` Robert Millan
2007-05-07 19:23 ` Yoshinori K. Okuji
0 siblings, 1 reply; 14+ messages in thread
From: Robert Millan @ 2007-05-07 9:17 UTC (permalink / raw)
To: The development of GRUB 2
[-- Attachment #1: Type: text/plain, Size: 788 bytes --]
On Sat, May 05, 2007 at 03:21:38PM +0200, Marco Gerards wrote:
> > I've looked into this, but I need some advice. What's the simplest way to
> > obtain the corresponding grub_partition_t structure for a partition by knowing
> > its drive name?
>
> You can use grub_partition_iterate. Or open the disk and use
> ->partition. You can read the name of the partitioning scheme. The
> is also done in grub-setup.c, in the code you altered.
Patch attached. Let me know if it's correct (I had my doubts about hardcoding
the the whole partition_map list in grub-probe.c, but then again I think safety
is more important).
--
Robert Millan
My spam trap is honeypot@aybabtu.com. Note: this address is only intended
for spam harvesters. Writing to it will get you added to my black list.
[-- Attachment #2: ptable.diff --]
[-- Type: text/x-diff, Size: 3371 bytes --]
2007-05-07 Robert Millan <rmh@aybabtu.com>
* util/i386/pc/grub-probe.c: Add `grub-probe -t ptable' parameter to
determine partition table module.
* util/i386/pc/grub-install.in: Use this feature to decide which
partition module to load, instead of hardcoding pc and gpt.
diff -ur grub2-1.95+20070505.1.old/util/i386/pc/grub-install.in grub2-1.95+20070505.1/util/i386/pc/grub-install.in
--- grub2-1.95+20070505.1.old/util/i386/pc/grub-install.in 2007-05-07 10:53:25.000000000 +0200
+++ grub2-1.95+20070505.1/util/i386/pc/grub-install.in 2007-05-07 10:54:27.000000000 +0200
@@ -216,8 +216,16 @@
exit 1
fi
-# Typically, _chain, pc and gpt are required.
-modules="$modules $fs_module _chain pc gpt"
+# Then the partition table module.
+ptable_module=`$grub_probe --target=ptable --device-map=${device_map} ${grubdir}`
+if test "x$ptable_module" = x -a "x$modules" = x; then
+ echo "Auto-detection of a partition table module failed." 1>&2
+ echo "Please specify the module with the option \`--modules' explicitly." 1>&2
+ exit 1
+fi
+
+# _chain is often useful
+modules="$modules $fs_module $ptable_module _chain"
$grub_mkimage --output=${grubdir}/core.img $modules || exit 1
diff -ur grub2-1.95+20070505.1.old/util/i386/pc/grub-probe.c grub2-1.95+20070505.1/util/i386/pc/grub-probe.c
--- grub2-1.95+20070505.1.old/util/i386/pc/grub-probe.c 2007-05-07 10:53:26.000000000 +0200
+++ grub2-1.95+20070505.1/util/i386/pc/grub-probe.c 2007-05-07 10:55:44.000000000 +0200
@@ -50,6 +50,7 @@
#define PRINT_FS 0
#define PRINT_DRIVE 1
#define PRINT_DEVICE 2
+#define PRINT_PTABLE 3
int print = PRINT_FS;
@@ -123,6 +124,23 @@
if (! dev)
grub_util_error ("%s", grub_errmsg);
+ if (print == PRINT_PTABLE)
+ {
+ if (strcmp (dev->disk->partition->partmap->name, "amiga_partition_map") == 0)
+ printf ("amiga\n");
+ else if (strcmp (dev->disk->partition->partmap->name, "apple_partition_map") == 0)
+ printf ("apple\n");
+ else if (strcmp (dev->disk->partition->partmap->name, "gpt_partition_map") == 0)
+ printf ("gpt\n");
+ else if (strcmp (dev->disk->partition->partmap->name, "pc_partition_map") == 0)
+ printf ("pc\n");
+ else if (strcmp (dev->disk->partition->partmap->name, "sun_partition_map") == 0)
+ printf ("sun\n");
+ else
+ grub_util_error ("Unknown partition table %s", dev->disk->partition->partmap->name);
+ goto end;
+ }
+
fs = grub_fs_probe (dev);
if (! fs)
grub_util_error ("%s", grub_errmsg);
@@ -160,7 +178,8 @@
Probe device information for a given path.\n\
\n\
-m, --device-map=FILE use FILE as the device map [default=%s]\n\
- -t, --target=(fs|drive|device) print filesystem module, GRUB drive or system device [default=fs]\n\
+ -t, --target=(fs|drive|device|ptable)\n\
+ print filesystem module, GRUB drive, system device or partition table module [default=fs]\n\
-h, --help display this message and exit\n\
-V, --version print version information and exit\n\
-v, --verbose print verbose messages\n\
@@ -204,6 +223,8 @@
print = PRINT_DRIVE;
else if (!strcmp (optarg, "device"))
print = PRINT_DEVICE;
+ else if (!strcmp (optarg, "ptable"))
+ print = PRINT_PTABLE;
else
usage (1);
break;
^ permalink raw reply [flat|nested] 14+ messages in thread* Re: GPT on PC/BIOS computers
2007-05-07 9:17 ` Robert Millan
@ 2007-05-07 19:23 ` Yoshinori K. Okuji
2007-05-07 19:58 ` Robert Millan
0 siblings, 1 reply; 14+ messages in thread
From: Yoshinori K. Okuji @ 2007-05-07 19:23 UTC (permalink / raw)
To: The development of GRUB 2
On Monday 07 May 2007 11:17, Robert Millan wrote:
> On Sat, May 05, 2007 at 03:21:38PM +0200, Marco Gerards wrote:
> > > I've looked into this, but I need some advice. What's the simplest way
> > > to obtain the corresponding grub_partition_t structure for a partition
> > > by knowing its drive name?
> >
> > You can use grub_partition_iterate. Or open the disk and use
> > ->partition. You can read the name of the partitioning scheme. The
> > is also done in grub-setup.c, in the code you altered.
>
> Patch attached. Let me know if it's correct (I had my doubts about
> hardcoding the the whole partition_map list in grub-probe.c, but then again
> I think safety is more important).
The naming is not good. In GRUB, we call "partmap" but not "ptable".
Okuji
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: GPT on PC/BIOS computers
2007-05-07 19:23 ` Yoshinori K. Okuji
@ 2007-05-07 19:58 ` Robert Millan
0 siblings, 0 replies; 14+ messages in thread
From: Robert Millan @ 2007-05-07 19:58 UTC (permalink / raw)
To: The development of GRUB 2
On Mon, May 07, 2007 at 09:23:54PM +0200, Yoshinori K. Okuji wrote:
> On Monday 07 May 2007 11:17, Robert Millan wrote:
> > On Sat, May 05, 2007 at 03:21:38PM +0200, Marco Gerards wrote:
> > > > I've looked into this, but I need some advice. What's the simplest way
> > > > to obtain the corresponding grub_partition_t structure for a partition
> > > > by knowing its drive name?
> > >
> > > You can use grub_partition_iterate. Or open the disk and use
> > > ->partition. You can read the name of the partitioning scheme. The
> > > is also done in grub-setup.c, in the code you altered.
> >
> > Patch attached. Let me know if it's correct (I had my doubts about
> > hardcoding the the whole partition_map list in grub-probe.c, but then again
> > I think safety is more important).
>
> The naming is not good. In GRUB, we call "partmap" but not "ptable".
Ok, fixed and committed.
Thanks,
--
Robert Millan
My spam trap is honeypot@aybabtu.com. Note: this address is only intended
for spam harvesters. Writing to it will get you added to my black list.
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2007-05-07 20:04 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-01 19:18 GPT on PC/BIOS computers Robert Millan
2007-05-03 13:33 ` Javier Rodríguez Sánchez
2007-05-03 14:17 ` Robert Millan
2007-05-03 14:27 ` Javier Rodríguez Sánchez
2007-05-04 20:32 ` Javier Rodríguez Sánchez
2007-05-04 22:15 ` Robert Millan
2007-05-05 13:13 ` Marco Gerards
2007-05-06 7:02 ` Javier Rodríguez Sánchez
2007-05-04 8:40 ` Marco Gerards
2007-05-04 23:05 ` Robert Millan
2007-05-05 13:21 ` Marco Gerards
2007-05-07 9:17 ` Robert Millan
2007-05-07 19:23 ` Yoshinori K. Okuji
2007-05-07 19:58 ` Robert Millan
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.