Installing Elastix on Embedded (Alix) hardware

There have been quite a few un-answered questions about getting Elastix working on embedded x86 hardware, such as PCEngines Alix hardware. In this tutorial we want to install Elastix on the Alix.6b2, however other Alix hardware will work fine. The aim is to have a fully working Elastix system booting on an embedded x86 system without a monitor ever being plugged into the hardware. You will need one attached to your desktop however.

I was incredibly surprised at how easy it was to install Elastix on an embedded system. Very little tweaking was required when I found out where to go and what to do. Now you too can install Elastix on your Alix hardware with ease!

Be warned, there’s a few screenshots after the break (Around 20)!

Requirements:

  • Alix.6b2 or similar embedded system, preferably with 256MB RAM
  • Compact Flash USB Card Reader, or IDE -> CF adapter for your Desktop PC. Either will suffice
  • 4GB CompactFlash Card
  • The latest Elastix-1.6 ISO (Well older ISO’s work too, but the latest is nice)
  • VirtualBox
  • Teraterm or similar application (Optional for viewing boot process over serial cable)

Allow at least 90 minutes for this whole procedure, you don’t want to rush it, and installing Elastix in a VM can take longer than usual. It took around 60 minutes for Elastix just to install the packages, though thats possibly my slow & cheap CompactFlash card.

Firstly, we want to install Virtualbox, with the latest version being 3.0.12 at the time of writing. This can also work with VMWare, but due to Virtualbox being free I figured it was easiest for all if the guide was written with it in mind.

Once Virtualbox is installed, you want to plug in your USB Compact Flash reader with your 4GB CompactFlash Card inserted. If windows asks “Do you want to format”, just ignore / cancel it for now.

Now, we’re going to bring up Windows Disk Management. Right-click on My Computer –> Manage –> Storage –> Disk Management

Where it says “Disk 0″, “Disk 1″, is the Physical Disk ID. Make a note of the Physical Disk ID of your CompactFlash Card. For me, it was “Disk 4″:

Physical Disk ID

Now we’re going to open a command window, click Start –> (then click Run for Win9X / 2K / XP) –> type in: cmd

Hit Enter and you should see a new Command Prompt Window.

Type in the following:

cd "\Program Files\Sun\VirtualBox"

You should now be in the directory you installed VirtualBox into.

What we’re now going to do is create a Virtual Disk Image for VirtualBox to use, but this Disk Image will use the physical CompactFlash card as it’s drive.

Now, type in:

VBoxManage.exe internalcommands createrawvmdk -filename
c:\cf.vmdk -rawdisk \\.\PhysicalDrive4 -register

(I had to put in a line-break in order for it to fit in the blog window width, but this should all be done on one line)

Where it says “\\.\PhysicalDrive4″ replace the number with the Physical Disk ID you made a note of earlier.

It should say “RAW host disk access VMDK file c:\cf.vmdk created successfully.”:

Make RAW disk

If it did, then great! Now you can fire up VirtualBox and get ready to create a new Virtual Machine.

In VirtualBox, click on “New”, it will welcome you to the Wizard, click on Next.

Name your VirtualMachine “Elastix Embedded”, tell its Linux –> Other Linux. Click Next:

Name your VM

Give it 256MB RAM, just like your final system will have, and click Next:

VM RAM

Tell it to use an Existing Hard Disk and click on the little Folder button. In the Virtual Media Manager, add c:\cf.vmdk to the list and select it. Hit Next to continue:

Add disk to Manager

Selected RAW Disk

It’ll give you a quick run-down of your system, click on Finish.

Now, before you power it on you need to tell it to boot the Elastix DVD first. Right-click on the Elastix Embedded Virtual Machine and go to Settings. Click CD / DVD-ROM and tick “Mount CD/DVD Drive”. Choose ISO Image, then find your Elastix ISO. Select it and it should now boot it by default when you turn on your Virtual Machine:

Mount Elastix ISO

I also go into the Audio and USB and disable them both:

Disable Audio

Disable USB

Click OK to close the Settings, then Start the Elastix Embedded Virtual Machine.

Boot Elastix VM

When the Virtual Machine starts and you’re at the boot prompt for Elastix (As above), enter:

linux text resolution=800×600 mem=256M

Otherwise the install hangs during startup, and we don’t want that.

Follow through the install, most of the defaults seem to be fine.

When it comes to partitionging, try it like this (Give it some SWAP just in-case):

Partitioning

Once installed, let the Virtual Machine restart and login as root.

We’re now going to tidy up the install a little and make it boot from the Alix system by “disabling” the GUI and sending output over the Serial interface.

Note: If you’ve never used Nano before, then just remember that if you make any mistakes, or to save the file when you’re done just press Ctrl + X to exit. It’ll ask you if you want to save the file or not. Choose yes or no. If you choose Yes, it’ll ask you what the filename is and if you want to overwrite. Naturally you’re going to press Enter to overwrite. Feel free to use Vi or anything else you’re comfortable with.

