Compile new kernel and setup partitions

It’s not as hard as you may think.  By compiling a custom kernel you can take out a lot of the things you won’t need or don’t want to use such as power management and SCSI support.  This makes the Kernel smaller and could improve performance.  You also have the option of building some modules right into the kernel instead of loadable on demand.  Loadable on demand is not needed when you have an embedded device that will not change.  You can do a search if you are interested in the potential advantages of integrated vs loadable modules.

# cd /usr/src
# tar -xvjf kernel-source-2.6.8.tar.bz2
# cd kernel-source-2.6.8
# make menuconfig

Select various kernel options.  Remove everything you don’t need.  Especially all the modular components which can add significantly to the /var/modules/kernel/ files.

Now compile the new kernel.  This may take several hours depending on the speed of your CPU.

# make-kpkg clean
# make-kpkg –append-to-version=.[some ID] kernel_image

Where [some ID] is a name you specify to identify it as your custom kernel.  Once complete, it will add the option of booting this new kernel to your menu.lst file.  You will still have the option of booting from the original kernel.

Now that we have our Linux foundation it’s almost time to start building Asterisk on top of it.  I decided to clone partition #1 over to partition #2 at this point and boot/install Asterisk from there.  If anything goes wrong we can always clone over our known pristine install of Debian Linux again and start over. 

Clone partition #1 to partition #2

First you want to edit the grub boot file menu.lst

#vi /boot/grub/menu.lst

When finished editing, your menu.lst file should look similar to the following.  The important information is the last two paragraphs. This is the additional information needed to boot from partition #2 and #3.

/boot/grub/Menu.lst file on partition #2

# Set the default entry to the entry number NUM. Numbering starts at 0
# the entry number 0 is the default if the command is not used.
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.          

default saved

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).

timeout     5

# Pretty colours

color cyan/blue white/blue

title       Debian GNU/Linux, kernel 2.6.8-2-386 on Partition #1
root        (hd0,0)
kernel      /boot/vmlinuz-2.6.8-2-386 root=/dev/hda1 ro
initrd      /boot/initrd.img-2.6.8-2-386

title       Debian GNU/Linux, kernel 2.6.8-2-386 (recovery mode)

root        (hd0,0)
kernel      /boot/vmlinuz-2.6.8-2-386 root=/dev/hda1 ro single
initrd      /boot/initrd.img-2.6.8-2-386

title       Debian + Asterisk on partition #2

root        (hd0,1)
kernel      /boot/vmlinuz-2.6.8-2-custom_compile root=/dev/hda2 ro
initrd      /boot/initrd.img-2.6.8-2-custom_compile

title       Compact Flash configuration on partition #3
root        (hd0,2)
kernel      /boot/vmlinuz-2.6.8-2-custom_compile root=/dev/hda3 ro
initrd      /boot/initrd.img-2.6.8-2-custom_compile


Once you have finished editing your menu.lst file simply reboot from your Debian CD and go through the pre-install process again until you reach the hard drive partitioner step.  Carefully select manual install for the hard drive, select partition #2. Then select the partition copy option at the bottom of the partition #2 menu.  Select partition #1 as the source.

After the copy is complete, remove the CD and reboot the development system.  Watch as the system reboots.  Ensure that you are booting into partition #2 by selecting it from the GRUB boot screen.  This will be remembered and will be the default boot choice next time.  Once booted we need to edit the /etc/fstab file to reflect the partition change

#vi /etc/fstab
Change the “/dev/hda1” to “/dev/hda2” and reboot again.