Installing on Linux
We recommend that you install the drivers first, then the Kvaser CANlibSDK, and last install the hardware.
The latest versions of documentation, software and drivers can be downloaded for free at www.kvaser.com/download.
Installing the Driver
System requirements:
- Linux kernel version 4.15 or later
- Header files and compiler for kernel compilation.
- pkg-config
In Ubuntu e.g. installing header files is accomplished by issuing the command:
On some systems you may need to install the Linux headers using something like:
- Note
- Having versions of the Linux headers installed other than that of the currently running kernel may cause conflicts and faulty drivers.
To download and unpack the latest drivers you may use:
- Note
- Choose a path that doesn't contain any spaces for CANlib to build properly.
Option 1. Manually build and install drivers
To build (compile) all drivers use:
- Note
- It is advised to remove the old driver by calling
sudo make uninstallbefore replacing the installed drivers.
To install all drivers, canlib and linlib use:
To install and load, virtual and PCI drivers:
- Note
- Running
sudo make loadwill also cause the virtual and PCI drivers to be loaded at boot time. This might be bad if experimenting with the device drivers. - It is never required to manually install or load any modules, create or edit files. This is taken care of the Makefile, in the root of the linuxcan directory.
Option 2. Build and install drivers using DKMS
Alternatively, drivers can be installed using DKMS which automatically recompiles and reinstalles the CANlib drivers after a kernel upgrade. In order to use DKMS, the same version of Linux kernel package as your kernel version needs to be installed. On Ubuntu, the correct kernel header version can be installed by:
To install DKMS on Ubuntu:
To build a DKMS tarball, use:
To add and install all drivers, canlib and linlib using DKMS:
- Note
- Running dkms_install removes all previously installed CANlib DKMS modules for all kernel versions
To list all managed DKMS modules, versions and kernels within the tree as well as whether they have been added, built or installed, use:
The example output is taken from a computer running Ubuntu 16.04.7 LTS.
More information can be found in the included README file.
Installing Virtual Devices
The driver named "virtualcan" controls the Virtual Devices. The number of channels each Virtual Device has, and the total number of Virtual Devices, is controlled by editing define statements in linuxcan\virtualcan\virtualcan.h.
Removing the driver
Option 1. Removing manually installed driver
To unload and uninstall all drivers, canlib and linlib:
Alternatively, if there are multiple versions of the drivers installed, all of them can be removed using:
Option 2. Removing drivers installed using DKMS
To remove the installed CANlib DKMS module for all kernel versions, along with canlib and linlub, use:
Installing Kvaser CANlib SDK
System requirements:
- The package libxml2-dev is needed in order to build kvamemolibxml.
- The package zlib1g-dev is needed to build kvlclib.
To download and unpack the latest version of Linux SDK library use:
To build everything, run
To run self-tests, run
To install everything, run
Removing Kvaser CANlib SDK
To uninstall everything, run