如果修改makefile
把KERNELDIR := /lib/modules/$(shell uname -r)/build
改成:KERNELDIR ?=$(KERNEL_DIR)
则编译报错:
build driver module: ch9344
rm -rf *.mk .tmp_versions Module.symvers *.mod.c *.o *.ko .*.cmd Module.markers modules.order
make -C /home/vm/rk/project/firefly-sdk/rk3328_drv/../kernel M=/home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344
make[1]: Entering directory '/home/vm/rk/project/firefly-sdk/kernel'
LD /home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344/built-in.o
CC [M] /home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344/ch934x.o
/home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344/ch934x.c: In function 'ch934x_tty_ioctl':
/home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344/ch934x.c:1395:16: warning: unused variable 'flags' [-Wunused-variable]
error, forbidden warning:ch934x.c:1395
unsigned long flags;
^~~~~
At top level:
/home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344/ch934x.c:2202:12: warning: 'ch934x_reset_resume' defined but not used [-Wunused-function]
error, forbidden warning:ch934x.c:2202
static int ch934x_reset_resume(struct usb_interface *intf)
^~~~~~~~~~~~~~~~~~~
/home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344/ch934x.c:2142:12: warning: 'ch934x_suspend' defined but not used [-Wunused-function]
error, forbidden warning:ch934x.c:2142
static int ch934x_suspend(struct usb_interface *intf, pm_message_t message)
^~~~~~~~~~~~~~
/home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344/ch934x.c:1158:13: warning: 'ch934x_tty_unthrottle' defined but not used [-Wunused-function]
error, forbidden warning:ch934x.c:1158
static void ch934x_tty_unthrottle(struct tty_struct *tty)
^~~~~~~~~~~~~~~~~~~~~
/home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344/ch934x.c:1148:13: warning: 'ch934x_tty_throttle' defined but not used [-Wunused-function]
error, forbidden warning:ch934x.c:1148
static void ch934x_tty_throttle(struct tty_struct *tty)
^~~~~~~~~~~~~~~~~~~
/home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344/ch934x.c:219:12: warning: 'ch934x_cmd_in' defined but not used [-Wunused-function]
error, forbidden warning:ch934x.c:219
static int ch934x_cmd_in(struct ch934x *ch934x,
^~~~~~~~~~~~~
/home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344/ch934x.c:154:12: warning: 'ch934x_control_out' defined but not used [-Wunused-function]
error, forbidden warning:ch934x.c:154
static int ch934x_control_out(struct ch934x *ch934x, u8 request,
^~~~~~~~~~~~~~~~~~
scripts/Makefile.build:283: recipe for target '/home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344/ch934x.o' failed
make[2]: *** [/home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344/ch934x.o] Error 1
Makefile:1479: recipe for target '_module_/home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344' failed
make[1]: *** [_module_/home/vm/rk/project/firefly-sdk/rk3328_drv/ch9344] Error 2
make[1]: Leaving directory '/home/vm/rk/project/firefly-sdk/kernel'
Makefile:5: recipe for target 'default' failed
make: *** [default] Error 2