Asterisk Live CF card

Andy Powell - 2004

http://www.automated.it/asterisk
http://www.automated.it/guidetoasterisk.htm

asterisk-live@automated.it


Based on cvs of 21-09-2004
First test release. b-01

Many thanks again to Stropharia and Multithread for hosting these files.


The asterisk live cf card is, clearly, a compact flash install of asterisk that will give you a complete, running system similar to that of the asterisk live CD. Indeed most things are the same although there have been some additions and changes. You may also want to read the advanced configuration and notes on remote configuration

To install the CF you will need some way of getting the image onto the card. Generally this can be done with a USB CF card reader using

  
  dd if=asterisk-cf-b01 of=/dev/sda bs=1k count=64000

asterisk-cf-b01 is the name of the file extracted from the downloaded cf tarball (alternate link)
/dev/sda is the device your system sees your USB CF card reader as. Windows users might want to check out this version of dd


Useful things to know



1. The cf install currently assumes it's hda (1 2 and 3) so you'll need to put it in as your primary master using your CF->IDE adaptor, this will be more automagical in the future

2. example configs are stored on hda3 along with a new feature script called remoteconfig. This will allow you to update the configuration/OS automatically on boot from a remote webserver. More detail on how to use this feature will appear at http://www.automated.it/asterisk be sure to read any notes there first.

3. At the minimum you'll need a 64mb CF card but you can use a larger one if you wish and create futher partitions. Currenly when you create the CF from the image the following partitions exist


  Disk /dev/hda: 8 heads, 32 sectors, 490 cylinders
  Units = cylinders of 256 * 512 bytes

     Device Boot    Start       End    Blocks   Id  System
     /dev/hda1   *         1        33      4208   83  Linux
     /dev/hda2            34       354     41088   83  Linux
     /dev/hda3           355       490     17408   83  Linux

4. Once booted you will need to make changes to the files in /dev/hda3/astlive-example, particularly networking and the zapata/zaptel configs. Note, if you rename the astlive-example directory to astlive then on the next boot the files will be copied and activated on the running system automatically. Using the example astlive directory includes a PASSWORD CHANGE for root from 'EPPING' to 'epping' (without quotes) as a demonstration. At the minimum you MUST change the networking to suit your environment, since they will change to what is in this directory too.

5. All partitions on the CF are unmounted after boot so if you need to work on them, you will need to specifically mount them.

6. I've tested E100P, X100P and TDM40B cards using this install, and would be interested to hear of other cards proven to be working.

7. Enjoy

Andy



Advanced



For this to work there must be a directory on the CF card (hda3) called

  
    astlive

astlive can contain (some, all or none) of the following directories:

  
  networking
  asterisk
  sys

but it must contain a file called

  
  .config

The contents of this file are of little regard - you can use touch for this if you like, or simply add config date information inside.

The asterisk directory contains all the .conf files that should be updated from your CF device. It may also contain the file

  
  s.asterisk
  

If this file exists then asterisk will start automatically at boot. (after all scripts are run)

The networking directory can contain all, some or none of the following files:

  
  hostname
  hosts
  ifcfg-eth0
  network
  resolv.conf

If you don't know what they are for, talk to someone who does.

This directory may also contain the file

  
  s.dhcp

If this file exists then the dhcp client will start at boot. If the network config files exist then they will be copied and the network will be started.

The sys directory contains specific system files for update.

  
  passwd
  shadow
  ssh_host_dsa_key.pub
  ssh_host_rsa_key.pub
  ssh_host_key
  sshd_config
  ssh_host_key.pub
  ssh_host_dsa_key
  ssh_host_rsa_key


if the file

  
  s.sshd

exists then sshd will start at boot allowing remote logins. If the file

  
  s.rud

exists then a remote update is performed (/etc/remoteconfig is executed)

  
  userinit

exists then it will be copied to /etc and executed from there. This is where you can add your own commands/scripting that will run at boot. If the file

  
  s.tftpd

exists then the tftp server will start, however you MUST export TFTPDIR in your userinit script first.



Additional notes on remoteconfig



You will probably want to grab this asterisk-cf-update.tar.gz (alternate link) so that you have a starting point and a little script to help you on your way.

First of all extract the archive:

  
  tar -zxvf asterisk-cf-update.tar.gz

This will give you a script (make_update) and a folder (updatetree). Simply place the files you want to update on the RUNNING system into the appropriate directory on updatetree. You can add directories as you wish. Note that the update will overwrite only the system running in RAM. Before you run make_update you MUST define BASEDIR. This is the path to the directory where the script and updatetree folders are located for example:

  
  export BASEDIR=/usr/src/asterisk-cf-update

You can then run the make_update script which will create a file called Config_MAC.tar.gz, this file should be renamed to Config_MAC_ADDRESS_OF_THE_TARGET_BOX.tar.gz (where MAC_ADDRESS_OF_THE_TARGET_BOX is, funnily enough, the actual mac address of the target machine). Move this file to your webserver. You will need to tell your target box where the config server is, you can do this in a couple of ways.

1. Change the remoteconfig script on hda3 by modifying serverip to be the webserver.

2. Add an entry in hosts or dns to point config.server.blah at the proper ip

You will then need to create a directory path on hda3 (the config partition of the CF)

  
  astlive/sys

and in this directory create a file

  
  s.rud

it doesn't matter about the content, the file should simply exist. On reboot the system will run remoteconfig and try to grab it's config and install it. If you create a script in the top level of updatetree called

  
  remote-config-script

then this will be executed as a post-update script.