grub-devel
[Top][All Lists]
Advanced

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

Partitioned software RAID support (for testing grub-setup)


From: Timothy Baldwin
Subject: Partitioned software RAID support (for testing grub-setup)
Date: Sun, 23 Oct 2005 12:06:24 +0100
User-agent: KMail/1.8.2

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  <address@hidden>

        * 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: pgpNYEcmGAxPW.pgp
Description: PGP signature


reply via email to

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