Dkms For Developers

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 38

DKMS for Developers

John A. Hull
Software Engineer
Dell, Inc.
April 13, 2005 Novell Inc.
2
What is DKMS?
D!na"ic Kernel Mo#ule Support
Allows in#ivi#ual $ernel "o#ules to %e upgra#e#
without changing the entire $ernel

A##, %uil#, install, re"ove, an# trac$ $ernel "o#ules


Stan#ar#i&e# fra"ewor$ for

'ollecting #river source co#e

(uil#ing co"pile#)"o#ule %inar! files

installing*uninstalling "o#ules into +inu, $ernel

-ac$aging #river source co#e an# %inar! "o#ules


3
DKMS Is*Is .ot
IS IS NOT
Distro-agnostic Tied to specific distro
Architecture agnostic x86-only
A backport helper
Makes use of Kbuild Kbuild replacement
2.4 and 2.6 kernels <= 2.2 kernels
A way to maintain your drivers
outside of kernel.org forever
April 13, 2005 Novell Inc.
4
I#eal /se 'ases for DKMS -ac$ages
Driver releases inte#e# for testers

E,a"ple0 testing new "egarai# #river on S+ES 1 %efore


su%"itting to S/SE*$ernel.org for inclusion
(ac$ports for !our $ernel.org)"erge# #river inten#e#
for users

E,a"ple0 Distri%uting latest "egarai# #river for S+ES 1


until accepte# into ne,t service pac$
'reating #river #is$s
April 13, 2005 Novell Inc.
5
DKMS /ses 2or Developers
2ra"ewor$ to use on %uil# s!ste"

'onfigura%le %uil# an# source tree locations

/ses $ernel)provi#e# %uil# "echanis"

Supports "ulti)arch %uil#s


Si"plifies testing of up#ate# #evice #rivers

(uil# %inar! "o#ules fro" source co#e outsi#e the


$ernel source tree

.o nee# to reco"pile $ernel

Driver up#ate an# roll%ac$ "echanis" ) version control


Si"plifies creation of #river 3-Ms an# #river #is$s
DKMS 'oncepts
7
DKMS +ife '!cle
Not in tree
Added
State
Built
State
Installed
State
add build install
uninstall
remove
Commands: add, build, install, uninstall, remove, status,
match, mktarball, ldtarball, mkdriverdisk
mkrpm
April 13, 2005 Novell Inc.
8
#$"s.conf
4ives DKMS the necessar! configuration infor"ation
nee#e# to %uil#, install, an# pac$age %inar! "o#ules
Mini"al file0
-A'KA4E5.AME67e89997
-A'KA4E5:E3SI;.67<.=.>=7
(/I+?5M;D/+E5.AME@9A67e89997
DES?5M;D/+E5+;'A?I;.@9A67*$ernel*#rivers*net7
9
DKMS ?ree
/var/lib/dkms
Module name
Module version
tarball
driverdisk
log
architecture 1
architecture
module
kernel 1
kernel
build
source !s"mlink to source tree#
10
Source ?ree
/usr/src
$module name%&$module version%
'redhat(driver(disk' director" !optional#
patch )iles
Make)ile !re*uired#
'patches' director" !optional#
source code )iles !re*uired#
dkms+con) )ile !re*uired#
disk&in)o
modin)o
modules+dep
modules+pcimap
pci+ids
pcitable
April 13, 2005 Novell Inc.
11
fra"ewor$.conf
Allows user or a#"in to set s!ste")wi#e varia%les for
DKMS

source tree location B#efault0 *usr*srcC

DKMS tree location B#efault0 *var*li%*#$"sC

install tree location B#efault0 *li%*"o#ulesC

:er%osit! level
/sing DKMS0 An E,a"ple
April 13, 2005 Novell Inc.
13
-rocess for 'reating -ac$ages
8.'reate an# configure source tree
=.'onfigure #$"s.conf file
>.A## "o#ule an# "o#ule version to DKMS tree
D.(uil# "o#ules for $ernel versions
<.'reate DKMS tar%all
E.'reate DKMS 3-M
F.'reate #river #is$
April 13, 2005 Novell Inc.
14
'onfigure Source ?ree

'reate *usr*src*G"o#ule na"eH)G"o#ule versionH

-lace source co#e an# Ma$efile into this #irector!

-ut license file into #irector!

If Ma$efile is fro" $ernel tree0

3eplace o%I)J';.2I4:A3 option with o%I)" to ensure


