参考的文章: 源码 | Bianbu Linux | 源码 | Bianbu Linux | 进迭时空开发者社区
问题概述:
在按照官方文档进行标准编译流程时,发现多个配置选项都会在zlib-ng包的patch阶段出现段错误,导致编译失败。
编译环境信息:
宿主系统: Ubuntu 22.04 (已安装必需依赖)
也已经执行过安装依赖:
sudo apt-get install git build-essential cpio unzip rsync file bc wget python3 python-is-python3 libncurses5-dev libssl-dev dosfstools mtools u-boot-tools flex bison python3-pip
sudo pip3 install pyyaml
Bianbu Linux版本: k1-bl-v2.2.y
repo版本: v2.48 (tsinghua源)
编译方式: 宿主机直接编译 (DIRECT_BUILD=1)
硬件配置: E5 2697v4 *2 ,ddr4 16G *4 ,磁盘 ssd 1t,剩余约500g。
编译步骤
- 配置SSH KEY,下载源码:
mkdir ~/bianbu-linux-qemu
cd ~/bianbu-linux-qemu
repo init -u git@gitee.com:bianbu-linux/manifests.git -b main -m k1-bl-v2.2.y.xml
repo sync -j4
repo start k1-bl-v2.2.y --all
- 设置编译环境:
export DIRECT_BUILD=1
- 开始编译
make envconfig
- 选择配置·
(base) cc-egg@ccegg-Super-Server:~/bianbu-linux-qemu$ make envconfig
\033[32;01mAvailable configs in /home/cc-egg/bianbu-linux-qemu/buildroot-ext/configs:\033[0m
1. spacemit_k1_defconfig
2. spacemit_k1_minimal_defconfig
3. spacemit_k1_plt_defconfig
4. spacemit_k1_plt_lxv10_defconfig
5. spacemit_k1_plt_v2_defconfig
6. spacemit_k1_plt_zt001h_defconfig
7. spacemit_k1_rt_defconfig
8. spacemit_k1_upstream_defconfig
9. spacemit_k1_v2_defconfig
10. spacemit_k1_v2_nand_defconfig
Your choice (1-10): 9
5.错误信息
patch: **** Can't rename file ./.gitignore.ogrYjDZ to .gitignore : No such file or directory
patch: **** Can't rename file ./.gitignore.ogrYjDZ to .gitignore : No such file or directory
patch: **** Can't rename file ./.gitignore.ogrYjDZ to .gitignore : No such file or directory
patch: **** Can't rename file ./.gitignore.ogrYjDZ to .gitignore : No such file or directory
patch: **** Can't rename file ./.gitignore.ogrYjDZ to .gitignore : No such file or directory
patch: **** Can't rename file ./.gitignore.ogrYjDZ to .gitignoresupport/scripts/apply-patches.sh: 第 67 行: 2841905 已完成 ${uncomp} "${path}/$patch"
2841906 段错误 (核心已转储) | patch -g0 -p1 --no-backup-if-mismatch -d "${builddir}" -t -N $silent
make[2]: *** [package/pkg-generic.mk:241:/home/cc-egg/bianbu-linux-qemu/output/k1_v2/build/zlib-ng-2.0.6/.stamp_patched] 错误 1
make[1]: *** [Makefile:82:_all] 错误 2
make[1]: 离开目录“/home/cc-egg/bianbu-linux-qemu/buildroot”
make: *** [Makefile:326:envconfig] 错误 2
核心问题 :zlib-ng-2.0.6包在patch阶段出现段错误,清空output重新测试了多个不同的defconfig配置都出现相同错误,且重新下载全新代码仍然复现
尝试过的解决方案
- 清理然后编译:
rm -rf output/后重新编译 - 容器和宿主机: 都测试过,结果一致
- 检查目录权限: 确认目录权限正常,均为当前用户
- 磁盘: 确认有充足磁盘空间
- 依赖: 也尝试预下载buildroot依赖包
wget -c -r -nv -np -nH -R "index.html*" http://archive.spacemit.com/buildroot/dl
现在这个一直没法解决,也尝试过搜索和自行尝试多种方案,两天了没有任何进展,遂来请求解答
希望能予以指导

