使用https设置远程rpm存储库时,Yocto构建损坏

时间:2018-05-08 09:34:54

标签: image https repository rpm yocto

我已经生成了一个Yocto图像,可以在我的所有目标设备上使用。当该映像在目标设备上运行时,必须能够使用rpm远程存储库通过https协议进行更新。

为了尝试这样做,我在自定义图层中添加了一个dnf bbappend:

$ cat recipes-devtools/dnf/dnf_%.bbappend
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += " \
    file://yocto-adv-rpm.repo \
"
do_install_append () {
    install -d ${D}/etc/yum.repos.d
    install -m 0600 ${WORKDIR}/yocto-adv-rpm.repo ${D}/etc/yum.repos.d/yocto-adv-rpm.repo
}
FILES_${PN} += "/etc/yum.repos.d"

这是dnf bbappend recipe:

中包含的存储库配置文件的内容
$ cat recipes-devtools/dnf/files/yocto-adv-rpm.repo
[yocto-adv-rpm]
name=Rocko Yocto Repo
baseurl=https://storage.googleapis.com/my_repo/
gpgkey=https://storage.googleapis.com/my_repo/PACKAGEFEED-GPG-KEY-rocko
enabled=1
gpgcheck=1

此存储库配置会破坏映像的构建过程。当我尝试构建myimage食谱时,我总是会收到此错误:

ERROR: myimage-1.0-r0 do_rootfs: [log_check] myimage: found 1 error message in the logfile:
[log_check] Failed to synchronize cache for repo 'yocto-adv-rpm', disabling.
ERROR: myimage-1.0-r0 do_rootfs: Function failed: do_rootfs
ERROR: Logfile of failure stored in: /home/yocto/yocto/build/tmp/work/machine-poky-linux/myimage/1.0-r0/temp/log.do_rootfs.731
ERROR: Task (/home/yocto/yocto/sources/meta-mylayer/recipes-images/myimage.bb:do_rootfs) failed with exit code '1'

然而,当我更换" https"通过" http" in" baseurl"变量:

baseurl=http://storage.googleapis.com/my_repo/

然后myimage食谱很好。

主机可以使用wget:

从https存储库下载文件
$ wget https://storage.googleapis.com/my_repo/PACKAGEFEED-GPG-KEY-rocko

以前的命令工作正常,所以问题与主机无关,我认为它必须与谷歌证书和yocto相关。

我在此文件中找到了一些相关信息:

yocto/build/tmp/work/machine-poky-linux/myimage/1.0-r0/temp/dnf.librepo.log

相关部分:

15:56:41 lr_download: Downloading started
15:56:41 check_transfer_statuses: Transfer finished: repodata/repomd.xml (Effective url: https://storage.googleapis.com/my_repo/repodata/repomd.xml)
15:56:41 check_finished_transfer_status: Fatal error - Curl code (77): Problem with the SSL CA cert (path? access rights?) for https://storage.googleapis.com/my_repo/repodata/repomd.xml [error setting certificate verify locations:
  CAfile: /home/yocto/yocto/build/tmp/work/x86_64-linux/curl-native/7.54.1-r0/recipe-sysroot-native/etc/ssl/certs/ca-certificates.crt
  CApath: none]
15:56:41 lr_yum_download_repomd: repomd.xml download was unsuccessful

你们有些人可以提供任何有用的建议来试图解决这个问题吗?

提前感谢您的时间! : - )

2 个答案:

答案 0 :(得分:1)

我终于修复了我的问题,从我的自定义图层中删除了我的dnf bbappend配方并将此变量添加到我的distro.conf文件中:

PACKAGE_FEED_URIS = "https://storage.googleapis.com/my_repo/"

之后,在构建过程结束时,图像包含一个有效的/etc/yum.d/oe-remote-repo文件以及管理它的所有必要内容。没有必要复制" ca-certificates.crt"手动完全。

此外,在完成图像构建后执行此命令非常重要:

$ bitbake package-index

此命令生成" repodata"目标设备在使用repo使用dnf客户端更新软件包时所需的软件包Feed中的目录。

答案 1 :(得分:0)

我找到了解决问题的时间黑客:

$ cp /etc/ssl/certs/ca-certificates.crt /home/yocto/yocto/build/tmp/work/x86_64-linux/curl-native/7.54.1-r0/recipe-sysroot-native/etc/ssl/certs/

之后,我终于能够使用“https”repo构建图像。

现在我正在以正确的方式解决这个问题。我会回到最后的解决方案。