Prepare the compact flash image

After you have installed asterisk and all the add ons, configured it and fully tested it to ensure it is set up just the way you want it, it’s time to create the CF image.  This is the final configuration that will be written to your CF disk.

Before we do this we will first clone Partition #2 over to Partition #3.  Once we do that we will strip it down to only the essential files to get the overall size as small as possible.  If we break something all we have to do is copy over Partition #2 again and start over.  If we know what files we need to fix it we could just copy over those files from partition #2.

Boot from the Debian CD as before until you reach the partitioner.  This time select Partition#3 as the destination and Partition#2 as the source.  Once you clone the partition reboot to GRUB and select the partition#3 boot option.  Edit /etc/fstab and change /dev/hda2 to /dev/hda3.  Now reboot and make sure you are in fact booting to partition #3

We want to get the total size of partition #3 down to below 100Megs.  We should be able to get it below about 75Megs but it’s not easy.  In this project we will be running entirely from RAM (ramdisk).  The smaller the size of the image the smaller the ramdisk needed and the smaller the ramdisk the more RAM is available for Asterisk to run and the less RAM required overall.  Getting this size down is the most painful and most critical part of the whole process.

Stripping the Binaries

This operation removes unneeded symbols from the binaries we compiled earlier.  This significantly reduces the size of the Asterisk executable.  Less so in the Asterisk modules but it all adds up.

#  strip --strip-unneeded /usr/sbin/asterisk
#  strip --strip-unneeded /usr/lib/asterisk/modules/*