howto

Bjorn Wesen bjorn.wesen at axis.com
Thu Jan 11 13:58:03 EST 2001


On Wed, 10 Jan 2001, Michael Stumpf wrote:
> > Can I boot totally from flash without any other storage support?
> 
> There is a patch out there somewhere (search this list, if you can't find it,
> let me know and I'll get it to you.) that adds a block device to the kernel
> called "/dev/rom".. it has two modes of operation:

That would be the krom device, I think it was done by the uClinux
guys. It's not necessary for booting from cramfs though, it was made for
hackish support of romfs/mmap's directly to flash without going through
the buffer layer.

> unclear) 4 bytes containing the filesystem size (in bytes), 4 bytes of "00",
> and then the filesystem image, whatever that may be.  I use cramfs with great
> success on a very memory-constrained target.

To do that I just replace cramfs_read with this (romfs_start is defined by
head.S during boot to the place where the cramfs lives):

static inline void *cramfs_read(struct super_block *sb, unsigned int
offset, unsigned int len)
{
	return romfs_start + offset;
}

Then to be able to boot from it, add this to fs/super.c:

#ifdef CONFIG_ROOT_CRAMFS_AS_IMAGE
       void *data;
       fs_type = get_fs_type("cramfs");
       ROOT_DEV = get_unnamed_dev();
       sb = read_super(ROOT_DEV, NULL, fs_type, root_mountflags, data, 1);
       goto mount_it;
#endif

in mount_root just above the CONFIG_NFS_ROOT check.

-BW



To unsubscribe, send "unsubscribe mtd" to majordomo at infradead.org



More information about the linux-mtd mailing list