当前位置: 首页 > news >正文

buildroot构建根文件系统报错(已解决大部分问题)


title: buildroot构建根文件系统报错(set FORCE_UNSAFE_CONFIGURE=1)
author: cbus
categories:

  • 小知识
    tags:
  • 小知识
    abbrlink: 53691
    date: 2025-04-20 08:03:00

错误1 set FORCE_UNSAFE_CONFIGURE=1

在使用buildroot构建根文件系统时,一切按照文档的配置,但是在make的时候出现:

checking whether mknod can create fifo without root privileges... configure: error: in `/home/xxx/buildroot-2025.02/output/build/host-tar-1.35':
configure: error: you should not run configure as root (set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check)
See `config.log' for more details
package/pkg-generic.mk:253: recipe for target '/home/xxx/buildroot-2025.02/output/build/host-tar-1.35/.stamp_configured' failed
make: *** [/home/xxx/buildroot-2025.02/output/build/host-tar-1.35/.stamp_configured] Error 1

错误2 expected 4.1.x, got 4.0.x

解决错误1之后,出现下面问题:

Incorrect selection of kernel headers: expected 4.1.x, got 4.0.x
package/pkg-generic.mk:253: recipe for target '/home/xxxbuildroot-2025.02/output/build/toolchain-external-custom/.stamp_configured' failed
make: *** [/home/xxx/buildroot-2025.02/output/build/toolchain-external-custom/.stamp_configured] Error 1

错误3 toolchain-external-custom/.stamp_configured failed

解决问题2后,编译过程出现以下问题:

Fortran support is not selected but is available in external toolchain
package/pkg-generic.mk:253: recipe for target '/home/xxx/buildroot-2025.02/output/build/toolchain-external-custom/.stamp_configured' failed
make: *** [/home/xxx/buildroot-2025.02/output/build/toolchain-external-custom/.stamp_configured] Error 1
OpenMP support is not selected but is available in external toolchain
package/pkg-generic.mk:253: recipe for target '/home/zwl/linux/IMX6ULL/buildroot-2025.02/output/build/toolchain-external-custom/.stamp_configured' failed
make: *** [/home/zwl/linux/IMX6ULL/buildroot-2025.02/output/build/toolchain-external-custom/.stamp_configured] Error 1

错误4 fatal error: sys/random.h: No such file or directory

解决以上问题后,又又又出现下面问题:

ubi-utils/ubihealthd.c:15:24: fatal error: sys/random.h: No such file or directory
compilation terminated.
Makefile:3020: recipe for target 'ubi-utils/ubihealthd.o' failed
make[1]: *** [ubi-utils/ubihealthd.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory '/home/zwl/linux/IMX6ULL/buildroot-2025.02/output/build/host-mtd-2.2.1'
package/pkg-generic.mk:270: recipe for target '/home/zwl/linux/IMX6ULL/buildroot-2025.02/output/build/host-mtd-2.2.1/.stamp_built' failed
make: *** [/home/zwl/linux/IMX6ULL/buildroot-2025.02/output/build/host-mtd-2.2.1/.stamp_built] Error 2
ERROR: No hash found for busybox-1.29.3.tar.bz2
package/pkg-generic.mk:175: recipe for target '/home/zwl/linux/IMX6ULL/buildroot-2025.02/output/build/busybox-1.29.3/.stamp_downloaded' failed
make: *** [/home/zwl/linux/IMX6ULL/buildroot-2025.02/output/build/busybox-1.29.3/.stamp_downloaded] Error 1

解决方法

可以看到,报错里面让我们set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check

首先切换管理员用户

sudo su root

然后输入

export FORCE_UNSAFE_CONFIGURE=1

最后重新构建。

make

对于问题2

expected 4.1.x, got 4.0.x,意思是我们在配置buildroot的Toolchain时,选择的内核头为4.1.x,而交叉编译器里的内核头为4.0.x。我们打开交叉编译器的version.h文件

sudo vim /usr/local/arm/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include/linux/version.h

image-20250419220915108

可以看到,LINUX_VERSION_CODE 262144,此值为10进制,转换为16进制为40000,对应的linux内核版本为4.0.x

image-20250419221040333

我们将buildroot的Toolchain里面的External toolchain kernel headers series改为4.0.x,然后最好清理一下

make clean

然后重新编译:

make

对于问题三,很明显,提示也给出了原因

进入配置界面在Toolchain交叉编译工具下输入y使能Fortran和OpenMP。

image-20250419225041243

针对问题四,较老版本的Linux 是没有 sys/random.h 文件的,所以我们需要修改下载的busybox版本

进入busybox目录下:

/home/xxx/buildroot-2025.02/package/busybox

修改BUSYBOX_VERSION 为1.29.3.然后终端输入

make busybox-dirclean
make

编译后,出现缺少Hash,添加Hash后,又会出现 Buildroot 正在尝试对 busybox-1.33.2 的源码打补丁时,找不到要打补丁的文件,所以补丁失败,最终构建失败。

改到这博主又去把这些补丁删除,不让Buildroot打补丁,但是后续编译就会出错。

所以只能删掉现在的buildroot,换成低版本。换成低版本后,没有报错,直接可以编译成功,所以按照手册来才是最优解,不然折腾太磨人了。

http://www.xdnf.cn/news/51535.html

相关文章:

  • Linux学习——Linux进程间通信(IPC)聊天程序实践
  • Android开发中广播(Broadcast)技术详解
  • 线程基础题
  • FOC控制中的正弦PWM和空间矢量PWM对比与理解
  • 【计量地理学】实验五 试验变异函数计算
  • 软件设计师/系统架构师---计算机网络
  • Python爬虫实战:获取fenbi网最新备考资讯
  • 机器学习专栏(4):从数据饥荒到模型失控,破解AI训练的七大生死劫
  • SpringBoot Actuator健康检查:自定义HealthIndicator
  • Java 8 date/time type `java.time.LocalDateTime`
  • FreeRTOS中断管理
  • LangChain4j对话内存管理:ChatMemory原理与实战应用
  • 【深度学习与大模型基础】第12章-损失函数与梯度下降
  • 高等数学同步测试卷 同济7版 试卷部分 上 做题记录 上册期中同步测试卷 B卷
  • 相对路径和绝对路径解析
  • windows下配置Ninja
  • 算法笔记—动态规划
  • Multisim使用教程详尽版--(2025最新版)
  • B树的异常恢复
  • pivot_root:原理、用途及最简单 Demo
  • 项目预期管理:超越甘特图,实现客户价值交付
  • 协程?协程与线程的区别?Java是否支持协程?
  • The_Planets_Earth靶场笔记(VulnHub)
  • 第一章,HCIA复习
  • 人形机器人马拉松:北京何以孕育“领跑者”?
  • C++ 基础:注意a == b; b == a;陷阱
  • 如何高效利用呼叫中心系统和AI语音机器人
  • (12)VTK C++开发示例 --- 生成高斯随机数
  • 苍穹外卖阶段性总结 (超详细版)
  • AIGC(生成式AI)试用 30 -- AI做软件程序测试 1