linux-mips
[Top] [All Lists]

Re: Ramdisk image on flash.

To: krishnakumar@naturesoft.net
Subject: Re: Ramdisk image on flash.
From: Atsushi Nemoto <anemo@mba.sphere.ne.jp>
Date: Fri, 21 Feb 2003 11:24:56 +0900 (JST)
Cc: linux-mips@linux-mips.org, ralf@linux-mips.org
In-reply-to: <200302201135.09154.krishnakumar@naturesoft.net>
Organization: TOSHIBA Personal Computer System Corporation
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <200302201135.09154.krishnakumar@naturesoft.net>
Sender: linux-mips-bounce@linux-mips.org
>>>>> On Thu, 20 Feb 2003 11:35:09 +0530, "Krishnakumar. R" 
>>>>> <krishnakumar@naturesoft.net> said:
krishnakumar> Is there any way that I can keep a ramdisk image
krishnakumar> (containing the root filesystem) in a flash device and
krishnakumar> boot to it.

If your flash device can be accessed as MTD block device, you can use
"root=/dev/mtdblockN load_ramdisk=1" (and also "ramdisk_start=N") boot
option to load your (compressed) ramdisk image from the flash device.

This method needs following patch (for 2.4.20).  Also, this method
does not need initrd support or bootloader support.

--- linux-2.4.20/init/do_mounts.c       Wed Dec 25 15:30:02 2002
+++ linux/init/do_mounts.c      Wed Dec 25 16:56:40 2002
@@ -883,6 +883,18 @@
                }
        } else if (is_floppy && rd_doload && rd_load_disk(0))
                ROOT_DEV = MKDEV(RAMDISK_MAJOR, 0);
+#if defined(CONFIG_MTD_BLOCK) || defined(CONFIG_MTD_BLOCK_RO)
+#ifndef MTD_BLOCK_MAJOR
+#define MTD_BLOCK_MAJOR 31
+#endif
+       else if (MAJOR(ROOT_DEV) == MTD_BLOCK_MAJOR && rd_doload) {
+#ifdef CONFIG_BLK_DEV_RAM
+               create_dev("/dev/ram", MKDEV(RAMDISK_MAJOR, 0), NULL);
+#endif
+               if (rd_load_image("/dev/root"))
+                       ROOT_DEV = MKDEV(RAMDISK_MAJOR, 0);
+       }
+#endif
        mount_root();
 out:
        sys_umount("/dev", 0);
---
Atsushi Nemoto

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