如何通过yocto将额外的文件放入内核映像中

问题描述:

我有一个麻烦的做法是将我的initramfs.cpio放入我的内核映像中。如何通过yocto将额外的文件放入内核映像中

我有两个bb文件,一个用于构建initramfs,另一个用于构建fitimage。 我成功地构建了捆绑在我的initramfs映像中的fitimage。 但是,它总是无法构建fitImage中的/ usr目录中具有initramfs.cpio.gz的fitImage。 (我的意思是,我希望看到的/ usr命名initramfs.cpio当我用我fitImage引导到控制台文件)

================== ================================================== 这里是我的错误信息..

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' 

=================================== ================================= 这里是我的内核映像文件的BB

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

== ======================================== ========================== 这里是我的initramfs BB文件

LICENSE = "GPLv2" 

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

inherit core-image 

========== ================================================== ======== 我也发现了类似的问题: Ship extra files in kernel module recipeAn example of using FILES_${PN}

的方式aboves讨论都无法正常工作......

的任何信息将被赞赏! 谢谢!

+0

我不知道你尝试acheive什么。你在这里看过[手册](http://www.yoctoproject.org/docs/2.2/mega-manual/mega-manual.html#var-INITRAMFS_IMAGE)吗?如果需要,您可以在freenode上加入#yocto获取更多帮助。 – Nayfe

+0

嗨@Nayfe,感谢您的信息~~,我已经阅读了手册,并且我可以创建一个fitimage捆绑ramdisk。但这不是我想要的。我想要一个fitimage而不捆绑ramdisk。然后将其闪存到我的设备,启动,最后,我希望我的/ usr目录有一个cpio文件。 – user3610309

+0

你有没有尝试过addint T优内核映像BB FILES _ $ {PN} + =“/usr/initramfs-mine-${MACHINE_ARCH}.cpio” 让我知道如果这能帮助,如果是这样,我将发布答案。 –

错误似乎是QA问题,它意味着源已编译但未添加到rootfs。将以下行添加到您的kernel-image.bb。它会解决这个问题。

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

注:可能是你kernel.bb文件你给错了格式