[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] util/i386/pc/grub-setup.c : now sets the config partition number
From: |
Vincent Pelletier |
Subject: |
[PATCH] util/i386/pc/grub-setup.c : now sets the config partition number |
Date: |
Thu, 23 Dec 2004 20:28:19 +0100 |
User-agent: |
Mozilla Thunderbird 0.9 (X11/20041124) |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello.
That patch makes grub-setup write the correct partition number to tell
where grub config is, and adds support for more than one partition map type.
Remaining bugs I saw and which I'm not sure how to fix:
- -under linux, uses the /boot default dir instead of /boot/grub (see line
49 and following)
- -parameters -b & -c should be described as relative path to parameter -d
(the seem to be absolute path for now, which is wrong)
2004-12-23 Vincent Pelletier <address@hidden>
* util/i386/pc/grub-setup.c (setup): Add local function
`find_partition_map'. Initialize and deinitialize the pc
partition map support. Check for `pc_partition_map' instead
of `pc'. Correctly access the partition data.
Vincent Pelletier
PS: thanks for the changelog Marco :)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFByxxTFEQoKRQyjtURAiLvAJ9d2WSLamCZN0WGTbT+w42aSjzlEQCfaAeM
HF5RmBzG13HcXSSaissVku0=
=Z6rb
-----END PGP SIGNATURE-----
Index: grub-setup.c
===================================================================
RCS file: /cvsroot/grub/grub2/util/i386/pc/grub-setup.c,v
retrieving revision 1.9
diff -u -p -r1.9 grub-setup.c
--- grub-setup.c 4 Dec 2004 18:45:46 -0000 1.9
+++ grub-setup.c 23 Dec 2004 14:45:03 -0000
@@ -106,15 +106,17 @@ setup (const char *prefix, const char *d
auto int find_first_partition_start (const grub_partition_t p);
- int find_first_partition_start (const grub_partition_t p)
+ auto int find_partition_map (const grub_partition_map_t partmap);
+
+ int find_partition_map (const grub_partition_map_t partmap)
{
- struct grub_pc_partition *pcdata = p->data;
+ return (partmap->iterate (dest_dev->disk, find_first_partition_start) ==
GRUB_ERR_NONE );
+ }
- 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;
-
+ int find_first_partition_start (const grub_partition_t p)
+ {
+ if ( p->len && first_start > p->start )
+ first_start = p->start;
return 0;
}
@@ -159,6 +161,7 @@ setup (const char *prefix, const char *d
current_segment += GRUB_DISK_SECTOR_SIZE >> 4;
}
+ grub_pc_partition_map_init ();
/* Read the boot image by the OS service. */
boot_path = grub_util_get_path (dir, boot_file);
boot_size = grub_util_get_image_size (boot_path);
@@ -232,7 +235,7 @@ setup (const char *prefix, const char *d
try to embed the core image into after the MBR. */
if (dest_dev->disk->has_partitions && ! dest_dev->disk->partition)
{
- grub_partition_iterate (dest_dev->disk, find_first_partition_start);
+ grub_partition_map_iterate ( find_partition_map );
/* If there is enough space... */
if ((unsigned long) core_sectors + 1 <= first_start)
@@ -255,16 +258,19 @@ setup (const char *prefix, const char *d
/* 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");
+ if (!strcmp (root_dev->disk->partition->partmap->name,
"pc_partition_map"))
+ {
- *install_dos_part
- = grub_cpu_to_le32 (pcdata->dos_part);
- *install_bsd_part
- = grub_cpu_to_le32 (pcdata->bsd_part);
+ 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
+ grub_util_error ("Partition map unknown"); /* known by grub but
not by grub-config */
}
else
*install_dos_part = *install_bsd_part = grub_cpu_to_le32 (-1);
@@ -449,6 +455,7 @@ setup (const char *prefix, const char *d
free (boot_img);
grub_device_close (dest_dev);
grub_device_close (root_dev);
+ grub_pc_partition_map_fini ();
}
static struct option options[] =
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] util/i386/pc/grub-setup.c : now sets the config partition number,
Vincent Pelletier <=