ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Build and deploy a kernel module with catkin

asked 2015-11-18 02:44:37 -0500

Michael Stoll gravatar image

Is it reasonable to build and deploy a kernel module with catkin and the ros infrastructure? And if so, how could it be achieved? Are there any examples?

In the scenario there's a hardware driver implemented as a kernel module and a ros node using it. While the kernel module is independant of ros, there are other components in the ros repository, which are independant, too. Furthermore deploying the kernel with a separate method would introduce a dependency on an inofficial repository.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-11-18 22:55:41 -0500

ahendrix gravatar image

catkin does not provide any direct tools for distributing kernel modules.

The technical details of kernel modules is generally outside the scope of this forum, so I'll just touch on the places where the process would intersect with the ROS ecosystem. Expect to do lots of additional research.

Distributing kernel modules is generally difficult, and it gets more difficult if you want to install binary kernel modules without user intervention. Each Linux distribution (Ubuntu, fedora, gentoo, arch, etc) distribute kernels and modules differently, and sometimes different versions of the kernel will have different APIs.

Therefore, you should start by determining which versions of the linux kernel you want to support, and which distributions. If you're releasing packages through bloom for a specific version of ROS, this should include the versions of Fedora and Ubuntu that are supported for that version of ROS, and the kernel versions used by those distributions.

It's quite reasonable to include the source for your kernel module inside of a ROS package, and to include additional instructions for users to build the module from source and install it. You can make this a little easier by having your ROS package depend on the kernel header packages, so that they're installed automatically, and by adding catkin install rules for the full source of your kernel module, so that the module source is included in binary distributions.

This is about as far as you can go without doing anything specific to a Linux distribution.

Whatever you do, DO NOT distribute a binary kernel module. Distribute the source code. Binary kernel modules usually do not work for any kernel other than the one they were compiled for.

If you really want to have a binary package which installs kernel modules for your users, most distributions build the new kernel modules against the running kernel during package installation. On Ubuntu, for example, this is done through DKMS. (A quick search suggests Fedora users dkms as well, but I haven't used it and can't confirm)

If you want to do a kernel module install through DKMS, you should install the module source code as part of your catkin install step (as described above). You'll also want to read the DKMS documentation about how to add the appropriate package install hooks to run DKMS during your package install, and then you'll want to add patches to your bloom release repository to add those commands to the generated debian package scripts.

edit flag offensive delete link more


Thanks for the extensive answer. In fact I wanted to distribute the binaries, but you just confirmed all my concerns. So I'm doppping that idea and simply distribute the source code.

Michael Stoll gravatar image Michael Stoll  ( 2015-11-20 02:54:21 -0500 )edit

Question Tools



Asked: 2015-11-18 02:44:37 -0500

Seen: 374 times

Last updated: Nov 18 '15