我在 Ubuntu 18.04 上尝试交叉编译 Linux 内核 v.5.0.0 时遇到错误。
我测试了两个不同版本的aarch64-linux-gnu-gcc
:v7.4.0 和 v5.5.0,但两者都会导致相同的错误。
以下是我已安装的依赖项以及我运行的编译内核的命令:
$ sudo apt install libssl-dev libelf-dev build-essentials libncurses5-dev flex bison gcc-arm-linux-gnueabi gcc-arm-none-eabi gcc-arm-linux-gnueabihf gcc-arm-none-eabi-source
$ ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make defconfig
$ ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make -j
这是我收到的错误消息:
GEN .version
CHK include/generated/compile.h
UPD include/generated/compile.h
CC init/version.o
AR init/built-in.a
AR built-in.a
LD vmlinux.o
MODPOST vmlinux.o
arch/arm64/crypto/sha2-ce-glue.o: In function `sha256_base_do_update':
/home/shpark/git.kernel.org/arm64/linux/./include/crypto/sha256_base.h:82: undefined reference to `sha256_block_data_order'
/home/shpark/git.kernel.org/arm64/linux/./include/crypto/sha256_base.h:82:(.text+0x220): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `sha256_block_data_order'
/home/shpark/git.kernel.org/arm64/linux/./include/crypto/sha256_base.h:75: undefined reference to `sha256_block_data_order'
/home/shpark/git.kernel.org/arm64/linux/./include/crypto/sha256_base.h:75:(.text+0x2bc): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `sha256_block_data_order'
arch/arm64/crypto/sha2-ce-glue.o: In function `sha256_base_do_finalize':
/home/shpark/git.kernel.org/arm64/linux/./include/crypto/sha256_base.h:111: undefined reference to `sha256_block_data_order'
/home/shpark/git.kernel.org/arm64/linux/./include/crypto/sha256_base.h:111:(.text+0x4ec): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `sha256_block_data_order'
/home/shpark/git.kernel.org/arm64/linux/./include/crypto/sha256_base.h:106: undefined reference to `sha256_block_data_order'
/home/shpark/git.kernel.org/arm64/linux/./include/crypto/sha256_base.h:106:(.text+0x598): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `sha256_block_data_order'
arch/arm64/crypto/sha2-ce-glue.o: In function `sha256_base_do_update':
/home/shpark/git.kernel.org/arm64/linux/./include/crypto/sha256_base.h:82: undefined reference to `sha256_block_data_order'
/home/shpark/git.kernel.org/arm64/linux/./include/crypto/sha256_base.h:82:(.text+0x694): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `sha256_block_data_order'
arch/arm64/crypto/sha2-ce-glue.o:/home/shpark/git.kernel.org/arm64/linux/./include/crypto/sha256_base.h:75: more undefined references to `sha256_block_data_order' follow
arch/arm64/crypto/sha2-ce-glue.o: In function `sha256_base_do_update':
/home/shpark/git.kernel.org/arm64/linux/./include/crypto/sha256_base.h:75:(.text+0x6cc): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `sha256_block_data_order'
arch/arm64/crypto/sha2-ce-glue.o: In function `sha256_base_do_finalize':
/home/shpark/git.kernel.org/arm64/linux/./include/crypto/sha256_base.h:111:(.text+0x79c): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `sha256_block_data_order'
/home/shpark/git.kernel.org/arm64/linux/./include/crypto/sha256_base.h:106:(.text+0x908): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `sha256_block_data_order'
arch/arm64/crypto/sha256-glue.o: In function `sha256_base_do_update':
/home/shpark/git.kernel.org/arm64/linux/./include/crypto/sha256_base.h:82:(.text+0x158): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `sha256_block_data_order'
/home/shpark/git.kernel.org/arm64/linux/./include/crypto/sha256_base.h:75:(.text+0x190): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `sha256_block_data_order'
arch/arm64/crypto/sha256-glue.o: In function `sha256_base_do_finalize':
/home/shpark/git.kernel.org/arm64/linux/./include/crypto/sha256_base.h:111:(.text+0x218): additional relocation overflows omitted from the output
arch/arm64/crypto/sha256-glue.o: In function `sha256_base_do_update':
/home/shpark/git.kernel.org/arm64/linux/./include/crypto/sha256_base.h:82: undefined reference to `sha256_block_neon'
/home/shpark/git.kernel.org/arm64/linux/./include/crypto/sha256_base.h:75: undefined reference to `sha256_block_neon'
/home/shpark/git.kernel.org/arm64/linux/./include/crypto/sha256_base.h:75: undefined reference to `sha256_block_data_order'
arch/arm64/crypto/sha256-glue.o: In function `sha256_base_do_finalize':
/home/shpark/git.kernel.org/arm64/linux/./include/crypto/sha256_base.h:111: undefined reference to `sha256_block_neon'
/home/shpark/git.kernel.org/arm64/linux/./include/crypto/sha256_base.h:111: undefined reference to `sha256_block_data_order'
/home/shpark/git.kernel.org/arm64/linux/./include/crypto/sha256_base.h:106: undefined reference to `sha256_block_data_order'
/home/shpark/git.kernel.org/arm64/linux/./include/crypto/sha256_base.h:106: undefined reference to `sha256_block_neon'
arch/arm64/crypto/sha256-glue.o: In function `sha256_base_do_update':
/home/shpark/git.kernel.org/arm64/linux/./include/crypto/sha256_base.h:82: undefined reference to `sha256_block_data_order'
/home/shpark/git.kernel.org/arm64/linux/./include/crypto/sha256_base.h:75: undefined reference to `sha256_block_data_order'
arch/arm64/crypto/sha256-glue.o: In function `__ksymtab_sha256_block_data_order':
sha256-glue.c:(___ksymtab+sha256_block_data_order+0x0): undefined reference to `sha256_block_data_order'
Makefile:1021: recipe for target 'vmlinux' failed
make: *** [vmlinux] Error 1
我该如何解决这个问题?我不明白失败的原因;)
谢谢!