2007-05-05 Robert Millan <rmh@aybabtu.com>
* conf/i386-pc.rmk (grub_setup_SOURCES): Add partmap/gpt.c. (grub_probe_SOURCES): Likewise. * 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 (setup): Ditto for install_dos_part and install_bsd_part. (main): Activate gpt module for use during partition identification, and deactivate it afterwards. * util/i386/pc/grub-install.in: Add gpt module to core.img. * util/i386/pc/grub-probe.c (main): Activate gpt module for use during partition identification, and deactivate it afterwards.
This commit is contained in:
parent
99123174c9
commit
20b976586e
6 changed files with 81 additions and 29 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
||||||
|
2007-05-05 Robert Millan <rmh@aybabtu.com>
|
||||||
|
|
||||||
|
* conf/i386-pc.rmk (grub_setup_SOURCES): Add partmap/gpt.c.
|
||||||
|
(grub_probe_SOURCES): Likewise.
|
||||||
|
* 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 (setup): Ditto for install_dos_part and
|
||||||
|
install_bsd_part.
|
||||||
|
(main): Activate gpt module for use during partition identification,
|
||||||
|
and deactivate it afterwards.
|
||||||
|
* util/i386/pc/grub-install.in: Add gpt module to core.img.
|
||||||
|
* util/i386/pc/grub-probe.c (main): Activate gpt module for use during
|
||||||
|
partition identification, and deactivate it afterwards.
|
||||||
|
|
||||||
2007-05-05 Robert Millan <rmh@aybabtu.com>
|
2007-05-05 Robert Millan <rmh@aybabtu.com>
|
||||||
|
|
||||||
* term/i386/pc/console.c (grub_console_fini): Call
|
* term/i386/pc/console.c (grub_console_fini): Call
|
||||||
|
|
|
@ -65,9 +65,10 @@ grub_mkimage_LDFLAGS = $(LIBLZO)
|
||||||
grub_setup_SOURCES = util/i386/pc/grub-setup.c util/i386/pc/biosdisk.c \
|
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 \
|
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 \
|
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/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 \
|
partmap/gpt.c fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c \
|
||||||
kern/fs.c kern/env.c fs/fshelp.c util/raid.c util/lvm.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.
|
# For grub-mkdevicemap.
|
||||||
grub_mkdevicemap_SOURCES = util/i386/pc/grub-mkdevicemap.c util/misc.c
|
grub_mkdevicemap_SOURCES = util/i386/pc/grub-mkdevicemap.c util/misc.c
|
||||||
|
@ -76,9 +77,10 @@ grub_mkdevicemap_SOURCES = util/i386/pc/grub-mkdevicemap.c util/misc.c
|
||||||
grub_probe_SOURCES = util/i386/pc/grub-probe.c \
|
grub_probe_SOURCES = util/i386/pc/grub-probe.c \
|
||||||
util/i386/pc/biosdisk.c util/misc.c util/i386/pc/getroot.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 \
|
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/ext2.c kern/parser.c kern/partition.c partmap/pc.c \
|
||||||
fs/minix.c fs/hfs.c fs/jfs.c kern/fs.c kern/env.c fs/fshelp.c \
|
partmap/gpt.c fs/ufs.c fs/minix.c fs/hfs.c fs/jfs.c kern/fs.c \
|
||||||
fs/xfs.c fs/affs.c fs/sfs.c fs/hfsplus.c disk/lvm.c disk/raid.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.
|
# For grub-emu.
|
||||||
grub_emu_DEPENDENCIES = grub_script.tab.c grub_script.tab.h \
|
grub_emu_DEPENDENCIES = grub_script.tab.c grub_script.tab.h \
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* biosdisk.c - emulate biosdisk */
|
/* biosdisk.c - emulate biosdisk */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* 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
|
* GRUB is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -743,9 +743,12 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
|
||||||
const grub_partition_t partition)
|
const grub_partition_t partition)
|
||||||
{
|
{
|
||||||
struct grub_pc_partition *pcdata = 0;
|
struct grub_pc_partition *pcdata = 0;
|
||||||
|
int gpt = 0;
|
||||||
|
|
||||||
if (strcmp (partition->partmap->name, "pc_partition_map") == 0)
|
if (strcmp (partition->partmap->name, "pc_partition_map") == 0)
|
||||||
pcdata = partition->data;
|
pcdata = partition->data;
|
||||||
|
else if (strcmp (partition->partmap->name, "gpt_partition_map") == 0)
|
||||||
|
gpt = 1;
|
||||||
|
|
||||||
if (pcdata)
|
if (pcdata)
|
||||||
{
|
{
|
||||||
|
@ -757,6 +760,11 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
|
||||||
pcdata->dos_part, pcdata->bsd_part + 'a',
|
pcdata->dos_part, pcdata->bsd_part + 'a',
|
||||||
partition->start);
|
partition->start);
|
||||||
}
|
}
|
||||||
|
else if (gpt)
|
||||||
|
{
|
||||||
|
grub_util_info ("GPT partition %d starts from %lu",
|
||||||
|
partition->index, partition->start);
|
||||||
|
}
|
||||||
|
|
||||||
if (hdg.start == partition->start)
|
if (hdg.start == partition->start)
|
||||||
{
|
{
|
||||||
|
@ -765,6 +773,11 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
|
||||||
dos_part = pcdata->dos_part;
|
dos_part = pcdata->dos_part;
|
||||||
bsd_part = pcdata->bsd_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
|
else
|
||||||
{
|
{
|
||||||
dos_part = 0;
|
dos_part = 0;
|
||||||
|
|
|
@ -216,8 +216,8 @@ if test "x$fs_module" = x -a "x$modules" = x; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Typically, _chain and pc are required.
|
# Typically, _chain, pc and gpt are required.
|
||||||
modules="$modules $fs_module _chain pc"
|
modules="$modules $fs_module _chain pc gpt"
|
||||||
|
|
||||||
$grub_mkimage --output=${grubdir}/core.img $modules || exit 1
|
$grub_mkimage --output=${grubdir}/core.img $modules || exit 1
|
||||||
|
|
||||||
|
|
|
@ -244,6 +244,7 @@ main (int argc, char *argv[])
|
||||||
/* Initialize the emulated biosdisk driver. */
|
/* Initialize the emulated biosdisk driver. */
|
||||||
grub_util_biosdisk_init (dev_map ? : DEFAULT_DEVICE_MAP);
|
grub_util_biosdisk_init (dev_map ? : DEFAULT_DEVICE_MAP);
|
||||||
grub_pc_partition_map_init ();
|
grub_pc_partition_map_init ();
|
||||||
|
grub_gpt_partition_map_init ();
|
||||||
grub_raid_init ();
|
grub_raid_init ();
|
||||||
grub_lvm_init ();
|
grub_lvm_init ();
|
||||||
|
|
||||||
|
@ -268,6 +269,7 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
grub_lvm_fini ();
|
grub_lvm_fini ();
|
||||||
grub_raid_fini ();
|
grub_raid_fini ();
|
||||||
|
grub_gpt_partition_map_fini ();
|
||||||
grub_pc_partition_map_fini ();
|
grub_pc_partition_map_fini ();
|
||||||
grub_util_biosdisk_fini ();
|
grub_util_biosdisk_fini ();
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* grub-setup.c - make GRUB usable */
|
/* grub-setup.c - make GRUB usable */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* 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
|
* GRUB is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -289,21 +289,32 @@ setup (const char *prefix, const char *dir,
|
||||||
*install_dos_part = *install_bsd_part = grub_cpu_to_le32 (-2);
|
*install_dos_part = *install_bsd_part = grub_cpu_to_le32 (-2);
|
||||||
else if (root_dev->disk->partition)
|
else if (root_dev->disk->partition)
|
||||||
{
|
{
|
||||||
struct grub_pc_partition *pcdata =
|
|
||||||
root_dev->disk->partition->data;
|
|
||||||
|
|
||||||
if (strcmp (root_dev->disk->partition->partmap->name,
|
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");
|
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
|
else
|
||||||
*install_dos_part = *install_bsd_part = grub_cpu_to_le32 (-1);
|
*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);
|
strcpy (install_prefix, prefix);
|
||||||
|
|
||||||
/* Write the core image onto the disk. */
|
/* Write the core image onto the disk. */
|
||||||
|
@ -452,19 +463,27 @@ setup (const char *prefix, const char *dir,
|
||||||
struct grub_pc_partition *pcdata =
|
struct grub_pc_partition *pcdata =
|
||||||
root_dev->disk->partition->data;
|
root_dev->disk->partition->data;
|
||||||
|
|
||||||
if (strcmp (root_dev->disk->partition->partmap->name,
|
if (strcmp (root_dev->disk->partition->partmap->name,
|
||||||
"pc_partition_map") != 0)
|
"pc_partition_map") == 0)
|
||||||
grub_util_error ("No PC style partitions found");
|
{
|
||||||
|
*install_dos_part
|
||||||
*install_dos_part
|
= grub_cpu_to_le32 (pcdata->dos_part);
|
||||||
= grub_cpu_to_le32 (pcdata->dos_part);
|
*install_bsd_part
|
||||||
*install_bsd_part
|
= grub_cpu_to_le32 (pcdata->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
|
else
|
||||||
*install_dos_part = *install_bsd_part = grub_cpu_to_le32 (-1);
|
*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_dos_part),
|
||||||
grub_le_to_cpu32 (*install_bsd_part),
|
grub_le_to_cpu32 (*install_bsd_part),
|
||||||
prefix);
|
prefix);
|
||||||
|
@ -644,6 +663,7 @@ main (int argc, char *argv[])
|
||||||
/* Initialize the emulated biosdisk driver. */
|
/* Initialize the emulated biosdisk driver. */
|
||||||
grub_util_biosdisk_init (dev_map ? : DEFAULT_DEVICE_MAP);
|
grub_util_biosdisk_init (dev_map ? : DEFAULT_DEVICE_MAP);
|
||||||
grub_pc_partition_map_init ();
|
grub_pc_partition_map_init ();
|
||||||
|
grub_gpt_partition_map_init ();
|
||||||
|
|
||||||
dest_dev = get_device_name (argv[optind]);
|
dest_dev = get_device_name (argv[optind]);
|
||||||
if (! dest_dev)
|
if (! dest_dev)
|
||||||
|
@ -745,6 +765,7 @@ main (int argc, char *argv[])
|
||||||
grub_hfs_fini ();
|
grub_hfs_fini ();
|
||||||
grub_jfs_fini ();
|
grub_jfs_fini ();
|
||||||
|
|
||||||
|
grub_gpt_partition_map_fini ();
|
||||||
grub_pc_partition_map_fini ();
|
grub_pc_partition_map_fini ();
|
||||||
grub_util_biosdisk_fini ();
|
grub_util_biosdisk_fini ();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue