bug-grub
[Top][All Lists]
Advanced

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

Caldera patches


From: Sergey Babkin
Subject: Caldera patches
Date: Wed, 13 Mar 2002 16:59:07 -0500

Hi,

I've recently ported the Caldera's patches from grub-0.5.96.1
to grub-0.91 and I wonder if the GRUB project would be interested
in integrating them back into the main tree. The patches are:

grub-0.91-splash.patch - the "splashscreen" command for a graphical
  splashscreen
grub-0.91-initrd16M.patch - I'm not sure what exactly it does but it looks
  like support for a larger RAM disk image
grub-0.91-extended.patch - support for more than one extended partition
grub-0.91-stage1.9.patch - implementation of a deeply pruned stage2
  loader (called stage1.9) to load the Linux kernel from an MS-DOS floppy.
  It's used for Caldera's boot floppy. I guess the other Linux distributions
  may be interested in it as well but probably nobody else. So I don't
  know if the GRUB project in general would have any interest in it.
grub-0.91-nomeminfo.patch - by default does not pass the "mem=" option
  to the Linux kernel since Linux 2.4 is able to determine the memory
  size by itself. Again, I'm not sure if it's of general interest.
grub-0.91-device.patch - support for some kind of RAID devices on Linux

I've attached the smaller patches, please let me know if you are interested
in the bigger ones. Thanks for GRUB!

-SB
diff -uNr grub-0.91-5nomeminfo/grub/main.c grub-0.91-6device/grub/main.c
--- grub-0.91-5nomeminfo/grub/main.c    Tue Mar 12 17:25:00 2002
+++ grub-0.91-6device/grub/main.c       Tue Mar 12 17:37:56 2002
@@ -43,7 +43,7 @@
 int verbose = 0;
 int read_only = 0;
 int floppy_disks = 1;
-char *device_map_file = 0;
+char *device_map_file = "/boot/grub/device.map";
 static int default_boot_drive;
 static int default_install_partition;
 static char *default_config_file;
