简体   繁体   English

Yocto使用.bbappend文件覆盖initramfs的默认init脚本的编写

[英]Yocto using .bbappend file to override writing of default init scripts for initramfs

I am trying to write a .bbappend file that will append to the initramfs-live-boot_1.0.bb which has a statement inside the do_install() that writes the contents of init-live.sh , a shell script that manages the boot procedure, to init , an initialisation script that runs upon boot. 我正在尝试编写一个附加到initramfs-live-boot_1.0.bb.bbappend文件,该文件在do_install()中有一个语句,用于写入init-live.sh的内容, init-live.sh是一个管理引导的shell脚本过程, init ,在启动时运行的初始化脚本。 The purpose of my .bbappend file is to reference a modified version of the startup script to be copied in place of the original without changing the base openembedded-core and/or poky environments. 我的.bbappend文件的目的是引用要复制的启动脚本的修改版本来代替原始版本而不更改基本的openembedded-core和/或poky环境。 The .bbappend file and my version of the script is therefore placed in my project directory with the rest of my own recipes to be built. 因此, .bbappend文件和我的脚本版本放在我的项目目录中,并构建了我自己的其他配方。

My initramfs-live-boot_1.0.bbappend looks like this: 我的initramfs-live-boot_1.0.bbappend看起来像这样:

SUMMARY = "Replacement recipe"
FILESEXTRAPATH_prepend := "${THISDIR}/files:"
SRC_URI += "file://init.sh"

do_install_append() {
        install -m 0755 ${WORKDIR}/init.sh ${D}/init
}

I have a folder files in the same directory as the .bbappend file that contains the init.sh script it should be reading from. 我在.bbappend文件所在的目录中有一个文件夹files ,其中包含应该从中读取的init.sh脚本。

The problem is when I try to build the image, it spits out this error: 问题是当我尝试构建图像时,它会吐出这个错误:

WARNING: Failed to fetch URL file://init.sh, attempting MIRRORS if available

and then attempts to search through the poky directory for the missing files rather than in my project directory. 然后尝试在poky目录中搜索丢失的文件,而不是在我的项目目录中。

Have I written my .bbappend file wrong? 我写的.bbappend文件错了吗? How would I go about editing the initramfs scripts using the .bbappend file? 我如何使用.bbappend文件编辑initramfs脚本?

FILESEXTRAPATH_prepend := "${THISDIR}/files:" should be FILESEXTRAPATHS_prepend := "${THISDIR}/files:" . FILESEXTRAPATH_prepend := "${THISDIR}/files:"应为FILESEXTRAPATHS_prepend := "${THISDIR}/files:" Note the last S in FILESEXTRAPATHS . 注意FILESEXTRAPATHS的最后一个S.

That should make it work for you. 这应该让它适合你。

Another improvement would be to rename you file file from init.sh to init-live.sh . 另一个改进是将文件文件从init.sh重命名为init-live.sh Ie use the same name as the file in the original initramfs-live-boot recipe. 即使用与原始initramfs-live-boot配方中的文件相同的名称。 That would allow you to remove your do_install_append() -function as well as SRC_URI += "file://init.sh" from the bbappend. 这将允许您从bbappend中删除do_install_append()函数以及SRC_URI += "file://init.sh" The recipe itself would handle those for you. 配方本身会为您处理这些。 Thus, the only line you'd actually need is the FILESEXTRAPATHS_prepend := "${THISDIR}/files:" . 因此,您实际需要的唯一一行是FILESEXTRAPATHS_prepend := "${THISDIR}/files:"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM