我在 DKMS 中设置了几个模块应该会自动安装到新的内核版本,但事实并非如此。我注意到我的所有四个自制 DKMS 模块都存在同样的问题。
这是一个例子。
生成文件对于内核模块:
KERNEL_VERSION := $(shell uname -r)
KERNEL_MODULES := /lib/modules/$(KERNEL_VERSION)/build
hid-y := hid-core.o hid-input.o hid-debug.o hidraw.o
obj-m += hid-apple.o hid.o
all:
$(MAKE) -C $(KERNEL_MODULES) M=$(PWD) modules
clean:
$(MAKE) -C $(KERNEL_MODULES) M=$(PWD) clean
dkms.conf对于 DKMS 模块:
MAKE="make KERNEL_VERSION=${kernelver} all"
CLEAN="make KERNEL_VERSION=${kernelver} clean"
BUILT_MODULE_NAME[0]=hid
BUILT_MODULE_NAME[1]=hid-apple
DEST_MODULE_LOCATION[0]='/kernel/drivers/hid'
DEST_MODULE_LOCATION[1]='/kernel/drivers/hid'
PACKAGE_NAME=hid-apple
PACKAGE_VERSION=2.0
REMAKE_INITRD=yes
AUTOINSTALL=yes
该模块安装在DKMS中:
sudo dkms status -m hid-apple -v 4.2
hid-apple, 4.2, 3.19.0-32-generic, x86_64: installed (original_module exists)
hid-apple, 4.2, 3.19.0-33-generic, x86_64: installed (original_module exists)
对于 3.19.0-33,我必须手动重新安装模块才能sudo dkms install hid-apple/4.2
使其再次工作,并且每次升级时我都必须执行该手动步骤。
我将其制作成 Debian 软件包,并在安装后运行以下脚本后安装脚本:
#!/bin/sh
set -e
dkms_name="hid-apple"
dkms_version="4.2"
case "$1" in
configure)
# add
if ! dkms status -m $dkms_name -v $dkms_version | egrep '(added|built|installed)' >/dev/null ; then
# if it's not been added yet, add it
dkms add -m $dkms_name -v $dkms_version
fi
# build
if ! dkms status -m $dkms_name -v $dkms_version | egrep '(built|installed)' >/dev/null ; then
# if it's not been built yet, build it
dkms build $dkms_name/$dkms_version
fi
# install
if ! dkms status -m $dkms_name -v $dkms_version | egrep '(installed)' >/dev/null; then
# if it's not been installed yet, install it
dkms install $dkms_name/$dkms_version
fi
;;
*)
echo "postinst called with unknown argument: $1"
exit 1
;;
esac
#DEBHELPER#
exit 0
我不确定为什么在内核升级时没有安装它。有任何想法吗?