Dear all,
I would like to request help and advices on how to compile a specific driver kernel module on Venus.
I have a Usb2CanV2.0 interface from IXXAT and already successfully compiled and operated the socketcan driver on a regular Debian (Linux 4.9) as well as the latest Raspbian (Linux >5.6).
Data about this product and driver source can be found as follows:
- https://www.ixxat.com/products/products-industrial/can-interfaces/usb-can-interfaces/usb-to-can-v2-professional?ordercode=1.01.0281.12001
- https://cdn.hms-networks.com/docs/librariesprovider8/ixxat-english-new/pc-can-interfaces/linux-drivers/socketcan-linux.zip?sfvrsn=3eb48d7_10
In order to compile for Venus (installed on a RaspberryPi V3B+), I have downloaded and installed the SDK according to instructions provided (https://github.com/victronenergy/venus/wiki/howto-install-and-use-the-sdk) and tested compilation and execution of the 'helloworld.c' test code.
My main issues regarding the compilatoin of the kernel module are the modification of the MakeFile and the location of the usual kernel headers for venus:
- Calling make as usual enter path '/usr/src/linux-headers-4.9.0-9-amd64' rather than '/opt/venus/current/sysroots/cortexa7hf-neon-vfpv4-ve-linux-gnueabi' and calls the host linux gcc and libs rather than the SDK toolchain...
- Trying to compile directly throw errors:
$CC ixx_usb_v2.c ixx_usb_v2.c:18:10: fatal error: linux/usb.h: No such file or directory #include <linux/usb.h> ^~~~~~~~~~~~~ compilation terminated
Trying to locate the usb.h thanks to a classic find command was unsuccessful : ./usr/include/pcap/usb.h which has nothing to do with the necessary one linux/usb.h
For information, here is the Makefile
mod-name += ixx_usb obj-m += ixx_usb.o ixx_usb-objs := ixx_usb_v2.o ixx_usb_fd.o ixx_usb_core.o all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean install: mkdir -p /lib/modules/$(shell uname -r)/kernel/drivers/net/can/usb/ixxat/ install $(mod-name).ko /lib/modules/$(shell uname -r)/kernel/drivers/net/can/usb/ixxat/ depmod -a modprobe $(mod-name) uninstall: rm -f /lib/modules/$(shell uname -r)/kernel/drivers/net/can/usb/ixxat/$(mod-name).ko modprobe -r $(mod-name) depmod -a
I would be very grateful if someone (maybe @mvader (Victron Energy)) could provide some guidance on how to progress on this subject.
Best regards,
Xavier