Debian Remaster Netinstaller - Integrate Firmware bnx2x and Preseed

last edit .. by

General
We are using about eight Debian based OpenVZ hosts to run 150+ OpenVZ containers on it. At this time this containers are Ubuntu based, in the future we would like to use Debian Squeeze. The Hardware boxes are HP BL Blades 460c G6 and they have onboard Broadcom bnx2x network interface cards. To make life easier we have decided to use the Debian Netinstaller, a local repository cache (apt-cacher-ng), our own repository with self made packages, Puppet for configuration file changes and of course Debian preseed.

In fact, the setup from the pure iron to the running ready to use system doesn't take longer then 15 minutes and we were using this setup over the last 5 years.

Informations about bnx2x firmware
The firmware for the bnx2x hardware is only available through the Debian non-free repository. This meens that the firmware is not included on the Debian setup media and therefore e.g. a Netinstaller setup won't work.

To get things up and running you will have to integrate the firmware onto the Netinstaller. In 2009 Dann Frazier wrote a script that integrates the needed firmware automatically onto the Netinstaller. Unfortunately the link to the script on his side is dead. I've tried to send him an email but haven't got any response until today (Sep. 2010)

The site an the script from Dann Frazier is back online. Thanks to Tomasz Jadczuk who send me the original script! Here is the link do Dann's script -> http://people.debian.org/~dannf/add-firmware-to/add-firmware-to

Here is the script from Tomasz -> http://www.n0r1sk.com/images/9/95/Add-firmware-to.sh

Why we wrote this documentation?
After a lot of search on the internet we found all needed information to do it ourselves. But the informations are currently spreaded about a lot of sites with obsolate state. You can find the ressources at the bottom of this page. If you have any problems with this step by step guide, please let us know! This guide is a summary of certain pages listed at the bottom of the page!

Preparation
Create a folder as a working directory. Under this folder we will extract the Netinstaller, the init.rd and after all we will recreate the iso.

Important: You will probably have to work as root user or at least you have to use sudo! We are using the amd64 bit version of the installer!

Let's create our folder: mkdir ~/netinstaller

Download and extract Debian Netinstaller iso
Create a folder called "cd" under our "netinstaller" folder. To this folder we will extract the Netinstaller iso file. mkdir ~/netinstaller/cd

Change into the Netinstaller folder and download the current stable Netinstaller from one of the Debian mirror sites. Please check back the current stable version at: http://www.debian.org/CD/netinst/ cd ~/netinstaller && wget http://cdimage.debian.org/debian-cd/5.0.6/amd64/iso-cd/debian-506-amd64-netinst.iso

To extract the Netinstaller in a simple manner we use "7z" from http://www.7-zip.org/. It is integrated in most of the repositories, for Debian use: apt-get install -y p7zip

Extract the iso to the ~/netinstaller/cd folder. 7z x ocd ~/netinstaller/debian-506-amd64-netinst.iso

'''

To extract the Netinstaller in a simple manner we use "bsdtar". This version of tar is not installed as default. Use apt to install it. apt-get install -y bsdtar

Extract the iso to the ~/netinstaller/cd folder. bsdtar -C ~/netinstaller/cd -xf ~/netinstaller/debian-506-amd64-netinst.iso

Download and extract the bnx2x firmware
Create a folder called "bnx2x" under our "netinstaller" folder. To this folder we will extract the contents of the bnx2x Debian firmware package. mkdir ~/netinstaller/bnx2x

Change into the Netinstaller folder and download the current stable bnx2x firmware package from one of the Debian mirror sites. Please check back the current stable version at: http://ftp.debian.org/debian/pool/non-free/f/firmware-nonfree/ cd ~/netinstaller && wget http://ftp.debian.org/debian/pool/non-free/f/firmware-nonfree/firmware-bnx2x_0.26_all.deb

To extract the firmware package we use dpkg-deb. dpkg-deb -x ~/netinstaller/firmware-bnx2x_0.26_all.deb ~/netinstaller/bnx2x/

Extract and modify the initrd.gz
Now we are ready to extract the initrd.gz, modify it and bring the changes back to an initrd.gz. We know that there are different ways to modify the initrd.gz file, like concatenating another .gz to it, but we like to know what we are doing and why things work like they do. Create a folder called "initrd" under our "netinstaller" folder. To this folder we will extract the contents of the initrd.gz from the Netinstaller. mkdir ~/netinstaller/initrd

To extract the initrd.gz use the following command. cd ~/netinstaller/initrd && zcat ~/netinstaller/cd/install.amd/initrd.gz | cpio -iv

Copy the extracted firmware to the extracted initrd
Now, after we extracted the initrd we can copy the firmware into it. cp -Rpv ~/netinstaller/bnx2x/lib/firmware ~/netinstaller/initrd/lib

Copy the Preseed file to the extracted initrd
If you like to integrate a d-i Preseed file you can add it to the / (root) of the initrd. Please note that the Preseed file must be named preseed.cfg! cp -v ~/netinstaller/initrd/preseed.cfg

Recreate the initrd.gz
After we made the changes in our initrd we have to recreate the initrd.gz cd ~/netinstaller/initrd && find. -print0 | cpio -0 -H newc -ov | gzip -c > ~/netinstaller/cd/install.amd/initrd.gz

Recreate the netinstaller iso
Before we can recreate the iso we have to compute the new md5 checksums of the modified content (Preseed file, new initrd.gz). In the root directory of our extracted Netinstaller (folder "cd") there is the md5sum.txt that must be modified. cd ~/netinstaller/cd; md5sum `find ! -name "md5sum.txt" ! -path "./isolinux/*" -follow -type f` > md5sum.txt;cd -

After computing the new md5sums we can create the new Debian Netinstaller iso. mkisofs -o ~/netinstaller/debian-506-amd64-netinst-bnx2x.iso -r -J -no-emul-boot -boot-load-size 4 -boot-info-table -b isolinux/isolinux.bin -c isolinux/boot.cat ~/netinstaller/cd

Test
You can use VirtualBox, Qemu or something similar to test your new Debian netinstaller iso.