我收到错误:
make ${BUILD_FLAGS} -j1 modules
HOSTCC scripts/basic/fixdep
CALL scripts/checksyscalls.sh
CALL scripts/atomic/check-atomics.sh
DESCEND objtool
CHK include/generated/compile.h
LD [M] arch/x86/crypto/crc32c-intel.ko
arch/x86/crypto/crc32c-intel.lto.o: warning: objtool: file already has __mcount_loc section, skipping
arch/x86/crypto/crc32c-intel.lto.o: warning: objtool: file already has .orc_unwind section, skipping
make[2]: *** [scripts/Makefile.modfinal:78: arch/x86/crypto/crc32c-intel.ko] Error 255
make[1]: *** [scripts/Makefile.modpost:156: __modpost] Error 2
make: *** [Makefile:1762: modules] Error 2
我在用着uname -a
Linux 4.19.0-17-amd64 #1 SMP Debian 4.19.194-1 (2021-06-10) x86_64 GNU/Linux
echo $BUILD_FLAGS
LLVM=1 LLVM_IAS=1 CC=clang-12 CXX=clang++-12 LD=ld.lld-12
AR=llvm-ar-12 NM=llvm-nm-12 STRIP=llvm-strip-12
READELF=llvm-readelf-12 HOSTCC=clang-12 HOSTCXX=clang++-12
HOSTAR=llvm-ar-12 HOSTLD=ld.lld-12 OBJCOPY=llvm-objcopy-12
OBJDUMP=objdump
Linux内核构建5.13.1
有人有同样的情况吗?尝试通过 Clang-12 构建具有 LTO 优化的内核
答案1
运行make
(或make all
)默认情况下已经执行make modules
。因此,make modules
在构建模块后再次运行,将显示此消息。此时您可能已经拥有一个功能正常的内核和模块,并且可以make modules_install
像make install
往常一样运行。
$ make help | grep "*"
all - Build all targets marked with [*]
* vmlinux - Build the bare kernel
* modules - Build all modules
make SPHINX_CONF={conf-file} [target] use *additional* sphinx-build
* bzImage - Compressed kernel image (arch/x86/boot/bzImage)
bzdisk/fdimage*/isoimage also accept:
Execute "make" or "make all" to build all targets marked with [*]
Makefile 中有机会进行清理,以更优雅地处理此问题。这可能是一个回归https://github.com/ClangBuiltLinux/linux/issues/1369#issuecomment-832307198,我之前在构建带有集成 initramfs 的 clang 内核时没有注意到 5.12 的警告/错误(必须调用make
两次,才能有效地将生成的 initramfs cpio 合并到 bzImage 中——因此,可以直接运行make vmlinux
并make bzImage
合并initramfs cpio 并跳过多余的make modules
步骤。)