that "o#uleBsC will get %uilt

If Ma$efile is custo"0

Mo#if! to allow DKMS to pass $ernel version an# $ernel


source path as varia%le when perfor"ing a %uil#

Must not have Kuna"e )rK reference# in %o#!


April 13, 2005 Novell Inc.
15
Source tree e,a"ple
Kls *usr*src*"egarai#)=.=9.D.DK
#$"s.conf
Kconfig."egarai#
"ega5co""on.h
"egarai#5"%o,.h
Ma$efile
"egarai#5ioctl.h
"egarai#5"".c
"%o,5#efs.h
"egarai#5"%o,.c
"egarai#5"".h
April 13, 2005 Novell Inc.
16
'onfigure #$"s.conf 2ile B8C
-lain te,t file that is Lsource# inM %! DKMS
3eNuire# #irectives to set0

-A'KA4E .AME

-A'KA4E :E3SI;.

(/I+?5M;D/+E5.AME@9A

DES?5M;D/+E5+;'A?I;.@9A
/seful B%ut optionalC #irectives to set0

3EMAKE5I.I?3D6M!esM Bfor storage #evice #riversC

M;D/+ES5';.25A+IAS5?O-E@9A
April 13, 2005 Novell Inc.
17
'onfigure #$"s.conf 2ile B=C

(/I+?5M;D/+E5+;'A?I;.@9A

DES?5M;D/+E5.AME@9A

-A?'H

A/?;I.S?A++6M!esM

MAKE@9A
MAKE@9A #oes not have to %e set

Will use #efault $ernel "a$e co""an# if not set

;nl! shoul# %e use# for custo" Ma$efile


Man! #irectives are arra!s
All other #irectives can %e foun# in DKMS "an page
April 13, 2005 Novell Inc.
18
#$"s.conf E,a"ple
-A'KA4E5.AME6M"egarai#M
-A'KA4E5:E3SI;.6M=.=9.D.DM
(/I+?5M;D/+E5.AME@9A6M"egarai#5"%o,M
DES?5M;D/+E5+;'A?I;.@9A6M*$ernel*#rivers*scsi*M
(/I+?5M;D/+E5.AME@8A6M"egarai#5""M
DES?5M;D/+E5+;'A?I;.@8A6M*$ernel*#rivers*scsi*M
M;D/+ES5';.25A+IAS5?O-E@9A6Mscsi5hosta#apterM
3EMAKE5I.I?3D6M!esM
April 13, 2005 Novell Inc.
19
A## an# (uil# Mo#ules

A## the "o#ule*version to DKMS tree

#$"s a## )" G"o#uleH )v GversionH

(uil# "o#ules for the necessar! $ernels

#$"s %uil# )" G"o#uleH )v GversionH )$ G$ernelH

(uil# process output #u"pe# to


*var*li%*#$"s*G"o#uleH*GversionH*%uil#*"a$e.log

K#$"s statusK shows the status of the "o#ules


April 13, 2005 Novell Inc.
20
#$"s status output
K#$"s statusK
"egarai#, =.=9.D.D, =.E.<)F.1F)s"p, ,PE5ED0 %uilt
"egarai#, =.=9.D.D, =.E.<)F.1F)#efault, ,PE5ED0 %uilt
"egarai#, =.=9.D.D, =.E.<)F.1F)s"p, i<PE0 %uilt
"egarai#, =.=9.D.D, =.E.<)F.1F)#efault, i<PE0 %uilt
"egarai#, =.=9.D.D, =.E.<)F.8>1)s"p, ,PE5ED0 %uilt
"egarai#, =.=9.D.D, =.E.<)F.8>1)#efault, ,PE5ED0 %uilt
"egarai#, =.=9.D.D, =.E.<)F.8>1)s"p, i<PE0 %uilt
"egarai#, =.=9.D.D, =.E.<)F.8>1)#efault, i<PE0 %uilt
April 13, 2005 Novell Inc.
21
'reate #$"s tar%all

'reate a #$"s tar%all

#$"s "$tar%all )" G"o#uleH )v GversionH )$ G$ernelH )a


GarchH

'an also specif! Q)source)onl! or Q%inaries)onl!

Will gra% all specifie# "o#ules an# the source tree

?o loa# tar%all on another s!ste"

#$"s l#tar%all Q)archive6Gtar%all na"eH

Eas! wa! to %ac$ up an# save wor$, an# to "ove it


%etween s!ste"s

'an inclu#e "o#ules for "ultiple $ernels an#


architectures in tar%all


April 13, 2005 Novell Inc.
22
'reate Device Driver 3-M
'reate the 3-M

#$"s "$rp" )" G"o#uleH )v GversionH )$ G$ernelH )a


GarchH

Will use <module>-dkms-rpm.spec fro" source tree if


e,ists, otherwise /etc/dkms/template-dkms-rpm.spec

'reates a #$"s tar%all, inclu#es in 3-M


When installe#, 3-M will loa# DKMS tar%all

If $ernels e,ist for %uilt "o#ules, installs "o#ules

If no "o#ules for running $ernel, will %uil# an# install

'an inclu#e "o#ules for "ultiple $ernels an#


architectures in 3-M
April 13, 2005 Novell Inc.
23
'reate Driver Dis$
'reate #istri%ution)specific #river #is$s B3H or S/SEC

#$"s "$#river#is$ )# G#istroH )r GreleaseH )" G"o#uleH


)v GversionH )$ G$ernelH )a GarchH
3eco""en#ations

Ma$e "ulti)arch #river #is$s

'reate "o#ules for $ernels availa%le on #istri%ution


"e#a Be.g. #efault, s"p, %igs"p $ernelsC
April 13, 2005 Novell Inc.
24
E,a"ple0 'reating a D/D an# 3-M for
S+ES 1 S-8
R #$"s a## )" "egarai# )v =.=9.D.D
R #$"s %uil# )" "egarai# )v =.=9.D.D )$ =.E.<)8.8>1)#efault )a i<PE
R #$"s %uil# )" "egarai# )v =.=9.D.D )$ =.E.<)8.8>1)s"p )a i<PE
R #$"s %uil# )" "egarai# )v =.=9.D.D )$ =.E.<)8.8>1)#efault )a ,PE5ED
R #$"s %uil# )" "egarai# )v =.=9.D.D )$ =.E.<)8.8>1)s"p )a ,PE5ED
R #$"s "$rp" )" "egarai# )v =.=9.D.D )$ =.E.<)8.8>1)s"p )a ,PE5ED S
)$ =.E.<)8.8>1)#efault )a ,PE5ED )$ =.E.<)8.8>1)s"p )a i<PE S
)$ =.E.<)8.8>1)#efault )a i<PE
R #$"s "$#river#is$ )" "egarai# )v =.=9.D.D )# suse )r sles1 S
)$ =.E.<)8.8>1)s"p )a ,PE5ED )$ =.E.<)8.8>1)#efault )a ,PE5ED S
)$ =.E.<)8.8>1)s"p )a i<PE )$ =.E.<)8.8>1)#efault )a i<PE
April 13, 2005 Novell Inc.
25
?rou%leshooting
Dou%le) an# triple)chec$ the #$"s.conf file
:iew "o#ule %uil# errors in
*var*li%*#$"s*G"o#uleH*GversionH*%uil#*"a$e.log
'hec$ that Ma$efile accepts $ernel source an# $ernel
version info fro" DKMS
'hec$ that all reNuire# source co#e is present
April 13, 2005 Novell Inc.
26
'onclusion
2ra"ewor$ to use on %uil# s!ste"

'onfigura%le %uil# an# source tree locations

/ses $ernel)provi#e# %uil# "echanis"

Supports "ulti)arch %uil#s


Si"plifies testing of up#ate# #evice #rivers

(uil# %inar! "o#ules fro" source co#e outsi#e the


$ernel source tree

.o nee# to reco"pile $ernel

Driver up#ate an# roll%ac$ "echanis" ) version control


Si"plifies creation of #river 3-Ms an# #river #is$s
April 13, 2005 Novell Inc.
27
More Infor"ation*Status
Availa%le as a 4-+ open)source proIect
fro"0http0**linu,.#ell.co"*#$"s
Mailing list0 #$"s)#evelTlists.us.#ell.co"
E,tensivel! teste# on 3e# Hat Enterprise +inu, an#
.ovell S/SE +inu, Enterprise ServerU inclu#e# on
Man#ra$e 89.8 'Ds.
Multiple architectures0 Intel ,PE, AMDED*EMED?,
Itaniu"
Shipping on ever! Dell server with +inu,.
(ac$up
April 13, 2005 Novell Inc.
29
A## 'o""an#
#$"s a## )" G"o#ule na"eH )v G"o#ule versionH
3eNuire"ents

Source co#e in source tree


Q
*usr*src*G"o#ule na"eH)G"o#ule versionH

