4

I want to install an initramfs in the rootfs /boot (not the same as a wic boot partition).

In rootfs /boot, there are a kernel image, and a fit image installed.

I don't bundle the initramfs in the kernel, but put it in the fit image, but this fit image is the one without the initramfs.

I need to put the initramfs in /boot on the rootfs but I don't find what is installing these or if there is a legitimate way to also install other things there, or if I need to patch something?

I'm hoping for something like IMAGE_BOOT_FILES where I can specify extra files from DEPLOY_DIR_IMAGE

As an extra detail, the initramfs I wish to install isn't the one declared to the kernel recipe with INITRAMFS_IMAGE (for fit image inclusion) but an alternate initramfs which can be built separately.

But I'm having trouble specifying the dependency so this extra initramfs is built separately.

I've tried specifying the name of this initramfs recipe using:

  • DISTRO_EXTRA_RDEPENDS
  • EXTRA_IMAGEDEPENDS
  • PACKAGES

Edit: Part of the answer seems to be that the initramfs is an image and so anything it installs (using staging) would be in itself.

Clearly I need to follow the kernel recipe plan which is a different recipe to depend on the imitramfs, and it having produced it's artifacts to then steal them


The simple answer is to use something like this in the top level yocto-image-base.bb recipe

ROOTFS_POSTPROCESS_COMMAND_append += "install_initramfs;"
install_initramfs() {
    cp ${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.cpio.gz ${IMAGE_ROOTFS}/boot/
    ln -sf ${INITRAMFS_IMAGE}-${MACHINE}.cpio.gz ${IMAGE_ROOTFS}/boot/initramfs.gz
}

But I'd rather add back in inherit staging to the initramfs bb with something like:

addtask populate_sysroot after do_build before do_complete

to re-introduce the ability for an image recipe to contribute to a higher-level sysroot other than through ${DEPLOY_IMAGE_DIR}

It ought to be as straighforward to drop an initramfs in a parent sysroot as it is with wic into /boot

Rachid K.
  • 4,490
  • 3
  • 11
  • 30
Sam Liddicott
  • 1,265
  • 12
  • 24
  • 1
    The way you are doing it is the only way I've found it done: https://www.yoctoproject.org/pipermail/yocto/2019-July/045988.html and https://lists.yoctoproject.org/g/yocto/message/47500 – benf Aug 21 '20 at 19:23

0 Answers0