I'm trying to start my Raspberry Pi with a custom 5.10.y cross-compiled Kernel for https://cdimage.ubuntu.com/releases/20.04.2/release/ubuntu-20.04.2-preinstalled-server-arm64+raspi.img.xz with HUGETLB enabled.

I've successfully cross-compiled the Kernel (I believe) and installed it to my SD card following the generic cross-compilation instructions from the Raspberry Pi website. However, when booting, I get an error about initramfs not being able to find the correct Kernel.

I've copied the initramfs.conf from the SD card into my cross compile directory and am running:

mkinitramfs -d ~/linux -o myinitramffs 5.10.0-v7l-custom

Which results in the following errors:

W: missing /lib/modules/5.10.0-v7l-custom
W: Ensure all necessary drivers are built into the linux image!
depmod: ERROR: could not open directory /lib/modules/5.10.0-v7l-custom: No such file or directory
depmod: FATAL: could not search modules: No such file or directory

How do I build an initramfs from my cross-compile machine for the Ubuntu 20.04 LTS Raspberry Pi image that will work with my custom Kernel?

  • If you don't have a specific reason for using an initramfs on the pi, don't -- there is not a lot of purpose to it since that kernel is only every going to be used in one very specific context and so might as well have the drivers required to boot built into it.
    – goldilocks
    Jul 25, 2021 at 13:59

1 Answer 1


I always use the package initramfs-tools which contains update-initramfs its a pretty easy to use script based initramfs-hook system. Though as making a single mistake will r

So when I've modified the /etc/initramfs entries I then just have to run..

sudo update-initramfs -u


  • 1
    This seems to apply when updating the initramfs from within the Pi not from the machine that is cross-compiling the Kernel.
    – junglie85
    Feb 25, 2021 at 13:30
  • That is true but initramfs is architecture dependant so you should be able to build your initramfs using update-ramps and specify an non-default output.. .. -b Set an different bootdir for the image creation. Feb 25, 2021 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.