Page 1 of 1

Pcan adapter with docker container, set KERNEL_LOCATION variable to the root directory of your own built kernel

Posted: Thu 22. Jul 2021, 16:37
by jwillnetwork

Code: Select all

FROM amd64/python:3.7-slim-buster

WORKDIR /app

ADD cisco_umbrella_root_ca.crt /usr/local/share/ca-certificates/cisco_umbrella_root_ca.crt

RUN chmod 644 /usr/local/share/ca-certificates/cisco_umbrella_root_ca.crt && update-ca-certificates

RUN apt-get update

RUN apt-get install make -y

#RUN apt-get install linux-headers -y

RUN apt-get install -y --no-install-recommends software-properties-common

RUN apt-get -y install sudo

RUN sudo apt-get install -y --no-install-recommends gcc make python3-dev

#RUN pip install psutil --cert="/usr/local/share/ca-certificates/cisco_umbrella_root_ca.crt"

#RUN pip3 install ptvsd==4.1.3 --cert="/usr/local/share/ca-certificates/cisco_umbrella_root_ca.crt"

#COPY requirements.txt ./

#RUN pip3 install -r requirements.txt --cert="/usr/local/share/ca-certificates/cisco_umbrella_root_ca.crt"

#RUN pip3 install j1939 --cert="/usr/local/share/ca-certificates/cisco_umbrella_root_ca.crt"

#RUN pip3 install cantools --cert="/usr/local/share/ca-certificates/cisco_umbrella_root_ca.crt"

#RUN pip3 install aio-timers --cert="/usr/local/share/ca-certificates/cisco_umbrella_root_ca.crt"

RUN pip install psutil 

RUN pip3 install ptvsd==4.1.3 

COPY requirements.txt ./

RUN pip3 install -r requirements.txt 

RUN pip3 install j1939 

RUN pip3 install cantools 

RUN pip3 install aio-timers

#RUN apt-get install udev

#RUN apt-get install kmod

RUN mkdir -p /temp/peak-linux-driver-8.12.0

ADD peak-linux-driver-8.12.0 /temp/peak-linux-driver-8.12.0

WORKDIR /temp/peak-linux-driver-8.12.0/driver

RUN sudo make clean

#RUN make

RUN make install

RUN modprobe pcan

WORKDIR /app

COPY . .

CMD [ "python3", "-u", "./main.py" ]
There's my dockerfile to run the peak adapter in a docker container running ubuntu 18.04. The error is "Makefile:129 *** Unable to automatically find the kernel headers. These are mandatory to build the pcan driver. Please set the KERNEL_LOCATION variable to the root directory of your own built kernel."

What should I do next?

Re: Pcan adapter with docker container, set KERNEL_LOCATION variable to the root directory of your own built kernel

Posted: Fri 23. Jul 2021, 08:27
by M.Heidemann
Hello,

We do not use Docker and cannot support Docker environments,
however it seems like the installation of kernel-headers is commented out:

Code: Select all

#RUN apt-get install linux-headers -y
As the error-message clearly states, these are required to build the PCAN-Linux driver.

Try to have your docker container setup with kernel-headers installed and try again.

Please also note the requirements mentioned in the PCAN-Linux documentation, chapter "2.2 - System Requirements":

http://www.peak-system.com/fileadmin/me ... an_eng.pdf

Please report back to us if this has resolved your issue.

Best Regards

Marvin

Re: Pcan adapter with docker container, set KERNEL_LOCATION variable to the root directory of your own built kernel

Posted: Mon 2. Aug 2021, 19:19
by jwillnetwork
Getting the can messages over socketcan worked instead of pcan_usb using the docker container.

During device setup in the container this code was used:
self.ecu.connect(bustype='socketcan', channel='can0')
#self.ecu.connect(bustype='pcan', channel='PCAN_USBBUS1', bitrate=250000)

Running this script on the device before container deployment allowed the messages to be uploaded:
sudo modprobe peak-usb
sudo ip link set can0 up type can bitrate 250000
sudo ip link set up can0

Re: Pcan adapter with docker container, set KERNEL_LOCATION variable to the root directory of your own built kernel

Posted: Tue 3. Aug 2021, 08:05
by M.Heidemann
Hello,

Thank you for your feedback!

Best Regards

Marvin