生成文件并将其部署到映像中,并放入yocto配方中

问题描述 投票:0回答:1

我需要根据配方内容生成某种清单。该文件也需要部署到映像。

[生成文件,我已经在许多bbclasses中看到python代码功能以类似的方式使用,例如:

      python do_create_manifest () {
          [...]
          filename = d.expand("${D}${LOC}/${MANIFEST_NAME}")
          [...]
          with open (filename,'w') as manifest_dict:
             json.dump(manifest_dict, manifest_dict, indent=True)
          os.chmod(filename, 0o644)
      }
  • 还有其他首选方法吗?

该文件是在添加任务依赖项之后创建的,但是,打包该文件时,在文件中会出现host-user-contaminated警告。

尽管我在许多食谱中都看到了使用:

        chown -R root:root ${D}${...}/${...}

此操作失败,因为chown需要由root用户运行,并且bitbake由当前用户运行:

Log data follows:
| DEBUG: Executing shell function do_uncontaminate
| chown: changing ownership of '/mnt/thud/build-r0w/[...]/manifest.json': Operation not permitted
| WARNING: exit code 1 from a shell command.
  • 在这种情况下,我该如何解决被主机用户污染警告?

注意:我知道这可以防止出现警告,但不能解决问题。

    INSANE_SKIP_${PN} = "host-user-contaminated"
yocto bitbake openembedded
1个回答
1
投票

您没有指定该文件的创建位置,filename包含的路径,但是由于错误,我怀疑您是在${D}下的某个位置直接创建该文件。

如果您改为在例如下创建清单文件, ${WORKDIR},然后在常规的do_install中使用例如install -Dm0644 ${WORKDIR}/my_manifest ${D}/dest/path/my_manifest所有权问题将与配方安装的任何其他文件一样得到解决。

只需确保在do_install之前运行do_create_manifest任务。

© www.soinside.com 2019 - 2024. All rights reserved.