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

使用BitBake SRC_URI file://获取器去除解压源码树的基础路径

Fixing Yocto SRC_URI basepath Issue for Local Directories

Let me break down what's going wrong here and how to fix it:

The Problem with Your Current Configuration

When you use file:///src/someproject in SRC_URI, Yocto creates a temporary tarball of the entire someproject directory (not just its contents). The paths inside this tarball look like someproject/file1, someproject/subdir/, etc.

Your original basepath=/src/someproject is trying to match an absolute filesystem path, but basepath works against the paths inside the source archive—not your local system's absolute paths. Since the archive doesn't have a /src/someproject prefix, the basepath rule does nothing, and Yocto extracts the full someproject directory into your source subdir, resulting in the nested structure you're seeing.

Solution 1: Correct the basepath Value

Use the directory name (not the full absolute path) as your basepath. This tells Yocto to strip that prefix from the archive paths:

SRC_URI="file:///src/someproject;subdir=source;basepath=someproject"

Now when Yocto extracts the archive, it will remove the someproject prefix and drop all files/subdirs directly into build/tmp/work/target/someproject/1.0-r1/source/.

Solution 2: Target Directory Contents Directly

Alternatively, you can skip basepath entirely by pointing SRC_URI to all contents inside your local directory using a wildcard:

SRC_URI="file:///src/someproject/*;subdir=source"

This tells Yocto to grab every file and subdirectory under /src/someproject and copy them directly into your source subdir, no extra nested directories included.

Either approach will give you the flat source structure you're expecting.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.28 07:27:24