[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

toward better module package building



Let me show you what I've got here. It's just a first step, mind..

joey@satin:~>apt-src list
i   pcmcia-cs      3.1.33-7       /home/joey/lib/kernel/modules/pcmcia-cs   
i   kernel-source  2.4.18         /home/joey/lib/kernel/linux        
i   poldhu         0.2.12-2       /home/joey/lib/kernel/modules/poldhu-0.2.12  

The poldhu source package is a kernel module package; a driver for a
wireless pcmcia card. Let's say I release a new version:

joey@satin:~>sudo apt-get update
<snip>
joey@satin:~>apt-src upgrade --install
Cleaning in /home/joey/lib/kernel/modules/poldhu-0.2.12 ..
dh_testdir
dh_testroot
/usr/bin/make clean
<snip>
Reading Package Lists... Done
Building Dependency Tree... Done
Need to get 0B/33.0kB of source archives.
dpkg-source: extracting poldhu in poldhu-0.2.12
Building in /home/joey/lib/kernel/modules/poldhu-0.2.12 ..
dpkg-buildpackage: source package is poldhu
dpkg-buildpackage: source version is 0.2.12-3
dpkg-buildpackage: source maintainer is Joey Hess <joeyh@debian.org>
dpkg-buildpackage: host architecture is i386
<snip snip>
 debian/rules build
 dh_testdir
 ./Configure -n --kernel=/home/joey/lib/kernel/linux --target=`pwd`/debian/poldhu-2.4.18
<snip>
dpkg-genchanges: binary-only upload - not including any source code
dpkg-buildpackage: binary only upload (no source included)
Installing debs ..
(Reading database ... 38233 files and directories currently installed.)
Preparing to replace poldhu-2.4.18 0.2.12-2 (using
.../poldhu-2.4.18_0.2.12-3_i386.deb) ...
Unpacking replacement poldhu-2.4.18 ...
Setting up poldhu-2.4.18 (0.2.12-3) ...
Reloading  configuration files.

Look ma, I'm running the new module! Was that quick, or what?

This module can also be built in the usual way using make-kpkg
modules_image inside my kernel source tree.

Notice that the debian/rules was able to work out where the kernel tree
was (and what version kernel). It did this by quetying apt-src. In the
rules file, I have:

ifdef APT_SRC_BUILD
# Get info from apt-src about where the kernel source is, and what version
# it is. These variables are otherwise set by make-kpkg.
KVERS=$(shell apt-src version 'kernel-source.*')
KSRC=$(shell apt-src location 'kernel-source.*')

The rules file also does a little bit more probing, and if you have a
pcmcia-cs package registered with apt-src, it takes care of building the
module against that your pcmcia-cs tree, so it will work with
non-in-kernel pcmcia modules. By the way, what is the current accepted
"right way" to make a add-on pcmcia modules package do that, in the Real
Debian World today? Is there one at all?

The rules file in all is a mere 75 lines long, which is a far cry from
the more typically 200 or 300 line complex rules files a module package
has traditionally required. A lot of this is because I didn't bother to
make this package generate a -source deb. You have to use apt-src with
it. (This may, reluctantly, change, before I upload that package to
debian proper.)

My kernel source tree happens to be a locally installed and patched
tree. I could use the debian kernel-source source package just as
easily, and if I did, apt-src would happily upgrade it as well if
Herbert released a new one.

This is where things begin to break down, because if apt-src did that
hypothetical upgrade, it would not know that the poldhu module package
needs a recompile too. And the possibility of the pcmcia-cs tree
influencing things is far beyond its ken. It also wouldn't know to build
the kernel source with make-kpkg. This last can be solved with some
more apt-src config options. The former, well, that would take some form
of source dependencies to get straight.

Anyway, if you want to try out this stuff (and expecially if you have a
3com xjack card and so can actually use the poldhu driver), the apt
repository is here:

deb http://kitenet.net/programs/code/debian /
deb-src http://kitenet.net/programs/code/debian /

Install a recent apt-src; the latest debhelper; then 
"apt-src install poldhu" in /usr/src/modules or wherever you keep those
modules. You have to tell apt-src where your kernel tree is, either by
"apt-src install kernel-source-2.4.18 --location=/usr/src", or if you
want to use your own tree, with a command similar to this:

  apt-src import kernel-source --version=2.4.18 --location=/usr/src/linux

After that you'll be set up as I was at the top of this email. See other
side of card.

-- 
see shy jo


-- 
To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: