Dave Cinege wrote:
> It happened anyway.... : P DOOOOHHHH! <slamming head on desk>
> NO MAS! NO MAS!
;-)) Well, you know the alternative: continue with the "pull everything
into the kernel" approach and special-case ramfs handling in mount_root.
> > - you load a small initrd, and boot as usual, with or without /linuxrc
> > - your initrd environment creates and populates the ramfs (*)
>
> That's not going to work very well in an embedded system with only 8MB of ram
> and a (possibliy) unmountable boot device, OK?
My experience with the Psion S5 suggests that there's actually quite
a lot you can do with 8 MB ...
Maybe you're concerned that you won't have space for initrd+initrd.gz+
ramfs+ramfs.tar.gz. Fortunately, you can free things quite
aggressively, if you wish. E.g. you could free pages from /dev/initrd
as soon as they're read. (*)
And the initrd that populates ramfs doesn't need to contain a regular
execution environment with libc and such. The only significant
redundancy/overhead here is the empty FS structure plus the gunzip
code.
(*) /dev/initrd is mainly designed for debugging purposes (and most
people probably don't even know it exists ;-), but it may still
be a good idea to keep it compatible with existing behaviour,
e.g. by enabling that free-after-reading mode only if the kernel
is actually reading from initrd. As a side-effect, such a change
also improves memory usage of initrd in all other cases.
Assuming you've added that free-after-reading extension, let's have a
quick look at the memory usage:
before boot (on disk/flash) kernel.gz+initrd.gz+ramfs.tar.gz
kernel uncompresses itself kernel+kernel.gz+initrd.gz+ramfs.tar.gz
kernel starts kernel+data+initrd.gz+ramfs.tar.gz
kernel builds initrd, approx. kernel+data+initrd*X+initrd.gz*(1-X)+
ramfs.tar.gz
initrd runs kernel+data+initrd+pgm+ramfs.tar.gz
populating ramfs, approx. kernel+data+initrd+pgm+ramfs*X+
ramfs.tar.gz*(1-X)
pivot_root to ramfs kernel+data+initrd+pgm+ramfs
if we clean up now kernel+data+pgm+ramfs
exec init kernel+data+init...+ramfs
kernel(.gz) = regular kernel, without initrd-arch extensions
initrd(.gz) = the tiny environment that populates ramfs
ramfs(.tar.gz) = the actual ramfs content. ramfs.tar.gz is appended to
initrd.gz
pgm = program that populates ramfs
X = fraction of work done, 0 <= X <= 1
init... = init and everything it launches
- Werner
-- _________________________________________________________________________ / Werner Almesberger, ICA, EPFL, CH werner.almesberger@ica.epfl.ch / /_IN_N_032__Tel_+41_21_693_6621__Fax_+41_21_693_6610_____________________/- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Wed May 31 2000 - 21:00:15 EST