diff -uNr grub-0.91-5nomeminfo/lib/device.c grub-0.91-6device/lib/device.c
--- grub-0.91-5nomeminfo/lib/device.c   Tue Mar 12 17:25:00 2002
+++ grub-0.91-6device/lib/device.c      Tue Mar 12 17:37:56 2002
@@ -646,7 +646,7 @@
                    int sector, int size, const char *buf)
 {
   char dev[PATH_MAX];  /* XXX */
-  int fd;
+  int fd, len, pnum;
   
   if ((partition & 0x00FF00) != 0x00FF00)
     {
@@ -664,7 +664,16 @@
       if (strcmp (dev + strlen(dev) - 5, "/disc") == 0)
        strcpy (dev + strlen(dev) - 5, "/part");
     }
-  sprintf (dev + strlen(dev), "%d", ((partition >> 16) & 0xFF) + 1);
+
+  len = strlen(dev);
+  pnum = ((partition >> 16) & 0xFF);
+  if (isdigit(dev[len-1]))
+    {
+      /* It is obviously some RAID disk: "/dev/<dsk>/c0d0" . "p1" */
+      sprintf (dev + len, "p%d",  pnum + 1);
+    }
+  else
+    sprintf (dev + len, "%d",  pnum + 1);
   
   /* Open the partition.  */
   fd = open (dev, O_RDWR);
diff -uNr grub-0.91-2initrd16M/stage2/disk_io.c 
grub-0.91-3extended/stage2/disk_io.c
--- grub-0.91-2initrd16M/stage2/disk_io.c       Mon Mar 11 17:42:08 2002
+++ grub-0.91-3extended/stage2/disk_io.c        Mon Mar 11 17:51:16 2002
@@ -632,10 +632,18 @@
       if (*entry == PC_SLICE_MAX)
        {
          int i;
+         int iStart = 0;
+         static int nextPrimary = 0;
 
+loop_extended:
          /* Search the first extended partition in current table.  */
-         for (i = 0; i < PC_SLICE_MAX; i++)
+         for (i = iStart; i < PC_SLICE_MAX; i++)
            {
+             /* Remember index of next slice, if current table comes
+              * from MBR.  This allows looping over more than one
+              * extended partition... (supported e.g by Linux!) */
+             if ( *offset == 0 )
+               nextPrimary = i + 1;
              if (IS_PC_SLICE_TYPE_EXTENDED (PC_SLICE_TYPE (buf, i)))
                {
                  /* Found. Set the new offset and the entry number,
@@ -647,6 +655,18 @@
                  return next_pc_slice ();
                }
            }
+         if ( *offset != 0 && nextPrimary < PC_SLICE_MAX ) {
+           /* The end of an extended partition chain has been
+            * hit (*offset != 0), yet not all entries of the MBR
+            * have been visited (nextPrimary < PC_SLICE_MAX).
+            * Therefore return top-level (*offset == 0) in
+            * order to continue looking for extended partitions... */
+           iStart = nextPrimary;
+           *ext_offset = *offset = 0;
+           if (! rawread (drive, *offset, 0, SECTOR_SIZE, buf))
+             return 0;
+           goto loop_extended;
+         }
 
          errnum = ERR_NO_PART;
          return 0;
diff -uNr grub-0.91-1splash/stage2/builtins.c 
grub-0.91-2initrd16M/stage2/builtins.c
--- grub-0.91-1splash/stage2/builtins.c Mon Mar 11 17:02:47 2002
+++ grub-0.91-2initrd16M/stage2/builtins.c      Mon Mar 11 17:42:08 2002
@@ -1637,20 +1637,26 @@
 static int
 initrd_func (char *arg, int flags)
 {
+  int retval = 0;
+#ifndef NO_DECOMPRESSION
+  no_decompression = 1;
+#endif
   switch (kernel_type)
     {
     case KERNEL_TYPE_LINUX:
     case KERNEL_TYPE_BIG_LINUX:
       if (! load_initrd (arg))
-       return 1;
+       retval = 1;
       break;
 
     default:
       errnum = ERR_NEED_LX_KERNEL;
-      return 1;
+      retval = 1;
     }
-
-  return 0;
+#ifndef NO_DECOMPRESSION
+  no_decompression = 0;
+#endif
+  return retval;
 }
 
 static struct builtin builtin_initrd =
diff -uNr grub-0.91-1splash/stage2/shared.h grub-0.91-2initrd16M/stage2/shared.h
--- grub-0.91-1splash/stage2/shared.h   Mon Mar 11 17:02:47 2002
+++ grub-0.91-2initrd16M/stage2/shared.h        Mon Mar 11 17:42:08 2002
@@ -137,7 +137,7 @@
 #define LINUX_MAGIC_SIGNATURE          0x53726448      /* "HdrS" */
 #define LINUX_DEFAULT_SETUP_SECTS      4
 #define LINUX_FLAG_CAN_USE_HEAP                0x80
-#define LINUX_INITRD_MAX_ADDRESS       0x38000000
+#define LINUX_INITRD_MAX_ADDRESS       0x00F00000
 #define LINUX_MAX_SETUP_SECTS          63
 #define LINUX_BOOT_LOADER_TYPE         0x71
 #define LINUX_HEAP_END_OFFSET          (0x7F00 - 0x200)
diff -uNr grub-0.91-4stage19/stage2/boot.c grub-0.91-5nomeminfo/stage2/boot.c
--- grub-0.91-4stage19/stage2/boot.c    Tue Mar 12 17:02:09 2002
+++ grub-0.91-5nomeminfo/stage2/boot.c  Tue Mar 12 17:25:00 2002
@@ -338,7 +338,7 @@
 
            while (((int) dest) < CL_MY_END_ADDR && *src)
              *(dest++) = *(src++);
-           
+#if 0  /* 2.4 kernels are good at figuring mem maps themselves */
            /* Add a mem option automatically only if the user doesn't
               specify it explicitly.  */
            if (! grub_strstr (arg, "mem=")
@@ -353,7 +353,7 @@
                dest = convert_to_ascii (dest, 'u', (extended_memory + 0x400));
                *(dest++) = 'K';
              }
-
+#endif
            *dest = 0;
          }
 

reply via email to

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