~ubuntu-branches/debian/stretch/dkms/stretch

1 by Matt Domsch
Import upstream version 2.0.17.4
1
.\" -*- nroff -*-
1.1.3 by Mario Limonciello
Import upstream version 2.0.20.0
2
.TH DKMS 8 "June 2008" "Version 2.0.20"
1 by Matt Domsch
Import upstream version 2.0.17.4
3
.SH NAME
4
dkms \- Dynamic Kernel Module Support
5
.SH SYNOPSIS
6
.B dkms
7
.I [action] [options]
8
.SH DESCRIPTION
9
.B dkms
10
is a framework which allows kernel modules to be dynamically built
11
for each kernel on your system in a simplified and organized fashion.
12
.SH ACTIONS
13
.TP
14
.B add
15
Adds a module/version combination to the tree for builds and installs.
16
Requires source in
17
.I /usr/src/<module>-<module-version>/
18
as well as a properly
19
formatted
20
.I dkms.conf
21
file.
22
.TP
23
.B remove
24
Removes a module/version or module/version/kernel combination from the
25
tree.  If the modules is currently installed, it first uninstalls it
26
and if applicable, will replace it with its original_module.  Use the
27
.B --all
28
option in order to remove all instances for every kernel at once.
29
.TP
30
.B build
31
Builds the specified module/version combo for the specified kernel. If
32
no kernel is specified it builds for the currently running kernel.  All builds
33
occur in the directory
1.1.8 by Mario Limonciello
Import upstream version 2.0.21.0
34
.I /var/lib/dkms/<module>/<module-version>/build/.
1 by Matt Domsch
Import upstream version 2.0.17.4
35
.TP
36
.B install
37
Installs a built module/version combo onto the kernel it was built for. If
38
the kernel option is not specified it assumes the currently running kernel.
39
.TP
40
.B uninstall
41
Uninstalls an installed module/version combo from the kernel it was installed
42
upon.  After uninstall completion, the driver will be left in the built state.
43
To completely remove a driver, the remove action should be utilized.
44
.TP
45
.B match
46
Match installs modules onto the specified kernel by looking at the
47
configuration of the specified
48
.B templatekernel.
49
Every module that is installed on the
50
.B templatekernel
51
within
52
.B dkms
53
is then installed on that specified kernel.
54
.TP
55
.B mkdriverdisk
56
Creates a floppy driver disk image for use when updated drivers are needed
57
to install an OS.  Currently, the supported distributions are redhat, suse
58
and UnitedLinux. For Red Hat driver disks, necessary driver disk files are
59
looked for in the redhat_driver_disk
60
subdirectory of your module source directory.  You
61
must specify the distro while using this action.  Driver disks can be made
62
for single kernels or can be made to support multiple kernels.  To create
63
a driver disk image with modules for multiple kernels, just specify multiple
64
-k parameters on the command line (-k kernel1 -k kernel2 -a arch1 -a arch2).
65
66
Red Hat began supporting multi-arched driver disks in RHEL3.  To force creation
67
of a driver disk with arch information, specify
68
.B -d redhat2
69
or if you specify multiple architectures on the command-line and use
70
.B -d redhat
71
, DKMS will create a version 2 driver disk.  By specifying
72
.B -d redhat1
73
, you can force a version 1 driver disk image.
74
75
Note that redhat1 driver disks actually supported multiple architectures when
76
the second arch was i386 and the kernel module was for the BOOT kernel.  DKMS
77
allows for this, and as such you can create a redhat1 style driver disk if the
78
only other arch is i386 and the kernel name ends in BOOT.
79
80
See
81
.I http://people.redhat.com/dledford
82
for more information on the Red Hat driver
83
disk standards and which files are necessary to make a driver disk.
84
85
Fedora Core 5 and higher, RHEL5 and higher require DKMS version 2.0.14
86
or higher to generate a proper driver disk image.
87
88
For suse/UnitedLinux driver disks, /usr/share/YaST2/modules/Vendor.ycp
89
will also be copied to the driver disk; no other files are needed.
90
However, for these distros, you must specify a -r release. For
91
SuSE 9.1, it would be -d suse -r 9.1. For SLES9, it would be -d suse -r sles9.
92
93
By default the disk image it creates is 1440 (k) in size.  This can be
94
overridden by specifying a different
95
.B --size ####
96
which should should be given as a number in kilobytes divisible by 20.
97
98
You may have more content than will fit on a floppy.  Therefore, DKMS
99
can now generate image files of different types.
100
.B --media=floppy (default)
101
to generate a floppy disk image, or
102
.B --media=iso
103
to generate a CD-ROM ISO file, or
104
.B --media=tar
105
to generate a tar file.
106
107
You may copy the floppy or ISO image file to a USB key to be used with
108
OS installer.
109
110
111
.TP
112
.B mktarball
113
Creates a tarball archive for the specified module/version of all files
114
in the DKMS tree for that module/version combination.  This includes
115
the source and any built modules for kernels in the tree (as specified).
116
Otherwise, you can specify
117
a singular kernel to archive only, or multiple kernels to archive
118
(-k kernel1 -k kernel2 -a arch1 -a arch2).  Optionally, you can use
119
.B --archive
120
to specify the name (with no preceding path) that you would like this
121
tarball to have.  You can also specify
122
.B --binaries-only
123
if you want the resultant tarball not to include the module source.  Likewise,
124
.B --source-only
125
can be used to specify that no prebuilt binaries should be included in the tarball.
126
In general,
127
.B mktarball
128
is great for systems management purposes as you can build your driver
129
on just one system and then use
130
.B ldtarball
131
on all of your other systems to get the same built modules loaded
132
without having to wait for anything to compile.
133
.TP
134
.B ldtarball
135
This takes a tarball made from the
136
.B mktarball
137
command and specified with the
138
.B --archive
139
option and loads it into your DKMS tree.  This will leave any
140
newly added modules in the built state and
141
.B dkms install
142
should then be called to install any of them.  If files already
143
exist where
144
.B ldtarball
145
is attempting to place them, it will warn and not copy over them.  The
146
.B --force
147
option should be used to override this.
148
.TP
149
.B mkrpm
150
This action allows you to create an RPM package for a specified module / version.
151
It uses a template .spec file found in
152
.I /etc/dkms/template-dkms-mkrpm.spec
153
as the basis for the RPM.  Alternatively, if DKMS finds a file called
154
.I /usr/src/<module>-<module-version>/<module>-dkms-mkrpm.spec
155
it will use that .spec file instead.  In general, a DKMS tarball is placed inside
156
the contents of this RPM, and the RPM itself calls various DKMS commands to
157
load this tarball, build and install modules on the end user's system.  If you do
158
not want your RPM to contain any prebuilt binaries, be sure to specify
159
.B --source-only
160
in the mkrpm command.
161
.TP
162
.B mkdeb
1.1.3 by Mario Limonciello
Import upstream version 2.0.20.0
163
This action allows you to create a debian binary package for a specified module / version.
1 by Matt Domsch
Import upstream version 2.0.17.4
164
It uses a template debian directory found in
165
.I /etc/dkms/template-dkms-mkdeb
166
as the basis for the package. Alternatively, if DKMS finds a file called
167
.I /usr/src/<module>-<module-version>/<module>-dkms-mkdeb
168
it will use that folder instead. In general, a DKMS tarball is placed inside the
169
contents of this package, and the package itself calls various DKMS commands to
170
load this tarball, build and install modules on the end user's system.  If you do
171
not want your debian package to contain any prebuilt binaries, be sure to specify
172
.B --source-only
173
in the mkdeb command.
174
.TP
1.1.3 by Mario Limonciello
Import upstream version 2.0.20.0
175
.B mkdsc
176
This action allows you to create a debian source package for a specified module / version.
177
It will create a .tar.gz, and a .dsc.  All options supported by
178
.B mkdeb
179
are supported by it.  The main difference in it's usage is that it will look in
180
.I /etc/dkms/template-dkms-mkdsc
181
as the basis for the package. Alternatively, if DKMS finds a file called
182
.I /usr/src/<module>-<module-version>/<module>-dkms-mkdsc
183
it will use that folder instead. If you do not want your debian source package to
184
contain any prebuilt binaries, be sure to specify
185
.B --source-only
186
in the mkdsc command.
187
.TP
1 by Matt Domsch
Import upstream version 2.0.17.4
188
.B mkkmp
189
This action allows you to create an Kernel Module Package source RPM for a specified module / version.
190
It uses the .spec file specified by
191
.I --spec=specfile
192
else
193
.I $module-kmp.spec
194
as the basis for the RPM.  The generated source RPM may then be built using SuSE's build.rpm or
195
Fedora/RHEL's mock chroot environments.  See http://kerneldrivers.org/ for
196
more details on KMPs.
197
.TP
198
.B status
199
Returns the current status of modules, versions and kernels within
200
the tree as well as whether they have been added, built or installed.
201
Status can be shown for just a certain module, a certain kernel,
202
a module/version combination or a module/version/kernel combination.
203
.SH OPTIONS
204
.TP
205
.B -m <module>
206
The name of the module.
207
.TP
208
.B -v <module-version>
209
The version of the module to execute the specified action upon.
210
.TP
211
.B -k <kernel-version>
212
The kernel to perform the action upon.  You can specify multiple kernel versions
213
on the command line by repeating the -k argument with a different kernel name.
214
However, not all actions support multiple kernel versions (it will error out
215
in this case).
216
.TP
217
.B -a, --arch
218
The system architecture to perform the action upon.  If not specified, it assumes
219
the arch of the currently running system (`uname -m`).  You can specify multiple
220
arch parameters on the same command line by repeating the -a argument with a
221
different arch name.  When multiple architectures are specified, there must
222
be a 1:1 relationship between -k arguments to -a arguments.  DKMS will then
223
assume the first -a argument aligns with the first -k kernel and so on for the
224
second, third, etc.
225
226
For example, if you were to specify: -k kernel1 -k kernel2 -a i386 -k kernel3 -a i686 -a x86_64,
227
DKMS would process this as: kernel1-i386, kernel2-i686, kernel3-x86_64.
228
.TP
229
.B -q, --quiet
230
Quiet.
231
.TP
232
.B -V, --version
233
Prints the currently installed version of dkms and exits.
234
.TP
235
.B -c <dkms.conf-location>
236
The location of the
237
.I dkms.conf
238
file.  This is needed for the add action and if not specified,
239
it is assumed to be located in
240
.I /usr/src/<module>-<module-version>/.
241
See below for more information on the format of
242
.I dkms.conf.
243
.TP
244
.B -d, --distro
245
The distribution being used.  This is only currently needed for
246
.B mkdriverdisk.
247
The supported distros are
248
.B redhat,
249
.B suse
250
and
251
.B UnitedLinux.
252
See the sections on
253
.B mkdriverdisk
254
and
255
.B mkkmp
256
for more information.
257
.TP
258
.B -r, --release
259
The release being used.  This is only currently used for
260
.B mkdriverdisk
261
and is only used for suse or UnitedLinux distros (eg. -r 9.1).  It is
262
used in the internal makeup of the driverdisk.
263
.TP
264
.B --size
265
The size of the driver disk image to be created.  By default, this value is set
266
at 1440.  Any different size should be given as an integer value only, should
267
be divisible by 20 and should represent the number of kilobytes of the image
268
size you desire.
269
.TP
270
.B --config <kernel-.config-location>
271
During a
272
.B build
273
this option is used to specify an alternate location for the kernel .config
274
file which was used to compile that kernel.  Normally,
275
.B dkms
276
uses the Red Hat standard location and config filenames located in
277
.I /usr/src/linux-<kernel>/configs/.
278
If the config for the kernel that you
279
are building a module for is not located here or does not have the expected
280
name in this location, you will need to tell
281
.B dkms
282
where the necessary .config can be found so that your kernel can be properly
283
prepared for the module build.
284
.TP
285
.B --archive <tarball-location>
286
This option is used during a
287
.B ldtarball
288
action to specify the location of the tarball you wish to load into
289
your DKMS tree.
290
.TP
291
.B --templatekernel <kernel-version>
292
This option is required for the action:
293
.B match.
294
Match will look at the
295
templatekernel specified and install all of the same module/version
296
combinations on the other kernel.
297
.TP
298
.B --force
299
This option can be used in conjunction with
300
.B ldtarball
301
to force copying over of already existant files.
302
.TP
303
.B --binaries-only
304
This option can be used in conjunction with
305
.B mktarball
306
in order to create a DKMS tarball which does not contain the source for the
307
module within it.  This can be helpful in reducing the size of the tarball
308
if you know that the system which this tarball will be loaded upon already
309
has the source installed.  In order to load a tarball made as binaries-only
310
.B you must
311
have the module source in that systems DKMS tree.  If you do not, DKMS
312
.B will refuse
313
to load a binaries-only tarball.
314
.TP
315
.B --source-only
316
This option can be used in conjunction with
317
.B mktarball
318
or
319
.B mkrpm
320
or
321
.B mkdeb
322
in order to create a DKMS tarball which does not contain any prebuilt
323
kernel module binaries within it.  This is helpful if you simply want
324
to easily tar up your source but don't want anything prebuilt within
325
it.  Likewise, if you are using
326
.B mkrpm
327
but do not want the RPM you create to have any prebuilt modules within it,
328
passing this option will keep its internal DKMS tarball from containing any
329
prebuilt modules.
330
.TP
331
.B --all
332
This option can be used to automatically specify all relevant kernels/arches
333
for a module/module-version.  This is useful for things like
334
.B remove
335
,
336
.B mktarball
337
, etc.  This saves the trouble of having to actually specify -k kernel1 -a
338
arch1 -k kernel2 -a arch2 for every kernel you have built your module for.
339
.TP
340
.B --no-prepare-kernel
341
This option keeps DKMS from first preparing your kernel before building
342
a module for it.  Generally, this option should not be used so as to
343
ensure that modules are compiled correctly.
344
.TP
345
.B --no-clean-kernel
346
This option keeps DKMS from cleaning your kernel source tree after a
347
build.
348
.TP
349
.B --kernelsourcedir <kernel-source-directory-location>
350
Using this option you can specify the location of your kernel source
351
directory.  Most likely you will not need to set this if your kernel
352
source is accessible via
353
.I /lib/modules/$kernel_version/build.
354
.TP
355
.B --directive <"cli-directive=cli-value">
356
Using this option, you can specify additional directives from the command
357
line.  The
358
.B --directive
359
option can be used multiple times on the same command-line to specify
360
multiple additional command line directives.
361
.TP
362
.B --rpm_safe_upgrade
363
This flag should be used when packaging DKMS enabled modules in RPMs.  It should
364
be specified during both the
365
.B add
366
and
367
.B remove
368
actions in the RPM spec to ensure that DKMS and RPM behave correctly in all
369
scenarios when upgrading between various versions of a dkms enabled module
370
RPM package.  See the sample.spec file for an example or read more in the section
371
below on Creating RPMs Which Utilize DKMS.
372
.TP
373
.B --spec specfile
374
This option is used by the
375
.B mkkmp
376
action to specify which RPM spec file to use when generating the KMP.
377
.I specfile
378
will be sought in the module source directory.
1.1.3 by Mario Limonciello
Import upstream version 2.0.20.0
379
.TP
380
.B --dkmstree path/to/place
381
Provides a destination tree for building and installing modules to.  Useful in
382
cases that you don't want to contaminate a system when using solely for building.
1.1.7 by Mario Limonciello
Import upstream version 2.0.20.4
383
.TP
1.1.3 by Mario Limonciello
Import upstream version 2.0.20.0
384
.B --sourcetree path/to/place
385
Provides a location to build a DKMS package from.  Useful for systems that you may
386
not have root access, but would still like to be able to build DKMS packages.
1.1.7 by Mario Limonciello
Import upstream version 2.0.20.4
387
.TP
1.1.3 by Mario Limonciello
Import upstream version 2.0.20.0
388
.B --installtree path/to/place
389
Provides a location to place modules when a
390
.I dkms install
391
command is issued.
1.1.7 by Mario Limonciello
Import upstream version 2.0.20.4
392
.TP
1.1.3 by Mario Limonciello
Import upstream version 2.0.20.0
393
.B --dkmsframework path/to/file
394
A supplemental configuration file to the systemwide dkms framework, typically located
395
in /etc/dkms/framework.conf.  All option that are normally provided on a command line
396
can be provided in this file.
1 by Matt Domsch
Import upstream version 2.0.17.4
397
.SH ORIGINAL MODULES
398
During the first install of a module for a <kernelversion>,
399
.B dkms
400
will search
401
.I /lib/modules/<kernelversion>
402
for a pre-existing module of the same name. If one is found, it will automatically
403
be saved as an "original_module" so that if the newer module is later removed,
404
.B dkms
405
will put the original module back in its place.  Currently, DKMS searches
406
for these original modules with first preference going to modules located in
407
.I /lib/modules/<kernelversion>/updates/
408
followed by
409
.B $DEST_MODULE_LOCATION
410
(as specified in
411
.I dkms.conf
412
).  If one cannot be found in either location, a find will be used to locate one for
413
that kernel.
414
If none are found, then during a later uninstall, your kernel will not have that module
415
replaced.
416
417
If more than one is found, then the first one located (by preference indicated
418
above) will be considered the "original_module".  As well, all copies of the same-named
419
module will be removed from your kernel tree and placed into
1.1.8 by Mario Limonciello
Import upstream version 2.0.21.0
420
.I /var/lib/dkms/<module>/original_module/$kernelver/collisions
1 by Matt Domsch
Import upstream version 2.0.17.4
421
so that they can be *manually* accessible later. DKMS will never actually do anything
422
with the modules found underneath the /collisions directory, and they will be stored there
423
until you manually delete them.
424
.SH DKMS.CONF
425
When performing an
426
.B add
427
, a proper
428
.I dkms.conf
429
file must be found.  A properly formatted conf file is essential
430
for communicating to
431
.B dkms
432
how and where the module should be installed.  While not all the directives
433
are required, providing as many as possible helps to limit any ambiguity.  Note
434
that the
435
.I dkms.conf
436
is really only a shell-script of variable definitions which are then sourced in
437
by the
438
.B dkms
439
executable (of the format, DIRECTIVE="directive text goes here").  As well, the
440
directives are case-sensitive and should be given in
441
.B ALL CAPS.
442
443
It is important to understand that many of the DKMS directives are arrays whose index
444
values are tied together.  These array associations can be considered families, and there
445
are currently four such families of directive arrays.  MAKE[#] and MAKE_MATCH[#] make up
446
one family.  PATCH[#] and PATCH_MATCH[#] make up the second family.  The third  and
447
largest family consists of BUILT_MODULE_NAME[#], BUILT_MODULE_LOCATION[#], DEST_MODULE_NAME[#],
448
DEST_MODULE_LOCATION[#], MODULES_CONF_ALIAS_TYPE[#], MODULES_CONF_OBSOLETES[#],
449
MODULES_CONF_OBSOLETE_ONLY[#] and STRIP[#].  The fourth
450
family is made up of only MODULES_CONF[#].  When indexing these arrays when creating your
451
dkms.conf, each family should start at index value 0.
452
.TP
453
.B MAKE[#]=
454
The MAKE directive array tells DKMS which make command should be used for building your module. The default make command
455
should be put into
456
.B MAKE[0].
457
Other entries in the MAKE array will only be used if their corresponding entry in
458
.B MAKE_MATCH[#]
459
matches, as a regular expression (using egrep), the kernel that the module is being built for.
460
Note that if no value is placed in
461
.B MAKE_MATCH[#]
462
for any
463
.B MAKE[#]
464
where # > 0, then that
465
.B MAKE
466
directive is ignored.
467
.B MAKE_MATCH[0]
468
is optional and if it is populated, it will be used to determine
469
if MAKE[0] should be used to build the module for that kernel.  If multiple
470
.B MAKE_MATCH
471
directives match against the kernel being built for, the last matching
472
.B MAKE[#]
473
will be used to build your module. If no MAKE directive is specified or if no
474
MAKE_MATCH matches the kernel being built for, DKMS
475
will attempt to use a generic MAKE command to build your module.
476
.TP
477
.B MAKE_MATCH[#]=
478
See the above entry on
479
.B MAKE[#]
480
directives.  This array should be populated with regular expressions which, when matched
481
against the kernel being built for, will tell
482
.B DKMS
483
to use the corresponding make command in the
484
.B MAKE[#]
485
directive array to build your module.
486
.TP
487
.B BUILT_MODULE_NAME[#]=
488
This directive gives the name of the module just after it is built.  If your DKMS module
489
package contains more than one module to install, this is a
490
.B required
491
directive for all of the modules.  This directive should explicitly not contain any
492
trailing ".o" or ".ko".
493
Note that for each module within a dkms package, the numeric value of
494
.B #
495
must be the same for each of BUILT_MODULE_NAME, BUILT_MODULE_LOCATION, DEST_MODULE_NAME and
496
DEST_MODULE_LOCATION and that the numbering should start at 0 (eg. BUILT_MODULE_NAME[0]="qla2200"
497
BUILT_MODULE_NAME[1]="qla2300").
498
.TP
499
.B BUILT_MODULE_LOCATION[#]=
500
This directive tells DKMS where to find your built module after it has been built.  This
501
pathname should be given relative to the root directory of your source files (where your
502
dkms.conf file can be found).  If unset, DKMS expects to find your
503
.B BUILT_MODULE_NAME[#]
504
in the root directory of your source files.
505
Note that for each module within a dkms package, the numeric value of
506
.B #
507
must be the same for each of BUILT_MODULE_NAME, BUILT_MODULE_LOCATION, DEST_MODULE_NAME and
508
DEST_MODULE_LOCATION and that the numbering should start at 0 (eg. BUILT_MODULE_LOCATION[0]="some/dir/"
509
BUILT_MODULE_LOCATION[1]="other/dir/").
510
.TP
511
.B DEST_MODULE_NAME[#]=
512
This directive can be used to specify the name of the module as it should be installed.  This
513
will rename the module from
514
.B BUILT_MODULE_NAME[#]
515
to
516
.B DEST_MODULE_NAME[#].
517
This directive should explicitly not contain any trailing ".o" or ".ko".  If unset, it is
518
assumed to be the same value as
519
.B BUILT_MODULE_NAME[#].
520
Note that for each module within a dkms package, the numeric value of
521
.B #
522
must be the same for each of BUILT_MODULE_NAME, BUILT_MODULE_LOCATION, DEST_MODULE_NAME and
523
DEST_MODULE_LOCATION and that the numbering should start at 0 (eg. DEST_MODULE_NAME[0]="qla2200_6x"
524
DEST_MODULE_NAME[1]="qla2300_6x").
525
.TP
526
.B DEST_MODULE_LOCATION[#]=
527
This directive specifies the destination where a module should be installed to, once compiled.  It also
528
is used for finding original_modules.  This is a
529
.B required
530
directive.  This directive must start with the text "/kernel" which is in reference to
531
/lib/modules/<kernelversion>/kernel.
532
Note that for each module within a dkms package, the numeric value of
533
.B #
534
must be the same for each of BUILT_MODULE_NAME, BUILT_MODULE_LOCATION, DEST_MODULE_NAME and
535
DEST_MODULE_LOCATION and that the numbering should start at 0 (eg. DEST_MODULE_LOCATION[0]="/kernel/drivers/something/"
536
DEST_MODULE_LOCATION[1]="/kernel/drivers/other/").
537
.TP
538
.B MODULES_CONF_ALIAS_TYPE[#]=
539
This directive array specifies how your modules should be aliased in
540
.I /etc/modules.conf
541
when your module is installed.  This is done in an intelligent fashion so if DKMS
542
detects an already existing reference in modules.conf, it won't add a new line.  If
543
it is not detected, it will add it to the modules.conf as the last alias number for
544
that alias type (eg. if MODULES_CONF_ALIAS_TYPE="scsi_hostadapter", no alias
545
currently exists for that module and the last scsi_hostadapter reference is 6, then
546
your module will be added as "scsi_hostadapter7").  Common values for this directive
547
include:
548
.B scsi_hostadapter
549
,
550
.B sound-slot-
551
and
552
.B eth.
553
Note that the numeric value of
554
.B #
555
is tied to the index of BUILD_MODULE_NAME, BUILT_MODULE_LOCATION, DEST_MODULE_NAME
556
and DEST_MODULE_LOCATION.  The index is also tied to MODULES_CONF_OBSOLETES.
557
.TP
558
.B MODULES_CONF_OBSOLETES[#]=
559
This directive array tells DKMS what modules.conf alias references are obsoleted by the
560
module you are installing.  If your module obsoletes more than one module, this directive
561
should be a comma-delimited list of those modules that are obsoleted (eg. for megaraid2,
562
MODULES_CONF_OBSOLETES[0]="megaraid,megaraid_2002"). When you are installing your module,
563
DKMS ensures that any entries in
564
.I /etc/modules.conf
565
with the same
566
.B MODULES_CONF_ALIAS_TYPE
567
are changed over to the new module name.  When you are uninstalling
568
your module, depending on the modules in your
569
.I /lib/modules
570
tree, DKMS will take different actions.
571
If you kernel has an original_module, then modules.conf will not be touched and the non-obsolete
572
reference will remain.  If the kernel does not have an original_module but does have one
573
of the obsolete modules, it will replace those references with the first obsolete module name in
574
the comma-delimited list that is also in that kernel (thus, your obsolete list should be prioritized
575
from left to right).  If no original_module or obsolete modules are found within the kernel, the alias
576
entry is removed all-together. Note that the numeric value of
577
.B #
578
is tied to the index of BUILD_MODULE_NAME, BUILT_MODULE_LOCATION, DEST_MODULE_NAME
579
and DEST_MODULE_LOCATION.  The index is also tied to MODULES_CONF_ALIAS_TYPE.
580
.TP
581
.B MODULES_CONF_OBSOLETE_ONLY[#]=
582
If set to
583
.B yes
584
, this directive will tell DKMS to only modify
585
.I /etc/modules.conf
586
if it finds within it an obsolete reference as specified in the corresponding value of
587
.B MODULES_CONF_OBSOLETES[#]
588
array directive.
589
.TP
590
.B STRIP[#]=
591
By default strip is considered to be "yes".  If set to "no", DKMS will not
592
run strip -g against your built module to remove debug symbols from it.
593
.TP
594
.B PACKAGE_NAME=
595
This directive is used to give the name associated with the entire package of modules.  This is the same
596
name that is used with the
597
.B -m
598
option when building, adding, etc. and may not necessarily be the same as the MODULE_NAME.  This
599
directive must be present in every dkms.conf.
600
.TP
601
.B PACKAGE_VERSION=
602
This directive is used to give the version associated with the entire package of modules being installed within that dkms
603
package.  This directive must be present in every dkms.conf.
604
.TP
605
.B CLEAN=
606
CLEAN specifies the make clean command to be used to clean up both before and after building the
607
module.  If unset, it is assumed to be "make clean".
608
.TP
609
.B REMAKE_INITRD=
610
This directive specifies whether your initrd should be remade after the module is installed
611
onto the kernel.  Any text after the first character is ignored and if the first character
612
is not a "y" or a "Y", it is assumed that REMAKE_INITRD="no".
613
.TP
1.1.8 by Mario Limonciello
Import upstream version 2.0.21.0
614
.B UDEV_TRIGGER=
615
This optional directive specifies, if the udev daemon will be get a trigger event after the module is installed 
616
for your currently running kernel. Because this udev trigger might have some unfriendly side effects on some Linux 
617
Systems, you can now disable this trigger, if your driver does not need it anyway.
618
UDEV_TRIGGER=yes is assumed as the default, although this directive may not be given. This esures backward compatibility 
619
to older DKMS releases. Any text after the first character is ignored and if the first character is not a "n" or a "N",
620
it is assumed that UDEV_TRIGGER="yes". 
621
.TP
1 by Matt Domsch
Import upstream version 2.0.17.4
622
.B MODULES_CONF[#]=
623
This directive array specifies what static configuration text
624
lines need to be added into
625
.I /etc/modules.conf
626
for your module. See the section on MODULES.CONF CHANGES for more information regarding the
627
implications of modifying
628
.I /etc/modules.conf
629
.TP
1.1.3 by Mario Limonciello
Import upstream version 2.0.20.0
630
.B OBSOLETE_BY=
631
This directive allows you to specify a kernel version that obsoletes the necessity for this
632
particular DKMS module.  This can be specified as a particular upstream kernel or an ABI
633
bump of a kernel.  For example, "2.6.24" would be an upstream kernel and "2.6.24-16" would
634
represent an ABI bump for a kernel.  Both are valid in this area.
635
636
Please avoid the use of
637
.B OBSOLETE_BY
638
wherever possible.  It's use indicates a lack of proper module
639
versioning using
640
.B MODULE_VERSION()
641
tags in the module source itself.  It is better to fix the
642
.B MODULE_VERSION()
643
tags than use
644
.B OBSOLETE_BY.
645
This also introduces a implicit distribution/version dependency on the
646
package, as the value of
647
.B OBSOLETE_BY
648
is meaningful only in the context of a single distribution/version.
649
650
If you feel you must use it, please use as such in dkms.conf:
651
652
 ubuntu_804="Ubuntu
653
 8.04"
654
 if [ -x /usr/bin/lsb_release ]; then
655
   if [ "$(/usr/bin/lsb_release -sir)" == "${ubuntu_804}" ]; then
656
     OBSOLETE_BY="2.6.25"
657
   fi
658
 fi
659
660
.TP
1 by Matt Domsch
Import upstream version 2.0.17.4
661
.B PATCH[#]=
662
Use the PATCH directive array to specify patches which should be applied to your source before a build occurs.
663
All patches are expected to be in -p1 format and are applied with the patch -p1 command.
664
Each directive should specify the filename of the patch to apply, and all patches must
665
be located in the patches subdirectory of your source directory (
666
.I /usr/src/<module>-<module-version>/patches/
667
).  If any patch fails to apply, the build will be halted and the rejections can be
668
inspected in
1.1.8 by Mario Limonciello
Import upstream version 2.0.21.0
669
.I /var/lib/dkms/<module>/<module-version>/build/.
1 by Matt Domsch
Import upstream version 2.0.17.4
670
If a PATCH should only be applied conditionally, the
671
.B PATCH_MATCH[#]
672
array should be used, and a corresponding regular expression should be placed in
673
.B PATCH_MATCH[#]
674
which will alert dkms to only use that
675
.B PATCH[#]
676
if the regular expression matches the kernel which the module is currently being built for.
677
.TP
678
.B PATCH_MATCH[#]=
679
See the above description for
680
.B PATCH[#]
681
directives. If you only want a patch applied in certain scenarios, the
682
.B PATCH_MATCH
683
array should be utilized by giving a regular expression which matches
684
the kernels you intend the corresponding
685
.B PATCH[#]
686
to be applied to before building that module.
687
.TP
688
.B AUTOINSTALL=
689
If this directive is set to
690
.B yes
691
then the service
692
.I /etc/rc.d/init.d/dkms_autoinstaller
693
will automatically try to install this module on any kernel you boot into.  See the section
694
on
695
.B dkms_autoinstaller
696
for more information.
697
.TP
698
.B BUILD_EXCLUSIVE_KERNEL=
699
This optional directive allows you to specify a regular expression which defines
700
the subset of kernels which DKMS is allowed to build your module for.  If the kernel
701
being built for does not match against this regular expression, the dkms build
702
will error out.  For example, if you set it as ="^2\.4.*", your module would not be
703
built for 2.6 kernels.
704
.TP
705
.B BUILD_EXCLUSIVE_ARCH=
706
This optional directive functions very similarly to
707
.B BUILD_EXCLUSIVE_KERNEL
708
except that it matches against the kernel architecture.  For example, if you set
709
it to ="i.86", your module would not be built for ia32e, x86_64, amd64, s390, etc.
710
.TP
711
.B POST_ADD=
712
The name of the script to be run after an
713
.B add
714
is performed.  The path should be given relative to the root directory of your source.
715
.TP
716
.B POST_BUILD=
717
The name of the script to be run after a
718
.B build
719
is performed. The path should be given relative to the root directory of your source.
720
.TP
721
.B POST_INSTALL=
722
The name of the script to be run after an
723
.B install
724
is performed. The path should be given relative to the root directory of your source.
725
.TP
726
.B POST_REMOVE=
727
The name of the script to be run after a
728
.B remove
729
is performed. The path should be given relative to the root directory of your source.
730
.TP
731
.B PRE_BUILD=
732
The name of the script to be run before a
733
.B build
734
is performed. The path should be given relative to the root directory of your source.
735
.TP
736
.B PRE_INSTALL=
737
The name of the script to be run before an
738
.B install
739
is performed. The path should be given relative to the root directory
740
of your source.  If the script exits with a non-zero value, the
741
install will be aborted.  This is typically used to perform a custom
742
version comparison.
743
.TP
744
.SH DKMS.CONF VARIABLES
745
Within your
746
.I dkms.conf
747
file, you can use certain variables which will be replaced at run-time with their
748
values.
749
.TP
750
.B $kernelver
751
This variable can be used within a directive definition and during use, the actual kernel
752
version in question will be substituted in its place.  This is especially useful in MAKE
753
commands when specifying which INCLUDE statements should be used when compiling your
754
module (eg. MAKE="make all INCLUDEDIR=/lib/modules/${kernelver}/build/include").
755
.TP
756
.B $dkms_tree
757
See the section on /etc/dkms/framework.conf for more information.  This variable represents
758
the location of the DKMS tree on the local system.  By default this is
1.1.8 by Mario Limonciello
Import upstream version 2.0.21.0
759
.I /var/lib/dkms
1 by Matt Domsch
Import upstream version 2.0.17.4
760
, but this value should not be hard-coded into a dkms.conf in the event that the local user
761
has changed it on their system.
762
.TP
763
.B $source_tree
764
See the section on /etc/dkms/framework.conf for more information.  This variable represents
765
the location where DKMS keeps source on the local system.  By default this is
766
.I /usr/src
767
, but this value should not be hard-coded into a dkms.conf in the event that the local user
768
has changed it on their system.
769
.TP
770
.B $kernel_source_dir
771
This variable holds the value of the location of your kernel source directory.  Usually, this
772
will be
773
.I /lib/modules/$kernelver/build
774
, unless otherwise specified with the
775
.B --kernelsourcedir
776
option.
777
.SH /etc/dkms/framework.conf
778
This configuration file controls how the overall DKMS framework handles.  It is sourced
779
in everytime the dkms command is run.  Mainly it can currently be used to set different
1.1.3 by Mario Limonciello
Import upstream version 2.0.20.0
780
default values for the variables.
1 by Matt Domsch
Import upstream version 2.0.17.4
781
.B $dkms_tree
782
,
783
.B $source_tree
784
and
785
.B $install_tree
786
which control where DKMS looks for its framework.  Note that these variables can also
1.1.3 by Mario Limonciello
Import upstream version 2.0.20.0
787
be manipulated on the command line with --dkmstree, --sourcetree
788
and --installtree options.
1 by Matt Domsch
Import upstream version 2.0.17.4
789
.SH dkms_autoinstaller
790
This boot-time service automatically installs any module which has
791
.B AUTOINSTALL="yes"
792
set in its
793
.B dkms.conf
794
file.  The service works quite simply and if multiple versions of a module are in
795
your system's DKMS tree, it will not do anything and instead explain that manual
796
intervention is required.
797
.SH MODULES.CONF / MODPROBE.CONF CHANGES
798
Changes that your module will make to
799
.I /etc/modules.conf
800
or
801
.I /etc/modprobe.conf
802
should be specified with the
803
.B MODULES_CONF_ALIAS_TYPE[#]
804
, the
805
.B MODULES_CONF_OBSOLETES[#]
806
and the
807
.B MODULES_CONF[#]
808
directive arrays.  These arrays should also be used even if your distro uses
809
.I /etc/sysconfig/kernel
810
to track kernel modules.
811
812
When the first module is installed upon the first kernel within the user's system,
813
these entries in
814
.B MODULES_CONF[#]
815
are automatically added to
816
.I /etc/modules.conf
817
and if
818
.B REMAKE_INITRD
819
is specified, then the user's initrd is then remade.  Subsequently, as your modules are then
820
later removed from the user's system, until the final module/version combination is removed
821
from the final kernel version, those references in
822
.I modules.conf
823
will remain.  Once the last module/version combination is removed, those references are then
824
removed.
825
826
As modules/versions are removed and initrds are remade, one of three things will happen if you
827
have specified a
828
.B MODULES_CONF_ALIAS_TYPE.
829
If no original_module exists for that kernel, and no
830
.B MODULES_CONF_OBSOLETES
831
modules are found in that kernel too, the
832
.I modules.conf
833
alias references will temporarily be removed so that the initrd will successfully
834
remake.  Once the initrd is remade, however; those references are then automatically put
835
back into
836
.I modules.conf
837
(unless you are removing the last instance of the module on the last kernel).
838
However, if no original_module exists, but there is an OBSOLETE module
839
found within that kernel, the alias reference is temporarily shifted to point to the
840
OBSOLETE module so that the initrd can be remade.  After it is remade, it then automatically
841
puts back the alias reference (unless you are removing the last instance of the module
842
on the last kernel).  Lastly, if an original_module does exist for the kernel
843
version, then
844
.I modules.conf
845
is not touched and all references persist (even if you are removing the last instance of the
846
module on the last kernel).
847
848
Certain module installations might not only require adding references to
849
.I modules.conf
850
but also require removing conflicting references that might exist in the user's system.  If this
851
is the case, the
852
.B MODULES_CONF_OBSOLETES[#]
853
directive should be utilized to remove these references.  More information about this directive
854
can be found in the
855
.B DKMS.CONF
856
section of this man page.
857
858
Note that the end state of your modules.conf file very much depends on what kernel modules exist
859
in the final kernel you remove your DKMS module from.  This is an imperfect system caused by the
860
fact that there is only one modules.conf file for every kernel on your system even though various
861
kernels use different modules.  In a perfect world, there would be one modules.conf file for
862
every kernel (just like System.map).
863
.SH CREATING RPMS WHICH UTILIZE DKMS
864
See the
865
.I sample.spec
866
file packaged with
867
.B DKMS
868
as an example for what your RPM spec file might look like.
869
Creating RPMs which utilize
870
.B dkms
871
is a fairly straight-forward process.  The RPM need only to install the source into
872
.I /usr/src/<module>-<module-version>/
873
and then employ
874
.B dkms
875
itself to do all the work of installation.  As such, the RPM should first untar the source into
876
this directory.  From here, within the RPM
877
.I .spec
878
file, a
879
.B dkms add
880
should be called (remember to use the --rpm_safe_upgrade flag during the add) followed by a
881
.B dkms build
882
followed by a
883
.B dkms install.
884
Your
885
.I dkms.conf
886
file should be placed within the
887
.I /usr/src/<module>-<module-version>/
888
directory.
889
890
Under the removal parts of the
891
.I .spec
892
file, all that needs to be called is a: dkms remove -m <module> -v <module-version> --all --rpm_safe_upgrade.
893
894
Use of the
895
.B --rpm_safe_upgrade
896
flag is imperative for making sure DKMS and RPM play nicely together in all scenarios of using
897
the -Uvh flag with RPM to upgrade dkms enabled packages.  It will only function if used during
898
both the add
899
.B and
900
remove actions within the same RPM spec file. Its use makes sure that when upgrading between different
901
releases of an RPM for the same <module-version>, DKMS does not do anything dumb (eg. it ensures
902
a smooth upgrade from megaraid-2.09-5.noarch.rpm to megaraid-2.09-6.noarch.rpm).
903
904
It should be noted that a binary RPM which contains source is not a traditional practice.
905
However, given the benefits of
906
.B dkms
907
it hopefully will become so.  As the RPM created which utilizes
908
.B dkms
909
is not architecture specific,
910
.B BuildArch: noarch
911
should be specified in the
912
.I .spec
913
file to indicate that the package can work regardless of the system architecture.  Also
914
note that DKMS RPM upgrades (-U option) will automatically work because of the structure
915
of the
916
.B dkms
917
tree.
918
919
Lastly, as a matter of convention, you should name your RPM:
920
<package>-<version>-<rpm-version>dkms.noarch.rpm.  The word
921
.B dkms
922
as part of the rpm-version signifies that the RPM
923
works within the DKMS framework.
924
.SH AUTHOR
925
Gary Lerhaupt
926
.SH WEBPAGE
927
.I http://linux.dell.com/dkms
928
.SH WHITE-PAPERS
929
.I http://linux.dell.com/dkms/dkms-ols2004.pdf
930
931
.I http://www.dell.com/downloads/global/power/1q04-ler.pdf
932
933
.I http://www.linuxjournal.com/article.php?sid=6896
934
.SH MAILING-LIST
935
dkms-devel@dell.com
936
.I http://lists.us.dell.com/mailman/listinfo/dkms-devel
937
.SH REFERENCES
938
Kernel Module Packages
939
.I http://kerneldrivers.org
940
941
Novell Kernel Module Packages
942
.I http://www.suse.de/~agruen/KMPM
943
944
Fedora Kernel Module Packages
945
.I http://fedoraproject.org/wiki/Extras/KernelModuleProposal