User avatar
clausmuus
Posts: 50
Joined: Thu Nov 10, 2011 1:54 pm
Location: Germany, Lübeck
Contact: Website

use an initrd

Wed Jun 06, 2012 10:10 am

Hi,

i want to use an initrd/initramfs with the R-PI. But I can't find a way, to use it. As I know, there is no way to load it by the firmware, eg. by extend the cmdline.txt with a initrd=/boot/initrd.
A other way should be to compile the initramfs into the kernel. But this also don't work. If I activate the initrd/initramfs support in the Kernel, the kernel will not be loaded any more.
For my test I compile the R-PI Kernel with the default configuration. This works file. Than I activate initrd support and include an empty initramfs into the kernel. This kernel don't work any more. I will only see the color test screen. It seems that the R-PI don't load this kernel. Why?
How can I activate initrd support? What is the problem? Where I'm wrong?

Claus
MLD - a distribution also for the Raspberry-Pi

Max

Re: use an initrd

Wed Jun 06, 2012 4:38 pm

I did got an initramfs embedded in the kernel to work a couple times, but not reliable either.

A few times it seemed that it did work when starting with an empty FAT file system (mkfs.vfat), and copying the kernel+bootloader files to that, but not when mounting the existing file system and overwriting the files.
Like the bootloader has some race condition where it sometimes fails to load larger files when they are laid out fragmented on disk, or something.

I gave up on it.
Now simply put the root file system on the second partition like the official images do (with the exception that I use squashfs instead of ext4, as I like to keep things compact and read-only).

User avatar
clausmuus
Posts: 50
Joined: Thu Nov 10, 2011 1:54 pm
Location: Germany, Lübeck
Contact: Website

Re: use an initrd

Wed Jun 06, 2012 6:40 pm

Is there any official statement, how to use an initramfs?

Claus
MLD - a distribution also for the Raspberry-Pi

Max

Re: use an initrd

Wed Jun 06, 2012 6:59 pm

clausmuus wrote:Is there any official statement, how to use an initramfs?
There is a kernel_emergency.img that has an embedded busybox initramfs:

https://github.com/raspberrypi/target_fs
https://github.com/raspberrypi/linux/bl ... _defconfig


The Git comment suggests that enabling CONFIG_BLK_DEV_INITRD and setting CONFIG_INITRAMFS_SOURCE to your folder -as usual- should be enough.
But like you and I already noticed: that doesn't work that well in practice for some reason.

User avatar
jojopi
Posts: 3042
Joined: Tue Oct 11, 2011 8:38 pm

Re: use an initrd

Wed Jun 06, 2012 8:44 pm

There is some evidence that start.elf supports loading a separate initrd image using the "initramfs" keyword in config.txt. See http://www.raspberrypi.org/phpBB3/viewt ... 513#p41513

However, I have not yet been able to make this work...

User avatar
clausmuus
Posts: 50
Joined: Thu Nov 10, 2011 1:54 pm
Location: Germany, Lübeck
Contact: Website

Re: use an initrd

Tue Jun 12, 2012 8:29 am

Until a lot of search I found the reason, why the initramfs don't work for me.
I have try to add a initramfs.cpio.gz archive to the kernel. In the kernel I have configured to compress the archive with lzma (and not with gz). So I have also only activate the lzma uncompress support.
The problem was, that the kernel makefile do not unpack and repack the initramfs with the selected compression system, like I understand the kernel documentation. Because of this the kernel was not able to unpack the included initramfs.
A second problem was, that the RPI in this case do not shows the kernel boot messages, like it done if no initramfs is included, but shows only the debug color screen. So we thought that the RPI was not able to load the kernel.

Today we have a running kernel and also a running MLD Distribution http://www.minidvblinux.de/site/cont_in ... sub_id=918. OK, there is some fine tuning necessary, but its already running :)

Claus
MLD - a distribution also for the Raspberry-Pi

buddymoore
Posts: 7
Joined: Fri Jan 04, 2013 2:31 am

