Hi , One of the things I am working on requires me to have a kernel and an initrd (as root filesystem , based on busybox) in one single image. I am trying to use initramfs for this, but there are a few things that I just can't figure out. As a test, I made a cpio archive of my own for the kernel source (plain 2.6.0-test5). Everything gets unpacked just fine during boot. Somehow I was expecting that there would be a way to have it execute its own /sbin/init and stay in ramfs - but I do not know how to get this to work. The best I could come up with was modifying /init/do_mounts.c to skip over all the initrd loading stuff - then it worked. My question is, is there a way to use an initramfs archive as a rootfilesystem, without patching the kernel source? (Further more, depending on some conditions the system may or may not have to pivot_root to an nfs or ide-disk based filesystem.) Thanks, Daniel
On Mon, 2003-10-13 at 22:20, Daniel Toussaint wrote:> The best I could come up with was modifying /init/do_mounts.c to skip > over all the initrd loading stuff - then it worked. > My question is, is there a way to use an initramfs archive as a > rootfilesystem, without patching the kernel source?No, there isn't. Someone submitted such a patch to Andrew Morton a few months ago, but I don't see any trace of it in the mainline kernel as of 2.6.0-test7. Maybe take a look at a recent -mm patch? <b
> One of the things I am working on requires me to have a kernel and an > initrd (as root filesystem , based on busybox) in one single image.I'm doing something along these lines as well (end goal in my case is a livecd to run a game on a diskless system). At the moment I'm PXE-booting 2.6.0-test7 with a uClibc/busybox initramfs as the root filesystem.> As a test, I made a cpio archive of my own for the kernel source (plain > 2.6.0-test5). Everything gets unpacked just fine during boot. Somehow I > was expecting that there would be a way to have it execute its own > /sbin/init and stay in ramfs - but I do not know how to get this to > work. > The best I could come up with was modifying /init/do_mounts.c to skip > over all the initrd loading stuff - then it worked.Same here. The only way I got this to work was to modify do_mounts.c. I inserted a one-liner to skip the mount_root call if I boot with "root=0:0". Someone else has posted a similar patch to the mailing list archives, and I think it's in the -mm series kernel.> My question is, is there a way to use an initramfs archive as a > rootfilesystem, without patching the kernel source?Perhaps I'm missing something obvious, but I don't see any way to do this with a stock kernel.
On Tue, 2003-10-21 at 10:14, Rogelio Serrano wrote: Please use a mailer that wraps your lines properly.> Well i read through the code and see that initramfs is being run by default. I configured out initrd and still im seeing nothing but of course populate_root() is always run. I will try customising my own initramfs archive and see what happens.You'll need to patch the kernel so that it doesn't try to mount a root device on top of initramfs, or you'll never get to execute anything inside of the initramfs filesystem.> Using initrd even with -mm patches just dont work with cramfs anymore.I've had no problems with ext2-based initrd. If you're having problems with cramfs, you should report them. I don't recall seeing anything on lkml. <b
--- Bryan O'Sullivan <bos@serpentine.com> wrote: On Tue, 2003-10-21 at 10:14, Rogelio Serrano wrote: Please use a mailer that wraps your lines properly.> Well i read through the code and see that initramfs is being run by default. I configured out initrd and still im seeing nothing but of course populate_root() is always run. I will try customising my own initramfs archive and see what happens.You'll need to patch the kernel so that it doesn't try to mount a root device on top of initramfs, or you'll never get to execute anything inside of the initramfs filesystem. i used the test8-mm1 patch. boot dies with a "no cpio header message". i did: find . | cpio -H crc -ov | gzip -9 > initramfs_data.cpio.gz dir is in my uclibc/busybox root dir i used to generate my cramfs initrd images from. im using gcc 3.3.1 and binutils-2.14> Using initrd even with -mm patches just dont work with cramfs anymore.I've had no problems with ext2-based initrd. If you're having problems with cramfs, you should report them. I don't recall seeing anything on lkml. <b will do after i test with ext2.
>--- Bryan O'Sullivan <bos@serpentine.com> wrote: >On Tue, 2003-10-21 at 10:14, Rogelio Serrano wrote:> > >Please use a mailer that wraps your lines properly.oops! sorry about that. this webmailer used to handle that properly.