如何将包含子目录的整个目录复制到yocto中的 /启动(IE bootf)时,如何继承核心图像类?
我有一个目录,该目录又包含子目录,这些子目录是其他食谱的一部分,并使用部署BB类移至Deploy_dir_image。因此,现在我想将其复制到主图像引导分区。
如果它是一个文件,则将需要文件名附加到image_efi_boot_files变量,然后Yocto将其复制到 /启动。但是,对于包含子目录的目录也不适用,请提供样式,即使包括子目录。谢谢
PS:我尝试了附加image_efi_boot_files +=“ parent_dir/*”不起作用。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
显然,
image_efi_boot_files
的作用与众所周知的image> image_boot_files
和其他负责在启动分区中运送所需文件的变量。这需要文件而不是目录。因此,如果您不需要手工指定所有文件,而是要通过目录,我建议您使用Python方法为您收集文件并将其附加到变量上。
请参阅我开发和测试的以下示例:
该方法将测试参数是否是真实的路径,则它将直接检查文件,如果没有,则假定它是Bitbake变量,并且将获得其内容,因此,如果
deploy_dir_image
是,例如/home/user/user/dir
,通过deploy_dir_image
或/
/home/home/home/usr/usr/dir
将给予相同的结果。重要
很明显,
image_efi_boot_files
在.conf
文件中使用,例如local.conf
或自定义机器配置文件。因此,添加.conf
文件中的Python函数将无法工作。我建议为其创建一个类,并在您的.conf
文件中全球继承它:meta-custom/class/class/utils.bbclass
local.conf :
尝试一下,在评论中让我知道。
编辑
我刚刚意识到Bitbake已经在Python表达式扩展中导入
OS
,因此您可以在一行中进行此操作,而无需单独的Python函数:It is obvious that
IMAGE_EFI_BOOT_FILES
is acting like the well knownIMAGE_BOOT_FILES
and other variables that are responsible for having the files necessary to be shipped in the boot partition. And that needs files and not directories.So, if you do not need to specify all the files by hand, but instead you want to pass the directory, I suggest you use a python method to collect the files for you and append them to the variable.
See the following example I developed and tested:
The method will test if the argument is a real path then it will directly check for files, if not it will assume that it is a bitbake variable and it will get its content, so if
DEPLOY_DIR_IMAGE
is, for example,/home/user/dir
, passingDEPLOY_DIR_IMAGE
or/home/usr/dir
will give the same result.IMPORTANT
It is obvious also that
IMAGE_EFI_BOOT_FILES
is used in a.conf
file such aslocal.conf
or a custom machine configuration file. So adding that python function in.conf
file will not work. I suggest creating a class for it and inherit it globally in your.conf
file:meta-custom/classes/utils.bbclass
local.conf:
Try this and let me know in the comments.
EDIT
I have just realized that bitbake already imports
os
within python expressions expansions, so you can do it in one line without any need for a separate python function:注意:我正在寻找可以实现上述解决方案的Yocto内置,希望分享其他方法以解决社区的利益。
如果您使用一个或一个或请参阅talel-belhadjsalem使用utils.bbclass的答案。
Note: I am looking for Yocto built-in which can achieve solution for above mentioned , would like to share other way to resolve the functionality for community's benefit.
Add following in bb file if you are using one or refer to talel-belhadjsalem answer to use utils.bbclass.