You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用meta-intel构建core-image-base安装镜像失败求助

问题描述

参考meta-intel指南生成core-image-base安装镜像时,编译触发do_image_wic任务失败,提示找不到文件core-image-base-intel-corei7-64.ext4,但实际对应目录下存在core-image-base-intel-corei7-64.rootfs.ext4文件,怀疑遗漏配置步骤。

错误信息

| DEBUG: Python function set_image_size finished
| DEBUG: Executing shell function do_image_wic
| INFO: Creating image(s)...
|
| ERROR: _exec_cmd: install -m 0644 -D /home/remote/workspace/poky/build/tmp/work/intel_corei7_64-poky-linux/core-image-base/1.0/deploy-core-image-base-image-complete/core-image-base-intel-corei7-64.ext4 /home/remote/workspace/poky/build/tmp/work/intel_corei7_64-poky-linux/core-image-base/1.0/tmp-wic/boot.2/rootfs.img returned '1' instead of 0
| output: install: cannot stat '/home/remote/workspace/poky/build/tmp/work/intel_corei7_64-poky-linux/core-image-base/1.0/deploy-core-image-base-image-complete/core-image-base-intel-corei7-64.ext4': No such file or directory
|
| WARNING: exit code 1 from a shell command.
ERROR: Task (/home/remote/workspace/poky/meta/recipes-core/images/core-image-base.bb:do_image_wic) failed with exit code '1'
NOTE: Tasks Summary: Attempted 6943 tasks of which 6942 didn't need to be rerun and 1 failed. 
Summary: 1 task failed: /home/remote/workspace/poky/meta/recipes-core/images/core-image-base.bb:do_image_wic
Summary: There was 1 ERROR message, returning a non-zero exit code.
remote@epiroc: ~/workspace/poky/build$

目标目录文件列表

remote@epiroc:~$ cd  workspace/poky/build/tmp/work/intel_corei7_64-poky-linux/core-image-base/1.0/deploy-core-image-base-image-complete/
remote@epiroc:~/workspace/poky/build/tmp/work/intel_corei7_64-poky-linux/core-image-base/1.0/deploy-core-image-base-image-complete$ ls
core-image-base.env
core-image-base-image-installer.wks
core-image-base-intel-corei7-64.rootfs-20231207012556.ext4
core-image-base-intel-corei7-64.rootfs-20231207012556.manifest
core-image-base-intel-corei7-64.rootfs-20231207012556.qemuboot.conf
core-image-base-intel-corei7-64.rootfs-20231207012556.spdx.tar.zst
core-image-base-intel-corei7-64.rootfs-20231207012556.testdata.json
core-image-base-intel-corei7-64.rootfs.ext4
core-image-base-intel-corei7-64.rootfs.manifest
core-image-base-intel-corei7-64.rootfs.qemuboot.conf
core-image-base-intel-corei7-64.rootfs.spdx.tar.zst
core-image-base-intel-corei7-64.rootfs.testdata.json
remote@epiroc:~/workspace/poky/build/tmp/work/intel_corei7_64-poky-linux/core-image-base/1.0/deploy-core-image-base-image-complete$

现有配置文件

local.conf

MACHINE ??= "qemux86-64"
MACHINE ?= "intel-corei7-64"

PREFERRED_PROVIDER_virtual/kernel ?= "linux-intel-rt"

IMAGE_INSTALL:append = " \n    vim \n    "

WKS_FILE = "image-installer.wks.in"
IMAGE_FSTYPES:append = " ext4"
IMAGE_TYPEDEP_wic = "ext4"
INITRD_IMAGE_LIVE="core-image-minimal-initramfs"
do_image_wic[depends] += "${INITRD_IMAGE_LIVE}:do_image_complete"
do_rootfs[depends] += "virtual/kernel:do_deploy"
IMAGE_BOOT_FILES:append = "\n    ${KERNEL_IMAGETYPE} \n    microcode.cpio \n    ${IMGDEPLOYDIR}/${IMAGE_BASENAME}-${MACHINE}.ext4;rootfs.img \n    ${@bb.utils.contains('EFI_PROVIDER', 'grub-efi', 'grub-efi-bootx64.efi;EFI/BOOT/bootx64.efi', '', d)} \n    ${@bb.utils.contains('EFI_PROVIDER', 'grub-efi', '${IMAGE_ROOTFS}/boot/EFI/BOOT/grub.cfg;EFI/BOOT/grub.cfg', '', d)} \n    ${@bb.utils.contains('EFI_PROVIDER', 'systemd-boot', 'systemd-bootx64.efi;EFI/BOOT/bootx64.efi', '', d)} \n    ${@bb.utils.contains('EFI_PROVIDER', 'systemd-boot', '${IMAGE_ROOTFS}/boot/loader/loader.conf;loader/loader.conf ', '', d)} \n    ${@bb.utils.contains('EFI_PROVIDER', 'systemd-boot', '${IMAGE_ROOTFS}/boot/loader/entries/boot.conf;loader/entries/boot.conf', '', d)} "

bblayers.conf

# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"

BBPATH = "${TOPDIR}"
BBFILES ?= ""

BBLAYERS ?= " \n  /home/remote/workspace/poky/meta \n  /home/remote/workspace/poky/meta-poky \n  /home/remote/workspace/poky/meta-yocto-bsp \n  /home/remote/workspace/poky/meta-intel \n  "
解决方案

问题根源

WIC镜像制作时,脚本尝试读取不带.rootfs后缀的ext4文件,但Yocto默认生成的根文件系统镜像会带有.rootfs后缀,导致路径不匹配。

修复步骤

方案1:修改IMAGE_BOOT_FILES路径(直接匹配现有文件)

编辑local.conf,将IMAGE_BOOT_FILES中的这一行:

${IMGDEPLOYDIR}/${IMAGE_BASENAME}-${MACHINE}.ext4;rootfs.img

替换为:

${IMGDEPLOYDIR}/${IMAGE_BASENAME}-${MACHINE}.rootfs.ext4;rootfs.img

方案2:修改镜像命名规则(生成不带.rootfs后缀的文件)

若希望统一文件名格式,可在local.conf中添加以下配置,让Yocto直接生成不带.rootfs后缀的ext4镜像:

IMAGE_ROOTFS_EXT4 = "${IMAGE_BASENAME}-${MACHINE}.ext4"

方案3:清理并重新编译

完成配置修改后,清理之前的构建残留并重新编译:

bitbake -c cleanall core-image-base
bitbake core-image-base

内容的提问来源于stack exchange,提问作者lucio.liu

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.04 14:15:56