当我移植ethercat到orin平台,从其官网下载ethercat-stable-1.5版本,编译etherCat所支持设备的内核模块,发现好多编译报错,提示jeston的内核缺少一些头文件。而其他芯片平台同版本Kernel-5.10是包含这些缺失的文件,您是否能帮忙看下需要如何解决。
注:orin的bsp源码包是从nvida官网下载,链接Jetson Linux 35.1 | NVIDIA Developer, 执行./nvbuild.sh -o $PWD/kernel_out可以编译内核OK。
编译ethercat设备内核模块报错如下:
ethercat-stable-1.5$ make ARCH=arm64 CROSS_COMPILE=/home/pd/seagate/nvida/l4t_gcc/bin/aarch64-buildroot-linux-gnu- -j 4 modules
make -C “/home/pd/seagate/nvida/Linux_for_Tegra/source/public/kernel/kernel-5.10” M=“/home/pd/seagate/nvida/ethercat/ethercat-stable-1.5” INSTALL_MOD_DIR=“ethercat” modules
make[1]: 进入目录“/home/pd/seagate/nvida/Linux_for_Tegra/source/public/kernel/kernel-5.10”
arch/arm64/Makefile:33: LSE atomics not supported by binutils
arch/arm64/Makefile:44: Detected assembler with broken .inst; disassembly will be unreliable
CC [M] /home/pd/seagate/nvida/ethercat/ethercat-stable-1.5/master/cdev.o
CC [M] /home/pd/seagate/nvida/ethercat/ethercat-stable-1.5/master/coe_emerg_ring.o
CC [M] /home/pd/seagate/nvida/ethercat/ethercat-stable-1.5/examples/mini/mini.o
CC [M] /home/pd/seagate/nvida/ethercat/ethercat-stable-1.5/devices/igb/e1000_82575-5.10-ethercat.o
In file included from ./include/linux/types.h:6,
from ./include/linux/list.h:5,
from ./include/linux/module.h:12,
from /home/pd/seagate/nvida/ethercat/ethercat-stable-1.5/master/cdev.c:35:
./include/uapi/linux/types.h:5:10: 致命错误: asm/types.h:没有那个文件或目录
5 | include <asm/types.h>
| ^~~~~~~~~~~~~
编译中断。
In file included from ./include/asm-generic/bug.h:5,
from ./arch/arm64/include/asm/bug.h:26,
from ./include/linux/bug.h:5,
from ./include/linux/mmdebug.h:5,
from ./include/linux/gfp.h:5,
from ./include/linux/slab.h:15,
from /home/pd/seagate/nvida/ethercat/ethercat-stable-1.5/master/coe_emerg_ring.c:38:
./include/linux/compiler.h:248:10: 致命错误: asm/rwonce.h:没有那个文件或目录
248 | include <asm/rwonce.h>
| ^~~~~~~~~~~~~~
编译中断。
/home/pd/seagate/nvida/ethercat/ethercat-stable-1.5/examples/mini/mini.c:30:10: 致命错误: linux/version.h:没有那个文件或目录
30 | include <linux/version.h>
| ^~~~~~~~~~~~~~~~~
编译中断。
make[3]: *** [scripts/Makefile.build:281:/home/pd/seagate/nvida/ethercat/ethercat-stable-1.5/master/cdev.o] 错误 1
make[3]: *** 正在等待未完成的任务…
make[3]: *** [scripts/Makefile.build:281:/home/pd/seagate/nvida/ethercat/ethercat-stable-1.5/master/coe_emerg_ring.o] 错误 1
make[2]: *** [scripts/Makefile.build:498:/home/pd/seagate/nvida/ethercat/ethercat-stable-1.5/master] 错误 2
make[2]: *** 正在等待未完成的任务…
make[4]: *** [scripts/Makefile.build:281:/home/pd/seagate/nvida/ethercat/ethercat-stable-1.5/examples/mini/mini.o] 错误 1
make[3]: *** [scripts/Makefile.build:498:/home/pd/seagate/nvida/ethercat/ethercat-stable-1.5/examples/mini] 错误 2
查找orin的Kernel-5.10,包含arm版本,但无arm64的asm/types.h文件,
nvida/Linux_for_Tegra/source/public/kernel/kernel-5.10$ find ./ -name types.h
./tools/testing/selftests/rcutorture/formal/srcu-cbmc/empty_includes/uapi/linux/types.h
./tools/testing/selftests/rcutorture/formal/srcu-cbmc/include/linux/types.h
./tools/include/linux/types.h
./tools/include/uapi/linux/types.h
./arch/arm/include/uapi/asm/types.h
./arch/s390/include/asm/fpu/types.h
./arch/s390/include/uapi/asm/types.h
./arch/sh/include/asm/types.h
./arch/parisc/include/uapi/asm/types.h
./arch/mips/include/asm/fw/arc/types.h
./arch/mips/include/asm/types.h
./arch/mips/include/asm/sn/types.h
./arch/mips/include/uapi/asm/types.h
./arch/powerpc/include/asm/types.h
./arch/powerpc/include/uapi/asm/types.h
./arch/powerpc/boot/types.h
./arch/ia64/include/asm/types.h
./arch/ia64/include/uapi/asm/types.h
./arch/alpha/include/asm/types.h
./arch/alpha/include/uapi/asm/types.h
./arch/x86/include/asm/fpu/types.h
./arch/x86/include/asm/e820/types.h
./arch/xtensa/include/uapi/asm/types.h
./include/linux/iio/types.h
./include/linux/types.h
./include/linux/sched/types.h
./include/linux/ceph/types.h
./include/linux/sunrpc/types.h
./include/uapi/asm-generic/types.h
./include/uapi/linux/iio/types.h
./include/uapi/linux/types.h
./include/uapi/linux/sched/types.h
./fs/ntfs/types.h
./drivers/net/wireless/broadcom/brcm80211/brcmsmac/types.h
./drivers/net/wireless/marvell/libertas/types.h
./drivers/net/fddi/skfp/h/types.h
./net/batman-adv/types.h
而其他平台同版本内核Kernel-5.10包含arm64版本此问题: