[Grml] [HOWTO] Packaging up out of tree Intel network drivers and adding them to grml

Andras Korn korn-grml at elan.rulez.org
Fri Oct 4 23:24:06 CEST 2013


I packaged a few of Intel's out of tree NIC drivers from
http://sourceforge.net/projects/e1000/ as dkms based .debs and included them
in a custom grml image.

I'll explain how; if there is interest, I can also share my packages
(although, as you'll see, they're likely sub-par, because I did not take the
time to really understand what I was doing; in particular, I fear the e1000e
module may not always build correctly at grml-live time, while it builds
correctly on the live system).

1. I grabbed some tarballs from http://sourceforge.net/projects/e1000/:

-rw-r--r-- 1 root root   269997 Sep  5 16:25 e1000e-2.5.4.tar.gz
-rw-r--r-- 1 root root   303648 Sep 17 02:23 igb-5.0.6.tar.gz
-rw-r--r-- 1 root root   362747 Sep 30 23:21 ixgbe-3.18.7.tar.gz
-rw-r--r-- 1 root root   140096 Sep 30 23:31 ixgbevf-2.11.3.tar.gz

2. I extracted each.

3. I moved the contents of foo-1.2.3/src to foo-1.2.3 itself in each.

4. I created a dkms.conf like the following in the root of every driver root
directory (i.e. foo-1.2.3/):

CLEAN="make clean"

5. I made sure the Makefiles get the kernel version to build for from the
KERNELRELEASE ennvar (not BUILD_KERNEL or similar), because this is what
dkms sets:


(In at least one case, I also replaced an #ifdef CONFIG_PM_SLEEP with #ifdef
CONFIG_PM in netdev.c because the module didn't build for my kernel
otherwise, but this problem doesn't manifest with the grml kernel because it
defines either both or neither.)

6. I issued the following dkms commands (from the source directories):

dkms add -m foo -v 1.2.3
dkms mkdeb -m foo -v 1.2.3 --source-only

(Naturally, you have to replace 'foo' with the name of the module and 1.2.3
with the actual version number.)

The second command will create a .deb and dump it somewhere under

7. I imported the .debs into my private repository (managed by reprepro).

8. I installed grml-live. I created a new fai 'class', called EXTRANIC. This
involved creating the following files:

/etc/grml/fai/config/hooks/instsoft.EXTRANIC (mode 755):

set -u
set -e
$ROOTCMD apt-get --yes --force-yes install \
	dkms build-essential linux-headers-3.10-1-grml-amd64

(You'll note this is inelegant because it hardcodes the kernel version; the
point here is to make sure the kernel-headers are already installed by the
time the driver packages are installed.)

/etc/grml/fai/config/scripts/EXTRANIC/50-dkms (mode 755):

set -u
set -e
for kernelversion in $(${=ROOTCMD} sh -c 'ls -1 /boot/vmlinuz-*' \
	| sed 's at .*boot/vmlinuz-@@'); do
		echo "Building dkms modules for kernel $kernelversion."
		${=ROOTCMD} /etc/kernel/postinst.d/dkms "$kernelversion"

(This may not be necessary. It attempts to build all dkms modules once more,
after all requested packages have been installed.)



(Yeah, so not just Intel. The others come from regular Debian.)


(Contains the deb http://... line for my repository.)


(Contains the public key of the repository signing key; I'm not sure this is
really the correct way of injecting it in the build process.)

9. In /etc/grml/grml-live.local, I have:

FAI_DEBOOTSTRAP="sid http://cdn.debian.net/debian"
VERSION=$(date +%F)
DEFAULT_BOOTOPTIONS="ssh=sekrit" # Be sure you understand what this does before using it

10. I built a new iso using the following command:

echo 'y\nn\ny\ny'\
	| env -u TMPDIR -u TMP \
	nice -n 20 \
	grml-live -A -u -e /path/to/grml64-full_sid_20131001.iso \

I'm posting this in the hope someone finds it useful. I'm not subscribed to
the list, so please Cc: me on replies.

The resulting image is larger than regular grml as it includes
build-essential and its dependencies; if that's a problem, I suppose you can
add a script after 50-dkms that purges now-unneeded packages.

Incidentally, zfsonlinux can be added to grml in much the same way (that was
the original point of the exercise for me).


               At some point in the project you're going to have
                 to break down and finally define the problem.

More information about the Grml mailing list