From: Vincent Pelletier <subdino2004@yahoo.fr>
To: Grub-devel@gnu.org
Subject: [PATCH] util/i386/pc/grub-setup.c : now sets the config partition number
Date: Thu, 23 Dec 2004 20:28:19 +0100 [thread overview]
Message-ID: <41CB1C53.4000501@yahoo.fr> (raw)
[-- Attachment #1: Type: text/plain, Size: 1077 bytes --]
-----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 <subdino2004@yahoo.fr>
* 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-----
[-- Attachment #2: grub-setup.diff --]
[-- Type: text/plain, Size: 3193 bytes --]
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[] =
next reply other threads:[~2004-12-23 19:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-23 19:28 Vincent Pelletier [this message]
2005-01-20 14:37 ` [PATCH] util/i386/pc/grub-setup.c : now sets the config partition number Marco Gerards
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=41CB1C53.4000501@yahoo.fr \
--to=subdino2004@yahoo.fr \
--cc=Grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.