如何在 Debian 中为多个内核映像版本编译 DKMS 模块?

如何在 Debian 中为多个内核映像版本编译 DKMS 模块?

我安装了 3.16 和 4.0 版本的linux-image软件包。登录期间,我可以在“高级选项”菜单项中选择要启动的内核。但是,当我安装 DKMS 模块时,它仅针对较新版本进行编译:

Setting up fglrx-modules-dkms (1:14.12-1) ...
Loading new fglrx-14.12 DKMS files...
Building only for 4.0.0-1-amd64

3.16 也安装了相关软件包 ( linux-headerslinux-kbuild、 )。linux-compiler-gcc

为什么没有为旧内核映像编译该包?我可以配置一些东西吗编译?

答案1

您可以使用 DKMS 安装命令(参考man dkms:)为特定内核重建和安装模块。下面是通过删除一个内核版本的 virtualbox 模块创建的示例。

sudo dkms install <module-name>/<module-version> -k <kernel-version>

$ dkms status
vboxhost, 5.0.10, 4.2.0-21-generic, x86_64: installed
vboxhost, 5.0.10, 4.2.0-22-generic, x86_64: installed
vboxhost, 5.0.10, 4.2.0-23-generic, x86_64: installed
vboxhost, 5.0.10, 4.2.0-25-generic, x86_64: installed

$ sudo dkms remove vboxhost/5.0.10 -k 4.2.0-22-generic
...

$ dkms status
vboxhost, 5.0.10, 4.2.0-21-generic, x86_64: installed
vboxhost, 5.0.10, 4.2.0-23-generic, x86_64: installed
vboxhost, 5.0.10, 4.2.0-25-generic, x86_64: installed


$ sudo dkms install vboxhost/5.0.10 -k 4.2.0-22-generic

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area....
make KERNELRELEASE=4.2.0-22-generic -C /lib/modules/4.2.0-22-generic/build M=/var/lib/dkms/vboxhost/5.0.10/build...............
cleaning build area....

DKMS: build completed.

vboxdrv.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/4.2.0-22-generic/updates/dkms/

vboxnetflt.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/4.2.0-22-generic/updates/dkms/

vboxnetadp.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/4.2.0-22-generic/updates/dkms/

vboxpci.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/4.2.0-22-generic/updates/dkms/

depmod....

DKMS: install completed.

$ dkms status
vboxhost, 5.0.10, 4.2.0-21-generic, x86_64: installed
vboxhost, 5.0.10, 4.2.0-22-generic, x86_64: installed
vboxhost, 5.0.10, 4.2.0-23-generic, x86_64: installed
vboxhost, 5.0.10, 4.2.0-25-generic, x86_64: installed

相关内容