On Thu, Feb 01, 2001 at 10:50:16PM -0500, Tyson D Sawyer wrote:
> Eric Seppanen wrote:
> >
> > On Thu, Feb 01, 2001 at 06:21:46PM -0500, Tyson D Sawyer wrote:
> > > Has anyone done any work loading an initrd image from linuxbios or
> > > anything that might be related and useful?
> > >
> > I have a PLD paging a 4MB flash device, and I actually have both: I use
> > initrd to load the root filesystem, and a block driver to reprogram the
> > system. I prefer initrd for booting because if you don't mind your root
> > fs being in ram you can compress the whole thing- I get 8MB worth of data
> > in my root fs, stored in only 4MB.
> >
> > It's really easy. If you can load your filesystem image (or compressed
> > filesystem image) into ram, it's trivial to get the kernel to notice it
> > and use it. You just have to drop a pointer to the start of the image,
> > and the size, into the kernel parameter table (same table that holds the
> > kernel command line).
> >
> Ron says that he likes the block device driver better but I have done
> some digging through the sources and the initrd option looks easier and
> I really need to take the fastest option.
>
> Eric, do you have any suggestions on where in ram to load the compressed
> ramdisk image? It looks like syslinux loads it just below top of ram,
> or 0x????? (didn't write it down), which ever is lower. Is that the
> best policy?
Um, I'm not sure exactly. I loaded it at the very top of ram. I would
hope that the kernel is smart enough to reclaim the memory for
general-purpose use later, but I really have no idea.
BTW, you need to find INITRD_START and INITRD_SIZE from params.c and
that's where you put the start address and size of your initrd image
(which is just a filesystem image, optionally gzipped). I also add a
parameter "root=/dev/ram", but I don't remember anymore if that's strictly
required.
If you want a sample initrd root image, you can try using the sample
root-image builder package I assembled a few months ago:
http://www.reric.net/linux/sampleroot/
I'm haven't assembled the sources to the included binaries, but they're
all just copied from a redhat 6.2 system so please don't sue me for GPL
violations :) Maybe I'll get around to it if there's actually some
interest (to my knowledge nobody's actually _used_ this stuff before,
other than me).
> Since I also like the block device driver option and think it would be a
> nice addition to the linuxbios tool set (though part of the kernel), is
> that something that could be made available?
It's pretty crappy- this is the first block driver I ever wrote. It has
made-up ioctls for locking/unlocking/erasing, but read/write are standard
block operations. I've never actually mounted a filesystem using
it (because I only use initrd) so for all I know it may crash and burn if
you try. Anyway, it's at:
http://www.reric.net/linux/linuxbios/
the file "flash-old.c" is known to work, but spins the cpu while waiting
(oops). The new "flash.c" sleeps correctly, but hasn't been exhaustively
tested.
Eric