by

Proprietary drivers on a custom Debian installer

Recently I had the need to create a custom GNU/Linux distribution. It would install the system in a computer, along with a few handpicked packages, all with minimum fuss. Luckily enough, there’s software for this: Debian Live.

Debian

Image by Debian

CC-SA License

The project’s website is not initially the most inviting, but it doesn’t take much digging to find the documentation of the project. Just following the section titled “For the impatient” gets you up and running in no time, creating a customised installer of Debian GNU/Linux. The rest of the documentation covers a number of advanced cases.

Proprietary drivers during installation

However, I did come across a stumbling block. Some of the laptops where I have to install this require a proprietary driver for their WiFi card. The problem here is not getting these drivers installed: instead, the problem is getting the card to work during the installation process itself, so that updated packages can be downloaded if desired.

Initial attempt

Reading the documentation, it’s straightforward to see how to get the drivers working after the installation. Simply add the name of your package to one of the “chroot” package lists:

1# config/package-lists/firmware.list.chroot
2firmware-b43-installer

And make sure you are fetching packages from the contrib/non-free repositories if required:

1# auto/config
2set -e
3
4lb config noauto \
5    --archive-areas 'main contrib non-free' \
6    "${@}"
7

So that’s simple. Now, how to make this work for the installation process too? On further reading, I am led to think I only need a “binary” package list referencing the same package but, much as I try, that leads nowhere. The required firmware doesn’t end up in the expected place

The solution

Finally I figured out a way. During the build process, and after the firmware is unpackaged on the “chroot” tree, I can have a hook (see section 9.2 of the manual) copy the files across to the “binary” tree. For this I just needed this file (as well as the two listings above):

1# config/hooks/firmware.binary
2#!/bin/sh
3cp -pr chroot/lib/firmware/b43 binary/firmware/
4

And that is this problem solved! I’ll note that the installation process still asks whether you want to supply firmware from the wayward device. In my case, it asks three times, each time mentioning different required files. Just go “Yes” until it’s satisfied. Of course, if it always asks about the same files, it’s probably because something went wrong and it can’t actually find them.

A way to avoid this question asked at all is using a preseeded configuration:

1# config/includes.binary/install/preseed.cfg
2...
3d-i hw-detect/load_firmware boolean true
4...
5

That should make it clear that yes, we want that firmware loaded and there’s no need to ask so many questions.

A working example

A nice feature of Debian Live is that it’s all configured using just a few text files. Very convenient to track your progress with version control. I published the config files for my distro on Github if you want to check it out. At the time of writing these lines, it is a working example of the technique described above: https://github.com/pablobm/w2c3-livecd