2

我正在尝试编写一个简单的 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'

现在我已经阅读了local-file-fetcher 上的 bitbake 文档,它说:

该子模块处理以 file:// 开头的 URL。您在 URL 中指定的文件名可以是文件的绝对路径或相对路径。如果文件名是相对的,则 FILESPATH 变量的内容的使用方式与使用 PATH 查找可执行文件的方式相同。

所以我的文件名在我的本地目录中,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: /主页/mike/ULF/ulf/oe-ghmi/recipes/images/files/ "

4

2 回答 2

7

根据OpenEmbedded 手册,第 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 Tasks

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}被打包,然后${IMAGE_ROOTFS}rootfs_ipkg类安装到最终的 ROOTFS 目录中(由您正在构建的图像的接收者调用)。从部分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}最终文件系统最终创建。

于 2014-11-14T23:23:26.047 回答
0

您需要像这样在“”SRC_URI”上方添加以下行

FILESEXTRAPATHS_prepend := "${THISDIR}:"

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

bitbake 搜索与配方名称相同的目录,这就是为什么它不复制 WORKDIR 现在您正在添加 FILESEXTRAPATHS 行,然后它将从您的 RECIPE 的目录路径中搜索。

于 2017-04-06T05:13:27.317 回答