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

使用Kas构建Yocto时遭遇'build/../conf/layer.conf'未找到错误

问题描述

使用Kas搭建Yocto环境时,Kas已成功拉取代码仓库并解析配置,但执行构建时出现如下错误:

ERROR: Unable to parse /home/simon/source/raspi_rheaos/layers/poky/bitbake/lib/bb/parse/__init__.py
Traceback (most recent call last):
  File "/home/simon/source/raspi_rheaos/layers/poky/bitbake/lib/bb/parse/__init__.py", line 145, in resolve_file(fn='/home/simon/source/raspi_rheaos/build/../conf/layer.conf', d=<bb.data_smart.DataSmart object at 0x7f8d974f27e0>):
         if not os.path.isfile(fn):
    >        raise IOError(errno.ENOENT, "file %s not found" % fn)

FileNotFoundError: [Errno 2] file /home/simon/source/raspi_rheaos/build/../conf/layer.conf not found

2024-07-05 12:13:03 - ERROR    - Command "/home/simon/source/raspi_rheaos/layers/poky/bitbake/bin/bitbake -c build core-image-base" failed with error 1

项目目录结构:

├── README
├── build
│	├── bitbake-cookerdaemon.log
│	├── cache
│	├── conf
│	├── sstate-cache
│	├── tmp
│	└── tmp-glibc
├── layers
│	├── meta-openembedded
│	├── meta-qt5
│	└── poky
├── meta-raspberrypi
│	├── COPYING.MIT
│	├── README.md
│	├── classes
│	├── conf
│	├── docs
│	├── dynamic-layers
│	├── files
│	├── img
│	├── kas-poky-rpi.yml
│	├── lib
│	├── recipes-bsp
│	├── recipes-connectivity
│	├── recipes-core
│	├── recipes-devtools
│	├── recipes-graphics
│	├── recipes-kernel
│	├── recipes-multimedia
│	├── recipes-sato
│	└── wic
├── meta-rheaos
│	└── conf
├── poky
│	├── LICENSE
│	├── LICENSE.GPL-2.0-only
│	├── LICENSE.MIT
│	├── MAINTAINERS.md
│	├── MEMORIAM
│	├── README.OE-Core.md
│	├── README.hardware.md -> meta-yocto-bsp/README.hardware.md
│	├── README.md -> README.poky.md
│	├── README.poky.md -> meta-poky/README.poky.md
│	├── README.qemu.md
│	├── SECURITY.md
│	├── bitbake
│	├── contrib
│	├── documentation
│	├── meta
│	├── meta-poky
│	├── meta-selftest
│	├── meta-skeleton
│	├── meta-yocto-bsp
│	├── oe-init-build-env
│	└── scripts
└── rheaos_kas.yaml

Kas配置文件rheaos_kas.yaml内容:

header:
  version: 14
  includes:
    - repo: meta-raspberrypi
      file: kas-poky-rpi.yml

# Set the machine to build for
machine: raspberrypi5

# Set the distro to build for
distro: rheaos
#distro: poky

# Set the repos
repos:
  meta-rheaos:
    path: meta-rheaos

  meta-raspberrypi:
    url: "https://github.com/agherzan/meta-raspberrypi.git"
    refspec: scarthgap

  poky:
    url: "https://git.yoctoproject.org/poky/"
    refspec: scarthgap
    layers:
      meta-poky:
问题原因分析
  1. 重复Poky目录引发路径冲突:本地同时存在根目录poky和layers/poky,加上Kas配置拉取的独立Poky仓库,导致BitBake加载配置时路径解析混乱,错误地去项目根目录寻找conf/layer.conf。
  2. Poky核心层未被引用:Kas配置中仅启用了meta-poky,但Yocto构建必需的核心层meta(OE-Core)未被添加,基础配置缺失触发路径解析错误。
  3. 自定义Distro层配置可能不完整:meta-rheaos层的conf/distro/rheaos.conf可能未正确配置(比如未继承Poky的基础配置),导致构建流程无法正常加载核心配置。
解决步骤
  • 清理重复Poky目录:删除根目录poky或layers/poky,建议保留Kas拉取的Poky仓库(由Kas统一管理),移除手动放置的layers/poky。
  • 补全Poky核心层引用:修改Kas配置中Poky的layers部分,添加meta层:
    poky:
      url: "https://git.yoctoproject.org/poky/"
      refspec: scarthgap
      layers:
        meta:
        meta-poky:
    
  • 检查自定义Distro层配置:确保meta-rheaos/conf/distro/rheaos.conf存在,且包含基础配置,示例:
    require conf/distro/poky.conf
    
    DISTRO_NAME = "RheaOS"
    DISTRO_VERSION = "1.0"
    
    同时确认meta-rheaos/conf/layer.conf正确声明层信息,示例:
    BBFILES += "${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bbappend"
    BBFILE_COLLECTIONS += "meta-rheaos"
    BBFILE_PATTERN_meta-rheaos = "^${LAYERDIR}/"
    BBFILE_PRIORITY_meta-rheaos = "6"
    
  • 重新初始化构建环境:删除现有build目录,重新执行Kas构建:
    rm -rf build
    kas build rheaos_kas.yaml
    

内容的提问来源于stack exchange,提问作者SimonC

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.21 09:22:04