Injecting kernel modules in initrd.gz for the Debian Installer

I manage a PXE infrastructure running Cobbler that I use to kickstart Debian and RedHat servers. I had to install Wheezy on few Dell R720's that had some NIC's with drivers not in the Wheezy initrd image file, so the PXE was failing. I decided to rebuild the initrd image file with the new drivers that I was able to find from source. The process is as follows:

First check the version of the linux kernel and the initrd that is used by the Wheezy installer:

I actually got the latest versions of the kernel and initrd from here:

To extract the files from the initrd image run the following:
Now, if the kernel you are currently running matches the kernel that you are trying to build the driver for, then you can just compile the driver from source (./configure && make) and replace the .ko file that is in the initrd image file that you've just unpackaged. In this example I am compiling the Intel e1000 driver, so replacing it is simple:
If the kernel you are currently running does not match the kernel for the installer then you have to install the kernel headers for that version, edit the Make file and find or add an option similar to this:
Once you have replaced the kernel module it's time to rebuild the initrd image and replace the old one so that Cobbler can sync it and tftp can serve it:
If you are not replacing an already existing driver in the initrd image, then you can just copy the .ko file somewhere in the extracted image and edit the init script file that's in the / of the initrd image:
In some cases you might have to get the latest PCI ID file, that contains all known ID's used in PCI devices and replace the one in the initrd file:
To add a firmware blob, you can copy the bin file to /usr/local/lib/firmware the same way like the driver, but just make sure to run update-initramfs -u

This is a nice and simple way of adding kernel drivers to the initrd image file for PXE booting new severs.