Skip to contentSkip to conversation

howto

DISCUSSION Michael Stumpf 2 participants 2 messages Jan 10, 2001 – Jan 11, 2001 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

Sorry for the slow response; been on vacation.

Quoted 1 line

Can I boot totally from flash without any other storage support?

I'm doing some work requiring precisely this--flash chips, preprogrammed, intended to boot linux with a read-only filesystem, preferrably compressed, from a well-known ROM address.

I originally hacked up mtdram.c to do what has already been done, quite elegantly infact..

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:

1) Encodes the binary filesystem image and compiles it directly into the kernel, bloating its final size

or 2) Allow you to point it to a "well known" memory address that has (this is 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.

Quoted 1 line

Is there any howto or high level docs to configure and compile?

Patch it in, enable it in config, refer to above notes. Let me know if you're still lost.

Regards,
Michael

=====
=====================================================================
Michael J. Stumpf
LinuxPPC enablement
IBM-Austin, TX 512.838.1524 [lab] 512.838.5335 [work]
http://www.pobox.com/~mstumpf

__________________________________________________
Do You Yahoo!?
Yahoo! Photos - Share your holiday photos online!
http://photos.yahoo.com/

To unsubscribe, send "unsubscribe mtd" to [email protected]

#1 lore raw
Quoted 5 lines · Michael Stumpf
Quoted 1 line

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.

Quoted 3 lines

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 [email protected]