Martin Michlmayr wrote:> 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.)
Could it be added to klibc? Absolutely, it's just a matter of someone
writing one. Using a modified version of the one in the kernel sounds
like a good idea.
-hpa