Adding Non-free Drivers to a Debian Netboot initrd
When working on an IaaS product, there is a constant need to have an easy and quick way to re-provision bare metal quickly. At Eucalyptus we utilize Cobbler and a home grown solution that allow us to setup servers automatically. PXE along with kickstart/preseed configurations create an easy, consistent and automated way to setup bare metal on the fly. Setting this up though is not always as easy as one would like for some operating systems and hardware configurations.
When netbooting Debian on a Dell server with a Broadcom Netextreme II network card, a missing firmware error will occur with the stock Debian netboot ramdisk. The Broadcom Netextreme II network card uses non-free firmware so Debian will not pack it by default with its stock images. So, the firmware needs to be added to the netboot ramdisk manually before the machine will be able to successfully boot and access the network.
The Debian Wiki’s Netboot Firmware page contains some instructions on how to add the non-free firmware deb package to the stock ramdisk. Unfortunately, I was unable to get this to work. So, another method was performed to get the firmware into the netboot ramdisk and below is what I did. (NOTE: the below example uses the Debian Squeeze release. The same instructions will work with other versions of Debian as well.)
- Download the netboot kernel and ramdisk from your favorite Debian mirror. For example, on the USC Mirror these files for 64-bit can be found at the following location: http://mirrors.usc.edu/pub/linux/distributions/debian/dists/squeeze/main/installer-amd64/current/images/netboot/debian-installer/amd64/
- Create a temporary directory that you will extract the ramdisk to.
- Copy the ramdisk to the temporary location and then extract the ramdisk into the directory.
cp $DOWNLOAD_DIR/initrd.gz /tmp/initrd cd /tmp/initrd gunzip <initrd.gz | cpio --extract --preserve --verbose
$DOWNLOAD_DIRis the location the ramdisk was originally downloaded to.
- Remove the
initrd.gzfile from the temp directory.
*NOTE: There may be a more proper place to put this directory according to the Debian Wiki – Firmware Locations. This location works though without any issues in the ramdisk.
- Download the Debian non-free drivers tarball from the Debian package websiteand unpack it in another temporary directory.
cd /tmp wget http://ftp.de.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-nonfree_0.28+squeeze1.tar.gz tar xzvf firmware-nonfree*.tar.gz
- Copy over the bnx2 folder contents from the non-free drivers tarball to the firmware directory created in step 5.
cp -Rav /tmp/firmware-nonfree/bnx2/bnx2* /tmp/initrd/lib/firmware/
- Now repack the initrd with the newly added drivers.
cd /tmp/initrd find . | cpio --create --format='newc' | gzip >../initrd.gz
A new ramdisk has been created with the non-free drivers included. The
/tmp/initrd.gz file can be placed onto a tftpboot server or other boot server for usage by properly configured systems using PXE. The Debian Squeeze installer can then be run by users or with a proper configuration, a fully automated install can occur with preseed configurations.