Posts: 3
Joined: Fri Sep 27, 2013 9:40 am

initrd/initramfs problems

Thu Oct 03, 2013 3:20 pm


I am trying to use a current kernel on the Pi with an initrd/initramfs, but
cannot get it to work properly. shows the following initramfs/initrd-related options for /boot/config.txt:
  • ramfsfile (string) ramfs file to load
  • ramfsaddr address to load ramfs file at
  • initramfs (string address) ramfs file and adress to load it at (it's like ramfsfile+ramfsaddr in one option). NOTE: this option uses different syntax than all other options - you should not use "=" character here. Example:

    initramfs initramf.gz 0x00800000
I am using a self-built kernel (current git, 3.11.y branch); kernel and initrd image were built using the Debian kernel-package tools. The kernel itself is configured for both initramfs as well as for "classic" (block device) ramdisk support:

Code: Select all

# CONFIG_BLK_DEV_XIP is not set
# CONFIG_RD_LZO is not set
# CONFIG_RD_LZ4 is not set
Booting the kernel without initrd options works ok (just "kernel=vmlinuz-3.11.2-rpiinitrd" in /boot/config.txt). When adding

Code: Select all

  initramfs initrd.img-3.11.2-rpiinitrd 0x00a00000
as described in ... =28&t=7626, the kernel log shows the following error message:

Code: Select all

[    1.286546] Trying to unpack rootfs image as initramfs...
[    1.292336] rootfs image is not initramfs (junk in compressed archive); looks like an initrd
[    1.332560] Freeing initrd memory: 3604K (c0a00000 - c0d85000)
The file /boot/initrd.img-3.11.2-rpiinitrd is a gzip-compressed ASCII cpio archive (SVR4 with no CRC), i.e. valid initramfs
format, so the error message "image is not initramfs" seems to be wrong. Maybe the kernel is looking at the wrong memory address?

I have then tried to let the firmware determine the initramfs load address itself by just putting

Code: Select all

initramfs initrd.img-3.11.2-rpiinitrd
without address information into /boot/config.txt. This resulted in

Code: Select all

[    1.286662] Trying to unpack rootfs image as initramfs...
[    1.795917] Freeing initrd memory: 3604K (dbc6a000 - dbfef000)
but the actual initramfs code does not seem to be executed. To further test that, I have tried to boot a self-contained mini-system in an initramfs. For this, I have taken the files from and built an initramfs image from them:

Code: Select all

find . -print -depth | cpio --quiet -R 0:0 -o -H newc > /boot/rescue.cpio
gzip /boot/rescue.cpio
and then changed the initramfs line in /boot/config.txt to

Code: Select all

initramfs rescue.cpio.gz
This resulted in:

Code: Select all

[    1.300421] Trying to unpack rootfs image as initramfs...
[    1.664563] Freeing initrd memory: 3140K (dbcde000 - dbfef000)
and the system then just booted the root partition from the SD card instead of falling into a busybox shell within the initrd.

The given sizes in both cases (3604K/3140K) correspond roughly with the respective initramfs file sizes, so it seems that the kernel has actually found the initramfs in memory.

I would appreciate very much if anybody could give me a hint what is going wrong here.


Posts: 63
Joined: Mon Jan 30, 2012 4:27 pm

Re: initrd/initramfs problems

Fri Apr 18, 2014 9:13 am

What I've always done on my pandaboard is to create the filesystem I want to live in. convert to cpio archive. gzipped the result. Then during kernel compile when configuring initramfs there is an option to give the file that contains the cpio archive. The build kernel then has the filesystem directly embedded in it - and that boots fine.

I'd only do this for fairly small file systems btw, I have little more that uClibc + busybox, with some configuration files, and some wifi configuarion programs - so the gzipped cpio archive is ~9MB, which sill turns out to be most of the kernel image (~13MB).

Havn't tried loading the initramfs up seperatly into memory from the kernel, guess its possible with uboot - but seems far easier to package it up in the kernel image itself. On a Pi don't even know how you would load up the initramfs into memory - its not like you boot from uboot ...

Posts: 13
Joined: Sat Oct 27, 2012 12:41 pm

Re: initrd/initramfs problems

Sun Apr 17, 2016 7:55 am


I'm digging up a very old thread but I have exactly the same problem.
I'm using the latest Arch Linux for the RPi, it's a RPi version 1 model B.

I get exactly the same problem :

Code: Select all

[    2.442697] Trying to unpack rootfs image as initramfs...
[    2.448633] rootfs image is not initramfs (junk in compressed archive); looks like an initrd
[    2.474632] Freeing initrd memory: 2536K (c0f00000 - c117a000)
When using cmdline.txt :

Code: Select all

And config.txt :

Code: Select all

initramfs initrd.gz 0x00f00000
The initrd.gz file has been made with mkinitcpio -g /boot/initrd.gz

I also tried removing the initrd config option from the cmdline and using initramfs with followkernel, but my kernel shows this and I really don't like it :

Code: Select all

[    0.383618] No ATAGs?
It looks like the bootloader doesn't pass the ATAGs to the kernel.
Normally the INITRD location is passed through an ATAG by the bootloader... the RPi bootloader doesn't do that ?
I also get this line when not specifying initrd to the cmdline and using followkernel in the config.txt initramfs option. That's bad, it means the followkernel option will never work if the bootloader doesn't pass the corresponding ATAG to the kernel...

Anyway, if anyone has a successful configuration to setup an initrd for an RPi, I'd gladly appreciate any help.


Posts: 1
Joined: Fri May 13, 2016 10:06 am

Re: initrd/initramfs problems

Tue May 17, 2016 6:44 am

I'm pretty happy someone in irc told me that it will work using a different image, e.g. raspbian netinstaller which has a default initramfs and which supports the followkernel option.

Return to “Linux Kernel”