Re: Ramdisk image on flash.

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

 



>>>>> 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


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux