* Install needed development tools- packages (sudo apt-get
install ...):
linux-headers-$(uname -r)
build-essential
fakeroot
dh-make
* Set needed additional repositories - edit /etc/apt/sources.list
- add lines:
deb http://filest.linuxmedialabs.com/deb/ /
deb-src http://filest.linuxmedialabs.com/deb/ /
* Place untarred kernel module sources into some work area
directory, for example ~home/workarea/tmp/hellodebkmod-0.1
o Note: sources MUST be placed in the directory named same
as the Debian package (.deb) you're intending to build
o Note: .deb packages would emerge in ~home/workarea/tmp
directory (one level above build directory)
* verify that kernel module is can be build in a 'refular' Linux
kernel build way, and that it can be installed/removed from the
running kernel:
cd to ~home/workarea/tmp/hellodebkmod-0.1
make
sudo insmod hellokmod.ko
sudo rmmod hellokmod
dmesg | tail -2
should produce this output:
[ nnnn.nnnn] Hello, world
[ nnnn.nnnn] Goodbye, cruel world
* clean up build area with:
make clean
* and create Debian package build subdirectory 'debian', and
original module sources subdir at the above level:
dh_make --email vl...@linuxmedialabs.com --kmod --copyright gpl2 --
createorig
* edit stuff inside the 'debian' subdirectory created by dh_make:
o remove extra files:
+ dirs
+ docs
+ *.ex
+ *.EX
o edit 'control' file - remove hellodebkmod-utils (since we
don't have any utilities associated with that package)
o edit 'control.modules.in'
o edit rules file
+ edit $(MAKE) in the 'binary-modules:' target
+ edit copy binaries command for proper source of *.ko
file in the same 'binary-modules:' target
+ edit copy drivers source in the 'install:' target
+ edit copy debian/* subdirectory files in the same
'install:" target (get rid of *_KVERS_* nonsense)
+ include debian/control file
+ comment out $(MAKE) .... install command in the
'install:' target
* execute build package command:
dpkp-buildpackage
* this will produce following important files (among others we
don't need) at the above level (~/workarea/tmp):
o hellodebkmod_0.1-1.dsc
o hellodebkmod_0.1-1.diff.gz
o hellodebkmod_0.1.orig.tar.gz
o hellodebkmod-source_0.1_all.deb
* those files and additional files need to go into deb repository
(to be expanded ....)
* module-assistant with build, then install commands should be
used to actually build and install driver on the target system (to be
expanded ....)