xfs
[Top] [All Lists]

[Patch] cramfs initrd will not boot

To: linux-xfs@xxxxxxxxxxx
Subject: [Patch] cramfs initrd will not boot
From: karlheg@xxxxxxxxxxxxxx (Karl M. Hegbloom)
Date: 19 Dec 2001 12:52:10 -0800
Sender: owner-linux-xfs@xxxxxxxxxxx
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Artificial Intelligence)
 
 This diff is between Debian kernel-source-2.4.16 and a checkout of
 SGI 2.4.16 that was last freshened yesterday.  (2001-12-18)

 I have not tested yet, but I believe that it will fix a problem I am
 experiencing, where an SGI kernel will not load a cramfs from an
 initrd.  This patch may be part of the Debian kernel and not from
 Linus' kernel.  I'm not certain...  There may be other patches in the
 Debian kernel that you might like to have; could be worth having a
 look.

 I need this (and perhaps others will as well) since I need to use
 your kernel for the XFS support.  Right now, it fails to mount the
 cramfs initrd, saying "wrong magic".  I hope that this patch fixes
 the problem.


ROMEO:          Courage, man; the hurt cannot be much.
MERCUTIO:       No, 'tis not so deep as a well, nor so wide
                        as a church-door; but 'tis enough, 'twill serve.
karlheg@juniper:~
% diff -u /usr/src/SGI-linux-2.4/linux/drivers/block/rd.c 
/usr/src/kernel-source-2.4.16/drivers/block/rd.c
--- /usr/src/SGI-linux-2.4/linux/drivers/block/rd.c     Sun Nov 11 22:37:22 2001
+++ /usr/src/kernel-source-2.4.16/drivers/block/rd.c    Fri Nov 23 18:34:21 2001
@@ -47,6 +47,7 @@
 #include <linux/minix_fs.h>
 #include <linux/ext2_fs.h>
 #include <linux/romfs_fs.h>
+#include <linux/cramfs_fs.h>
 #include <linux/fs.h>
 #include <linux/kernel.h>
 #include <linux/hdreg.h>
@@ -562,6 +563,7 @@
  *     minix
  *     ext2
  *     romfs
+ *     cramfs
  *     gzip
  */
 static int __init 
@@ -571,6 +573,7 @@
        struct minix_super_block *minixsb;
        struct ext2_super_block *ext2sb;
        struct romfs_super_block *romfsb;
+       struct cramfs_super *cramfsb;
        int nblocks = -1;
        unsigned char *buf;
 
@@ -581,6 +584,7 @@
        minixsb = (struct minix_super_block *) buf;
        ext2sb = (struct ext2_super_block *) buf;
        romfsb = (struct romfs_super_block *) buf;
+       cramfsb = (struct cramfs_super *) buf;
        memset(buf, 0xe5, size);
 
        /*
@@ -610,6 +614,14 @@
                       "RAMDISK: romfs filesystem found at block %d\n",
                       start_block);
                nblocks = (ntohl(romfsb->size)+BLOCK_SIZE-1)>>BLOCK_SIZE_BITS;
+               goto done;
+       }
+
+       if (cramfsb->magic == CRAMFS_MAGIC) {
+               printk(KERN_NOTICE
+                      "RAMDISK: cramfs filesystem found at block %d\n",
+                      start_block);
+               nblocks = (cramfsb->size + BLOCK_SIZE - 1) >> BLOCK_SIZE_BITS;
                goto done;
        }
 

-- 
mailto: (Karl M. Hegbloom) karlheg@xxxxxxxxxxxxxx
http://www.microsharp.com
phone://USA/WA/360-260-2066
jabber: karlheg@xxxxxxxxxx


<Prev in Thread] Current Thread [Next in Thread>