Intel board CAN Bus Driver with insmod

Hi,

This is my first time posting here. I’m a newbie to snapcraft, currently, I’m working on a project that requires me to install the CAN Bus driver to Ubuntu Core 20 with MIO 5373 intel board.

The board I’m using is Advantech’s MIO 5373, the CAN Bus driver source code is given by Advantech so that I can build the external module (can-ahc.ko) against kernel 5.4.0-73-generic. I built the .ko on my vmware’s ubuntu 20.04 against kernel 5.4.0-73-generic and copy it over to my MIO5373 board.

On the board, I tried to use the command below to insmod the can driver but it fails.
sudo modprobe can
sudo modprobe can-raw
sudo modprobe can-dev
sudo insmod can-ahc.ko (Fails here, the ssh terminal broken)

Upon checking “dmesg --follow” on monitor screen, it shows:
[ 393.963039] can: controller area network core (rev 20170425 abi 9)
[ 393.963055] NET: Registered protocol family 29
[ 396.795839] can: raw protocol (rev 20170425)
[ 399.720560] CAN device driver interface
[ 405.609551] can_ahc0512: no symbol version for module_layout
[ 405.612417] can_ahc0512: module verification failed: signature and/or required key missing - tainting kernel
[ 405.612951] RDC CAN: Module_init: platform driver version 5.0
[ 405.612952] RDC CAN: sizeof(char):1 sizeof(int):4 sizeof(long):8
*[ 405.612952] RDC CAN: sizeof(void ):8 sizeof(unsigned long):8
[ 405.612952] RDC CAN: moduleport_init:

It seems like it complains about the version, but the versions between the .ko and core 20’s are the same which is 5.4.0-73-generic. I tried on classic Ubuntu 20.04 (with kernel 5.8.0) and it works flawlessly.

I’m not sure if I’m doing any step wrong, is there a proper way to insmod the vendor’s CAN driver on Ubuntu Core 20?

Thank you!

Please forgive my bad English.

with the introduction of secureboot in UbuntuCore 20 by default for x86 hardware, all kernel modules need to be signed.

i fear the only two options you have here is to either ask the kernel team to include can-ahc in the ubuntu kernel or to get a brand store and maintain your own kernel snap for the hardware…

is the source code for can-ahc anywhere public so a kernel team member could take a look at it ?
also, you should file a bug on launchpad to ask for it:

https://bugs.launchpad.net/ubuntu/+source/linux/+filebug

1 Like

Hi, appreciate your reply.

Here are some questions regarding the options available.

For option 1, how can we ask the kernel team to include can-ahc for us in the Ubuntu kernel in this case, is there any procedure that we can follow to register our CAN driver to become part of the kernel?

For option 2, is there any tutorial on how to maintain own kernel snap? The source code is not openly available but I can share with you the source code for your review. May I know which email address(es) shall I share with? Or you may share your email with me at: tianxun.ng@thermofisher.com.

Thanks!

for option 1 you would file a bug under the URL i gave above and link to the (public) source you would like to have included … then someone from the kernel team would rerview and decide if the quality is suitable for inclusion …

for option 2 you’d clone the ubuntu kernel source, the current tree for the pc-kernel snap is under:

patch it to your needs (adding the can-ahc code in-tree) and use snapcraft to build it (all ubuntu kernel trees come with a snapcraft.yaml file in the top of the tree that allows building a kernel snap by simply running the snapcraft command while you are in the tree) … but note that this will only produce an unsigned kernel, so secure boot will not be possible unless this kernel is actually built by canonical using the correct signing key …

there are enablement services you could buy along a brand store via

that could give you a signed kernel with the module included (even if it is non-public) and a proper secure boot signature …

Hi, thank you for your reply.

Sorry for my delayed reply as I’m currently in Singapore (Different timezone).

Interesting. Let’s say the purpose here is to make sure that the CAN driver can work, so what I’d do is to build the pc-kernel snap (option 2, with patches to .yaml) and snap install it? Then I should expect to see the CAN interface show up?

yes, you could either build an image from scratch using a local sideloaded kernel with the --snap option to the ubuntu-image command or build an image without full disk encryption and secureboot using the dangerous model and use snap install --dangerous ... to sideload it on the running system.

note that sideloaded snaps do not get updated …

Appreciate your kind assistance, I’ll try that! =)