编译命令:

./build.sh --product-name rk3568 --ccache --no-prebuild-sdk --enable_notice_collection=false --gn-args build_product_type=DEBUG --gn-args load_test_config=false

在编译到内核时可能会报如下错误:

  GEN     .tmp_initcalls.lds
  LTO     vmlinux.o
  MODPOST vmlinux.symvers
WARNING: modpost: vmlinux.o(___ksymtab_gpl+rockchip_clk_register_armclk+0x0): Section mismatch in reference from the variable __ksymtab_rockchip_clk_register_armclk to the function .init.text:rockchip_clk_register_armclk()
The symbol rockchip_clk_register_armclk is exported and annotated __init 
Fix this by removing the __init annotation of rockchip_clk_register_armclk or drop the export.

  MODINFO modules.builtin.modinfo
  GEN     modules.builtin
  LD      .tmp_vmlinux.btf
ld.lld: error: undefined symbol: __aarch64_cas4_acq_rel
>>> referenced by hdf_vnode_adapter.c:294 (/home/smile/OpenHarmony-v4.1.1-Release/out/kernel/OBJ/linux-5.10/../../../../drivers/hdf_core/framework/core/adapter/vnode/src/hdf_vnode_adapter.c:294)
>>>               vmlinux.o:(HdfVNodeAdapterIoctl)
>>> referenced by hdf_vnode_adapter.c:303 (/home/smile/OpenHarmony-v4.1.1-Release/out/kernel/OBJ/linux-5.10/../../../../drivers/hdf_core/framework/core/adapter/vnode/src/hdf_vnode_adapter.c:303)
>>>               vmlinux.o:(HdfVNodeAdapterIoctl)
>>> referenced by hdf_vnode_adapter.c:428 (/home/smile/OpenHarmony-v4.1.1-Release/out/kernel/OBJ/linux-5.10/../../../../drivers/hdf_core/framework/core/adapter/vnode/src/hdf_vnode_adapter.c:428)
>>>               vmlinux.o:(HdfDeviceSendEventToClient)
>>> referenced 1 more times
  BTF     .btf.vmlinux.bin.o
pahole: .tmp_vmlinux.btf: No such file or directory
  LD      .tmp_vmlinux.kallsyms1
ld.lld: error: .btf.vmlinux.bin.o: unknown file type
make[2]: *** [/home/smile/OpenHarmony-v4.1.1-Release/out/kernel/src_tmp/linux-5.10/Makefile:1225: vmlinux] Error 1
make[1]: *** [arch/arm64/Makefile:208: rk3568-toybrick-x0-linux.img] Error 2
make[1]: Leaving directory '/home/smile/OpenHarmony-v4.1.1-Release/out/kernel/OBJ/linux-5.10'
make: *** [Makefile:192: __sub-make] Error 2

解决方法:

vim kernel/linux/patches/linux-5.10/rk3568_patch/kernel.patch

找到 +MAKE="make LLVM=1 LLVM_IAS=1 CROSS_COMPILE=aarch64-linux-gnu-" ,删除掉CROSS_COMPILE=aarch64-linux-gnu-

其它解决方法可以尝试:rk3568 arm、arm64编译失败undefined symbol: __aarch64_cas4_acq_rel · Issue #I6VB7R · OpenHarmony/build - Gitee.com

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部