在centos7.9.2009精简版中编译ch34x串口驱动出现如题错误,解决方案:
将ch34x.c中的
KERNEL_VERSION(3, 11, 0)
替换为
KERNEL_VERSION(3, 10, 0)
重新make clean、make即可,警告可忽略,编译成功如下图。
[root@192 /opt]# make
make -C /lib/modules/3.10.0-1160.el7.x86_64/build M=/opt
make[1]: 进入目录“/usr/src/kernels/3.10.0-1160.36.2.el7.x86_64”
CC [M] /opt/ch34x.o
/opt/ch34x.c: 在函数‘ch34x_close’中:
/opt/ch34x.c:591:15: 警告:未使用的变量‘wait’ [-Wunused-variable]
wait_queue_t wait;
^
/opt/ch34x.c:590:7: 警告:未使用的变量‘timeout’ [-Wunused-variable]
long timeout;
^
/opt/ch34x.c:589:6: 警告:未使用的变量‘bps’ [-Wunused-variable]
int bps;
^
Building modules, stage 2.
MODPOST 1 modules
CC /opt/ch34x.mod.o
LD [M] /opt/ch34x.ko
make[1]: 离开目录“/usr/src/kernels/3.10.0-1160.36.2.el7.x86_64”