0

I have a trouble of putting my initramfs.cpio in my kernel image by yocto.

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 )

==================================================================== Here are my error message..

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'

==================================================================== Here is my kernel image bb file

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/
}

==================================================================== Here is my initramfs bb file

LICENSE = "GPLv2"

PACKAGE_INSTALL = "initramfs-live-boot ${VIRTUAL-RUNTIME_base-utils} udev ${ROOTFS_BOOTSTRAP_INSTALL}"
IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"

inherit core-image

==================================================================== I have found similar questions: Ship extra files in kernel module recipe and An example of using FILES_${PN}

The way in aboves discussion are not work...

Any information would be appreciate !! Thanks !!

  • 1
    I'm not sure what you try to acheive. Did you look at the [manual](http://www.yoctoproject.org/docs/2.2/mega-manual/mega-manual.html#var-INITRAMFS_IMAGE) here ? You can join #yocto on freenode for more help if you need. – Nayfe Dec 18 '17 at 08:54
  • Hi @Nayfe, Thanks your information ~~, I have read the manual, and I can build a fitimage bundle a ramdisk. but it is not what I want. I want a fitimage without bundling a ramdisk. then flash it to my device, booting up, at last, I want my /usr directory has a cpio file. – user3610309 Dec 18 '17 at 08:59
  • Have you tried just addint t you kernel image bb FILES_${PN} += " /usr/initramfs-mine-${MACHINE_ARCH}.cpio" Let me know if this helps, and if so I will post the answer. – Paulo Neves Dec 18 '17 at 09:27
  • Are you sure ${B}/usr/initramfs-mine-${MACHINE_ARCH}.cpio exists? Shouldn't it be ${DEPLOY_DIR} instead ? – Nayfe Dec 18 '17 at 09:47
  • Hi PauloNeves, yes~ I'v tried but it still failed !! Hi Nayfe, yes~I check the ${B}/usr, there has initramfs-mine-${MACHINE_ARCH}.cpio ~ – user3610309 Dec 18 '17 at 11:08
  • Try to remove MACHINE_ARCH from cpio name, and add FILES_${PN} stuff. Is it a cpio file or cpio.gz file? Did you try to add some other place ? – Nayfe Dec 18 '17 at 13:54
  • Hi @Nayfe, very thanks your reply !! Yocto will appear the error message says it cannot find initramfs-mine.cpio. And, I have added do_install or do_install_append in my initramfs bb file, but... it doesn't be executed !!!! I'm still studying doc and tracing yocto's source code...@@. – user3610309 Dec 19 '17 at 03:07
  • To me, kernel recipe is not where you want to add the cpio file. I think you need to do it at rootfs creation time. – Nayfe Dec 19 '17 at 08:35
  • Hi @Nayfe~Thanks your reply !! I will try other ways to make my initramfs, maybe a new layer~~Thanks. – user3610309 Dec 19 '17 at 20:17

1 Answers1

0

The error seems to QA issues it means the source is compiled but not adding to rootfs. Add below line to yourkernel-image.bb. it will solve the issue.

FILES_${PN} += "${exec_prefix}/*"

Note: may be In your kernel.bb file you have given wrong format

yoctotutor.com
  • 5,145
  • 4
  • 26
  • 36