# [solved] kexec and initramfs

## Atomic Fusion

I'm trying to boot Gentoo using my own initramfs from kexec.

When I repackage it into an initrd image, and specify root=/dev/ram0 on the kernel command line, it boots. With my initramfs, it merely fails with a kernel panic about not having a root.

I created my initramfs with:

```
find . -print0 | cpio --null -ov --format=newc | gzip -9 > /boot/main/initramfs.cpio.gz
```

What could I be doing wrong?Last edited by Atomic Fusion on Mon Jun 13, 2011 4:44 pm; edited 1 time in total

----------

## [n00b@localhost]

Could you post the output of 

```
gzip -dc /boot/main/initramfs.cpio.gz | cpio -tv
```

This will list the contents of your initramfs and make sure that everything needed has actually been included.  My guess is that the device node /dev/ram0 isn't included in your initramfs.

----------

## Atomic Fusion

/dev/ram0 was not included. I created (via copypasta) with

```
mknod ram0 b 1 0
```

I remade my initramfs and checked, and it was there. When I then used kexec on it, it failed in the same way.

Is there more of a difference between initramfs and initrd than I'm getting?

----------

## cach0rr0

how about mounting a devtmpfs at /dev within your initramfs? 

be surprised if that didnt give you every device node you needed

----------

## Atomic Fusion

Wouldn't I need to get into userspace to do that, or do you mean compiling it into the kernel?

I tried an Ubuntu initramfs, and it worked... It used lzma for compression rather than gzip. Might that be an issue?

----------

## Atomic Fusion

I think... I found the issue...

I copied my initscript from /sbin/init to /init. I also modified them to display which one was being run. Upon remaking my initramfs and booting, it worked, and reported that /init was run.

Does anyone know if this is true, that for initrd, /sbin/init is executed, while for initramfs, /init is executed?

----------

## [n00b@localhost]

I know that, at least for an initramfs, it is /init that is run and not /sbin/init.

Wikipedia says that for an initrd it is /linuxrc that is run.  Last time I used an initrd I seem to remember /linuxrc being a symlink to /sbin/init.

----------

