How do I build debian packages of kernel modules?

9,513

Solution 1

There is a better solution than m-a: dkms

It actually makes it easier to distribute external kernel modules and automatically compiles them for newer kernel-versions (think installing a new package of linux-headers).

Solution 2

There's no easy answer. To create a real Debian package from scratch is not just a matter of sticking files into an archive, you'll need the control file and installation scripts and everything else that makes it a package rather than just a tarball.

To learn about using dh-make and debhelper to create packages, start with the New Maintainers' Guide, then read the Developer's Guide on packaging "best practices".

Then, /usr/share/doc/module-assistant/README.gz and HOWTO-DEVEL.gz covers how to use the packaging tools to create source packages that module-assistant can understand.

I think if you're packaging a module that exists in the default kernel package you'll have more work to prevent conflicts. If you're just doing this for yourself, it would probably be best to build and install a custom kernel package with the "old" driver disabled so that the files don't conflict (note the instructions in README.gz regarding KVERS).

Share:
9,513

Related videos on Youtube

b3m2a1
Author by

b3m2a1

Updated on September 17, 2022

Comments

  • b3m2a1
    b3m2a1 over 1 year

    Specifically, I want to build a package for debian/lenny using the latest uvc drivers. I can compile and install them, but I want them packaged in the normal debian fashion. I imagine I want to use make-kpkg somehow, but I don't know how. module-assistant seems no good, because that seems to only use sources available in debian.

  • b3m2a1
    b3m2a1 over 13 years
    As mentioned on the page, module-assistant uses source code from apt repositories. That page doesn't go into details about getting the source code into an apt repository (or a format m-a understands).
  • b3m2a1
    b3m2a1 over 13 years
    I'll give dkms a try. Glad to see it's in backports.
  • b3m2a1
    b3m2a1 over 13 years
    :( I was really hoping there was something already specifically for kernel module packages. Two years ago, I used dh_make and a dodgy Makefile to make a e1000e package, which would install to /lib/modules/uname -r/updates, overriding the included kernel modules. I was hoping there was a lazier, more proper protocol now.
  • Fladi
    Fladi over 13 years
    You could take a look at the backfire-dkms or ndiswrapper-dkms packages for an example on how to build such a package. They are relatively simple and easy to understand in their structure.
  • b3m2a1
    b3m2a1 over 13 years
    I'm trying to follow this walkthrough: wiki.centos.org/HowTos/BuildingKernelModules