Problem, installing pcan driver

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
Torsten Robitzki
Posts: 11
Joined: Mon 23. Nov 2020, 18:09

Problem, installing pcan driver

Post by Torsten Robitzki » Thu 11. Aug 2022, 21:34

Hello,
I try to build and install the pcan driver (8.15.1) on a Docker image:
# uname -a
Linux 685b04ac64b0 5.10.104-linuxkit #1 SMP PREEMPT Thu Mar 17 17:05:54 UTC 2022 aarch64 Linux
The compilation and linking of the driver seems to not cause any problems, but the installation runs into a problem and I have hard times to understand the error message:
# cd /peak-linux-driver-8.15.1 && make -C driver all install
make: Entering directory '/peak-linux-driver-8.15.1/driver'
***
*** Making pcan driver in chardev mode
***
*** Host OS Release=Alpine Linux v3.13.5
*** Host machine kernel version=5.10.104-linuxkit
*** Driver kernel version=5.10.104-linuxkit (5.10.104)
*** Path to kernel sources=/usr/src/linux-headers-5.10.104-linuxkit
*** use KBUILD=yes
*** use DKMS=
*** gcc version=10.2.1
***
make -C /usr/src/linux-headers-5.10.104-linuxkit EXTRA_CFLAGS="-I/peak-linux-driver-8.15.1/driver -DNO_DEBUG -DMODVERSIONS -DNO_PARPORT_SUBSYSTEM -DUSB_SUPPORT -DPCI_SUPPORT -DPCIEC_SUPPORT -DISA_SUPPORT -DNO_DONGLE_SUPPORT -DNO_PCCARD_SUPPORT -DNO_NETDEV_SUPPORT -DNO_RT -Wno-date-time" V=0 modules M=/peak-linux-driver-8.15.1/driver
make[1]: Entering directory '/usr/src/linux-headers-5.10.104-linuxkit'
CC [M] /peak-linux-driver-8.15.1/driver/src/pcan_main.o
CC [M] /peak-linux-driver-8.15.1/driver/src/pcan_fops.o
CC [M] /peak-linux-driver-8.15.1/driver/src/pcan_fifo.o
CC [M] /peak-linux-driver-8.15.1/driver/src/pcan_filter.o
CC [M] /peak-linux-driver-8.15.1/driver/src/pcan_parse.o
CC [M] /peak-linux-driver-8.15.1/driver/src/pcan_sja1000.o
CC [M] /peak-linux-driver-8.15.1/driver/src/pcan_common.o
CC [M] /peak-linux-driver-8.15.1/driver/src/pcan_timing.o
CC [M] /peak-linux-driver-8.15.1/driver/src/pcanfd_core.o
CC [M] /peak-linux-driver-8.15.1/driver/src/pcanfd_ucan.o
CC [M] /peak-linux-driver-8.15.1/driver/src/pcan_usb_core.o
CC [M] /peak-linux-driver-8.15.1/driver/src/pcan_usb.o
CC [M] /peak-linux-driver-8.15.1/driver/src/pcan_usbpro.o
CC [M] /peak-linux-driver-8.15.1/driver/src/pcanfd_usb.o
CC [M] /peak-linux-driver-8.15.1/driver/src/pcan_pci.o
CC [M] /peak-linux-driver-8.15.1/driver/src/pcanfd_pci.o
CC [M] /peak-linux-driver-8.15.1/driver/src/pcan_pci_spi.o
CC [M] /peak-linux-driver-8.15.1/driver/src/pcan_pciec.o
CC [M] /peak-linux-driver-8.15.1/driver/src/pcan_isa.o
LD [M] /peak-linux-driver-8.15.1/driver/pcan.o
MODPOST /peak-linux-driver-8.15.1/driver/Module.symvers
CC [M] /peak-linux-driver-8.15.1/driver/pcan.mod.o
LD [M] /peak-linux-driver-8.15.1/driver/pcan.ko
make[1]: Leaving directory '/usr/src/linux-headers-5.10.104-linuxkit'
mkdir -p /usr/local/bin
cp -f udev/pcan_usb_minor_check.bash /usr/local/bin
chmod 744 /usr/local/bin/pcan_usb_minor_check.bash
cp -f udev/45-pcan.rules /etc/udev/rules.d
Info: Copied 45-pcan.rules to /etc/udev/rules.d.
cp -f udev/blacklist-peak.conf /etc/modprobe.d
chmod 644 /etc/modprobe.d/blacklist-peak.conf
Info: mainline drivers removed and blacklisted in
/etc/modprobe.d/blacklist-peak.conf
udevadm control --reload-rules
make: *** [Makefile:683: install_udev] Error 2
make: Leaving directory '/peak-linux-driver-8.15.1/driver'
According to the error message, there should be a problem in line 683 of driver/Makefile:

Code: Select all

	kvernum=$(KVERNUM);\
	for m in $(shell awk '/^blacklist/ { print $$2 }' udev/blacklist-peak.conf); do\
		if [ $$m = "peak_pci" ] && [ $$kvernum -lt 30400 ]; then\
			peak_pci=`lsmod | grep -ce peak_pci`;\  <------- Line 683
		else\
			rmmod $$m 2> /dev/null;\
		fi;\
	done;\
	if [ $$peak_pci -ne 0 ]; then\
		echo "Info: peak_pci can't be removed from the Kernel";\
		echo "      You should reboot to complete the installation.";\
	fi
	cp -f udev/blacklist-peak.conf $(shell dirname $(MODCONF))
But the output `chmod 644 /etc/modprobe.d/blacklist-peak.conf` suggests, that the loop was finished. Any idea, what the problem here could be?

TIA
Torsten

M.Maidhof
Support
Support
Posts: 1751
Joined: Wed 22. Sep 2010, 14:00

Re: Problem, installing pcan driver

Post by M.Maidhof » Fri 12. Aug 2022, 10:38

Hi,

it is not a good idea to do all the commands in just one call, because to install the driver you need admin rights. So please try:

make clean
make
sudo make install
sudo modprobe pcan

It could also be related to your docker image, but than we could not really help here.

regards

Michael

Torsten Robitzki
Posts: 11
Joined: Mon 23. Nov 2020, 18:09

Re: Problem, installing pcan driver

Post by Torsten Robitzki » Fri 12. Aug 2022, 14:15

well, when executing `make`, one of the examples fail due to missing `<popt.h>` header. As I don't care about the examples, I was trying to just build _and_ install the driver (so that I would be able to build the libpcanbasic library [to be able to build my application])

My original hope was, that someone of you could tell me, what went wrong in the make file, so that I could try to find a workaround. In the end, I want just use Docker to cross build Linux binaries on my Mac build machine. (sudo is not required, as the user has all rights)

M.Maidhof
Support
Support
Posts: 1751
Joined: Wed 22. Sep 2010, 14:00

Re: Problem, installing pcan driver

Post by M.Maidhof » Fri 12. Aug 2022, 15:46

well, it was not visible for me that you are working as su....

Please see info in the manual of the driver, you have to install libpopt-dev to be able to make all of the examples.

Maybe you could use a VM like VirtualBox on your system instead of a docker image.

regards

Michael

Torsten Robitzki
Posts: 11
Joined: Mon 23. Nov 2020, 18:09

Re: Problem, installing pcan driver

Post by Torsten Robitzki » Fri 12. Aug 2022, 16:18

Yes, I've read the predicates for the examples. But: I don't want to build the examples! I would like to build _and_ install the driver. If there is a problem with the examples, then I do not care, because I don't need the examples.

The problem is, that the given Makefile is not able to install the driver without reporting an error. I would like to understand, why your driver/Makefile is running into a problem while installing the driver. If I'm able to understand the problem, I probably could find a workaround.

Anyway, currently I just ignore the reported problems. The required files are stored where I would expect them (especially the pcan.h header required by the build of the libpcanbase library).

M.Maidhof
Support
Support
Posts: 1751
Joined: Wed 22. Sep 2010, 14:00

Re: Problem, installing pcan driver

Post by M.Maidhof » Mon 15. Aug 2022, 08:58

Hi,

good to here that you were able to manage the problems by yourself.

regards

Michael

Post Reply