title: How do I install initramfs in rootfs/boot?
body: <p>I want to install an initramfs in the rootfs <code>/boot</code> (not the same as a wic boot partition).</p>
  
  <p>In rootfs <code>/boot</code>, there are a kernel image, and a fit image installed.</p>
  
  <p>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.</p>
  
  <p>I need to put the initramfs in <code>/boot</code> 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?</p>
  
  <p>I'm hoping for something like <code>IMAGE_BOOT_FILES</code> where I can specify extra files from <code>DEPLOY_DIR_IMAGE</code></p>
  
  <p>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.</p>
  
  <p>But I'm having trouble specifying the dependency so this extra initramfs is built separately.</p>
  
  <p>I've tried specifying the name of this initramfs recipe using:</p>
  
  <ul>
  <li>DISTRO_EXTRA_RDEPENDS</li>
  <li>EXTRA_IMAGEDEPENDS</li>
  <li>PACKAGES</li>
  </ul>
  
  <hr>
  
  <p>Edit: Part of the answer seems to be that the initramfs is an <em>image</em> and so anything it installs (using staging) would be in itself.</p>
  
  <p>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</p>
  
  <hr>
  
  <p>The simple answer is to use something like this in the top level yocto-image-base.bb recipe</p>
  
  <pre><code>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
  }
  </code></pre>
  
  <p>But I'd rather add back in <code>inherit staging</code> to the initramfs bb with something like:</p>
  
  <pre><code>addtask populate_sysroot after do_build before do_complete
  </code></pre>
  
  <p>to re-introduce the ability for an image recipe to contribute to a higher-level sysroot other than through <code>${DEPLOY_IMAGE_DIR}</code></p>
  
  <p>It ought to be as straighforward to drop an initramfs in a parent sysroot as it is with wic into /boot</p>