Subject: RE: rom or flashrom root filesystem

From: Jamey Hicks <[email-masked]>
Date: Tue, 23 May 2000 10:21:53 -0400

Ramdisks cannot be mounted in place because the ramdisk implementation keeps
its contents in the file buffer cache.  The initrd initializes a ramdisk by
copying (and possibly uncompressing) a filesystem image from a memory region
into the ramdisks buffers.

However, to me it seems pointless to copy an initrd (compressed or not) from
flash to DRAM so that we can then import it into the file buffer cache when
the ramdisk is initialized.  The kernel complains or fails in several places
if you attempt to do this -- it has hardwared assumptions that the initrd is
in DRAM.  I think I ran into three places I had to patch to make this work.
I never submitted these patches because I didn't think they were clean
enough.  

The current code tests that the initrd is in DRAM.  I could remove this
check, and then it would work for initrd in Flash, but it would fail if you
accidentally passed in a bogus address.  Maybe that's OK, but it's less
checking than in the current kernel.  It might be better to add a data
structure describing the physical flash/rom regions corresponding to the one
describing physical DRAM regions.  (Down the slippery slope to a structure
passed from the firmware describing what hardware is on the system.  Wait,
that might be a good idea.)

-Jamey

> -----Original Message-----
> From: Nicolas Pitre [mailto:[email-masked]]
> Sent: Tuesday, May 23, 2000 10:06 AM
> To: Hugo Fiennes
> Cc: [email-masked]
> Subject: Re: rom or flashrom root filesystem
> 
> 
> 
> 
> On Tue, 23 May 2000, Hugo Fiennes wrote:
> 
> > The empeg uses a 320k rom/flash disk (read only) for a 
> halfway house boot
> > used when we upgrade the hard disk partitions/contents.
> > 
> > We do this just by setting the initrd start & end to point to the
> > appropriate place in flash (in our case I think it's 
> 0xd00b0000 - 0xd0000000
> > is the base of flash in our memory map.
> > 
> > One thing you *do* have to patch is the code in 
> arch/arm/setup.c which
> > checks to see if the initrd exists within physical RAM - 
> obviously, it won't
> > in this case. Also, you can't use a compressed image as it's mounted
> > in-place without any RAM usage.
> 
> Are you sure of that?  AFAIK initrd's are never mounted in place,
> compressed or not.  You need a special block device driver to mount
> uncompressed filesystems directly from flash.
> 
> 
> Nicolas
> 
> 
> unsubscribe: body of `unsubscribe linux-arm' to 
> [email-masked]
> ++        Please use [email-masked] 
> for           ++
> ++                        kernel-related discussions.         
>              ++
> 

unsubscribe: body of `unsubscribe linux-arm' to [email-masked]
++        Please use [email-masked] for           ++
++                        kernel-related discussions.                      ++

---

From: "Hugo Fiennes" <[email-masked]>
Date: Tue, 23 May 2000 15:26:48 +0100

> into the ramdisks buffers.

Ah. I guess it's slightly more memory efficient having it take the initrd
from flash directly than allocating some space, copying it to RAM, then
having it loaded into more memory in the buffer cache? Otherwise you'll have
2 copies, though one could quite possibly be thrown out after the mount.
This might have been what I was aiming for originally, it was a couple of
years ago now...

Hugo

---

From: Nicolas Pitre <[email-masked]>
Date: Tue, 23 May 2000 10:37:32 -0400 (EDT)

> This might have been what I was aiming for originally, it was a couple of

The initrd image is actually freed once it has been copied into the buffer
cache.  Of course this memory freeing must not occur if initrd data
initially exist in Flash.

Nicolas