Copy initramfs to rootfs
Hi,
I figured out the way to do this, im not sure if this is the good approach, but so far it works for me. So ill just post it here if someone else stumbles upon this issue.
I was on good track with ROOTFS_POSTPROCESS_COMMAND, so i did this in my image recipe.
In recipe called my-fancy-image.bb
INITRAMFS_IMAGE = "initramfs-image-recipe"INITRAMFS_FSTYPES = "cpio.gz"
initramfs_postprocess() {
rm ${IMAGE_ROOTFS}/boot/zImage-*
cp ${DEPLOY_DIR_IMAGE}/zImage-initramfs--* ${IMAGE_ROOTFS}/boot/zImage
}
ROOTFS_POSTPROCESS_COMMAND += "initramfs_postprocess; "
And in my local.conf
INITRAMFS_IMAGE_BUNDLE = "1"
Then, call bitbake my-fancy-image and in /boot you will get your zImage-initramfs (named zImage).
It surely does look like a little bit hackish way to do things, but yocto documentation does not provide any better solution as far as i can tell.
Feel free to post here if you have or know a better solution.
Regards,
Sinisa
Quoted 62 lines · Sinisa via Lists.Yoctoproject.Org
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_BUNDLEthat 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 + initramfsAnd in my main image recipe i have:
INITRAMFS_IMAGE= "initramfs-custom" #name of the recipe that provides some custom /initINITRAMFS_FSTYPES= "cpio.gz" # make a compressed cpio out of initramfsOne 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
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.View/Reply Online (#47472): https://lists.yoctoproject.org/g/yocto/message/47472
Mute This Topic: https://lists.yoctoproject.org/mt/64383719/3618560
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-