From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.33) id 1ChYol-0007GN-Jb for mharc-grub-devel@gnu.org; Thu, 23 Dec 2004 14:40:11 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1ChYoj-0007Da-32 for grub-devel@gnu.org; Thu, 23 Dec 2004 14:40:09 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1ChYod-0007AN-86 for Grub-devel@gnu.org; Thu, 23 Dec 2004 14:40:04 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1ChYoc-0007A0-VV for Grub-devel@gnu.org; Thu, 23 Dec 2004 14:40:03 -0500 Received: from [217.12.11.33] (helo=smtp002.mail.ukl.yahoo.com) by monty-python.gnu.org with smtp (Exim 4.34) id 1ChYdR-0004Wh-UL for Grub-devel@gnu.org; Thu, 23 Dec 2004 14:28:30 -0500 Received: from unknown (HELO ?192.168.0.2?) (subdino2004@83.194.35.238 with plain) by smtp002.mail.ukl.yahoo.com with SMTP; 23 Dec 2004 19:28:19 -0000 Message-ID: <41CB1C53.4000501@yahoo.fr> Date: Thu, 23 Dec 2004 20:28:19 +0100 From: Vincent Pelletier User-Agent: Mozilla Thunderbird 0.9 (X11/20041124) X-Accept-Language: fr, en MIME-Version: 1.0 To: Grub-devel@gnu.org X-Enigmail-Version: 0.89.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/mixed; boundary="------------060002090302070103030505" Cc: Subject: [PATCH] util/i386/pc/grub-setup.c : now sets the config partition number X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Dec 2004 19:40:10 -0000 This is a multi-part message in MIME format. --------------060002090302070103030505 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit -----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 * 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----- --------------060002090302070103030505 Content-Type: text/plain; name="grub-setup.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="grub-setup.diff" 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[] = --------------060002090302070103030505--