How to boot with initramfs on Raspberry Pi 4

I’ve tried following steps:

sudo apt install initramfs-tools
sudo apt --no-install-recommends install mdadm
sudo update-initramfs -c -k $(uname -r)
ls -1 /boot/ | grep -e "initrd.*$(uname -r)$"
echo "initramfs initrd.img-5.10.32-1-osmc" >> config-user.txt

But boot process breaks with a kernel panic.
I’ve also tried by adding init=/lib/systemd/systemd at /boot/cmdline.txt with no success.

We don’t support using a custom initramfs.

Are you really running RAID on your boot device?
If not, you can rely on mdadm to work after boot.

What I want to do is:

How to boot to USB RAID - Raspberry Pi Forums

Any other guide to jump boot process to USB and to that be a RAID of pendrives?

My final goal is to solve this:

(Rpi4) Crackling sound when video has HD resolution

With Raspbian (Kodi18), a USB RAID really helped on HD media playing, but I’m trying now to migrate to OSMC (Kodi19) and reach same performance.

I think this is outside the scope of OSMC. You could build your own kernel with your initramfs, but I don’t think it’s a good idea as you’ll need to do this regularly for updates.

initramfs-tools includes a hook script at /etc/kernel/postinst.d to do this automatically on kernel updates.

Yes - but we take the approach that initramfs should be embedded in to the kernel image.

If you show the panic I might be able to advise but I suspect it’s that init cannot be started

Sam

I confirm: init cannot be started and kernel goes to panic state.
This was the reason to try boot parameter init=/lib/systemd/systemd but no success.
When you generate initramfs image (update-initramfs), resulting package includes Linux kernel.

I believed OSMC was a Raspbian derivative and for this reason initramfs implementation could be easier.

OSMC is not based on Raspbian.
It is based on Debian.

It sounds like your initramfs can’t find root because it cannot assemble the array.
You will probably need a UART to debug the issue.

It’s not a customized initramfs; as I described, I install initramfs-tools from this distro’s repositories and directly apply it same as I do with another distro based on Debian: Raspbian (it hasn’t initramfs enabled by default: same as OSMC).

I try this with SDCard only; this is to do initranfs testing before configuring any USB block device as a next step. Sorry because I reported mdadm installation when it has no relation to reproduce issue.

OSMC does have an initramfs by default.

All of our kernels ship with one included.

Oh, this means OSMC kernel imatges are initramfs images instead, and what I’m doing is to make an initramfs image of another initramfs image, right?

How do I update stock initramfs image if “update-initramfs” is not indicated? I need to add device drivers, of course (such as mdadm).

An OSMC kernel image consists of the kernel and an embedded initramfs.

You would need to build your own kernel I think.
Booting from USB without an SD is something I want to support in the future, but I haven’t had time to do this yet.

Sam

initramfs is the solution to not have to build customized kernels, and be able to update them by apt. initramfs is a packaged minimal OS that includes Linux Kernel (got from installed OS), and acts as a previous boot stage to find and enable (for example) final root filesystem.

  • Stock Debian boot stages: Boot manager → initramfs[with kernel] → Complete OS[init] that includes kernel files only to be packaged by update-initramfs
  • Stock Raspbian boot stages: Boot manager → Simple Kernel → Complete OS[init]
  • Raspbian with initramfs enabled: Boot manager → initramfs[with kernel] → Complete OS[init] that includes kernel files only to be packaged by update-initramfs

initramfs embedded boot stages: Kernel → selected drivers to load and actions to take before delegating to OS init software from root filesystem.

I currently don’t specifically need to work without SDCard. By implementing and managing initramfs I want to be able to indicate any Debian supported volume to mount as root tree: USB key, RAID, encrypted, etc.

I know that some Raspberry models support firmware modules to boot from USB instead of SDCard, but it’s not what I’m looking for.

To make normal initramfs work in OSMC, I need to find how to configure so it finds init program.