Dynamic Kernel Module Support
Из Википедии — свободной энциклопедии
| Dynamic Kernel Module Support | |
|---|---|
| Тип | фреймворк и утилита |
| Автор | Gary Lerhaupt |
| Разработчик | Dell |
| Написана на | Bash |
| Операционная система | Linux |
| Первый выпуск | 2003 |
| Последняя версия | 2.8.4 [1] (20 ноября 2020) |
| Лицензия | GNU General Public License |
| Сайт | github.com/dell/dkms |
Dynamic Kernel Module Support или DKMS — фреймворк, который используется для генерации тех модулей ядра Linux, которые в общем случае не включены в дерево исходного кода. DKMS позволяет драйверам устройств автоматически пересобираться, когда ядро уже собрано. DKMS может быть использован в двух направлениях: автоматическая рекомпиляция всех модулей в случае установки новой версии ядра, и установка новых версий модулей (драйверов) в существующую систему без необходимости ручной компиляции или предкомпилированных пакетов. Это, к примеру, делает возможным использование новых видеокарт на старых Linux-системах.
DKMS поддерживает RPM и DEB форматы пакетов «из коробки».
Ubuntu Wiki
DKMS modules need to be configured to work with UEFI Secure Boot
Ubuntu is now checking module signing by default, on kernels 4.4.0-18.34, 4.4.0-21.37, 4.2.0-42.49, 3.19.0-65.73 and 3.13.0-92.139 onwards. You can read more details in this bug in Launchpad.
Because of those changes, DKMS modules will not work on systems with Secure Boot enabled unless correctly configured.
In order to make DKMS work, Secure Boot signing keys for the system must be imported in the system firmware, otherwise Secure Boot needs to be disabled. There are several methods to configure your system to properly load DKMS modules with Secure Boot enabled.
Simply install the package you need. Packages that make use of DKMS should prompt you to create a new Machine-Owner key (it will be done for you), and will guide you through the steps to enroll that key in your system’s firmware.
Select Change Secure Boot state
Enter the password you had selected in Step 2 and press Enter.
Select Yes to disable Secure Boot in shim-signed.
Press Enter key to finish the whole procedure.
Manual method
You may also opt to sign modules yourself. To make this simple, you can use the command:
UEFI/SecureBoot/DKMS (последним исправлял пользователь cyphermox 2018-06-26 19:53:49)
The material on this wiki is available under a free license, see Copyright / License for details.
Kubuntu Wiki
DKMSPackaging



