Custom ResinOS and OS update

Use case:

Custom ResinOS (https://github.com/resin-os/resin-intel) with additional kernel parameters is created. This is compiled, config injected and installed on one-to-many devices.

Changes to git repo (https://github.com/resin-os/resin-intel) will produces a new custom ResinOS.

Question:

How can custom ResinOS be updated when a new custom ResinOS is available?

The dashboard supports this for Resin provided ResinOS images, but does not seem to be supported for custom ResinOS images. How can this be performed?

Hi @aliasbits – I’m afraid we don’t support custom build OS updates through resin.io.

If the goal is to include kernel modules that are not included in our kernel build, you could use the stock image and add kernel modules using https://github.com/resin-io-playground/kernel-module-build

Hope that helps!

Hi Chris

The goal is to include support for CAN bus which requires CONFIG_CAN in the kernel and can-utils. If the CAN support comes from kernel or from a loaded kernel modules does not matter.

From what I can read, the https://github.com/resin-io-playground/kernel-module-build build system will allow me to build a kernel module. This then needs to be included in a docker images and ensure that the docker image is run’ed --privileged.

Is that correctly understood?

@aliasbits that is correct – a lot of the magic in this case happens in the https://github.com/resin-io-playground/kernel-module-build/blob/master/build.sh file

You could clone that, copy over the source for the CAN bus module, install the developer tools to have all compiler & make and so on, apt-get install can-utils, build the module from your Dockerfile.template, and finally modprobe the module from the bash script that starts your app – and you should be good to go!

Sounds good. I will look into it.

Hey @aliasbits

Here is our Dockerfile stage to compile a custom kernel module:

Change the module path in the kernel tree and you should be good to go.

Peter

2 Likes

Hi Peter

That is pretty clever. I managed to compile kernel modules this morning, but I will for sure adapt this dockerfile to automate kernel module building into the application container.

Thanks

1 Like

Update:

I found that I was missing can.ko and can-raw.ko from net/can. I already got slcan from drivers/net/can

When adding these to the application image then the network is stopped by a kernel bug/panic. This kernel bug is reported for net/netlink/af_netlink.c:1315. The modules are still being compiled and runned on 2.13.1+rev1.dev resinOS image

Note: Target is unaccesable after kernel bug/panic. A re-installation is needed

From my understanding then CAN supported can only be available if can.ko (CONFIG_CAN) raw and can-raw.ko (CONFIG_CAN_RAW) are provided by the kernel and not being loaded by via kernel modules. Then it is up to resin users to compile what ever CAN driver they need. I my case slcan.

Anyone got an idea?

Show the kernel issue:

Hi everyone,

Just a quick update to let you know that CAN drivers are included in the latest resinOS 2.13.6 intel NUC release. Let us know if you have a chance to try the image out.

1 Like

Hi Lekkas

Initial tests show that these modules works as expected. The initial test uses can.ko, can-raw.ko and slcan.ko which is to be used in the final docker container. I will need to create a docker container which load and use these modules in order to be sure all works as expected.

One question:

Will the CAN resinOS provided kernel modules be available and persist in all future resinOS releases?

Hi,

Yes, we plan to keep CAN kernel modules in future version of resinOS.

The provided CAN kernel modules by resinOS is working as expected. Has been tested on a CAN network with 15+ CAN nodes.

To other users. Generally do not use custom ResinOS if possible if you want a resin upgradable and managed device from the Dashboard, supervisor api or python SDK.

Kernel builder docker file is still valid for custom kernel modules. For my use case the ch341 usb serial driver was needed. Custom build into the container and insmod used to load it from container.

Gist github link is broken: Custom ResinOS and OS update

Use instead: How to build custom kernel modules