title: How to put an extra file in the kernel image by yocto
body: <p>I have a trouble of putting my initramfs.cpio in my kernel image by yocto.</p>
  
  <p>I have two bb files, one is used to build an initramfs, and the other one is used to build a fitimage.
  I successful to build the fitimage bundled with my initramfs image.
  But it always failed to build a fitImage that has an initramfs.cpio.gz in the /usr directory in the fitImage.
  ( I mean, I want to see a file named initramfs.cpio in the /usr when I use my fitImage booting to console )</p>
  
  <p>====================================================================
  Here are my error message..</p>
  
  <pre><code>ERROR: linux-mine-1_4.9.27+gitAUTOINC+d87116e608-r0 do_package: QA Issue: linux-mine: Files/directories were installed but not shipped in any package:
    /usr
    /usr/initramfs-mine-qemu.cpio
  Please set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.
  linux-mine: 2 installed and not shipped files. [installed-vs-shipped]
  ERROR: linux-mine-1_4.9.27+gitAUTOINC+d87116e608-r0 do_package: Fatal QA errors found, failing task.
  ERROR: linux-mine-1_4.9.27+gitAUTOINC+d87116e608-r0 do_package: Function failed: do_package
  ERROR: Logfile of failure stored in: /home/paul/projects/Test/yocto/build/tmp/work/mine-poky-linux-gnueabi/linux-mine/1_4.9.27+gitAUTOINC+d87116e608-r0/temp/log.do_package.26149
  ERROR: Task (/home/paul/projects/Test/yocto/yocto-2.2/poky/../meta-mine/recipes-kernel/linux/linux-mine_4.9.bb:do_package) failed with exit code '1'
  </code></pre>
  
  <p>====================================================================
  Here is my kernel image bb file</p>
  
  <pre><code>FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}-${PV}:"
  
  LINUX_VERSION ?= "4.9.27"
  
  SRCREV = "d87116e608e94ad684b5e94d46c892e33b9e2d78"
  SRC_URI = "git://local/kernel;protocol=ssh;branch=master"
  
  #FILES_${PN} += "/usr /usr/initramfs-mine-${MACHINE_ARCH}.cpio"
  #FILES_${PN}-${PV} += "/usr /usr/initramfs-mine-${MACHINE_ARCH}.cpio"
  #IMAGE_INSTALL = "initramfs-mine"
  
  do_install_append () {
  echo "WangPaul : S=[${S}]"
  echo "WangPaul : B=[${B}]"
  echo "WangPaul : D=[${D}]"
  install -d ${D}/usr/
  install -m 0444 ${B}/usr/initramfs-mine-${MACHINE_ARCH}.cpio ${D}/usr/
  }
  </code></pre>
  
  <p>====================================================================
  Here is my initramfs bb file</p>
  
  <pre><code>LICENSE = "GPLv2"
  
  PACKAGE_INSTALL = "initramfs-live-boot ${VIRTUAL-RUNTIME_base-utils} udev ${ROOTFS_BOOTSTRAP_INSTALL}"
  IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
  
  inherit core-image
  </code></pre>
  
  <p>====================================================================
  I have found similar questions:
  <a href="https://stackoverflow.com/questions/37118062/ship-extra-files-in-kernel-module-recipe">Ship extra files in kernel module recipe</a> and 
  <a href="https://stackoverflow.com/questions/46071039/an-example-of-using-files-pn">An example of using FILES_${PN}</a></p>
  
  <p>The way in aboves discussion are not work...</p>
  
  <p>Any information would be appreciate !!
  Thanks !!</p>