Copy initramfs to rootfs


Sinisa <sgujic@...>
 

Hello everyone,

I started to build kernel with initramfs, and so far all that works
great. I got my new shiny zImage-initramfs--4.1.14..xxx.bin. I can
boot it over tftp, its does exactly what i want.

Problem im facing is, how do i put this new zImage instead of
originally built zImage in final rootfs archive (tar.gz).

To clarify, upon a "bitbake create-my-fancy-image" i got in
tmp/deploy/images two zImage files, one without initramfs and one with
initramfs. When i inspect my rootfs.tar.gz /boot folder, i have zImage
inisde (symlink and DTB also).

I would like to replace somehow this zImage with initramfs version.
How do i do that?

Documentations talks only about this IMAGE_BUNDLE that is going to
merge kernel with initramfs, but i cant find any obvious way to get
this into rootfs, to replace somehow original zImage.

The best idea i have so far (that does not work) is to do something like this:

initramfs_postprocess() {
# NOTE: pseudo code
rm ${IMAGE_ROOTFS}/boot/zImage-custom*
unlink ${IMAGE_ROOTFS}/boot/zImage
# Im not sure how do i reference file from tmp/deploy/images, which
is my question number 2
cp zImage-initramfs-* to ${WORKDIR}/boot/zImage
}

ROOTFS_POSTPROCESS_COMMAND += "initramfs_postprocess; "

This above looks very dirty to me, but its best "idea" i have atm.

So, in my local.conf i have:
INITRAMFS_IMAGE_BUNDLE = "1" # means fuse kernel + initramfs

And in my main image recipe i have:
INITRAMFS_IMAGE = "initramfs-custom" #name of the recipe that provides
some custom /init
INITRAMFS_FSTYPES = "cpio.gz" # make a compressed cpio out of initramfs

One thing to note, im trying to avoid doing this with wks and creating
a special /boot partition. This is not something im really targeting,
i know its possible, but i want to have my kernel inside rootfs.tar.gz
in /boot from single image recipe due the various reasons.

Any suggestion is much appreciated.

Regards,
Sinisa

Join yocto@lists.yoctoproject.org to automatically receive all group messages.