C-Kermit for Android

Friday, 20 July 2012 01:51

Recently I purchased an Acer Iconia Tab A200 with the intention of using it as my primary travel computing device, relegating my Compaq CQ41 laptop to pretty much a desktop role.  I had looked around to ensure that there would be adequate software to do most of the things I needed and believed I had most bases covered.  The most important was network communications.  I do most of my work on OpenVMS and Linux servers from a command line and needed a telnet utility as well as serial communication software for hooking up to routers and things.

Initially I worked with ConnectBot and android-serial-api.  Both reasonable, but not up to scratch for me.  ConnectBot did not have decent keyboard support for my needs.  Unfortunately the android-serial-api example application for basic serial comms is abismal.  I needed something with a bit more.

The first thing I did was get Android-Terminal-Emulator, an open source VT100 terminal emulator for Android.  While it gave me access to the command line and full use of the keyboard, as well as the ability to see /dev/ttyUSB0, I still didn't have an application for going much further.  That is when I started looking at C-Kermit. For years I have used the software on both OpenVMS and UNIX (and its derivatives). I've even written some clever scripts for collecting and archiving router configurations and other stuff. However, I had never delved too deeply into its internals. The most I had done with the source code was build it using the procedures provided. Given that it always seemed to just work, there never was any need to. So, after a bit of looking around I couldn't find an Android port and so I decided I'd develop one. The instructions below detail what is needed and how to build C-Kermit for Android as well as providing pre-built images.

Firstly, there were not a lot of changes that needed to be made. A couple things needed to be #ifdef'd around, but largely the source code compiled without issue.  To build your own C-Kermit for Android from source, you will first need to install the Android NDK and ensure that the procedure ndk-build is in your path.  From here you can grab the source code from github:

$ git clone git://github.com/tesneddon/cka.git
$ cd cka

or by downloading the source kit and unpacking it:

$ mkdir cka
$ cd cka
$ wget -Ocka302.zip https://github.com/tesneddon/cka/zipball/master
$ unzip -j cka302.zip
$ rm cka302.zip

Now, build the software using the Android NDK:

$ ndk-build NDK_PROJECT_PATH=./ APP_BUILD_SCRIPT=./Android.mk APP_ABI=all

To build the Android version of kermit for all ABI's I define APP_ABI to all.  However, this is not necessary if you are only building for your own device.  You can drop this definition to pickup the default or you can define it for a specific ABI.

As for installation, well I used ftp to download the kermit image to my tablet and used the following to install the image.  I am assuming with the following instructions that the kermit archive has been downloaded from one of the links below. I must also point out that my tablet has been "rooted" and the following commands have been executed after assuming superuser access with the 'su' command.

$ cd <download-dir>
$ gzip -d kermit-<arch>.gz
$ cat kermit-<arch> > /data/local/bin/kermit
$ chmod 555 /data/local/bin/kermit

I have made sure that all of the commands above should work without having to install a shell other than the one that comes pre-installed, at least on the Acer release of Android 4.0.3 (Ice Cream Sandwich).  If I am wrong, or there is a better way of doing it, then please feel free to comment below.

You should now be able to now start C-Kermit and see something similar to the following in your terminal emulator:

$ alias telnet="kermit -J"
$ kermit
FIX ME! implement ttyname() bionic/libc/bionic/stubs.c:432
C-Kermit 9.0.302 OPEN SOURCE:, 20 Aug 2011, for Linux
 Copyright (C) 1985, 2011,
  Trustees of Columbia University in the City of New York.
Type ? or HELP for help.
(/mnt/sdcard/download/) C-Kermit>

Getting the Software

The source code referenced in this blog can be found as a project at github, tesneddon/cka.  Please feel free to fork, comment and report issues related to C-Kermit on Android here.  I have notified the maintained of C-Kermit, Frank Da Cruz, and hopefully these changes will be rolled into the official C-Kermit source code.  I will post further updates on this to the comments of this post.

For those of you not interested in building C-Kermit yourself, I have provided a some pre-built images for you to download here:

A nightly snapshot of the source code, as well as pre-built binaries (linked above) can all be found here.

References

The following sites were instrumental in being able to build this software:

The "Kermit the Droid" image was developed via a screen shot taken from the Androidify app from Google and then edited with GIMP to match the likeness of everyone's favourite amphibian.

[PRINT]  [PRINT]