我正在尝试使用此变量,以便在生成根FS后删除一些不需要的init文件,遵循以下文档:
我在我的食谱(.bb)文件中添加了完全相同的片段,没有任何运气......出了什么问题?这是我在.bb文件中输入的代码:
my_postprocess_function() {
echo "hello" > ${IMAGE_ROOTFS}/hello.txt
}
ROOTFS_POSTPROCESS_COMMAND += "my_postprocess_function; "
日志不会显示任何错误或警告,只会执行my_postprocess_function。
答案 0 :(得分:1)
我相信有一个错误会根据哪个列将结束的大括号放在中显示出来。最初,我无法相信这是行为,但在我测试并确认之后,这是我的结果:
$ bitbake --version
BitBake Build Tool Core version 1.28.0
我正在修改 core-image-minimal.bb ,如下所示:
SUMMARY = "G5 - A small image just capable of allowing a device to boot."
IMAGE_INSTALL = "packagegroup-core-boot ${ROOTFS_PKGMANAGE_BOOTSTRAP} ${CORE_IMAGE_EXTRA_INSTALL}"
IMAGE_LINGUAS = " "
LICENSE = "MIT"
IMAGE_ROOTFS_SIZE ?= "8192"
IMAGE_ROOTFS_EXTRA_SPACE_append = "${@bb.utils.contains("DISTRO_FEATURES", "systemd", " + 4096", "" ,d)}"
inherit core-image
my_postprocess_function() {
echo "hello" > ${IMAGE_ROOTFS}/hello.txt
}
ROOTFS_POSTPROCESS_COMMAND += "my_postprocess_function; "
以上操作无声,无法生成hello.txt 注意}如何缩进一个空格(除了一次空格之外的任何数量的缩进也会失败)。
但是,如果您按如下方式修改它:
SUMMARY = "G5 - A small image just capable of allowing a device to boot."
IMAGE_INSTALL = "packagegroup-core-boot ${ROOTFS_PKGMANAGE_BOOTSTRAP} ${CORE_IMAGE_EXTRA_INSTALL}"
IMAGE_LINGUAS = " "
LICENSE = "MIT"
IMAGE_ROOTFS_SIZE ?= "8192"
IMAGE_ROOTFS_EXTRA_SPACE_append = "${@bb.utils.contains("DISTRO_FEATURES", "systemd", " + 4096", "" ,d)}"
inherit core-image
my_postprocess_function() {
echo "hello" > ${IMAGE_ROOTFS}/hello.txt
}
ROOTFS_POSTPROCESS_COMMAND += "my_postprocess_function; "
然后,生成hello.txt。
我发现此错误的方法是将'inherit core-image'行移动到文件的末尾,如下所示:
SUMMARY = "G5 - A small image just capable of allowing a device to boot."
IMAGE_INSTALL = "packagegroup-core-boot ${ROOTFS_PKGMANAGE_BOOTSTRAP} ${CORE_IMAGE_EXTRA_INSTALL}"
IMAGE_LINGUAS = " "
LICENSE = "MIT"
IMAGE_ROOTFS_SIZE ?= "8192"
IMAGE_ROOTFS_EXTRA_SPACE_append = "${@bb.utils.contains("DISTRO_FEATURES", "systemd", " + 4096", "" ,d)}"
my_postprocess_function() {
echo "hello" > ${IMAGE_ROOTFS}/hello.txt
}
ROOTFS_POSTPROCESS_COMMAND += "my_postprocess_function; "
inherit core-image
在这种情况下,我收到错误:
ERROR: ParseError at ......./recipes-core/images/core-image-minimal.bb:13: Shell function my_postprocess_function is never closed
我提到了最后一部分,以防其他任何人有奇怪的行为,你已经用尽所有调试的可能性。
答案 1 :(得分:0)
这对我有用:
my_postprocess_function() {
echo "hello" > ${IMAGE_ROOTFS}/hello.txt
}
ROOTFS_POSTPROCESS_COMMAND_append = " \
my_postprocess_function; \
"
答案 2 :(得分:0)