Changes to a standard Elastix distribution to make it boot on an Alix system

yum install nano
nano -w /etc/sysconfig/kudzu

Set:

safe=yes

nano -w /etc/sysconfig/kudzu

This will stop Elastix from probing serial / ps2 hardware and potentially failing on boot.

nano -w /boot/grub/grub.conf

Comment out the following line by adding a # in front of it:

splashimage=(hd0,0)/grub/splash.xpm.gz

So it should now look like:

#splashimage=(hd0,0)/grub/splash.xpm.gz

Add in the following two lines after it:

serial -unit=0 -speed=9600 -word=8 -parity=no -stop=1
terminal -timeout=10 serial console

Also, add the following to the end of every line that starts with “kernel”:

CONSOLE=TTY0 CONSOLE=TTYS0,9600N8

nano -w /boot/grub/grub.conf

This tells Grub that you want to see everything both over the serial interface and your regular screen. Ctrl + X to quit, and save the file.

Next you want to run:

nano -w /etc/inittab

Add a line at the very bottom:

S0:12345:respawn:/sbin/agetty ttyS0 9600 linux

nano -w /etc/inittab

To be honest I’m not 100% certain why this is needed, but it seems to be required, so let me know if you know ;-)

Next, run:

nano -w /etc/securetty

Add a line at the very bottom:

ttyS0

That’s S then a Zero, not S then the letter “o”

nano -w /etc/securetty

This lets you login as root via the serial cable.

Lastly run:

nano -w /etc/sysconfig/init

Change “BOOTUP=color” to:

BOOTUP=serial

nano -w /etc/sysconfig/init

That’s it! All done!

Now, run:

shutdown -h now

shutdown -h now

That’ll shut down the virtual machine. Safely eject the CompactFlash Card, whip it out, pop it in your Alix system.

Safely Eject the CF Card

Remember that the LAN Cable goes in the port closest to the Power if you have more than one.

Plug in the power and let it boot! Success!

Alix LAN Port eth0

Note: It could take 3-4 minutes for it to power up, so if it doesn’t start up immediately then just be patient. I statically assigned mine an address via DHCP on my Tomato Router so I knew what IP it was going to get. I suggest you do likewise if possible, or use the Advanced LAN Scanner from radmin.com to scan your LAN for new machines. That, or check your router logs.

You should be all finished with a fully functional embedded system that boots from CompactFlash with no display. You can ssh in, boot into the WebGUI, anything you like!

Elastix WebGUI on Alix Hardware with Geode CPU

Elastix via SSH - Hardware details

Now if you run:

asterisk -r

Then type:

core show translation recalc 10

You should see a terribly slow system like mine:

*CLI> core show translation recalc 10
         Recalculating Codec Translation (number of sample seconds: 10)

         Translation times between formats (in milliseconds) for one second of data
          Source Format (Rows) Destination Format (Columns)

          g723 gsm ulaw alaw g726aal2 adpcm slin lpc10 g729 speex ilbc g726 g722
     g723    -   -    -    -        -     -    -     -    -     -    -    -    -
      gsm    -   -   13   13       29    14   12    46  150   255  214   29    -
     ulaw    -  41    -    1       18     3    1    35  139   244  203   18    -
     alaw    -  41    1    -       18     3    1    35  139   244  203   18    -
 g726aal2    -  56   17   17        -    18   16    50  154   259  218    1    -
    adpcm    -  41    2    2       18     -    1    35  139   244  203   18    -
     slin    -  40    1    1       17     2    -    34  138   243  202   17    -
    lpc10    -  62   23   23       39    24   22     -  160   265  224   39    -
     g729    -  74   35   35       51    36   34    68    -   277  236   51    -
    speex    -  71   32   32       48    33   31    65  169     -  233   48    -
     ilbc    -  78   39   39       55    40   38    72  176   281    -   55    -
     g726    -  56   17   17        1    18   16    50  154   259  218    -    -
     g722    -   -    -    -        -     -    -     -    -     -    -    -    -

As you can see there’s not much room for anything to be done in terms of transcoding. My LX800 (500Mhz) won’t handle much but I’ll run a few tests over the coming week and see how many calls I can squeeze out of the little sucker. Opening up the WebGUI immediately shoots the CPU up to 50% as it generates the graphs and things, so it’s probably not a good idea to be always on the WebGUI when you put it in to production, even just for a small home-office scenario or call quality may quickly deteriorate.

I’d love to hear any feedback you have, how it went for you, and what use you’ve found for Elastix on the hardware. So please, post your comments!

  • Share/Bookmark

Tags: , , , , , , , ,

