0

我正在尝试从 github 版本中获取文件,但它说找不到?我正在使用的食谱如下所示。

DESCRIPTION = "Description of package"
LICENSE = "CLOSED"


MY_DESTINATION = "${libdir}/folder"



#SRC_URI = "file://file.zip"

SRC_URI = "https://github.com/user/repo/releases/download/latest/file.zip;protocol=file"


S = "${WORKDIR}"

do_install_append() {
         install -d ${D}${MY_DESTINATION}
         cp -r ${S}/file/* ${D}${MY_DESTINATION}
}

FILES_${PN} += "${MY_DESTINATION}/*"

有人可以帮助我在这里做错了吗?

错误如下...

ERROR: repo-1.0-r0 do_fetch: Fetcher failure: Fetch command export PSEUDO_DISABLED=1; export GIT_PROXY_COMMAND="oe-git-proxy"; export NO_PROXY="*"; export PATH="/work/build/tmp-glibc/sysroots-uninative/x86_64-linux/usr/bin:/work/openembedded-core/scripts:/work/build/tmp-glibc/work/cortexa7t2hf-neon-vfpv4-oe-linux-gnueabi.......
https://github.com/user/repo/releases/download/latest/file.zip
Resolving github.com (github.com)... 140.82.121.4
Connecting to github.com (github.com)|140.82.121.4|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2021-07-14 09:22:01 ERROR 404: Not Found.


ERROR: repo-1.0-r0 do_fetch: Fetcher failure for URL: 'https://github.com/user/repo/releases/download/latest/file.zip;protocol=http'. Unable to fetch URL from any source.
4

1 回答 1

1

GitHub这是一个从项目中获取发布的示例:

SUMMARY = "RTCOS (Run To Completion Operating System)"
LICENSE = "MIT"

SRC_URI = "https://github.com/kaizoku-oh/rtcos/archive/refs/tags/1.2.3.zip;protocol=http"

SRC_URI[md5sum] = "37e7c1303db943e56e603e9ec699235b"
SRC_URI[sha256sum] = "e86ee36e8716fe4b33be9bcb272ef9835c5e5ec3b58fd3e2c681334175945e4b"

脚步:

  1. 转到项目发布
  2. 选择一个版本并复制链接Source code (zip)
  3. 将其添加到 SRC_URI
  4. 协议应该是http
  5. 现在,bitbake 会在错误中为您获取 md5 和 sha256 总和,将它们复制到您的配方中

更多配方增强功能:

您可以根据配方的版本号设置发布链接,如下所示:

SRC_URI = "https://github.com/kaizoku-oh/rtcos/archive/refs/tags/${PV}.zip;protocol=http"

这样,将配方命名为与项目相同的名称:

rtcos_1.2.3.bb

现在将根据您的配方版本自动获取该版本,当然您需要在bitbake抱怨时更改校验和。

现在,Yocto 会将包解压到${WORKDIR}/recipe_name-release_version中,对于我的示例,它将是:

${WORKDIR}/rtcos-1.2.3

因此,将您的 ${S} 变量设置为该变量,您可以将其设置为动态:

S = "${WORKDIR}/${PN}-${PV}"

PN : 包名

PV : 包版本

现在您可以将内容复制给您MY_DESTINATION

MY_DESTINATION = "${libdir}/folder"

do_install(){
   install -d ${D}${MY_DESTINATION}
   cp -r ${S}/* ${D}${MY_DESTINATION}
}

FILES_${PN} += "${MY_DESTINATION}/*"
于 2021-07-14T08:14:09.540 回答