Linux – How to combine linux kernel and initrd without compiling

initramfsinitrdkernellinuxlinux-kernel

I know that it's possible to extract from a linux kernel the embedded initramfs cpio. I want to know if the reverse operation is possible; i.e., given both a compiled kernel and initramfs archive, how does one combine them?

I'm trying to achieve the same effect of this kernel config…

CONFIG_EFI=y
CONFIG_EFI_STUB=y
...
CONFIG_FB_EFI=y
...
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="root=..."
...
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE="my_initrd.cpio"

…without actually configuring and/or compiling the kernel.

References:

Best Answer

I know it's a late answer, but for anyone still trying to find one, here is my solution: you can create a combined .efi image with kernel, commandline and initramfs inside, called a "unified kernel image".

Reference: https://wiki.archlinux.org/index.php/Systemd-boot#Preparing_a_unified_kernel_image

Related Question