14 Responses to “Installing Elastix on Embedded (Alix) hardware”

  1. Elastix Blogs » Blog Archive » Installing Elastix on Embedded … « new hardware Says:

    [...] from:  Elastix Blogs » Blog Archive » Installing Elastix on Embedded … 27 Nov 09 | [...]

  2. Shook Says:

    Hello,
    Can we install elastix on Linksys WRT54GL running on DD-WRT?

  3. Josiah Spackman Says:

    Technically speaking you can install Asterisk easily (Optware), but as for Elastix … I dunno … maybe if you were able to setup a base system the same as a CentOS install and then follow similar instructions such as the CentOS2Elastix install guide, but to be honest not really. There are separate guides available on the internet for FreePBX Optware Installation :)

  4. Josiah Spackman Says:

    It’s worth mentioning that you may *not* always need to type “linux text resolution=800×600 mem=256M”, however doing-so means that setup won’t hang during the boot up process at /sbin/loader. I’m unsure of the cause, but just thought I’d mention that :)

  5. icecbr Says:

    This guide rocks!!!

    I did it on an Alix.2d2 fast and easy as your guide!

    One issue that should be cleared, people say that cf cards fail because of continuously writing on them, what should we do to avoid that? shouldnt we stop asterisk logging?? please give us some more info how to do that

    thanks a lot elastix team :)

  6. Josiah Spackman Says:

    Hi icebr,
    Thanks for the feedback, it’s always nice to know our time as bloggers documenting these kinds of things is appreciated.
    Yes, you certainly can adjust Elastix to run “nicer” on a CF Card. Many CF Cards have so many write cycles it’s pretty much a non-issue any way, but just-in-case, here’s a few things you can do:
    1) edit /etc/asterisk/logger.conf and comment out the line that starts with:
    [code]full =>[/code]
    You want to add a semicolon “;” in front of it. Changes will take effect next time you run amportal restart, or wait and restart your system after the next suggestion
    2) edit /etc/fstab and for your / partition change “defaults” to “noatime”. You can read more about its effects here: http://bit.ly/2zyCz8
    Restart your system after you’ve saved the changes to the fstab for them to take effect.
    Let us know how you go with those suggestions :)
    Cheers
    Chill.

  7. icecbr Says:

    Great answer Josiah, thank you very much :)

  8. Justin Cardinal Says:

    Thanks for the excellent guide. Did you ever get a chance to see how many concurrent calls the alix could handle in this setup? You mentioned it didn’t really have the power for transcoding. Does that mean g729 is not an option at all?

    Just a thought, if wearing out the CF card is a concern, it might be a good idea to just use an NFS share for /var/log/ so you can still maintain log data.

  9. Josiah Spackman Says:

    Hi Justin,
    I’ve done some tests, but nothing as full-fledged as I could. Basically MOH is a killer, so if you’ve got MOH make that g729. If you’ve got trunks / endpoints, make them all g729. Make your IVR Menu’s also g729, and if you do that, I could honestly see this little guy doing 15-20 calls easy. Naturally as soon as you fire up anything like loading the WebGUI while on a few calls it’s going to start chewing up the CPU and call quality will drop, but yeah it’s possible. You can happily do 5-6 calls with 4 of them listening to the default elastix / asterisk MOH.
    There’s honestly a ton of things you can do with the CF card, you can make a RAM Disk if you really want too, but I just don’t bother, by and large the CF card will last for years and years to come :)

  10. Computer News Says:

    My cousin would appreciate this blog post. We were recently talking about this. hehe

  11. Josiah Spackman Says:

    Happy to help :) Always keen to hear how readers stories go too if you’d like to share?

  12. Sam Says:

    Interesting post, one question;

    When I boot from serial I get the following output;

    01F0 Master 044A CF 4GB
    Phys C/H/S 7769/16/63 Log C/H/S 971/128/63
    GRUB Loading stage2…..
    x€xx€xx€xx€xx€xx€xx€xx€xx€xx€xx€xx€xx€xx€xx€xx€xx€xø
    CentOS release 5.3 (Final)
    Kernel 2.6.18-164.el5 on an i586

    The normal boot messages I would expect to see have been replaced by “x€xx€xx€xx€xx€xx€xx€xx€xx€xx€xx€xx€xx€xx€xx€xx€xx€xø”.

    Is this normal? I am running my did my setup with the serial port running at 38400 instead of 9600, other than that I followed all the instructions as above.

    Thanks

    Sam.

  13. Josiah Spackman Says:

    Hi Sam,

    That’ll be because of the variation between 9600 and 38400 baud rates of grub / kernel / hardware. Adjust them so they’re all the same :)

    Cheers

    Chill.

  14. Carlos Says:

    I have an Alix2d2 and I followed the instructions but is not booting, shows some lines and when the CF will start to boot it stop.
    I found the following:
    My grub.conf is in /etc/grub.conf not in boot/grub/grub.conf
    When I write linux text resolution=800×600 mem-256 ate boot line I get an interrupt error, therefore I amd not doing it.
    Thanks for any help in having this Alix working with Elastix, by the way I am using Openvox minipci FXS/FXO

    Thanks

Leave a Reply