我正在尝试编译内核,但它总是返回此错误:
LD arch/arm64/kernel/vdso/built-in.o
ld.lld: error: cannot find linker script -r
make[2]: *** [scripts/Makefile.build:507: arch/arm64/kernel/vdso/built-in.o] Error 1
make[1]: *** [scripts/Makefile.build:647: arch/arm64/kernel/vdso] Error 2
make: *** [Makefile:1239: arch/arm64/kernel] Error 2
我已经检查了 vdso 的源代码、脚本和 Makefile,但没有运气。
谁能指出我如何以及在哪里调查此事,或者如何显示有关此问题的更多详细信息?
问候
编辑:我第一次尝试在我的 ubuntu 20.04 上使用 llvm 构建 Android 内核,我相信我可能已经设置了 clang17 和 gcc。但即使用 gcc 编译它也会产生相同的错误
这是配置设置:
CLANG_HOME=/usr/lib/llvm-17
export PATH=$CLANG_HOME/bin:$CLANG_HOME/lib:${PATH}
export CLANG_TRIPLE=/usr/bin/aarch64-linux-gnu-
export CROSS_COMPILE=/usr/bin/aarch64-linux-gnu-
export CROSS_COMPILE_ARM32=/opt1/android/toolchain/clang/proton-clang-v13.0.0/arm-linux-gnueabi/bin/arm-linux-gnueabi-
export CC=$CLANG_HOME/bin/clang
export REAL_CC=$CLANG_HOME/bin/clang
export LD=$CLANG_HOME/bin/ld.lld
export AR=$CLANG_HOME/bin/llvm-ar
export NM=$CLANG_HOME/bin/llvm-nm
export OBJCOPY=$CLANG_HOME/bin/llvm-objcopy
export OBJDUMP=$CLANG_HOME/bin/llvm-objdump
export READELF=$CLANG_HOME/bin/llvm-readelf
export STRIP=$CLANG_HOME/bin/llvm-strip
export LLVM=1 && export LLVM_IAS=1
export KALLSYMS_EXTRA_PASS=1
export ARCH=arm64 && export SUBARCH=arm64
make -j1 -V1 错误
make -f ./scripts/Makefile.build obj=arch/arm64/kernel/vdso
/usr/lib/llvm-17/bin/llvm-objcopy -S arch/arm64/kernel/vdso/vdso.so.dbg arch/arm64/kernel/vdso/vdso.so
/usr/lib/llvm-17/bin/clang -Wp,-MD,arch/arm64/kernel/vdso/.vdso.o.d -nostdinc -isystem /usr/lib/llvm-17/lib/clang/17/include -I./arch/arm64/include -I./arch/arm64/include/generated/uapi -I./arch/arm64/include/generated -I./include -I./drivers/kernelsu/include -I./arch/arm64/include/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -Qunused-arguments -mlittle-endian -Qunused-arguments -D__ASSEMBLY__ --target=aarch64-linux-gnu -DCC_USE_CLANG --prefix=/usr/bin/aarch64-linux-gnu-
--gcc-toolchain=/usr -Werror=unknown-warning-option -fno-PIE -DCONFIG_AS_LSE=1 -DCONFIG_VDSO32=1 -c -o arch/arm64/kernel/vdso/vdso.o arch/arm64/kernel/vdso/vdso.S
/usr/lib/llvm-17/bin/ld.lld -EL -maarch64elf -O3 -shared -nostdlib -soname=linux-vdso.so.1 --hash-style=sysv --build-id -n -T
-r -o arch/arm64/kernel/vdso/built-in.o arch/arm64/kernel/vdso/vdso.o
ld.lld: error: cannot find linker script -r
make[2]: *** [scripts/Makefile.build:507: arch/arm64/kernel/vdso/built-in.o] Error 1
make[1]: *** [scripts/Makefile.build:647: arch/arm64/kernel/vdso] Error 2
make: *** [Makefile:1239: arch/arm64/kernel] Error 2
edit2:尝试使用不同的 clang,但在编译 vdso 内容时仍然遇到问题。上面提到的最常见错误 - 找不到链接器脚本,因此built.o未成功编译