Building Custom Modules
Matt Domsch
Matt_Domsch at dell.com
Wed Jan 2 16:55:34 UTC 2008
On Wed, Jan 02, 2008 at 12:41:05AM -0500, Felix Miata wrote:
> On 2008/01/01 22:35 (GMT-0600) Matt Domsch apparently typed:
>
> > On Tue, Jan 01, 2008 at 11:13:57PM -0500, Felix Miata wrote:
> >> A note on
> >> http://fedoraproject.org/wiki/Docs/CustomKernel#head-5658f6db74cec105eb1e6d5481444c2d621e8636
> >> indicates it isn't complete. Can someone complete it, or tell me what's
> >> missing enough that I can build a few F8 modules?
>
> > What's there is sufficient for personal development purposes. It
> > doesn't address how to get your modules included in the upstream
> > kernel.org kernels, so they can be added to Fedora as well.
>
> > There are other mechanisms, such as DKMS (yum install dkms) which also
> > can be used for building kernel modules. The Makefile becomes even
> > simpler, just the single line:
>
> > obj-m := foo.o
>
> > and DKMS takes care of the rest.
>
> I must be dense. There's a Makefile already in the source dir that includes
> the desired module name, but dkms wants a -v parameter, and man dkms gives me
> no idea what a module-version is in this context of a module build. :-(
(yes, as Craig noted, I'm one of the authors, and maintainer for
DMKS).
DKMS makes a few assumptions.
1) the source code needs to be in a directory
/usr/src/<modulename>-<moduleversion>. So, /usr/src/foo-1.0 for
module foo version 1.0. The version field generally matches what's in
the MODULE_VERSION() tag of the source code.
2) in that directory, there needs to be a brief dkms.conf file that
looks like:
PACKAGE_NAME="foo"
PACKAGE_VERSION="1.0"
BUILT_MODULE_NAME[0]="foo"
DEST_MODULE_LOCATION[0]="/kernel/drivers/net"
(it can get fancier, but that's enough for most modules).
Then you execute:
# dkms add -m foo -v 1.0
# dkms build -m foo -v 1.0
# dkms install -m foo -v 1.0
This builds and installs module foo version 1.0 into your currently
running kernel's /lib/modules/ tree. If you need to build for a
different kernel than the currently running kernel (or architecture):
# dkms build -m foo -v 1.0 -k $kernelver -a $arch
# dkms install -m foo -v 1.0 -k $kernelver -a $arch
Thanks,
Matt
--
Matt Domsch
Linux Technology Strategist, Dell Office of the CTO
linux.dell.com & www.dell.com/linux
More information about the fedora-list
mailing list