Technologics TS-7200: Notes

Setting up serial communications

I use minicom to talk to the serial port of a TS-7200 from my Linux desktop (Putty works from Windows® ). But when I first launched minicom after powering things up, I only saw:

Welcome to minicom 2.2

OPTIONS: I18n 
Compiled on Jun  6 2007, 18:43:02.
Port /dev/ttyS0

               Press CTRL-A Z for help on special keys    

No response. What's the deal? I vaguely remember that the com ports on my desktop are numbered weird. Its probably trying to talk to the wrong com port. C-A z enters the configuration menu for minicom, 'o' gets me to the submenu where you set the port related stuff. The TS-7200 likes to talk at 115200 baud, 8N1, and that looks right. I change the port to /dev/ttyS1. I get out of the menus, hit Enter, and voila:

ts7200 login: 
Debian GNU/Linux 3.1 ts7200 ttyAM1

ts7200 login: jcunningham
Password: 
Last login: Sun Dec  2 17:25:38 2007 on ttyAM1
Debian linux 2.4.26-ts10 #31 Thu Mar 23 13:01:48 MST 2006 armv4l GNU/Linux
jcunningham@ts7200:~$ su
Password: 
root@ts7200:jcunningham# useradd -m mcurry
root@ts7200:jcunningham# passwd mcurry
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
root@ts7200:jcunningham# ls /home
jcunningham/  mcurry/
root@ts7200:jcunningham# exit
exit
jcunningham@ts7200:~$ who
jcunning ttyAM1       Dec  2 17:31
jcunningham@ts7200:~$ 

Bingo. Fortunately, (actually, by design) can save minicom's settings so you only have to do this once.

Booting the 2.4 kernel from CF

Interrupt the boot process with C-c (within the first second!) and get the Redboot> prompt. Then use the following commands (assuming that the kernel vmlinux-ts11 has been copied to the /boot/ directory on the CF flash):

load -b 0x00218000 -m disk hda1:/boot/vmlinux-ts11
exec -c "console=ttyAM0,115200 root=/dev/hda1 ip=dhcp" 
exec -c "console=ttyAM0,115200 root=/dev/hda1" 

The second exec command us used when no network is connected.

Building and Setting up a 2.6 Kernel

Important saftey tip: Do not do this as root. There is too great a chance you will clobber your native kernel and kernel modules as root, and it isn't necessary to be root in any event.

Get kernel sources

I started from the 2.6 kernel page at the Technologic website. The Technologic toolchain works (x86).I created a ts7200 directory and untarred this inside it:

cd 
mkdir -p ts7200/2.6/
cd ts7200/2.6
wget ftp://ftp.embeddedarm.com/ts-arm-linux-cd/cross-toolchains/\
   crosstool-linux26-3.4.4-2005q3-2.tar.gz
wget ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7200-linux/cross-toolchains/\
   crosstool-linux26-3.4.4-2005q3-2.tar.gz
This creates the directory arm-none-linux-gnueabi which contains the toolchain binaries.

The kernel sources on the Technologic website (2.6.21) work, but don't include IDE support yet, so I used the 2.6.23 sources modified by Dan Smolik. Here is a link to Dan Smolik's source tree . I started with Dan's kernel config , but modified it quite a bit, so use mine at this point:

wget http://jandmworks.com/ts7200/linux-2.6.23-rc1_arm_marvin.tar.bz
tar xvfj linux-2.6.23-rc1_arm_marvin.tar.bz
wget http://jandmworks.com/ts7200/linux-2.6.23-rc1-jkc.config
ln -s linux-2.6.23-rc1 linux
cp linux-2.6.23-rc1-jkc.config linux/.config

Configuring the kernel

We've copied the config file into the kernel source root and named it what the Makefile expects it to be. Note: the softlink to the kernel sources is a customary convenience.

Before we can build this kernel, we need to modify a couple things. And before we can run make menuconfig to modify things, we need to set up a script to use do so with your cross-toolchain. You can do this on the command line, but the strings are long and easy to forget so I do it in a script.

cd linux
wget http://jandmworks.com/ts7200/menuconfig.sh
nano -w menuconfig.sh 

Make sure the paths and names make sense for your setup if you have located things differently, or are using a different toolchain. Once you have this setup right, run the script. A colored text-based menu should come up.

sh menuconfig.sh

Okay, you are in the kernel configuration menu now. There are a couple things we want to verify are correct (and you should go through this, as it is a good way to learn how to navigate through the kernel options). Arrow down to "Networking --->" then to "Wireless --->". Make sure the "Generic IEEE 802.11 Networking Stack" will be built as a module by hitting the space bar until an 'M' appears. Also check that CCMP and TKIP encryption will be built. Exit up out of these and go into "Device Drivers --->" then into "Network Device Support --->" and down to "Wireless LAN ---->". Make sure the "Wireless LAN (IEEE 802.11) " is selected with a '*', and "USB ZD1201 based Wireless device support" and "IEEE 802.11 for Host AP (Prism2/2.5/3 and WEP/TKIP/CCMP)" will be built as modules 'M'. Go back up to Device Drivers again and select "Character Devices ---->". Make sure both "Unix98 PTY support" and "Legacy (BSD) PTY support" are '*' selected. Now go all the way out of Device Drivers and into "File systems --->". Select '*' "Ext3 journalling file system support" - who knows? you may want to plug in a USB flash-stick with ext3 on it.

And that's about it. Its a good idea to change the boot command too. Go to "Boot options --->" and select "console=...". Make sure the ip address is correct if you are assigning a static IP, and set root=/dev/hda1 if you want it to autoboot off the CF. You can override this on the command line to NFS boot. When you're happy with it, exit out and save your changes to the config.

There's one other thing you want to do and I don't know how to do it in the menu, so edit the .config directly and set the CONFIG_LOCALVERSION="ide" or something you can remember. This will be appended to the name of the kernel that shows up with "uname -a", for example, and you need to know what it is for when you load the modules you build.

Building the kernel

Okay, now you are ready to build this kernel. If you were just to type 'make' it would try to build it using your host system's compiler and toolchain. Don't do that. Instead, get another script ).

wget http://jandmworks.com/ts7200/build.sh
nano -w build.sh

Make sure the paths make sense as before, then run your build script.

sh build.sh

You should see it start building stuff right away. It will take awhile the first time. After you have built it once, it only rebuilds the things you subsequently modify. When it finishes (without errors I hope) you are ready to have it install the modules it just built. What this does is move them to a modules directory in your root file system where the kernel expects to find them, and builds a modules dependency map there. If you weren't cross-compiling all you'd need to do would be run 'make modules_install' and it would put them under /lib/modules/. Again, we have to do it in a cross-compilation environment. So download another script and make sure it's paths are right, then run it:

wget http://jandmworks.com/ts7200/modules.sh
nano -w modules.sh 
[check paths]
sh modules.sh

Setting up a root file system

If everything worked up to this point, you're almost done. Now get the root file system you will be using. I used the Debian Sarge with udev support provided by Technologic:

cd ../../
[you want to be at ts7200/ at this point]
wget ftp://ftp.embeddedarm.com/ts-arm-linux-cd/distributions/debian-sarge-udev-11-15-2007.tar.gz
sudo tar xvfz debian-sarge-udev-11-15-2007.tar.gz

Note that you do need to be root when you untar this. The reason is there are soft links built into the filesystem which will not be properly built if you are not.

Now copy the modules tree you built into the source tree, and the kernel itself somewhere useful:

sudo cp -rp modules/lib/modules/2.6.23-rc1ide debian-sarge-udev-11-15-2007/lib/modules/
cp linux-2.6.23-rc1/arch/arm/boot/compressed/vmlinux debian-sarge-udev-11-15-2007/boot/

These commands assume you are currently sitting in ts7200/2.6/ and that both the modules directory you built and the root file system are sitting their with you. You probably need to be root for the copies. I copy the kernel into boot/ under the root file system where it will be visible to tslinux at startup.

Copying the root file system to your CF

At this point you have built a kernel and modules and configured the base file system, but its sitting on your desktop. You need to get it into your CF. The trick here is to make sure you move it with all of its links. The best way I know to do this is using tar. You also get a backup of your modified root filesystem for free.

mount -t ext2 /dev/whatever /mnt/cf
cd debian-sarge-udev-11-15-2007
sudo tar cvfz ../debian-sarge-udev-11-15-2007_backup1.tgz *
cd /mnt/cf
tar xvfz [path-to]/debian-sarge-udev-11-15-2007_backup1.tgz
cd
umount /mnt/cf

Booting the new kernel

You are ready to try it. You can try booting off it directly. But I usually boot off an NFS mount at first. In that case the only thing you need off the CF is the kernel itself. Here is the RedBoot commands which should accomplish this:

load -b 0x00218000 -m disk hda1:/boot/vmlinux-ts11
exec -c "console=ttyAM0,115200 root=/dev/hda1 ip=dhcp" 
exec -c "console=ttyAM0,115200 root=/dev/hda1" 

The second exec command is used when no network is available.

I normally do development and testing through an NFS mount to my desktop. The RedBoot commands for this (on my system) are:

load -b 0x00218000 -m disk hda1:/boot/vmlinux
exec -c "root=/dev/nfs nfsroot=192.168.1.13:/home/ts7200/2.6/nfs_root console=ttyAM0,115200 ip=dhcp"

Here is my NFS /etc/exports file as an example. Here is my /etc/network/interfaces on the exported debian root file system (this needs to be right or NFS won't work). And here is my /etc/fstab on the exported debian root file system.

Tweaking things on the booted system

Once you get it to boot, there are a few things to tweak. I was getting regular error messages caused by lack of virtual terminals (the TS-7200 isn't running X so it has no virtual terminals). To turn this off I had to modify the /etc/initab slightly. Here's my inittab

Be sure to set up a hosts.allow file. You might need to apt-get install ssh to make sure it's set up properly. The hosts.allow makes sure your LAN addresses (and specified others) can SSH into the TS-7200.

To get my zonet wifi dongle to work I had to

sudo apt-get install zd1211-firmware

Here are a few other things you'll want to do while booted on your new system:

  • Edit resolv.conf so it has your LAN nameservers in it. E.g. add line(s) of the form:
  • nameserver 192.168.1.1
  • Set hostname and add your host name to hosts file
  • Set your time zone:
  • cd /etc
    ln -s /usr/share/zoneinfo/PST8PDT localtime
  • Install some useful tools:
  • sudo apt-get install makedev lynx wget bzip2 rdate unzip
    		     zip ncftp nmap fileutils less file diff python ntp
    		     emacs21-nox

    Installing makedev adds a device node making utility at /dev/MAKEDEV. Not sure this is necessary, but it certainly doesn't hurt anything. Linx is a text-only web browser which comes in real handy sometimes.

Once you do all that, it's easy.

Note: I think my copy of the root file system still has the system log turned on. This is very useful while still debugging, but once everything is running correctly, you should make sure it is off to save wear on the CF

Moving the new kernel into the TS-onboard Flash memory

Okay, this is a bit nerve-wracking because if you screw it up you will be sending your box back to Technologics to get the onboard flash reloaded. Basically, what you need to do is get the kernel you want to use loaded into memory, then delete the current kernel from the onboard flash, then copy the memory into the onboard flash. Here's the sequence after interrupting the boot process so you have the Redboot prompt:

Redboot> load -b 0x00218000 -m disk hda1:/boot/vmlinux-2.6.23
fis list
<shows you the name of your current kernel>
fis delete 
fis create -b 0x00218000 -l 0x160000 

This should write the current kernel you loaded into memory at 0x00218000 into the flash at 0x160000. Note that your new name can be the same as your old name. You can take a look at what you've got in the onboard flash with the fconfig command. Here's mine:

fconfig -l
RedBoot> fconfig -l
Run script at boot: true
Boot script: 
.. fis load vmlinux -b 0x00218000
.. exec -c "console=ttyAM0,115200 ip=dhcp root=/dev/hda1"

Boot script timeout (100ms resolution): 20
Use BOOTP for network configuration: false
Gateway IP address: 192.168.1.1
Local IP address: 192.168.1.50
Local IP address mask: 255.255.255.0
Default server IP address: 192.168.1.50
dns_ip: 192.168.1.13
Network hardware address [MAC]: 0x00:0xD0:0x69:0x40:0x9E:0x60
GDB connection port: 9000
Force console for special debug messages: false
Network debug at boot time: false