-roperl!)configure# #$"s.conf file in source tree


April 13, 2005 Novell Inc.
30
(uil# 'o""an#
#$"s %uil# )" G"o#ule na"eH )v G"o#ule versionH
;ptions0

)$ G$ernel versionH

)a GarchH

))$ernelsource#ir G$ernel source #ir pathH

))config G$ernel configfile locationH


3eNuire"ents

Mo#ule na"e*version "ust %e in La##e#M status


April 13, 2005 Novell Inc.
31
install*uninstall 'o""an#
#$"s install )" G"o#ule na"eH )v G"o#ule versionH
#$"s uninstall )" G"o#ule na"eH )v G"o#ule versionH
;ptions0

)$ G$ernel versionH

)a GarchH
3eNuire"ents

Driver "o#ule "ust %e in %uilt state for


$ernel*architecture co"%o
April 13, 2005 Novell Inc.
32
"$#river#is$ 'o""an# B3e# HatC
#$"s "$#river#is$ )# G#istroH )" G"o#ule na"eH )v
G"o#ule versionH )$ G$ernel versionH )a GarchH
;ptions0

G#istroH 6 Vre#hatV allows 8 arch on #is$

G#istroH 6 Vre#hat=V allows "ultiples arches on #is$


3eNuire"ents

Driver "o#ules "ust %e in %uilt state for


$ernel*architecture co"%o

2or 3e# Hat #river #is$s, re#hat5#river5#is$ "ust e,ist


an# inclu#e #is$)info, "o#info, "o#ules.#ep,
"o#ules.pci"ap, pci.i#s, an# pcita%le
April 13, 2005 Novell Inc.
33
"$#river#is$ 'o""an# BS/SEC
#$"s "$#river#is$ )# suse )r GreleaseH )" G"o#ule
na"eH )v G"o#ule versionH )$ G$ernel versionH )a GarchH
;ptions0

GreleaseH is the version of S/SE, i.e. Vsles1V for


enterprise, or V1.=V for professional releases
3eNuire"ents

Driver "o#ules "ust %e in %uilt state for


$ernel*architecture co"%o
April 13, 2005 Novell Inc.
34
"$rp" 'o""an#
#$"s "$rp" )" G"o#ule na"eH )v G"o#ule versionH )$
G$ernel versionH )a GarchH
;ptions0

'an specif! "ore than one $ernel*arch co"%o


3eNuire"ents

Driver "o#ules "ust %e in %uilt state for


$ernel*architecture co"%o
April 13, 2005 Novell Inc.
35
"$tar%all 'o""an#
#$"s "$tar%all )" G"o#ule na"eH )v G"o#ule versionH
;ptions0

)$ G$ernel versionH, )a GarchH

))%inaries)onl!

))source)onl!
3eNuire"ents

"o#ule*version "ust %e in a##e# state


April 13, 2005 Novell Inc.
36
A/?;I.S?A++ #irective
#$"s5autoinstaller service provi#e# %! DKMS, starts on
%oot
If A/?;I.S?A++6M!esM set in #$"s.conf, the service
will chec$ if "o#ule is %uilt for current $ernel

If "o#ule not %uilt, service will %uil# an# install


WH! "# $%

;nl! for non)storage #evice #rivers

;nl! for #evice #river that will not %e accepte# %! #istro


in a newer $ernel
April 13, 2005 Novell Inc.
37
Stan#ar# DKMS "a$e co""an#s
=.D $ernels0
"a$e )' J$ernel5source5#ir S/(DI3S6J#$"s5tree*J"o#ule*J"o#ule5version*%uil#
"o#ules

=.E $ernels0
"a$e )' J$ernel5source5#ir M6 J#$"s5tree*J"o#ule*J"o#ule5version*%uil#
April 13, 2005 Novell Inc.
38

You might also like