Unable to use peak-linux-driver with RT kernel built from source

I was able to compile peak-linux-driver on Jetson Orin 5.10.104-tegra, and the PCAN driver works as expected.

I was also able to compile peak-linux-driver on Jetson Orin 5.10.104-rt-tegra with kernel_out built from source (as the server for r35.1 does not contain rt-header). But the PCAN driver did not work as expected, and output when sudo dmesg | grep pcan:

[   12.008694] pcan: loading out-of-tree module taints kernel.
[   12.009139] pcan: module verification failed: signature and/or required key missing - tainting kernel
[   12.009231] pcan: Unknown symbol alloc_canfd_skb (err -2)
[   12.009272] pcan: Unknown symbol open_candev (err -2)
[   12.009306] pcan: Unknown symbol alloc_can_skb (err -2)
[   12.009309] pcan: Unknown symbol unregister_candev (err -2)
[   12.009319] pcan: Unknown symbol can_change_mtu (err -2)
[   12.009336] pcan: Unknown symbol alloc_candev_mqs (err -2)
[   12.009372] pcan: Unknown symbol close_candev (err -2)
[   12.009389] pcan: Unknown symbol can_bus_off (err -2)
[   12.009439] pcan: Unknown symbol register_candev (err -2)

Wonder if anyone has a way to get it installed successfully?

Hi,
We don’t have experience about using peak-linux-driver. Please share more information about it, such as purpose of enabling it.

Hi DaneLLL,

Thanks for the fast response!

The purpose:

We (Our academic research group) need to use Jetson Orin to talk to Barrett WAM Arm via SocketCAN, to form a low latency vision control loop with the controller.
Motivation:
The simplest way that we always did was to plug-in the peak-usb-can dongle with our old intel PCs with RT kernel.
With non-RT kernel on Jetson, we were able to compile and use linux driver with NETDEV. But soon we noticed some jittering motion, since the hardware is running control loop on the PC through direct socket CAN comm. (Their documentation mentioned the interrupt happened during the driver time may cause jittering.)
To note, ROS node (wrapper) was used, and jittering motion was noticed.

Specs:

Jetpack: r35.1 GA
OS: 20.04
ROS: Noetic
Platform: Jetson Orin 32Gb 12-core

Procedure I did:

  • I did cross-compile off the Jetson board as well
  • Here, I will show direct compile on the Jetson board for simplicity:
  1. Compile custom kernel:

    1. In your browser, go to Jetson Linux Archive | NVIDIA Developer.

    2. Locate and download the Jetson Linux source files for your release.

    3. Extract the .tbz2 file:

      $ tar -xjf public_sources.tbz2
      
    4. Extract the kernel source file:

      $ cd Linux_for_Tegra/source/public
      $ export TEGRA=$HOME/{somewhere}/Linux_for_Tegra/source/public
      $ tar –xjf kernel_src.tbz2
      

      This extracts the kernel source to the kernel/subdirectory.

    5. Apply RT Kernel:

      $ cd $TEGRA/kernel
      $ ./kernel-5.10/scripts/rt-patch.sh apply-patches
      ### OUTPUT:
      #> The PREEMPT RT patches have been successfully applied!
      
    6. :no_entry_sign:(ON NON-Jetson PC) Cross Compile:

      $ export CROSS_COMPILE_AARCH64_PATH=<toolchain-path>
      $ export CROSS_COMPILE_AARCH64=<toolchain-path>/bin/aarch64-buildroot-linux-gnu-
      
    7. Kernel out:

      $ cd {somewhere}/kernel_out
      $ export kernel_out={somewhere}/kernel_out
      
    8. Build:

      $ cd $TEGRA && ./nvbuild.sh -o $kernel_out
      
  2. Apply built to the root:

    1. Replace /boot/Image with a copy of this file:

      # a copy backup:
      $ sudo mv /boot/kernel/Image /boot/kernel/Image.bak.non-rt
      # override:
      $ sudo cp $kernel_out/arch/arm64/boot/Image /boot/kernel/Image
      
    2. Reboot:

      $ sudo reboot 0
      
  3. Compile PCAN with this custom rt-kernel:

    # download driver:
    $ wget https://www.peak-system.com/fileadmin/media/linux/files/peak-linux-driver-8.15.2.tar.gz
    
    # unzip:
    $ tar -xzf peak-linux-driver-8.15.2.tar.gz
    
    # define sth:
    $ export kernel_out=/home/uwarl-orin/JX_Linux/kernel_out
    
    # build driver with netdev and specified kernel:
    # doesnt work: $ make -C driver NET=NETDEV_SUPPORT KERNEL_LOCATION=$kernel_out 
    $ make NET=NETDEV_SUPPORT KERNEL_LOCATION=$kernel_out
    
    # install:
    $ make install KERNEL_LOCATION=$kernel_out
    
    # Reboot and test:
    $ sudo dmesg | grep pcan
    

    :warning: NETDEV support is needed for WAM

    :warning: Kernel location should be the compiled kernel output with RT-kernel, the /usr/src does not contain rt-kernel with custom build

My Questions:

  1. Is there possibly a solution to this issue?
  2. Meanwhile, I am planning to try the CAN directly from the Jetson Orin with the RT kernel, and possibly follow-up here. If this method works, then we can ditch the pcan driver, if it is not supported.
  3. (A minor question:) With SDK flashing tool, I only saw Desktop under the /usr/home/ directory.
  4. With RT-Kernel, my screen appears to have no output on the display. But I was able to ssh and use with xfce through xrdp.

Many Thanks,
Jack

Actually, I think I found the issue and was able to compile correctly without out-of-tree module taints.

I think the kernel header was never installed into the /lib/modules, causing the out-of-tree module to be installed.

Magic solution FYI:

# - copy kernel_out into `/usr/src/{uname -r}`
$ sudo mkdir /usr/src/linux-headers-5.10.104-rt63-tegra-ubuntu20.04_aarch64/
$ cd /usr/src/linux-headers-5.10.104-rt63-tegra-ubuntu20.04_aarch64/
$ mkdir kernel-5.10
$ sudo cp -r $kernel_out kernel-5.10
# - inside `/usr/src/{uname -r}` to install into `/lib/modules`
$ sudo make module_install 
$ ls /lib/modules 
# - expect: 5.10.104-rt63-tegra 
$ sudo mv 5.10.104-rt63/ 5.10.104-rt63-tegra # lets rename the foler instead
# export current kernel
$ export kernel=/usr/src/linux-headers-5.10.104-rt63-tegra-ubuntu20.04_aarch64/kernel-5.10

Install PCAN with rt-tegra:

# download driver:
$ wget https://www.peak-system.com/fileadmin/media/linux/files/peak-linux-driver-8.15.2.tar.gz

# unzip:
$ tar -xzf peak-linux-driver-8.15.2.tar.gz

# build driver with netdev and specified kernel:
$ make -C driver NET=NETDEV_SUPPORT KERNEL_LOCATION=$kernel LOCALVERSION="-tegra"

# install:
$ sudo make install KERNEL_LOCATION=$kernel

# GUCCI
cd ~/libbarrett/scripts && ~/libbarrett/scripts/install_dependencies.sh

$ sudo reboot 0
$ sudo dmesg | grep pcan
1 Like

Just a general comment: I don’t know your particular software, but whenever there is an “Unknown symbol” it means there is a driver or feature missing. You need to find out which feature provides the symbols, and add that. Most of the time this happens when one configures by directly editing the .config file instead of using a configuration editor, but of course if you have out of tree content, then you have to manually figure that out and Kconfig editors won’t do this.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.