Slcan module on Jetson

Hello, I have been trying to get the SLCAN kernel module working on my jetson orin nano running Jetpack 6.2. First I tried follow the instruction from this post. After building with the same kernel version build attempting to modprobe the slcan module let to an error similar to the one in this Ubuntu forum post. Implying that the module was compiled for a different version. However the kernel unames matched exactly.

Next I attempted to follow these instructions(specifically building the kernel and to prepare a Kernel source tree that is not built.). After successfully compiling the kernel with the SLCAN module included in the config I used the flash script to flash the Jetson Orin Nano. The flash was successful but running lsmod revealed that SLCAN was not loaded but all other expected modules were. Attempting to modprobe the module lead to the same exec format error.

What can I do to include the SLCAN module into my Jetson Image successfully?

1 Like

Hi @ckiw23

Can you provide me the SLCAN kernel module source file name? I have been trying to find it on JP 6.2 but I haven’t found it yet. With this, I can be able to set the module into your device.

Thanks,

Ricardo González Víquez
Embedded SW Engineer at RidgeRun
Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com
Website: www.ridgerun.com

Thank you for responding Ricardo. I’m not entirely sure what you are asking for but If i’m understanding correctly it is called slcan.c. It is located in after extracting.

/Linux_for_Tegra/source/kernel/kernel-jammy-src/drivers/net/can

Please let me know if this actually answers your question. I have limited experience with kernel modules.

Hi ckiw23,

Are you using the devkit or custom board for Orin Nano?

Please share the result of the following command on your board.

$ zcat /proc/config.gz | grep -E "CONFIG_CAN_SLCAN|CONFIG_TTY"

and check if it can work with the following commands.

$ sudo apt-get install can-utils
$ sudo modprobe can
$ sudo modprobe can_raw
$ sudo modprobe slcan

Hello Kevin,
We are using the devkit.

CONFIG_CAN_SLCAN is not set
CONFIG_TTY=y

I assume this means the kernel compilation wasn’t properly set up.

modprobe: ERROR: could not insert 'slcan': Exec format error

we were not able to setup the can bus after this.

Thank you

Yes, please configure CONFIG_CAN_SLCAN=y or m in kernel conifg(defconfig) of kernel source.

You can refer to Kernel Customization — NVIDIA Jetson Linux Developer Guide 1 documentation to sync and build kernel.

I built a kernel but when I used it to flash my Jetson I Got an several errors that seem to be from kernel modules and the Jetson did not boot

Sorry for a picture of the screen I didn’t have a way to get a log.

Does this help determine what went wrong in my build process?

Please share the full steps how did you update kernel config and build kernel image.

From your picture, it seems SD can not be found and it enters in to recovery kernel.
We need to check the full serial console log. You can refer to the following instruction to capture them on the devkit.
Jetson Nano & NX Style - Serial Debug Console - JetsonHacks

I got the kernel by dowloading the Jetson_Linux_R36.4.3_aarch64.tbz2 file from the jetson downloads page. I then extracted it and used source sync with the tag from the release notes.

after sourcing

to update the kernel config I went into /Linux_for_Tegra/source/kernel/kernel-jammy-src/arch/arm64/configs and added the two following lines to the defconfig file.

CONFIG_CAN_SLCAN=m
CONFIG_TTY=y

I then followed the build instructions that you sent except I ommited the out of tree modules. to get the /rootfs folder I downloaded the sample filesystem and extracted it to /rootfs in accordance with the readme I found there.

Next I followed this page to flash my image to the jetson sd. Specifically the Basic Flashing Procedures.

After flashing I got the error in the attached log/shown above.

thank you for your continued assistance.

Since you built it as a kernel module, do you get slcan.ko in output directory?

Do you perform the following steps?

Run the following commands to install the kernel and in-tree modules:
$ export INSTALL_MOD_PATH=<install-path>/Linux_for_Tegra/rootfs/
$ sudo -E make install -C kernel
$ cp kernel/kernel-jammy-src/arch/arm64/boot/Image \
  <install-path>/Linux_for_Tegra/kernel/Image

Actually no slcan.ko did not appear in the output kernel directory in the root file system. I didn’t see that before. I did run the steps you posted. I just rechecked that the defconfig still contains the lines I added and it does.

I’m not really familiar with building the Linux kernel should I have changed the defconfig differently? I just added the lines for the components with a text editor.

I think it should be included under the folder you build the kernel source.
Please run the following command to search it.

$ cd <Linux_for_Tegra>/source
$ sudo find -name slcan.ko

Alternative, you can try to build it into kernel image through specifying CONFIG_CAN_SLCAN=y in defconfig.
In this way, it should be included in the kernel image(Image).

Ok so I rebuilt the Kernel with

CONFIG_CAN_SLCAN=y

and the Jetson booted with the attached log but when I run lsmod there is not a single kernel module listed.

It seems the file you updated can not be accessed from me.
Please upload the log as simple text file here and share the result of lsmod|grep slcan on your board.