首页 > 解决方案 > 如何在基于 Yocto 项目的 lk-bootloader 中集成修补程序

问题描述

我是 yocto 的新手,现在我使用 MTK-demo-board 在 Yocto 上构建 linux-distro 基础。我想按照本教程通过 mender 实现 OTA:https ://docs.mender.io/1.0/Devices/Integrating-with-U-Boot 。

但是Mender默认支持u-boot作为bootloader,MTK使用lk bootloader,那么这个功能怎么实现呢?

我使用的AP是MT8183,我做的步骤如下: 1. /meta/meta-mediatek/recipes-bsp/lk/lk_2.0.0.0.bb 。添加以下代码:

require recipes-bsp/u-boot/u-boot-mender.inc
PROVIDES += "u-boot"
RPROVIDES_{PN} += "u-boot"

2.cp lk_2.0.0.0 lk-fw-utils_2.0.0.0,并将文件更改为后面:

 a. delete do_genkey{} function;
 b. add EXTRA_OEMAKE_class-target = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${CC} ${CFLAGS} ${LDFLAGS}" V=1' 
 c. add "oe_runmake env" in function do_compile()
 d. add PROVIDES_${PN} = "lk-fw-utils"
        RPROVIDES_${PN} = "lk-fw-utils"
        DEPENDS += "mtd-utils"

3./build/local.conf,添加这些代码

  MENDER_ARTIFACT_NAME = "release-1"
  INHERIT += "mender-full"
  MACHINE = "aiv8183m1v2"
  PREFERRED_VERSION_pn-mender = "1.0.%"
  PREFERRED_VERSION_pn-mender-artifact = "1.0.%"
  PREFERRED_VERSION_pn-mender-artifact-native = "1.0.%"

  DISTRO_FEATURES_append = "systemd"
  VIRTUAL-RUNTIME_init_manager = "systemed"
  DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
  VIRTUAL-RUNTIME_initscripts = ""
  IMAGE_FSTYPES = "ext4"

4.执行bitbake-layers add-layer /meta/meta-mender/meta-mender-core

5.bitbake-layers create-layer meta-mylayer,在这一层,我mkdir -p /recipes-mender/mender/files,在mender目录下,我触摸mender_%.bbappend文件如下:

FILESEXTARPATHS_prepend := "${THISDIR}/file:"
SRC_URI_append = "file://server.crt"
and put servert.crt in the the file directory.

6.在mancine.conf(aiv8183m1v2.conf)中,我添加了

PREFERRED_PROVIDER_u-boot-fw-utils = "lk-fw-utils"
  PREFERRED_PROVIDER_u-boot = "lk"
  IMAGE_INSTALL_append = "kernel-modules"
  MENDER_STORAGE_DEVICE = "/dev/mmcblk0"

7./meta-mender/meta-mender-core/classes/mender-full.bbclass

 MENDER_FEATURES_ENABLE_append_arm = ""
  MENDER_FEATURES_ENABLE_append_aarch64 = ""

我预期的结果是 linux 可以 OTA over mender。但是,实际结果是项目不能交叉构建。日志说:

DEBUG: Executing shell function soft_link_to_rootfs 
| ln: target ‘mender.bmap’ is not a directory 
| WARNING: /home/yewkui/yocto-linux/build/tmp/work/aiv8183m1v2-poky-linux/mtk-image-openmm-aiv/1.0-r0/temp/run.soft_link_to_rootfs.1347217:1 exit 1 from 'ln -nfs mtk-image-openmm-aiv-aiv8183m1v2-20181224064735.rootfs.ext4 mender mender.bmap /home/yewkui/yocto-linux/build/tmp/deploy/images/aiv8183m1v2/rootfs.ext4 mender mender.bmap' 
| DEBUG: Python function do_rootfs finished 
| ERROR: Function failed: soft_link_to_rootfs (log file is located at /home/yewkui/yocto-linux/build/tmp/work/aiv8183m1v2-poky-linux/mtk-image-openmm-aiv/1.0-r0/temp/log.do_rootfs.1347217) 
ERROR: Task (/home/yewkui/yocto-linux/meta/poky/../meta-mediatek-mt8183/recipes-aiv/images/mtk-image-openmm-aiv.bb:do_rootfs) failed with exit code '1' 
NOTE: Tasks Summary: Attempted 2392 tasks of which 2391 didn't need to be rerun and 1 failed. 
NOTE: Writing buildhistory


也许我第一步错了,但是如何通过yocto实现基于MTK lk-bootloader的OTA,请帮助!多谢!

标签: yoctoota

解决方案


推荐阅读