[prev in list] [next in list] [prev in thread] [next in thread] 

List:       grub-devel
Subject:    Partitioned software RAID support (for testing grub-setup)
From:       Timothy Baldwin <tim.lists () majoroak ! f2s ! com>
Date:       2005-10-23 11:06:24
Message-ID: 200510231206.32374.T.E.Baldwin99 () members ! leeds ! ac ! uk
[Download RAW message or body]


Here is support for partitioned software RAID devices for util/i386/pc/biosdisk.c.
You can now try grub-setup/grub-install on a partitioned RAID array, then boot
the result in an emulator.

A RAID array could consist of a single loop device.

Also linux_find_partition does not allocate enough memory to add the partition
number onto the end of real_dev.


2005-10-23  Timothy Baldwin  <T.E.Baldwin99@members.leeds.ac.uk>

        * util/i386/pc/biosdisk.c (util/i386/pc/biosdisk.c):
	Allocate enough memory for REAL_DEV.  Support partitioned software RAID.
	(get_os_disk): Support partitioned software RAID.


diff -purN -x '*.mk' -x '*~' -x autom4te.cache -x configure -x '.#*' -x '*.orig' -x \
'*.rej' -x CVS grub2-submitted/util/i386/pc/biosdisk.c \
                grub2-arm/util/i386/pc/biosdisk.c
--- grub2-submitted/util/i386/pc/biosdisk.c	2005-10-22 21:18:37.000000000 +0100
+++ grub2-arm/util/i386/pc/biosdisk.c	2005-10-23 11:29:51.000000000 +0100
@@ -217,7 +217,8 @@ linux_find_partition (char *dev, unsigne
   int i;
   char *real_dev;
 
-  real_dev = xstrdup (dev);
+  real_dev = xmalloc (len + 10);
+  strcpy (real_dev, dev);
   
   if (have_devfs () && strcmp (real_dev + len - 5, "/disc") == 0)
     {
@@ -243,6 +244,14 @@ linux_find_partition (char *dev, unsigne
 
       format = "p%d";
     }
+  else if (strncmp (real_dev + 5, "md_d", 4) == 0)
+    {
+      p = real_dev + 9;
+      while (*p && isdigit (*p))
+	p++;
+
+      format = "p%d";
+    }
   else
     {
       free (real_dev);
@@ -657,6 +666,17 @@ get_os_disk (const char *os_dev)
 	  p[3] = '\0';
 	  return path;
 	}
+
+      /* If this is a partitioned software RAID array.  */
+      if (strncmp ("md_d", p, 4) == 0)
+	{
+	  /* /dev/md_d[0-9]p[0-9]* */
+	  p = strchr (p, 'p');
+	  if (p)
+	    *p = '\0';
+
+	  return path;
+	}
     }
 
   return path;


-- 
Member AFFS, WYLUG, SWP (UK), UAF, RESPECT, StWC
No to software patents!    Victory to the iraqi resistance!


[Attachment #3 (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic