2005-05-25 17:44:27

by Wakko Warner

[permalink] [raw]
Subject: initramfs

I'm having problems with this. I apparently have a cpio archive that the
kernel likes. I am starting via grub with basically:
kernel /mykernel
initrd /mycpiofile

At first, I got "can't mount root". A little reading in main.c has it
looking for /init (shouldn't this be /bin/init instead?)

I moved my ./bin/init to . in my init filesystem tree and recreated the
cpio. my ./init script is a "#!/bin/busybox ash" script.

running cpio -tv, I see:
...
-rwxr-xr-x 1 root root 452508 May 5 14:33 bin/busybox
...
-rwxr-xr-x 1 root root 1328 May 9 15:46 init
...

Now I see a message saying:
Kernel panic - not syncing: No init found. Try passing init= option to kernel.

I did that. According to the source, init= is overridden when /init exists.

I'd like to get off the initrd ramdisk style to save some more on space.

I assume it is populating properly since also I don't see the initial console
warning message.

Kernel: vanilla 2.6.12-rc4 compiled with -Os with debian gcc 3.3.5-1

--
Lab tests show that use of micro$oft causes cancer in lab animals


2005-05-25 18:34:13

by Lennart Sorensen

[permalink] [raw]
Subject: Re: initramfs

On Wed, May 25, 2005 at 01:41:35PM -0400, Wakko Warner wrote:
> I'm having problems with this. I apparently have a cpio archive that the
> kernel likes. I am starting via grub with basically:
> kernel /mykernel
> initrd /mycpiofile
>
> At first, I got "can't mount root". A little reading in main.c has it
> looking for /init (shouldn't this be /bin/init instead?)
>
> I moved my ./bin/init to . in my init filesystem tree and recreated the
> cpio. my ./init script is a "#!/bin/busybox ash" script.
>
> running cpio -tv, I see:
> ...
> -rwxr-xr-x 1 root root 452508 May 5 14:33 bin/busybox
> ...
> -rwxr-xr-x 1 root root 1328 May 9 15:46 init
> ...
>
> Now I see a message saying:
> Kernel panic - not syncing: No init found. Try passing init= option to kernel.
>
> I did that. According to the source, init= is overridden when /init exists.
>
> I'd like to get off the initrd ramdisk style to save some more on space.
>
> I assume it is populating properly since also I don't see the initial console
> warning message.
>
> Kernel: vanilla 2.6.12-rc4 compiled with -Os with debian gcc 3.3.5-1

I didn't know you could use CPIO archives as initrd images. I have used
gzip'd ext2 and cramfs (on Debian kernels only so far). Actually I
didn't know cpio was even considered a filesystem (and hence would be
difficult to mount at all).

Len Sorensen

2005-05-25 18:51:28

by Wakko Warner

[permalink] [raw]
Subject: Re: initramfs

Lennart Sorensen wrote:
> I didn't know you could use CPIO archives as initrd images. I have used
> gzip'd ext2 and cramfs (on Debian kernels only so far). Actually I
> didn't know cpio was even considered a filesystem (and hence would be
> difficult to mount at all).

Apparently, initrd is just a name and a buffer. Whatever it does with it is
a different story. If the buffer looks like a cpio archive, it mounts tmpfs
as / and populates it from the archive. No ramdisk driver, no filesystem
driver required.

Unfortunately for me, it doesn't work. I'm still trying to figure out how
it works.

--
Lab tests show that use of micro$oft causes cancer in lab animals

2005-05-25 19:03:45

by Wakko Warner

[permalink] [raw]
Subject: Re: initramfs

Wakko Warner wrote:
> running cpio -tv, I see:
> ...
> -rwxr-xr-x 1 root root 452508 May 5 14:33 bin/busybox
> ...
> -rwxr-xr-x 1 root root 1328 May 9 15:46 init
> ...
>
> Now I see a message saying:
> Kernel panic - not syncing: No init found. Try passing init= option to kernel.

My fault. I haven't used cpio much. The cpio archive contained only files,
no directories, thus there was no /bin to put /bin/busybox in. I now have
it working.

--
Lab tests show that use of micro$oft causes cancer in lab animals

2005-05-25 19:56:56

by Wakko Warner

[permalink] [raw]
Subject: Re: initramfs

Wakko Warner wrote:
> Lennart Sorensen wrote:
> > I didn't know you could use CPIO archives as initrd images. I have used
> > gzip'd ext2 and cramfs (on Debian kernels only so far). Actually I
> > didn't know cpio was even considered a filesystem (and hence would be
> > difficult to mount at all).
>
> Apparently, initrd is just a name and a buffer. Whatever it does with it is
> a different story. If the buffer looks like a cpio archive, it mounts tmpfs
> as / and populates it from the archive. No ramdisk driver, no filesystem
> driver required.

Unfortunately, I noticed that the ramdisk driver has to be compiled in (I
didn't try w/o initrd support). Atleast I dropped ext2 from my compiled in
list (NO filesystems in my kernel!)

Now it would be nice if I could remove rd from the compiled in list as well
(even thought it would only save a few K)

> Unfortunately for me, it doesn't work. I'm still trying to figure out how
> it works.

As I stated earlier it now works. error with my archive.

--
Lab tests show that use of micro$oft causes cancer in lab animals