[Yocto] 直接向deploy/images目录部署binary

本文介绍如何处理非源代码的IP固件binary,并将其通过Yocto的do_deploy任务和wks脚本整合进最终镜像。讨论了yocto的工作目录结构,强调遵循其工作流程的重要性,提供了bb文件中添加do_deploy任务和修改wks script的步骤。

最近用yocto的时候碰到一个问题,有一些IP的FW binary是从别的地方直接拿来的,没有source code,有一个需求就是需要把它用wks script的方式把它们打包到最后的image里,这篇文章就是来谈谈这个问题。

yocto patch/deploy等做了什么

首先,虽然我们的code,bbfile,或者说patch,是用git repo的形式clone下来的,但是实际上yocto的工作目录是在build,或者说的更详细一点,是在build/tmp/work下的各级目录,说的再直白一点,如果你把文件直接放在source目录,想用传统的copy的方式把文件从source code目录copy到deploy目录,是很难办到的,就算你办到了,也已经脱离开了yocto的工作流程。

把binary或者文件添加到deploy目录的方法

正如上面我们说到的,我们要用Yocto自带的工作流程来处理这些文件。

在bb文件中添加do_deploy task

DESCRIPTION = "DDR Firmware deploy bblayer"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

inherit autotools-brokensep deploy
dockerfile文件内下载相关如下## Clone yocto honister RUN git clone -b ${YOCTO_VERSION} https://git.yoctoproject.org/poky ${YOCTO_WORKSPACE}/poky WORKDIR ${YOCTO_WORKSPACE}/poky RUN source oe-init-build-env ${YOCTO_WORKSPACE}/builddir ### ## Copy configuration samples and adapt them COPY resources/conf/* ${YOCTO_WORKSPACE}/builddir/conf/ RUN sed -i "s/LCM_TARGET_MACHINE/${LCM_TARGET_MACHINE}/g" ${YOCTO_WORKSPACE}/builddir/conf/local.conf; \ sed -i "s/SERVER_SSTATE_IP/${SSTATE_CACHE_IP}/g" ${YOCTO_WORKSPACE}/builddir/conf/sstatecache.conf ### ## Prepare the work directory RUN mkdir -p ${YOCTO_WORKSPACE}/meta-lcm WORKDIR ${YOCTO_WORKSPACE}/meta-lcm ### ## Retrieve all required meta layers: ## * common Yocto metas ## * common prpl meta layers: Ambiorix, USP ## * custom LCM meta layers: meta-containers (reponsible for handling OCI containers) RUN git clone -b ${YOCTO_VERSION} https://github.com/openembedded/meta-openembedded.git ${YOCTO_WORKSPACE}/meta-lcm/meta-openembedded && \ git clone -b ${YOCTO_VERSION} https://github.com/lgirdk/meta-virtualization.git ${YOCTO_WORKSPACE}/meta-lcm/meta-virtualization && \ git clone -b ${CONTAINERS_VERSION} https://gitlab.com/prpl-foundation/lcm/sdk/metalayers/meta-containers.git ${YOCTO_WORKSPACE}/meta-lcm/meta-containers && \ git clone -b ${USP_VERSION} https://gitlab.com/prpl-foundation/yocto/metalayers/meta-usp.git ${YOCTO_WORKSPACE}/meta-lcm/meta-usp && \ git clone -b ${AMX_VERSION} https://gitlab.com/prpl-foundation/yocto/metalayers/meta-amx.git ${YOCTO_WORKSPACE}/meta-lcm/meta-amx 修改下载操作,改为离线读取指定文件夹内对应文件
最新发布
09-24
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

山猫Show

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值