Is it possible to embed an initramfs image into existing kernel without recompiling the whole thing? I don't have resources to do that.
2 Answers
initramfs can be embedded in the kernel at build time (of course this is allowed from menuconfig, selecting rootfs tree). And can be useful for some specific circumstances. Only note that once embedded, any propertary rootfs tool in the final binary may break the GPL. But until your initramfs just contains some busybox stuff, there should not be any issue.
normally nobody would integrate an initramfs image into a kernel, as far as i know that isn't even possible (without rewriting the code against the concept) at least it is not intended.
the initrd is always a separated data stream (file) that is loaded together with the kernel to help with booting, it is optional but almost always included in modern gnu/linux distributions
so you don't have to ask yourself the question of how to embed it but how to change it, so have a look at your bootloader config, normally you should identify 3 things (also mostly in this order)
- kernel image (something that guides your bootolader to the kernel image (most times a file) to load it into ram
- command line (a string that is also written to ram for the kernel to access and use it (like giving parameters within a OS, but outside its just writing and calling (assembler code))) (this thing most times has some root=/dev/xy ro whatever option
- an initrd image (optional image of initial ramdisk that is loaded after the kernel into ram, the kernel then uses it as a virtual disk that is used to mostly (but there are live systems that run completely within it for example) assist booting before root fs is found and mounted (like disks are slow and fluid (order of disk, scsi stuff, booting from network, filesystem encryption, recovery emergency shell if fsck fails,... etc)
so to answer your question, you dont, if your boot-loader is incapable of using initrd directly and you cant replace it just load another bootloader with it (like very archaic stuff can still load grub as a kernel for example), otherwise just update the path to the separate initrd file in your bootloader config.
BTW, if you using grub2, dont edit config directly, its generated by update-grub using data within /etc/default/grub and /etc/default/grub.d/, on grub legacy you still edit the menu.lst directly on the boot partition, but grub2 is much to complex for this, you can still edit stuff directly but it will most possible be overwritten afterwards, so thats not a good idea...
- 1