grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] MINIX subpartition


From: Fam Zheng
Subject: [PATCH] MINIX subpartition
Date: Wed, 21 Jul 2010 10:52:03 +0800

Hi,

This patch is for handling the field of start in subpartition's partition table of MINIX.

Why and how:

With the latest trunk source, the subpartition is found by GRUB, partition names like (hd0,msdos1,msdos1) can be recognized, but the problem is the 'start' of partition: in the partition table for MINIX subpartitions (the table found at the end of the first sector of (hd0,msdos1) in this example), the field "start" is treated as an relative value, where for MINIX it is actually an absolute one. 

To solve this inconsistency, I patched to convert the value stored on harddisk to relative simply by a subtraction, this happens only when a MINIX type (type field == 0x81) subpartition within a MINIX type primary partition is encountered, with the msdos partition map.

To simplify the comparison of container's partition type, another field "type" is added in struct grub_partition.


=== modified file 'include/grub/partition.h'
--- include/grub/partition.h 2010-07-14 09:26:17 +0000
+++ include/grub/partition.h 2010-07-21 02:42:37 +0000
@@ -60,6 +60,9 @@ struct grub_partition
   /* The index of this partition in the partition table.  */
   int index;
 
+  /* The type number of this partition in msdos partition table */
+  grub_uint32_t type;
+  
   /* Parent partition (physically contains this partition).  */
   struct grub_partition *parent;
 

=== modified file 'partmap/msdos.c'
--- partmap/msdos.c 2010-03-26 14:44:13 +0000
+++ partmap/msdos.c 2010-07-21 02:40:43 +0000
@@ -82,8 +82,14 @@ pc_partition_map_iterate (grub_disk_t di
   e = mbr.entries + p.index;
 
   p.start = p.offset + grub_le_to_cpu32 (e->start);
+  if(disk->partition 
+    && disk->partition->partmap
+    && !grub_strcmp(disk->partition->partmap->name,"msdos")
+    && disk->partition->type == GRUB_PC_PARTITION_TYPE_LINUX_MINIX
+    && e->type == GRUB_PC_PARTITION_TYPE_LINUX_MINIX)
+      p.start -= disk->partition->start;
   p.len = grub_le_to_cpu32 (e->length);
-
+  p.type = e->type;
   grub_dprintf ("partition",
  "partition %d: flag 0x%x, type 0x%x, start 0x%llx, len 0x%llx\n",
  p.index, e->flag, e->type,


--
Best Regards!
Fam Zheng

reply via email to

[Prev in Thread] Current Thread [Next in Thread]