我已经生成了一个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'
但是,当我在“baseurl”变量中用“http”替换“https”时:
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
你们有些人可以提供任何有用的建议来试图解决这个问题吗?
提前谢谢您的时间! :-)
我终于修复了我的问题,从我的自定义层中删除了我的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
一旦使用repo使用dnf客户端更新软件包,此命令将在目标设备所需的软件包提要中生成“repodata”目录。
我找到了解决问题的时间黑客攻击:
$ 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构建图像。
现在我正在以正确的方式解决这个问题。我会带着最终解决方案回来。