Skip to contentSkip to conversation

initramfs

DISCUSSION Wakko Warner 2 participants 5 messages May 25, 2005

lore
Share & tools
lore
#0 lore raw

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

Signature · 1 line
 Lab tests show that use of micro$oft causes cancer in lab animals
#1 lore raw
Quoted 21 lines · Wakko Warner

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:
...

(quoted diff) +0 -2
-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.
Quoted 8 lines

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

#2 lore raw
Quoted 4 lines · Lennart Sorensen

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.

Signature · 1 line
 Lab tests show that use of micro$oft causes cancer in lab animals
#3 lore raw
Quoted 10 lines · Wakko Warner
Quoted 4 lines · Lennart Sorensen

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)

Quoted 2 lines

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.

Signature · 1 line
 Lab tests show that use of micro$oft causes cancer in lab animals
#4 lore raw
In reply to Wakko Warner
Quoted 9 lines · Wakko Warner

running cpio -tv, I see:
...

(quoted diff) +0 -2
-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.

Signature · 1 line
 Lab tests show that use of micro$oft causes cancer in lab animals