linux - 为什么 bitbake 找不到并安装我的脚本?

标签 linux environment-variables recipe openembedded bitbake

我正在尝试编写一个简单的 bitbake 配方,它将一些脚本安装到目标根文件系统中。我一定是遗漏了什么,因为我觉得我设置正确,但我不断收到错误消息:

ERROR: Function failed: do_install (see /home/mike/ULF/ulf/build-ulf/out/work/armv7ahf-vfp-neon-linux-gnueabihf/ttt/1.0-r0/temp/log.do_install.493 for further information)
ERROR: Logfile of failure stored in: /home/mike/ULF/ulf/build-ulf/out/work/armv7ahf-vfp-neon-linux-gnueabihf/ttt/1.0-r0/temp/log.do_install.493
Log data follows:
| DEBUG: Executing shell function do_install
| install: cannot stat `uim2svc.sh': No such file or directory
| ERROR: Function failed: do_install (see /home/mike/ULF/ulf/build-ulf/out/work/armv7ahf-vfp-neon-linux-gnueabihf/ttt/1.0-r0/temp/log.do_install.493 for further information)
ERROR: Task 2 (/home/mike/ULF/ulf/oe-ghmi/recipes/images/ttt.bb, do_install) failed with exit code '1'

现在我已经阅读了 bitbake documenation on the local-file-fetcher它说:

This submodule handles URLs that begin with file://. The filename you specify with in the URL can either be an absolute or relative path to a file. If the filename is relative, the contents of the FILESPATH variable is used in the same way PATH is used to find executables.

所以我在我的 SRC_URI 中有文件名,在本地 files 目录中有脚本,并且我已经检查了构建的输出和路径点到我的脚本目录...那为什么我仍然收到此错误?有人知道我可能做错了什么吗?


这是我的完整 bitbake 食谱 (ttt.bb):

LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58"
SRC_URI = "file://uim2svc.sh"

do_install() {
    install -d ${IMAGE_ROOTFS}/etc
    install -d -m 0755 ${IMAGE_ROOTFS}/etc/init.d
    install -m 0755 uim2svc.sh ${IMAGE_ROOTFS}/etc/init.d/
}

这是显示文件位置的树(从/home/mike/ULF/ulf 开始):

oe-ghmi/
├── classes
├── conf
├── recipes
│   └── images
│       ├── files
│       │   └── uim2svc.sh
│       ├── global-hmi-image.bb
│       ├── ttt.bb

bitbake -e ttt 的(截断的)输出:

FILESPATH="...:/home/mike/ULF/ulf/oe-ghmi/recipes/images/files/armv7a:/home/mike/ULF/ulf/oe-ghmi/recipes/images/files/ghmi:/home/mike/ULF/ulf/oe-ghmi/recipes/images/files/"

最佳答案

根据OpenEmbedded manual , 第 9.13 节:

When source code is specified as a part of SRC_URI it is unpacked into 
the work directory, ${WORKDIR}.

因此,您的脚本会被 bitbake 检测到并部署在 ${WORKDIR} 中。 do_install() 方法应该引用与 ${WORKDIR} 相关的文件。 9.13.2 部分的手册中有一个示例。文件:用于补丁和附加文件:

Non-patch files are copied to the work directory, ${WORKDIR}. You can access
these files from within a recipe by referring to them relative to the work
directory. The following example, from the quagga recipe, shows the above 
init script being included in the package by copying it during the install 
task

并且提供的代码显示了如何执行此操作:

do_install () {
# Install init script and default settings
install -m 0755 -d ${D}${sysconfdir}/default ${D}${sysconfdir}/init.d ${D}${sysconfdir}/
install -m 0644 ${WORKDIR}/quagga.init ${D}${sysconfdir}/init.d/quagga
...

可能还值得注意的是,文件不会直接复制到 ${IMAGE_ROOTFS},而是复制到 ${D}。来自 7.4 任务部分:

install
The install task is responsible for actually installing everything. 
This needs to install the software into the destination directory, D. 
This directory won’t actually be a part of the final package though. 
In other words if you install something into ${D}/bin then it will end 
up in the /bin directory in the package and therefore on the target.

完成 do_install 后,目录 ${D} 被打包,然后安装到最终的 ROOTFS 目录 ${IMAGE_ROOTFS} 中,通过rootfs_ipkg 类(由您正在构建的图像的接收方调用)。来自 9.10 rootfs_ipkg class 部分:

The rootf_ipk class is used to create a root filesystem for the target
device from a set of .ipkg packages.

在执行的任务中:

4. Configures ipkg to allow it to be used locally to install into the 
root filesystem ${IMAGE_ROOTFS};
5. Installs locale related .ipkg packages;

${IMAGE_ROOTFS} 最终创建了最终的文件系统。

关于linux - 为什么 bitbake 找不到并安装我的脚本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26594186/

相关文章:

gradle - 在Gradle中,有没有更好的方法来获取环境变量?

triggers - 使用 Gerrit 触发器插件时,哪些环境变量会传递给 Jenkins?

recipe - 使用 bitbake 是否可以根据目标图像为包设置不同的 do_install?

r - 将 tidymodels 配方包装到函数中

linux - Bz2 目录中的每个文件

linux - 批处理模式 SSH 给出错误 "TERM environment variable not set"

c++ - 如何向 arm-gnueabi 工具链添加新的 header ?

linux - Sed:替换日期格式

security - 如何设置将所有环境变量从 root 用户复制到另一个特定用户

ros - 在 Gumstix overo 上获取我自己的 ROS 包(Bitbake yocto 项目)