[klibc] initramfs gunzip problems.
dododge at dododge.net
Fri Nov 14 13:01:55 PST 2003
On Fri, 14 Nov 2003, Martin Hicks wrote:
> On Fri, 2003-11-14 at 11:57, Bryan O'Sullivan wrote:
> > On Fri, 2003-11-14 at 07:57, Martin Hicks wrote:
> > > The same .cpio archive works if I don't gzip it.
> > How are you doing the build? If you're building the cpio archive into
> > the kernel using the usual kbuild mechanism, you shouldn't need to gzip
> > it, because kbuild will do this for you.
> I'm building the archive by hand and then specify it on the command line
> with initrd=
I think that's your problem. An initramfs is normally linked directly
into the kernel binary. It becomes part of bzImage and is not a
separate file. There's no special option like "initrd=" needed for the
kernel or bootloader.
To use an initramfs, you prepare your initramfs_data.cpio file, place
it into the "usr" directory of the kernel source tree, and then "make"
the kernel. At least that's how I've been doing it. If you want to
change the initramfs contents, I believe you can just drop a fresh
initramfs_data file into place and "make" again and it will quickly
update and relink the kernel image (worked for me; YMMV).
BTW: in a stock kernel initramfs is not fully enabled. It will unpack
your cpio file into memory and then clobber it by mounting the real
root filesystem on top of it. If you actually want userspace to start
in initramfs, you'll have to modify do_mounts.c to remove the call to
mount_root from prepare_namespace.
More information about the klibc