Summary
dkms is a framework which allows kernel modules to be dynamically built for each kernel on your system in a simplified and organized fashion.
This page will show you how to build an DKMS deb package.
Prepare source
Prepare your kernel module source. It contains the C file and its Makefile at least. The following is an hello world kernel module as an example
The following is its Makefile as example.
dkms.conf
Add dkms.conf and put it with your Makefile
Here is an example dkms.conf for hello-0.1
PACKAGE_NAME, PACKAGE_VERSION is necessary information, it shall be the same with the information or your folder name.
CLEAN is the command to clean up the folder. Every time before build, it will be executed. If unset, it is assumed to be «make clean»
DEST_MODULE_LOCATION[0] tells DKMS where to put the kernel object when installing. In this example, the kernel object will be «/lib/modules/$kernelver/updates». In Ubuntu, this information will be overrade to «/updates/dkms». It means our kernel objects will be put at /lib/modules/$kernelver/updates/dkms». Although this information will be overrade, it is still a necessary field.
AUTOINSTALL set to yes means DKMS will try to build and install the kernel object when booting and it won’t be re-built nor re-installed if the kernel object has been installed.
DKMS commands
Now, use «dkms add» to tell DKMS we have a module is ready. DKMS will create symlink from /var/lib/dkms to /usr/src.
Then, you can try to build this module with «DKMS build».
And, you can install this module to the kernel module tree.
Then, you can see the kernel object has been add to your module tree
And you can use it now.
If the module is useless for you, you can remove the module from DKMS. All files related to this module under /var/lib/dkms and /lib/modules will be removed.
You can also ask DKMS to build and install this module for another kernel version after «dkms add».
It is also possible to build against multiple kernel versions.
The pre-built modules will be included in the DKMS deb made later. When the versions of the pre-built modules and the kernel on the target computer match, the pre-built modules will just be used rather than compiling on installation.
Debug when DKMS build failed
If DKMS build kernel failed, it will leave the make.log for you to tell what happened.
The log will be at /var/lib/dkms/ / /build/make.log
In this example, the log will be /var/lib/dkms/hello/0.1/build/make.log
Generate DKMS deb
Using «dkms mkdeb» to build deb package. You shall run «dkms mkdeb» after «dkms add» and «dkms build»
And you can have the deb package
with AUTOINSTALL=yes in dkms.conf, you can boot with various kernel and dkms will build the kernel module automatically for you.
Limitation of DKMS
Kernel/Dev/DKMSPackaging (последним исправлял пользователь fourdollars 2016-12-30 11:03:22)
What does DKMS do? How do I use it?
I’ve seen a few mentions about DKMS recently but it’s not clear what it’s actually doing on my system.
What does DKMS actually do and how do I use it?
1 Answer 1
DKMS (Dynamic Kernel Module Support) package (http://linux.dell.com/dkms/) provides support for installing supplementary versions of kernel modules. The package compiles and installs into the kernel tree. Uninstalling restores the previous modules. By default, installation is into the current kernel tree, but any kernel tree can be selected with command-line options. Furthermore, DKMS is called automatically upon installation of new Ubuntu kernel-image packages, and therefore modules added to DKMS will be automatically carried across updates.
Overview
To use a module with DKMS, one places the module installation files (could be source code or binary) in /usr/src/-, along with a configuration file dkms.conf that tells DKMS how to build/configure the module and what its name is. Under more advanced scenarios, conditional build instructions and patching can be done by the dkms system, but considering on your case this may not be necessary.
Walk-through
With DKMS, we tell DKMS how to do that for you by creating a dkms.conf file with the appropriate entries. For example, after we’ve unpacked the tarball:
All directories are with respect to the location of the dkms.conf file. This tells DKMS
You can also add options to call scripts before or after build or install, provide additional (conditional) make commands, patch commands, etc. The dkms.conf is in fact sourced into a shell script, so a fair amount of trickery can be done if necessary. These options and more are described in the dkms.conf section in man dkms.
Next, we install the module into DKMS by copying the module installation files into the kernel source tree /usr/src/- and tell DKMS about the new module:
That’s it! DKMS has now added our module to its list of modules to build for future kernel installations. To make sure it works and to install the module into our current kernel, we can instruct dkms to build and install the module:
With some luck, your module will be installed and reinstalled into future kernel updates.
Examples
The DKMS man page has helpful information on setting up your favorite kernel module for use with DKMS. It is not comprehensive documentation, but it will answer lots of questions. It may help you to note the following examples, even if the modules used are not the ones you want to setup:
More information can be found here:
Зачем нужен DKMS?
Прочитал о выходе нового драйвера NVidia, и что в нем «обеспечена возможность динамической пересборки модуля ядра Linux с использованием DKMS». Почитал про DKMS тут и тут. Не понял где профит.
«Выращиваю зерно, мелю его, завожу тесто, пеку. В чем профит от булочных?»
Профит проявляется в бинарных дистрибутивах.
Хотя megabaks пилил скрипт dkms и для gentoo.
Достаточно удобная вещь. Я просто обновляю ядро и перезагружаю машину, а все зависящие модули автоматически при загрузке системы обнаруживаются и пересобираются под текущее ядро.
Спасибо за подъем настроения в нерадостное субботне-похмельное утро. Вопрос изрядно посмешил 🙂
Профит проявляется в бинарных дистрибутивах.
Похоже на самый правильный ответ.
P. S. Я рад что я на Gentoo и не имею этих проблем.
Но оно ж не мониторит систему на предмет нового ядра!
И что, когда я в grub выберу другое ядро, оно мне перезагрузке все «внешние» модули будет перекомпилировать.
да, если они не собраны для данного ядра
//ты бы хоть погуглил чтоль.
И что, когда я в grub выберу другое ядро, оно мне перезагрузке все «внешние» модули будет перекомпилировать.
да, если они еще не были для этого ядра скомпилированы.
вообще довольно удобная штука. все руки не доходят к арчу прикрутить ее.
Хм. Это с невидией такое только? На AMD столько *-hook, что я сначала не знал какой выбрать
Хм. Это с невидией такое только? На AMD столько *-hook, что я сначала не знал какой выбрать
у меня на dkms нвидия висела, lirc и virtualbox.
Прочитал о выходе нового драйвера NVidia, и что в нем «обеспечена возможность динамической пересборки модуля ядра Linux с использованием DKMS».
Не прошло и ста лет.
обеспечена возможность динамической пересборки модуля ядра Linux с использованием DKMS
А, а я то думал что я просто делал что то не так, что у меня после установки самосборных ядер приходится драйвер Энвидии вручную переустанавливать.
Он и не нужен. Нужны нормальные дистрибутивы со стабилизированным ABI ядра.
В нормальных дистрах майнтейнеры сами собирают все внешние модули.















