Skip to content

fix(dkms): install all modules on kernel autoinstall - #97

Open
Till0196 wants to merge 4 commits into
tbsdtv:latestfrom
Till0196:fix/dkms-autoinstall
Open

fix(dkms): install all modules on kernel autoinstall#97
Till0196 wants to merge 4 commits into
tbsdtv:latestfrom
Till0196:fix/dkms-autoinstall

Conversation

@Till0196

@Till0196 Till0196 commented Apr 6, 2026

Copy link
Copy Markdown

Problem

When the kernel is updated and DKMS autoinstalls media-build, only dvb-core.ko
is installed instead of all ~750 media modules.

Root cause

autoinstall() calls read_conf() before the build starts. At that point
dkms_dyn.conf does not exist yet, so only the static fallback (dvb-core) is
cached in last_mvka. After POST_BUILD runs gen_dkms_dyn_conf.sh and
generates the full module list, do_install() hits the cache and never re-reads
the conf — resulting in only dvb-core.ko being installed.

A secondary issue (also reported in #60) is that KDIR26 in v4l/Makefile
was set to updates/extra/media, while gen_dkms_dyn_conf.sh searches under
/lib/modules/<kernel>/kernel/. The path mismatch caused the script to find no
modules, producing an empty (or minimal) dkms_dyn.conf.

Fix

v4l/Makefile

Change KDIR26 from updates/extra/media to kernel/drivers/media so that
gen_dkms_dyn_conf.sh can locate the installed modules.

-KDIR26 := /lib/modules/$(KERNELRELEASE)/updates/extra/media
+KDIR26 := /lib/modules/$(KERNELRELEASE)/kernel/drivers/media

gen_dkms_dyn_conf.sh

After generating the per-kernel dkms_dyn.conf, copy it to a
kernel-independent dkms_dyn_shared.conf (passed as an optional 4th argument).

dkms.conf

When the per-kernel dkms_dyn.conf does not exist yet (i.e. at the start of
autoinstall before the build), fall back to dkms_dyn_shared.conf from the
last successful build. This gives read_conf() the full module list before the
build starts, so do_install() installs all modules after the build completes.

First kernel build:  dkms_dyn.conf produced → copied to dkms_dyn_shared.conf
Next kernel update:  autoinstall reads dkms_dyn_shared.conf → full module list cached
                     → build runs → do_install installs all ~750 modules

Testing

Verified on Ubuntu 6.8.0-107-generic: dkms install installs all modules and
dkms status reports installed with no warnings.

Till0196 added 2 commits April 6, 2026 14:19
gen_dkms_dyn_conf.sh uses mod_build_loc_base='/kernel' to locate
built modules in the MEDIA_INST_DIR tree. With the old path
(updates/extra/media) the pattern never matched, so no modules
were written to dkms_dyn.conf and only dvb-core.ko was installed.

Fixes: tbsdtv#60
When a new kernel is installed, dkms autoinstall calls read_conf
before the build runs. At that point dkms_dyn.conf does not yet
exist, so only the fallback dvb-core entry is loaded and cached
in last_mvka. After POST_BUILD generates the full dkms_dyn.conf,
do_install hits the cache and never re-reads it, resulting in
only dvb-core.ko being installed.

Fix by maintaining a kernel-independent copy of dkms_dyn.conf
(dkms_dyn_shared.conf). On the next kernel autoinstall the
fallback is sourced before the build runs, so the cache is
populated with the full module list from the start.
Copilot AI review requested due to automatic review settings April 6, 2026 05:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes DKMS kernel autoinstall so that media-build installs the full set of media modules (not just dvb-core.ko) by ensuring a complete dynamic module list is available at autoinstall() time and by aligning install paths so module discovery works.

Changes:

  • Update v4l/Makefile install path to live under /kernel/... so module discovery matches gen_dkms_dyn_conf.sh expectations.
  • Extend gen_dkms_dyn_conf.sh to optionally write a kernel-independent “shared” dynamic config copy for reuse on subsequent kernel autoinstalls.
  • Update dkms.conf to generate the shared config in POST_BUILD and to source it as a fallback when the per-kernel config doesn’t exist yet.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
v4l/Makefile Adjusts module install base path to /kernel/drivers/media to support module discovery during DKMS install.
gen_dkms_dyn_conf.sh Adds optional shared-conf output to preserve the full module list across kernel autoinstalls.
dkms.conf Passes shared-conf path to POST_BUILD and sources shared conf as fallback during autoinstall.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread gen_dkms_dyn_conf.sh Outdated
Comment thread gen_dkms_dyn_conf.sh Outdated
Till0196 added 2 commits April 6, 2026 14:45
- Recognize --help after the 3rd positional argument and reject unexpected
  extra arguments instead of silently ignoring them
- Ensure shared fallback directory exists (mkdir -p) and fail explicitly
  when the cp to the shared conf path fails, preventing silent stale-conf issues
- Simplify --help check for optional 4th arg (already handled by arg_check_help)
- Use err_exit instead of exit_print for error consistency
- Quote variables in dkms.conf [ -e ] and source commands
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants