2

I'm trying to get a self-compiled kernel running together with an initramfs. It worked on the old raspberry, but somehow I can't get it to run.

What I'm trying to do exactly: Load kernel, "run" initramfs which then performs some checks (system-update etc.), finally mounting a squashfs image and invoking switch_root on said system.

But the kernel somehow refuses to run the initramfs' init. I tried various settings in cmdline.txt / config.txt but none of them seem to work, the kernel always waits for some root to be available (or fails with VFS: unable to mount root fs on unknown block). I assume that I'm missing some cmdline setting (probably a correct root=.... root=/dev/ram0 did not work) or a kernel flag. My current cmdline: dwc_otg.lpm_enable=0 console=tty1 elevator=deadline rootwait, config.txt: initramfs initramfs.gz followkernel

When I add root=/dev/mmcblk0p6 roottype=ext4 the whole system boots (into some test-linux I added to verify the kernel itself works).

I checked that the kernel is compiled with initramfs support (BLK_DEV_INITRD=y), compiling the initramfs into the kernel image is not an option sadly. The kernel (4.1 stable) is compiled using buildroot. Kernel binary format is zImage (seems not to work with vmlinux, screen stays black).

1
  • What do you mean compiling the initramfs into the kernel image is not an option sadly
    – jiggunjer
    Jan 24, 2017 at 13:50

1 Answer 1

1

I started from scratch and after hours of trial-and-error I got to the source(s) of my problem, which basically were just some stupid mistakes: My build script generated the initramfs with absolute paths (i.e. not, for example, lib/libc.so but rather ~/Work/project/target/lib/libc.so), which obviously causes the kernel to not find the inital init.

An interesting lession I learned: Embedded initramfs apparently is behaving slighlty different compared to an external one, namely that echo commands and suchlike in the init script don't get printed when an embedded initramfs is present. While tinkering around with an external initramfs I forgot to remove the embedded one, resulting in the external init being executed (and only that one), but not printing anything. After I removed the embedded initramfs, it worked.

1
  • 1
    In case you're wondering the difference in printing between internal and external is described here
    – jiggunjer
    Jan 24, 2017 at 13:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .