IP04 Open Hardware IP-PBX

VoIP Hardware Solutions
Provider Solution Details
VoIP Hardware Zycoo UC Solutions
  • Modular Design IP PBX for SMB
  • Remote office Centralized Management solution
  • 3rd party app integration, Enterprise Billing, Android & iOS client
Details
The IP04 is an open (free as in speech) four port IP-PBX that retails for around $450. Both the *hardware* and software are open. The goal of this Wiki page is build community generated content for the IP04, for example configuration and How-To's.


Links

  • http://www.staronetel.com/reseller/ Buy your IP04 or IP08 direct from USA.
  • Wangate Italy Shop for IP02/04/08 Based PBX with Wangate commercially supported software. Open source version also available. Europe resellers welcome.
  • Neotiq Shop Buy your open-source PBX IP04, IP08 or BR4 in France through our shop. Support and new service development upon this platform.
  • VoIPtel SE Actively maintained and available with a Support Contract for the entire line of IPxx PBX's manufactured by Atcom Technology
  • VoIPtel CE Latest firmware for the IP01, IP02, IP04, IP08 and IP BRI manufactured by Atcom Technology
  • IP04 and IP08 producer:ATCOM
  • IP04 page on the Free Telephony Project site.
  • BAPS (Blackfin Asterisk Package System) is the latest firmware distribution for the IP04. BAPS supports package based installation of software (like apt-get or rpm), no compiling is required.
  • VoIPtel GUI has been chosen by Atcom Technology, David Rowe and astfin.org as the default GUI for their IP04, IP08 and IP-BRI.
  • The IP04 is similar to the Asterisk Appliance (AA) and several other embedded Asterisk products. Here is a comparison of the AA and IP04.
  • EdgePBX best price, best voice quality embedded IP PBX provider, now IP02/IP08/IP08D released, and it still is open, including hardware and software.
  • BroadTel VoIP product manufacturer from China, offers IP04 100% compatible model with enhancement. Welcome OEM & ODM orders.
  • Linksoft Firmware for IP01, IP02, IP04 and IP08 manufactured by ATCOM Technology with Chinese language (Mandarin and Cantonese) support
  • Alsacecom | VoIP Product Reseller - France and EU Distribution.
  • Buy Atcom IP04 at IPChitChat - Atcom Asterisk Appliances - Atcom IP-04 Asterisk Appliance
  • NetcloudAtcom Distributor UK and Worldwide.

How Tos - Technical


The following sections describe how to take an IP04 from a blank state (i.e. a newly constructed IP04 with erased flash) to a working IP-PBX. Useful for those hacking the IP04 and/or building their own IP04s (the hardware design is open, remember!).

The uClinux firmware used below (astfin-ip04) is now (October 2008) quite out of date. Most production IP04s now run the Blackfin Asterisk Package System ( BAPS). Astfin2 is also available as alternative firmware. The astfin-ip04 firmware used below may still be useful for prototype IP04 hardware, or as a stepping stone to BAPS of Astfin 2.

The u-boot instructions in the section below are still valid for the IP04 and IP08.


HOWTO - Create a uClinux/Asterisk uImage for the IP04


$ svn co http://svn.rowetel.com/software/astfin/branches/astfin-ip04/ astfin-ip04
$ cd astfin-ip04
$ make menuconfig
    • Target Architecture (IP04 IP-PBX)
    • Package Selection <*> Zaptel <*> 4fx <*> oslec
$ make
$ make image
$ cp image_ip04/uImage /your/tftpboot

HOWTO - create u-boot for the IP04


Note that uBoot isn't built by default.

[astfin-ip04]$ make uBoot


This will generate:
build_ip04/u-boot-1.1.5-bf1/u-boot.ldr: serial flash image
build_ip04/u-boot-1.1.5-bf1/u-boot.bin: image you can execute for u-boot

u-boot Notes


To just make u-boot without making the entire astfin:

[astfin]$ make uBoot


Clean u-boot (it's a good idea to make clean if you modify ip04.h):

[astfin]$ make uBoot-clean


Create u-boot patches for IP04:

[astfin]$ make uBoot-make-patch


NOTE: You will see something like this at the end: "make: [uBoot-make-patch] Error 1 (ignored)", this is an artifact of patch and is expected.

NAND Flash Config Notes


You shouldn't have to change this unless you change the NAND flash size from the default 256 MByte. However here is how to configure NAND flash:

[astfin]$ cd build-ip04/uClinux-dist
  [astfin]$make linux_menuconfig


Dig through the config menus to here:

Linux Kernel Configuration
Device Drivers
Memory Technology Devices (MTD)
NAND Flash Device Drivers

Notes:

1/ uClinux-dist/linux-2.6.x/drivers/mtd/nand/bfin_nand.c

2/ The default size is 256M (0x10000000), and base address is 0x20000000.

3/ The NAND is divided into two partitions. The first partition is 8M (kernel), the second partition the remaining space and is used for yaffs.

HOWTO - Modify uClinux Configuration


1/ cd to the uClinux-dist folder:

[astfin-ip04]$ cd build_ip04/uClinux-dist


2/ To change linux config (e.g. drivers, file systems, vendors/Rowetel/IP04/rc):

[uClinux-dist]$ make linux_menuconfig


3/ To change applications (busy box etc):

[uClinux-dist]$ make config_menuconfig


4/ Then remake the astfin image as per usual:

[uClinux-dist]$ cd ../../
  [astfin-ip04]$ make


5/ These will just be temporary chnages to your local build tree. To
capture the changes to patches/config files to astfin:

[astfin-ip04]$ make uClinux-ip04-make-patch


HOWTO - Recreate the Zaptel patch file


To (re)create package/uClinux-dist.mk/zaptel2.patch:

[astfin-ip04]$ make uClinux-zaptel-make-patch



HOWTO - Copy a single file or dir to the IP04


Sometimes you want to test something without building a new uImage.

Use rcp (you need this installed on your host):

rcp /home/david/tmp/t.txt root@ip04:/var/tmp

For some more info on rcp see the blackfin docs:

http://docs.blackfin.uclinux.org/doku.php?id=remote_shell&s=rcp

GOTCHA


If you change anything in busybox (e.g. through make config_menuconfig),
it's a good idea to:

[astfin-ip04]$ cd build_ip04/uClinux-dist/user/busybox
  [astfin-ip04]$ make clean


before rebuilding. The uClinux-dist build process doesn't seem to
capture changes to busybox well.

Initial Flashing using JTAG


I use a version of jtagprog hacked for the M25P20 as described above and an IGLOO cable. It takes about 20 minutes to write, or 45 for a write and verify. I got impatient after a while so I tend to Ctrl-C
out once the verify starts. Here are the commands I use to program the SPI flash:

jtag> cable parallel 0x378 IGLOO
Initializing Excelpoint IGLOO JTAG Cable on parallel port at 0x378
jtag> detect
IR length: 5
Chain length: 1
Device Id: 01010010011110100101000011001011
Manufacturer: Analog Devices
Part: BF533
Stepping: 5
Filename: /usr/local/share/jtag/analog/bf533/bf533
jtag> initbus bf532_bf1
jtag> spidetectflash 0
All 0xffs returned
Making the dangerous assumption that we have a M25P20!
SPI FLASH:
Manufacturer ID: 20
Memory type: 20
Memory capacity: 12 (262144 bytes)
Chip: STMicroelectronics M25P20
jtag> spieraseflash 0 4
erasing:
jtag> spiflashmem 0 u-boot.ldr
program:
addr: 0x00019B84 (done)
verify:
addr: 0x00013F60

Using u-boot to Test u-boot


ip04>tftp 0x1000000 u-boot.bin
ip04>go 0x1000000

NOTE: I had to remove a lot of options from u-boot to get the NAND code to fit in the 128k allocated by boards/ip04/config.mk. Lowering TEXT_BASE didn't help - u-boot wouldn't run. Not sure why, if any one
knows how to allocate more room for u-boot please tell me!

You can see if you have exceed the 128k limit by:

$ grep PROV u-boot.map

Look at this line of the grep output and make sure it doesn't exceed 0x03ffffff (64M system):

0x03ffe6b8 PROVIDE (end, .)

Note that the linker will quite happily place code and data outside of this limit - you need to check manually.



Using u-boot to Upgrade u-boot


NOTE: Make sure it's the u-boot.ldr file you tftp and write, not u-boot.bin which is used when testing u-boot using 'go'!

ip04>tftp 0x1000000 u-boot.ldr
ip04>eeprom write 0x1000000 0x0 $(filesize)
ip04>reset


Testing uClinux uImage


I have some u-boot environment variables set up like this:

bootargs=root=/dev/mtdblock0 rw
addnet=setenv bootargs $(bootargs) ethaddr=$(ethaddr)
ramboot=tftp 0x1000000 uImage.ip04;run addnet;bootm 0x1000000

uImage.ip04 is placed on your tftpserver. Then to download and start uClinux:

ip04>run ramboot

Notes:

  1. The ethaddr (the MAC address) is passed via the kernel command line, in this case the same MAC as u-boot is used.

  1. To set up environment variables like those above use quotes to make sure the spaces are processed correctly, e.g.:

ip04>setenv bootargs 'root=/dev/mtdblock0 rw'

Writing a uImage to NAND


ip04>tftp 0x1000000 uImage.ip04
ip04>nand erase clean
ip04>nand write 0x1000000 0x0 0x4c0000

Notes:

  1. During the tftp step bytes transferred = 4b6901 hex. 'nand write' needs to have the size of the write rounded up to the nearest sector size. 'nand info' gave me a sector size of 128 KiB (0x20000 hex) so I rounded up to 0x4c0000.
  2. Make sure that the u-boot environment variable "autostart" is set to no, or else u-boot will try to immediately boot the uImage.ip04 after it is downloaded.
ip04>setenv autostart no

Reference:

  1. Blackfin uClinux u-boot and NAND flash docs.



How To set up NAND/yaffs for root


This is a little indirect as the user-mode yaffs tools like mkyaffs are broken. The process is:

  • boot a uImage that contains the kernel and root fs on a ram based ext2 file system.
  • copy the root fs to yaffs
  • reboot mounting yaffs as root

These steps were adpated from Frank Hoffman's instructions.

  1. wget http://www.rowetel.com/ucasterisk/downloads/ip04/uImage.ext2

  1. First tftp the ext2 uImage and load into the kernel section of NAND flash. We need the ext2 image for the next step (copying files onto yaffs).

In u-boot:

ip04>tftp 0x1000000 uImage.ext2
ip04>nand erase
ip04>nand write 0x1000000 0x0 0x48000

(see Note (1) in "Writing a uImage to NAND" section above re 0x48000)

ip04>bootm 0x1000000

  1. Now we have the IP04 booted, but using a ram-based ext2 file system for root. So we need to copy /root into the yaffs file system:

On the IP04:

root:~> copy_rootfs.sh
root:~> reboot

  1. Now set up u-boot to mount root from yaffs (some of these env variables may be set already, use 'print' to check):

ip04>setenv autostart yes
ip04>setenv addnet 'setenv bootargs $(bootargs) ethaddr=$(ethaddr)'
ip04>setenv bootargs root=/dev/mtdblock2 rw
ip04>setenv nandboot 'run addnet;nboot 0x2000000 0x0'
ip04>setenv bootcmd run nandboot
ip04>save
ip04>reset

Notes:

  1. Don't used mkyaffs, it is very broken for flash chips with 2048 byte pages, like the one used by the IP04! It will fail badly. To recover use nand erase in u-boot.

  1. In u-boot 'nand dump' is helpful, for example after a nand erase:

ip04>nand dump 0x0

(you should see a flash "page" of 2048 0xff's + 64 OOB 0xffs)

After 'nand write' use nand dump to see the uImage in NAND.

  1. For reference a typical boot sequence is here:

http://www.rowetel.com/ucasterisk/downloads/ip04/ip04_boot_typical.txt

  1. To get some stats on the yaffs file system

root:~> cat /proc/yaffs

How To - Erase/Format yaffs


This section has a little more information on yaffs, see also " How To set up NAND/yaffs for root".

In u-boot:

ip04>nand erase clean 0x800000
ip04>nand erase 0x800000

The 0x800000 ensures you don't erase the first 8M of NAND flash that is used to store the uImage (kernel plus root in ext2 filesystem). If you havent written the uImage or don't mind blowing it away it's OK to remove the 0x80000 which will erase the entire NAND chip.

Check bootargs root=/dev/mtdblock0 using:

ip04>print

Then reset and allow uClinux to boot:

ip04>reset

Now try mounting yaffs:

BusyBox v1.4.1 (2007-06-01 01:29:28 CST) Built-in shell (msh)
Enter 'help' for a list of built-in commands.

root:~> mount /dev/mtdblock2 /mnt
yaffs: dev is 32505858 name is "mtdblock2"
yaffs: Attempting MTD mount on 31.2, "mtdblock2"
yaffs: auto selecting yaffs2
block 948 is bad
block 1061 is bad
root:~> umount /mnt/
root:~>

Then copy the root file system onto yaffs. There is a script for this but at the moment the permissions are incorrect:

root:~> chmod u+x bin/copy_rootfs.sh
root:~> copy_rootfs.sh

Now reboot into u-boot and set boot args to boot with yaffs as root.
Use print to determine your current bootargs:

ip04>print
<snip>
bootargs=root=/dev/mtdblock0 rw ethaddr=00:09:45:53:d1:b3
<snip>

Now re-set this environment variable, just changing /dev/mtdblock0 to /dev/mtdblock2. Make sure you retype the same ethernet MAC as currently set in _your_ bootargs:

ip04>setenv bootargs root=/dev/mtdblock2 rw ethaddr=00:09:45:53:d1:b3

NOTE: Don't just blindly copy the line above - this is _my_ ethernet MAC!

Check it's typed in OK:

ip04>print

Then save and reset:

ipo4>save
Saving Environment to EEPROM...
0x0003FFFF
ip04>reset

Allow the IP04 to boot into uClinux, and check you are using yaffs as root:

BusyBox v1.4.1 (2007-06-01 01:29:28 CST) Built-in shell (msh)
Enter 'help' for a list of built-in commands.

root:~> mount
rootfs on / type rootfs (rw)
/dev/root on / type yaffs (rw)
<snip>

A good test for the IP04 and yaffs is to install some prompts. There is a script for this:

root:~> chmod u+x bin/install_asterisk_native_sounds.sh
root:~> install_asterisk_native_sounds.sh

NOTE: tab command-line-completeion is your friend here. No need to type long command lines.

These prompts are ulaw versions and sound a lot nicer than the default GSM prompts. The cool thing about the IP04 is that we have plenty of space in NAND flash so 5Mbyte of prompts is no big deal. This script downloads the prompts from the internet using wget, so you need to have an Internet connection to the IP04.

Yaffs Problems


If, just after the 'umount /mnt' above you get endless messages on the console for example:

root:~> umount /mnt/

<snip>
yaffs block 1876 gc prioritised
yaffs block 1877 gc prioritised
yaffs block 1878 gc prioritised
yaffs block 1879 gc prioritised
<snip>

The try the erase command above again. For some reason you need to run _both_ erase commands, and the order you run them is important.

Note that using u-boot to erase/format yaffs is a hack - in the future we hope to use mkyaffs from the uClinux command line, but at the time of writing it isn't working (either on the host or target).

Thanks to Alex Tao for working out this procedure.


How To - set zaptel driver wcfxs parameters


The zaptel drivers (including wcfxs) are compiled into the kernel. To set module parameters, the kernel command line can be used.

In this example we set opermode=AUSTRALIA and fxshonormode=1. At the u-boot prompt:

ip04>setenv bootargs root=/dev/mtdblock2 rw wcfxs.opermode=AUSTRALIA wcfxs.fxshonormode=1
ip04>print
<snip>
bootargs=root=/dev/mtdblock2 rw wcfxs.opermode=AUSTRALIA wcfxs.fxshonormode=1
ip04>save
Saving Environment to EEPROM...
0x0003FFFF
ip04>reset



The IP04 is an open (free as in speech) four port IP-PBX that retails for around $450. Both the *hardware* and software are open. The goal of this Wiki page is build community generated content for the IP04, for example configuration and How-To's.


Links

  • http://www.staronetel.com/reseller/ Buy your IP04 or IP08 direct from USA.
  • Wangate Italy Shop for IP02/04/08 Based PBX with Wangate commercially supported software. Open source version also available. Europe resellers welcome.
  • Neotiq Shop Buy your open-source PBX IP04, IP08 or BR4 in France through our shop. Support and new service development upon this platform.
  • VoIPtel SE Actively maintained and available with a Support Contract for the entire line of IPxx PBX's manufactured by Atcom Technology
  • VoIPtel CE Latest firmware for the IP01, IP02, IP04, IP08 and IP BRI manufactured by Atcom Technology
  • IP04 and IP08 producer:ATCOM
  • IP04 page on the Free Telephony Project site.
  • BAPS (Blackfin Asterisk Package System) is the latest firmware distribution for the IP04. BAPS supports package based installation of software (like apt-get or rpm), no compiling is required.
  • VoIPtel GUI has been chosen by Atcom Technology, David Rowe and astfin.org as the default GUI for their IP04, IP08 and IP-BRI.
  • The IP04 is similar to the Asterisk Appliance (AA) and several other embedded Asterisk products. Here is a comparison of the AA and IP04.
  • EdgePBX best price, best voice quality embedded IP PBX provider, now IP02/IP08/IP08D released, and it still is open, including hardware and software.
  • BroadTel VoIP product manufacturer from China, offers IP04 100% compatible model with enhancement. Welcome OEM & ODM orders.
  • Linksoft Firmware for IP01, IP02, IP04 and IP08 manufactured by ATCOM Technology with Chinese language (Mandarin and Cantonese) support
  • Alsacecom | VoIP Product Reseller - France and EU Distribution.
  • Buy Atcom IP04 at IPChitChat - Atcom Asterisk Appliances - Atcom IP-04 Asterisk Appliance
  • NetcloudAtcom Distributor UK and Worldwide.

How Tos - Technical


The following sections describe how to take an IP04 from a blank state (i.e. a newly constructed IP04 with erased flash) to a working IP-PBX. Useful for those hacking the IP04 and/or building their own IP04s (the hardware design is open, remember!).

The uClinux firmware used below (astfin-ip04) is now (October 2008) quite out of date. Most production IP04s now run the Blackfin Asterisk Package System ( BAPS). Astfin2 is also available as alternative firmware. The astfin-ip04 firmware used below may still be useful for prototype IP04 hardware, or as a stepping stone to BAPS of Astfin 2.

The u-boot instructions in the section below are still valid for the IP04 and IP08.


HOWTO - Create a uClinux/Asterisk uImage for the IP04


$ svn co http://svn.rowetel.com/software/astfin/branches/astfin-ip04/ astfin-ip04
$ cd astfin-ip04
$ make menuconfig
    • Target Architecture (IP04 IP-PBX)
    • Package Selection <*> Zaptel <*> 4fx <*> oslec
$ make
$ make image
$ cp image_ip04/uImage /your/tftpboot

HOWTO - create u-boot for the IP04


Note that uBoot isn't built by default.

[astfin-ip04]$ make uBoot


This will generate:
build_ip04/u-boot-1.1.5-bf1/u-boot.ldr: serial flash image
build_ip04/u-boot-1.1.5-bf1/u-boot.bin: image you can execute for u-boot

u-boot Notes


To just make u-boot without making the entire astfin:

[astfin]$ make uBoot


Clean u-boot (it's a good idea to make clean if you modify ip04.h):

[astfin]$ make uBoot-clean


Create u-boot patches for IP04:

[astfin]$ make uBoot-make-patch


NOTE: You will see something like this at the end: "make: [uBoot-make-patch] Error 1 (ignored)", this is an artifact of patch and is expected.

NAND Flash Config Notes


You shouldn't have to change this unless you change the NAND flash size from the default 256 MByte. However here is how to configure NAND flash:

[astfin]$ cd build-ip04/uClinux-dist
  [astfin]$make linux_menuconfig


Dig through the config menus to here:

Linux Kernel Configuration
Device Drivers
Memory Technology Devices (MTD)
NAND Flash Device Drivers

Notes:

1/ uClinux-dist/linux-2.6.x/drivers/mtd/nand/bfin_nand.c

2/ The default size is 256M (0x10000000), and base address is 0x20000000.

3/ The NAND is divided into two partitions. The first partition is 8M (kernel), the second partition the remaining space and is used for yaffs.

HOWTO - Modify uClinux Configuration


1/ cd to the uClinux-dist folder:

[astfin-ip04]$ cd build_ip04/uClinux-dist


2/ To change linux config (e.g. drivers, file systems, vendors/Rowetel/IP04/rc):

[uClinux-dist]$ make linux_menuconfig


3/ To change applications (busy box etc):

[uClinux-dist]$ make config_menuconfig


4/ Then remake the astfin image as per usual:

[uClinux-dist]$ cd ../../
  [astfin-ip04]$ make


5/ These will just be temporary chnages to your local build tree. To
capture the changes to patches/config files to astfin:

[astfin-ip04]$ make uClinux-ip04-make-patch


HOWTO - Recreate the Zaptel patch file


To (re)create package/uClinux-dist.mk/zaptel2.patch:

[astfin-ip04]$ make uClinux-zaptel-make-patch



HOWTO - Copy a single file or dir to the IP04


Sometimes you want to test something without building a new uImage.

Use rcp (you need this installed on your host):

rcp /home/david/tmp/t.txt root@ip04:/var/tmp

For some more info on rcp see the blackfin docs:

http://docs.blackfin.uclinux.org/doku.php?id=remote_shell&s=rcp

GOTCHA


If you change anything in busybox (e.g. through make config_menuconfig),
it's a good idea to:

[astfin-ip04]$ cd build_ip04/uClinux-dist/user/busybox
  [astfin-ip04]$ make clean


before rebuilding. The uClinux-dist build process doesn't seem to
capture changes to busybox well.

Initial Flashing using JTAG


I use a version of jtagprog hacked for the M25P20 as described above and an IGLOO cable. It takes about 20 minutes to write, or 45 for a write and verify. I got impatient after a while so I tend to Ctrl-C
out once the verify starts. Here are the commands I use to program the SPI flash:

jtag> cable parallel 0x378 IGLOO
Initializing Excelpoint IGLOO JTAG Cable on parallel port at 0x378
jtag> detect
IR length: 5
Chain length: 1
Device Id: 01010010011110100101000011001011
Manufacturer: Analog Devices
Part: BF533
Stepping: 5
Filename: /usr/local/share/jtag/analog/bf533/bf533
jtag> initbus bf532_bf1
jtag> spidetectflash 0
All 0xffs returned
Making the dangerous assumption that we have a M25P20!
SPI FLASH:
Manufacturer ID: 20
Memory type: 20
Memory capacity: 12 (262144 bytes)
Chip: STMicroelectronics M25P20
jtag> spieraseflash 0 4
erasing:
jtag> spiflashmem 0 u-boot.ldr
program:
addr: 0x00019B84 (done)
verify:
addr: 0x00013F60

Using u-boot to Test u-boot


ip04>tftp 0x1000000 u-boot.bin
ip04>go 0x1000000

NOTE: I had to remove a lot of options from u-boot to get the NAND code to fit in the 128k allocated by boards/ip04/config.mk. Lowering TEXT_BASE didn't help - u-boot wouldn't run. Not sure why, if any one
knows how to allocate more room for u-boot please tell me!

You can see if you have exceed the 128k limit by:

$ grep PROV u-boot.map

Look at this line of the grep output and make sure it doesn't exceed 0x03ffffff (64M system):

0x03ffe6b8 PROVIDE (end, .)

Note that the linker will quite happily place code and data outside of this limit - you need to check manually.



Using u-boot to Upgrade u-boot


NOTE: Make sure it's the u-boot.ldr file you tftp and write, not u-boot.bin which is used when testing u-boot using 'go'!

ip04>tftp 0x1000000 u-boot.ldr
ip04>eeprom write 0x1000000 0x0 $(filesize)
ip04>reset


Testing uClinux uImage


I have some u-boot environment variables set up like this:

bootargs=root=/dev/mtdblock0 rw
addnet=setenv bootargs $(bootargs) ethaddr=$(ethaddr)
ramboot=tftp 0x1000000 uImage.ip04;run addnet;bootm 0x1000000

uImage.ip04 is placed on your tftpserver. Then to download and start uClinux:

ip04>run ramboot

Notes:

  1. The ethaddr (the MAC address) is passed via the kernel command line, in this case the same MAC as u-boot is used.

  1. To set up environment variables like those above use quotes to make sure the spaces are processed correctly, e.g.:

ip04>setenv bootargs 'root=/dev/mtdblock0 rw'

Writing a uImage to NAND


ip04>tftp 0x1000000 uImage.ip04
ip04>nand erase clean
ip04>nand write 0x1000000 0x0 0x4c0000

Notes:

  1. During the tftp step bytes transferred = 4b6901 hex. 'nand write' needs to have the size of the write rounded up to the nearest sector size. 'nand info' gave me a sector size of 128 KiB (0x20000 hex) so I rounded up to 0x4c0000.
  2. Make sure that the u-boot environment variable "autostart" is set to no, or else u-boot will try to immediately boot the uImage.ip04 after it is downloaded.
ip04>setenv autostart no

Reference:

  1. Blackfin uClinux u-boot and NAND flash docs.



How To set up NAND/yaffs for root


This is a little indirect as the user-mode yaffs tools like mkyaffs are broken. The process is:

  • boot a uImage that contains the kernel and root fs on a ram based ext2 file system.
  • copy the root fs to yaffs
  • reboot mounting yaffs as root

These steps were adpated from Frank Hoffman's instructions.

  1. wget http://www.rowetel.com/ucasterisk/downloads/ip04/uImage.ext2

  1. First tftp the ext2 uImage and load into the kernel section of NAND flash. We need the ext2 image for the next step (copying files onto yaffs).

In u-boot:

ip04>tftp 0x1000000 uImage.ext2
ip04>nand erase
ip04>nand write 0x1000000 0x0 0x48000

(see Note (1) in "Writing a uImage to NAND" section above re 0x48000)

ip04>bootm 0x1000000

  1. Now we have the IP04 booted, but using a ram-based ext2 file system for root. So we need to copy /root into the yaffs file system:

On the IP04:

root:~> copy_rootfs.sh
root:~> reboot

  1. Now set up u-boot to mount root from yaffs (some of these env variables may be set already, use 'print' to check):

ip04>setenv autostart yes
ip04>setenv addnet 'setenv bootargs $(bootargs) ethaddr=$(ethaddr)'
ip04>setenv bootargs root=/dev/mtdblock2 rw
ip04>setenv nandboot 'run addnet;nboot 0x2000000 0x0'
ip04>setenv bootcmd run nandboot
ip04>save
ip04>reset

Notes:

  1. Don't used mkyaffs, it is very broken for flash chips with 2048 byte pages, like the one used by the IP04! It will fail badly. To recover use nand erase in u-boot.

  1. In u-boot 'nand dump' is helpful, for example after a nand erase:

ip04>nand dump 0x0

(you should see a flash "page" of 2048 0xff's + 64 OOB 0xffs)

After 'nand write' use nand dump to see the uImage in NAND.

  1. For reference a typical boot sequence is here:

http://www.rowetel.com/ucasterisk/downloads/ip04/ip04_boot_typical.txt

  1. To get some stats on the yaffs file system

root:~> cat /proc/yaffs

How To - Erase/Format yaffs


This section has a little more information on yaffs, see also " How To set up NAND/yaffs for root".

In u-boot:

ip04>nand erase clean 0x800000
ip04>nand erase 0x800000

The 0x800000 ensures you don't erase the first 8M of NAND flash that is used to store the uImage (kernel plus root in ext2 filesystem). If you havent written the uImage or don't mind blowing it away it's OK to remove the 0x80000 which will erase the entire NAND chip.

Check bootargs root=/dev/mtdblock0 using:

ip04>print

Then reset and allow uClinux to boot:

ip04>reset

Now try mounting yaffs:

BusyBox v1.4.1 (2007-06-01 01:29:28 CST) Built-in shell (msh)
Enter 'help' for a list of built-in commands.

root:~> mount /dev/mtdblock2 /mnt
yaffs: dev is 32505858 name is "mtdblock2"
yaffs: Attempting MTD mount on 31.2, "mtdblock2"
yaffs: auto selecting yaffs2
block 948 is bad
block 1061 is bad
root:~> umount /mnt/
root:~>

Then copy the root file system onto yaffs. There is a script for this but at the moment the permissions are incorrect:

root:~> chmod u+x bin/copy_rootfs.sh
root:~> copy_rootfs.sh

Now reboot into u-boot and set boot args to boot with yaffs as root.
Use print to determine your current bootargs:

ip04>print
<snip>
bootargs=root=/dev/mtdblock0 rw ethaddr=00:09:45:53:d1:b3
<snip>

Now re-set this environment variable, just changing /dev/mtdblock0 to /dev/mtdblock2. Make sure you retype the same ethernet MAC as currently set in _your_ bootargs:

ip04>setenv bootargs root=/dev/mtdblock2 rw ethaddr=00:09:45:53:d1:b3

NOTE: Don't just blindly copy the line above - this is _my_ ethernet MAC!

Check it's typed in OK:

ip04>print

Then save and reset:

ipo4>save
Saving Environment to EEPROM...
0x0003FFFF
ip04>reset

Allow the IP04 to boot into uClinux, and check you are using yaffs as root:

BusyBox v1.4.1 (2007-06-01 01:29:28 CST) Built-in shell (msh)
Enter 'help' for a list of built-in commands.

root:~> mount
rootfs on / type rootfs (rw)
/dev/root on / type yaffs (rw)
<snip>

A good test for the IP04 and yaffs is to install some prompts. There is a script for this:

root:~> chmod u+x bin/install_asterisk_native_sounds.sh
root:~> install_asterisk_native_sounds.sh

NOTE: tab command-line-completeion is your friend here. No need to type long command lines.

These prompts are ulaw versions and sound a lot nicer than the default GSM prompts. The cool thing about the IP04 is that we have plenty of space in NAND flash so 5Mbyte of prompts is no big deal. This script downloads the prompts from the internet using wget, so you need to have an Internet connection to the IP04.

Yaffs Problems


If, just after the 'umount /mnt' above you get endless messages on the console for example:

root:~> umount /mnt/

<snip>
yaffs block 1876 gc prioritised
yaffs block 1877 gc prioritised
yaffs block 1878 gc prioritised
yaffs block 1879 gc prioritised
<snip>

The try the erase command above again. For some reason you need to run _both_ erase commands, and the order you run them is important.

Note that using u-boot to erase/format yaffs is a hack - in the future we hope to use mkyaffs from the uClinux command line, but at the time of writing it isn't working (either on the host or target).

Thanks to Alex Tao for working out this procedure.


How To - set zaptel driver wcfxs parameters


The zaptel drivers (including wcfxs) are compiled into the kernel. To set module parameters, the kernel command line can be used.

In this example we set opermode=AUSTRALIA and fxshonormode=1. At the u-boot prompt:

ip04>setenv bootargs root=/dev/mtdblock2 rw wcfxs.opermode=AUSTRALIA wcfxs.fxshonormode=1
ip04>print
<snip>
bootargs=root=/dev/mtdblock2 rw wcfxs.opermode=AUSTRALIA wcfxs.fxshonormode=1
ip04>save
Saving Environment to EEPROM...
0x0003FFFF
ip04>reset



Created by: drowe, Last modification: Fri 01 of Jun, 2012 (04:51 UTC) by admin
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+