[klibc] Add cpio implementation to klibc

Martin Michlmayr tbm at cyrius.com
Sat Jan 14 13:06:04 PST 2006

I was wondering if it would be possible to add a cpio (extraction)
implementation to klibc.  Maybe this can be done in a way that the code
could bet shared between klibc and init/initramfs.c in the kernel.

Background of what I'm trying to do: I want to load an initramfs
from flash on a number of different devices.  The devices are quite
similar but the partition in flash where the initramfs located is
different.  Therefore, I cannot hardcode the flash partition in the
cmdline of the kernel.  So I was thinking of doing this: embed a small
initramfs in the kernel that will look for the location of the main
initramfs in flash (MTD), then unpack this and pivot/chroot into it.

For this, I'd need a small cpio extraction implementation though.
Do you think that could be added to klibc, or do you have a better
idea how to solve my problem?

(I tried dd'ing an ext2 image to /dev/ram1 and then mounting this but
for some reasons I got errors; it looked like I overwrote some
important stuff that way and things started to break.)
Martin Michlmayr

More information about the klibc mailing list