Flashing eeprom during imaging via PXE

I had a requirement to flash the eeprom on a FTDI chip while dropping a clonezilla image onto the system which is done via a PXE server

The 1st thing we need to do is get ftdi_eeprom tools on the clonezilla image, we do this by setting up an ubuntu system (I used ubuntu 12.04)

apt-get install squashfs-tools unzip

wget -O Clonezilla-2.1.2-20_amd64.zip http://downloads.sourceforge.net/project/clonezilla/clonezilla_live_stable/2.1.2-20/clonezilla-live-2.1.2-20-amd64.zip?r=http%3A%2F%2Fclonezilla.org%2Fdownloads%2Fdownload.php%3Fbranch%3Dstable&ts=1373475093&use_mirror=heanet

mkdir clonezilla-src clonezilla-sqfs
cd  clonezilla-src
unzip ../Clonezilla-2.1.2-20_amd64.zip
cd ../clonezilla-sqfs
unsquashfs ../clonezilla-src/live/filesystem.squashfs
cd squashfs-root/root

wget http://ftp.de.debian.org/debian/pool/main/f/ftdi-eeprom/ftdi-eeprom_0.3-2_amd64.deb
wget http://ftp.de.debian.org/debian/pool/main/c/confuse/libconfuse0_2.7-4_amd64.deb
wget http://ftp.de.debian.org/debian/pool/main/c/confuse/libconfuse-common_2.7-4_all.deb

rm *.deb

chroot ~/clonezilla-sqfs/squashfs-root
cd root

dpkg -i libconfuse-common_2.7-4_all.deb
dpkg -i libconfuse0_2.7-4_amd64.deb
dpkg -i ftdi-eeprom_0.3-2_amd64.deb

cat > ./eeprom.conf <<@


cd ~/clonezilla-sqfs

mksquashfs squashfs-root filesystem.squashfs -comp xz -Xbcj x86 -b 1024k

Replace the Fields above with the values you want to use most important is the two _id fields as they tell ftdi_eeprom which device to attempt to flash, you can get these by running the command “lsusb” and identifying the device.

Copy the file “filesystem.squashfs” that has just been created and overwrite the one on the PXE server used to deploy the image. When you next PXE boot the target machines you will find ftdi_eeprom is available to use.

Now during the deployment run the command
ftdi_eeprom –flash-eeprom /root/eeprom.conf