Re: use an initrd

Fri Jan 11, 2013 6:17 pm

From my rpi with stock Raspbian image on it (I assume they use the stock rpi kernel):

Code: Select all

cat /proc/config.gz | gunzip | grep -i initrd
# CONFIG_BLK_DEV_INITRD is not set
Is everyone else getting other results? Unless I don't understand something correctly (which I'd like to be informed, if I don't), then initrd/initramfs *should not* work. I need this feature, and I want it not to be an "option" but more of an extension method so I can permanently add additional capability to my boot partition without starting my own kernel distro.

cleverca22
Posts: 202
Joined: Sat Aug 18, 2012 2:33 pm

Re: use an initrd

Mon Mar 25, 2013 11:44 pm

not sure if this is your problem or not, but the config.txt format seems really wonky
initramfs=path causes it to not boot, but initramfs path causes it to run the kernel, (but the ramdisk doesnt seem to work yet)

found it over on http://wiki.gentoo.org/wiki/Raspberry_P ... ompilation

User avatar
clausmuus
Posts: 50
Joined: Thu Nov 10, 2011 1:54 pm
Location: Germany, Lübeck
Contact: Website

Re: use an initrd

Tue Mar 26, 2013 9:31 am

Hi,

you are not completely right. The use of an initramfs is no problem since half a year.

Claus
MLD - a distribution also for the Raspberry-Pi

cleverca22
Posts: 202
Joined: Sat Aug 18, 2012 2:33 pm

Re: use an initrd

Wed Mar 27, 2013 6:25 pm

ah, i found the solution to my problem over in http://www.raspberrypi.org/phpBB3/viewt ... 63&t=10532

seems the bootloader cant properly pass the initrd address/size to linux, so it has to be done manually

User avatar
clausmuus
Posts: 50
Joined: Thu Nov 10, 2011 1:54 pm
Location: Germany, Lübeck
Contact: Website

Re: use an initrd

Wed Mar 27, 2013 6:37 pm

No, that's also not right. You must not add any additional information. Only the location of the initramfs.

Claus
MLD - a distribution also for the Raspberry-Pi

User avatar
rpdom
Posts: 12948
Joined: Sun May 06, 2012 5:17 am
Location: Ankh-Morpork

Re: use an initrd

Wed Mar 27, 2013 8:03 pm

Happily using an initrd here (although not on a Linux kernel). I'm specifying the load address in config.txt, but the bootloader is correctly passing load address and size in the ATAGs.

cleverca22
Posts: 202
Joined: Sat Aug 18, 2012 2:33 pm

Re: use an initrd

Wed Mar 27, 2013 8:28 pm

hmmm, it wasnt working for me at all, just complained about root= being missing when i used ramfsfile=ramdisk.img

but forcing the location and size made it work without any problem

dimovnike
Posts: 7
Joined: Tue Apr 09, 2013 9:21 pm

Re: use an initrd

Sat May 18, 2013 2:22 am

Hi,
just to confirm here that:

initramfs initrd.cpio 0x00a00000
works great, no additional params needed.

i am using this custom compiled kernel:
Linux raspberrypi 3.6.11+ #13 PREEMPT Sat May 18 04:57:28 EEST 2013 armv6l GNU/Linux

(the initrd was created manually with custom compiled busybox)

danjperron
Posts: 3095
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: use an initrd

Mon Dec 23, 2013 1:04 pm

I found this site

http://www.minidvblinux.de/download/3.0.1-rpi

They used a inititial ramdisk.

You just need to install the uncompress tar file into a simple fat32 SD card. (single partition on FAT32).


Maybe just try the basic Rpi first. I can't test it since all Rpis are connected to something.

You will have to open the compress zip image folder
"MLD-3.0.1-rpi_initramfs-1.21.1_464.gz"

and add what you need.

I don't know if it stay on ramdisk but from there it should be easy to change it.

Use google to translate unless you speak german.


Daniel

Return to “Troubleshooting”