2004-12-04 Marco Gerards <metgerards@student.han.nl>
Modulize the partition map support and add support for the amiga partition map. * commands/ls.c: Include <grub/partition.h> instead of <grub/machine/partition.h>. * kern/disk.c: Likewise. * kern/rescue.c: Likewise. * loader/i386/pc/chainloader.c: Likewise. * normal/cmdline.c: Likewise. * kern/powerpc/ieee1275/init.c: Likewise. (grub_machine_init): Call `grub_pc_partition_map_init', `grub_amiga_partition_map_init' and `grub_apple_partition_map_init'. * conf/i386-pc.rmk (kernel_img_SOURCES): Remove `disk/i386/pc/partition.c'. Add `kern/partition.c'. (kernel_img_HEADERS): Remove `machine/partition.h'. Add `partition.h' and `pc_partition.h'. (grub_setup_SOURCES): Remove `disk/i386/pc/partition.c'. Add `kern/partition.c', `partmap/amiga.c', `partmap/apple.c' and `partmap/pc.c'. (grub_emu_SOURCES): Likewise. (pkgdata_MODULES): Add `amiga.mod', `apple.mod' and `pc.mod'. (amiga_mod_SOURCES, amiga_mod_CFLAGS, apple_mod_SOURCES) (apple_mod_CFLAGS, pc_mod_SOURCES, pc_mod_CFLAGS): New variables. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Remove `disk/powerpc/ieee1275/partition.c'. Add `kern/partition.c', `partmap/amiga.c', `partmap/apple.c' and `partmap/pc.c'. (grubof_SOURCES): Likewise. * disk/i386/pc/partition.c: File removed. * disk/powerpc/ieee1275/partition.c: Likewise. * include/grub/powerpc/ieee1275/partition.h: Likewise. * include/grub/i386/pc/partition.h: Likewise. * kern/partition.c: New file. * partmap/amiga.c: Likewise. * partmap/apple.c: Likewise. * partmap/pc.c: Likewise. * include/grub/partition.h: Likewise.. * include/grub/pc_partition.h: Likewise. * util/grub-emu.c: Include <grub/partition.h> instead of <grub/machine/partition.h>. (main): Call `grub_pc_partition_map_init', `grub_amiga_partition_map_init' and `grub_apple_partition_map_init' and deinitialize afterwards. * util/i386/pc/biosdisk.c: Include `#include <grub/partition.h>' and `include <grub/pc_partition.h>' instead of `<grub/machine/partition.h>'. * util/i386/pc/grub-setup.c: Likewise. * util/i386/pc/biosdisk.c: Likewise. (grub_util_biosdisk_get_grub_dev): Only access the PC specific partition information in case of a PC partition. * util/i386/pc/grub-setup.c: Include `#include <grub/partition.h>' and `include <grub/pc_partition.h>' instead of `<grub/machine/partition.h>'. (setup): Only access the PC specific partition information in case of a PC partition.
This commit is contained in:
parent
0ef4ced959
commit
3f1578fe4a
23 changed files with 1405 additions and 638 deletions
|
@ -34,6 +34,7 @@
|
|||
#include <grub/normal.h>
|
||||
#include <grub/util/getroot.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/partition.h>
|
||||
|
||||
#ifdef __NetBSD__
|
||||
/* NetBSD uses /boot for its boot block. */
|
||||
|
@ -154,6 +155,9 @@ main (int argc, char *argv[])
|
|||
|
||||
/* XXX: This is a bit unportable. */
|
||||
grub_util_biosdisk_init (args.dev_map);
|
||||
grub_pc_partition_map_init ();
|
||||
grub_amiga_partition_map_init ();
|
||||
grub_apple_partition_map_init ();
|
||||
|
||||
/* Initialize the default modules. */
|
||||
grub_iso9660_init ();
|
||||
|
@ -187,6 +191,9 @@ main (int argc, char *argv[])
|
|||
grub_cmp_fini ();
|
||||
grub_cat_fini ();
|
||||
grub_terminal_fini ();
|
||||
|
||||
grub_amiga_partition_map_fini ();
|
||||
grub_pc_partition_map_fini ();
|
||||
grub_apple_partition_map_fini ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,8 @@
|
|||
|
||||
#include <grub/machine/biosdisk.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/machine/partition.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/pc_partition.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/util/misc.h>
|
||||
|
@ -736,18 +737,34 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
|
|||
|
||||
int find_partition (const grub_partition_t partition)
|
||||
{
|
||||
if (partition->bsd_part < 0)
|
||||
grub_util_info ("DOS partition %d starts from %lu",
|
||||
partition->dos_part, partition->start);
|
||||
else
|
||||
grub_util_info ("BSD partition %d,%c starts from %lu",
|
||||
partition->dos_part, partition->bsd_part + 'a',
|
||||
partition->start);
|
||||
struct grub_pc_partition *pcdata = 0;
|
||||
|
||||
if (!strcmp (partition->partmap->name, "pc"))
|
||||
pcdata = partition->data;
|
||||
|
||||
if (pcdata)
|
||||
{
|
||||
if (pcdata->bsd_part < 0)
|
||||
grub_util_info ("DOS partition %d starts from %lu",
|
||||
pcdata->dos_part, partition->start);
|
||||
else
|
||||
grub_util_info ("BSD partition %d,%c starts from %lu",
|
||||
pcdata->dos_part, pcdata->bsd_part + 'a',
|
||||
partition->start);
|
||||
}
|
||||
|
||||
if (hdg.start == partition->start)
|
||||
{
|
||||
dos_part = partition->dos_part;
|
||||
bsd_part = partition->bsd_part;
|
||||
if (pcdata)
|
||||
{
|
||||
dos_part = pcdata->dos_part;
|
||||
bsd_part = pcdata->bsd_part;
|
||||
}
|
||||
else
|
||||
{
|
||||
dos_part = 0;
|
||||
bsd_part = 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,8 @@
|
|||
#include <grub/disk.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/fs.h>
|
||||
#include <grub/machine/partition.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/pc_partition.h>
|
||||
#include <grub/machine/util/biosdisk.h>
|
||||
#include <grub/machine/boot.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
|
@ -107,8 +108,10 @@ setup (const char *prefix, const char *dir,
|
|||
|
||||
int find_first_partition_start (const grub_partition_t p)
|
||||
{
|
||||
if (! grub_partition_is_empty (p->dos_type)
|
||||
&& ! grub_partition_is_bsd (p->dos_type)
|
||||
struct grub_pc_partition *pcdata = p->data;
|
||||
|
||||
if (! grub_pc_partition_is_empty (pcdata->dos_type)
|
||||
&& ! grub_pc_partition_is_bsd (pcdata->dos_type)
|
||||
&& first_start > p->start)
|
||||
first_start = p->start;
|
||||
|
||||
|
@ -252,10 +255,16 @@ setup (const char *prefix, const char *dir,
|
|||
/* Embed information about the installed location. */
|
||||
if (root_dev->disk->partition)
|
||||
{
|
||||
struct grub_pc_partition *pcdata =
|
||||
root_dev->disk->partition->data;
|
||||
|
||||
if (strcmp (root_dev->disk->partition->partmap->name, "pc"))
|
||||
grub_util_error ("No PC style partitions found");
|
||||
|
||||
*install_dos_part
|
||||
= grub_cpu_to_le32 (root_dev->disk->partition->dos_part);
|
||||
= grub_cpu_to_le32 (pcdata->dos_part);
|
||||
*install_bsd_part
|
||||
= grub_cpu_to_le32 (root_dev->disk->partition->bsd_part);
|
||||
= grub_cpu_to_le32 (pcdata->bsd_part);
|
||||
}
|
||||
else
|
||||
*install_dos_part = *install_bsd_part = grub_cpu_to_le32 (-1);
|
||||
|
@ -400,10 +409,16 @@ setup (const char *prefix, const char *dir,
|
|||
/* Embed information about the installed location. */
|
||||
if (root_dev->disk->partition)
|
||||
{
|
||||
struct grub_pc_partition *pcdata =
|
||||
root_dev->disk->partition->data;
|
||||
|
||||
if (strcmp (root_dev->disk->partition->partmap->name, "pc"))
|
||||
grub_util_error ("No PC style partitions found");
|
||||
|
||||
*install_dos_part
|
||||
= grub_cpu_to_le32 (root_dev->disk->partition->dos_part);
|
||||
= grub_cpu_to_le32 (pcdata->dos_part);
|
||||
*install_bsd_part
|
||||
= grub_cpu_to_le32 (root_dev->disk->partition->bsd_part);
|
||||
= grub_cpu_to_le32 (pcdata->bsd_part);
|
||||
}
|
||||
else
|
||||
*install_dos_part = *install_bsd_part = grub_cpu_to_le32 (-1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue