Claude Code Plugins

Community-maintained marketplace

Feedback

Guide for Dynamic Kernel Module Support (DKMS). Use when automatically rebuilding kernel modules across kernel updates, packaging modules for distribution, or managing third-party driver installations. DKMS maintains module sources and rebuilds automatically.

Install Skill

1Download skill
2Enable skills in Claude

Open claude.ai/settings/capabilities and find the "Skills" section

3Upload to Claude

Click "Upload skill" and select the downloaded ZIP file

Note: Please verify skill by going through its instructions before using it.

SKILL.md

name dkms
description Guide for Dynamic Kernel Module Support (DKMS). Use when automatically rebuilding kernel modules across kernel updates, packaging modules for distribution, or managing third-party driver installations. DKMS maintains module sources and rebuilds automatically.

DKMS - Dynamic Kernel Module Support

Overview

DKMS automatically rebuilds kernel modules when new kernels are installed. It maintains module source code and compiles against each kernel version.

DKMS Configuration

Create /usr/src/<module>-<version>/dkms.conf:

PACKAGE_NAME="mymodule"
PACKAGE_VERSION="1.0"
BUILT_MODULE_NAME[0]="mymodule"
DEST_MODULE_LOCATION[0]="/updates"
AUTOINSTALL="yes"
REMAKE_INITRD="no"

# For multiple modules
BUILT_MODULE_NAME[1]="mymodule_helper"
DEST_MODULE_LOCATION[1]="/updates"

Directory Structure

/usr/src/mymodule-1.0/
├── dkms.conf
├── Makefile
├── mymodule.c
└── mymodule.h

DKMS Commands

# Add module to DKMS tree
dkms add -m mymodule -v 1.0
# or from source directory
dkms add /usr/src/mymodule-1.0

# Build module
dkms build -m mymodule -v 1.0

# Install module
dkms install -m mymodule -v 1.0

# Build and install in one step
dkms install -m mymodule -v 1.0

# Remove module
dkms remove -m mymodule -v 1.0 --all

# Check status
dkms status

Advanced Configuration

# dkms.conf with build options
PACKAGE_NAME="mymodule"
PACKAGE_VERSION="1.0"
CLEAN="make clean"
MAKE[0]="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build"
BUILT_MODULE_NAME[0]="mymodule"
BUILT_MODULE_LOCATION[0]="build/"
DEST_MODULE_LOCATION[0]="/updates/dkms"
AUTOINSTALL="yes"

# Kernel version restrictions
BUILD_EXCLUSIVE_KERNEL="^4\."
BUILD_EXCLUSIVE_ARCH="x86_64"

Creating DKMS Packages

# Create tarball for distribution
dkms mktarball -m mymodule -v 1.0

# Create Debian package
dkms mkdeb -m mymodule -v 1.0

# Create RPM package
dkms mkrpm -m mymodule -v 1.0

Troubleshooting

# View build log
cat /var/lib/dkms/mymodule/1.0/build/make.log

# Force rebuild
dkms remove -m mymodule -v 1.0 -k $(uname -r)
dkms install -m mymodule -v 1.0 -k $(uname -r)

# Build for specific kernel
dkms build -m mymodule -v 1.0 -k 5.15.0-generic

Common Use Cases

  • NVIDIA/AMD proprietary drivers
  • VirtualBox guest additions
  • Wireless drivers (broadcom-wl, rtl8821ce)
  • Third-party filesystem modules (ZFS, NTFS3G)