[Android] 编译出现 xxx is not clean, please run 'make mrproper'

本文详细介绍了在Linux内核目录进行makemenuconfig配置并尝试编译时遇到xxxisnotclean,pleaserun'makemrproper'错误的解决方法。通过分析Makefile,发现该错误与.config文件及include/config目录的存在有关。解决方案为删除这些文件,确保内核源码目录干净。

在kernel目录进行过make menuconfig之后,再编译整包出现 xxx is not clean, please run 'make mrproper'报错
但是根据提示在kernel路径下执行 make mrproper,依旧出现错误

这时候去根据提示内容,去找相应的Makefile,看看设么条件下会报这样的错

Makefile位于kernel的根目录下

# prepare3 is used to check if we are building in a separate output directory,
# and if so do:
# 1) Check that make has not been executed in the kernel src $(srctree)
prepare3: include/config/kernel.release
ifneq ($(KBUILD_SRC),)
	@$(kecho) '  Using $(srctree) as source for kernel'
	$(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \
		echo >&2 "  $(srctree) is not clean, please run 'make mrproper'"; \
		echo >&2 "  in the '$(srctree)' directory.";\
		/bin/false; \
	fi;
ndif

也就是会检查kernel根目录下是否有名.config的文件以及include路径下是否存在名为config的目录,如果有就出现" $(srctree) is not clean, please run 'make mrproper'"提示

所以解决这个问题的办法就是删掉 .configinclude/config
继续工作~

<think>我们正在分析U-Boot的启动代码,用户突然提到一个make命令的错误。这看起来与之前的代码分析无关,可能是用户在编译U-Boot时遇到的错误。根据U-Boot的编译流程,当构建环境不干净时,会提示运行'make mrproper'来清理。因此,我应该解释这个命令的作用,并给出相关建议。 </think>好的,我将解释您遇到的构建环境问题: ### 关于`make mrproper`命令的说明 1. **问题根源** 当您看到 **_"is not clean, please run 'make mrproper'"_** 错误时,通常是由于以下原因: - 存在残留的临时文件(`.o`, `.d`, `.cmd`等编译产物) - 不同架构的配置文件冲突(如`include/config.h`) - 版本切换导致的缓存不一致(`include/generated/autoconf.h`) 2. **命令作用** ```bash make mrproper ``` - ️ **深度清理**:重置整个构建环境到初始状态 - 🧹 **删除文件**:清除所有配置文件和编译生成对象 - ✅ **修复场景**:架构切换/版本变更/构建中断后 3. **操作流程** ```bash # 1. 清理构建环境 make mrproper # 2. 重新配置(示例) make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- rpi_4_defconfig # 3. 重新编译 make -j$(nproc) ``` 4. **与`make clean`的区别** | **命令** | **清理范围** | **保留内容** | |------------------|----------------------------|---------------------------| | `make clean` | 仅删除.o等编译中间文件 | 配置文件/Kconfig配置 | | **`make mrproper`** | 删除所有生成文件(含配置) | 仅保留源代码目录原始文件 |
评论 4
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值