Hack17.Run Linux on Your Palm

Hack 17. Run Linux on Your Palm

Although it's not the Palm version of Linux that will no doubt blow our socks off when it eventually arrives, uClinux is a good way to play around with an alternative operating system on your Palm.

If you haven't heard already, Palm is switching operating systems, and in the not-so-distant future, Palm-Powered will mean Linux-Powered, but with all the elegance and grace of the current Palm OS. It's going to take a while, though. If you want to give Linux a whirl on a Palm right now, it's quick and easy. You won't get any of the graphical goodness you'll eventually get with the future version of Palm OS, but you will have a chance to play around a bit and run this powerful operating system right on your little handheld.

Unfortunately, Linux doesn't run on a lot of Palms. The good news is that it runs on a lot of older popular models, such as the IIIe, IIIx, V, Vx, and even some of the m series. You can usually find these Palms very cheaply [Hack #50], so you can play around with this on the cheap. In fact, when I bought a used Palm Vx for $30, it included a USB-to-serial adapter, which was worth nearly the price I paid for both items!

2.8.1. Boot Linux on Your Palm

The simplest way to get Linux running on a Palm is to pick a well-supported Palm, such as the Vx, and download a binary release of Linux from http://palm-linux.sourceforge.net/. At the time of this writing, they had versions that worked with the m500 as well as a bunch of older models. What you'll get is a small PRC file (such as uClinuxPalm.prc) that has the Linux distribution and a bootloader. Install the PRC on your Palm, and you're just about ready to launch Linux.

I say just about, because you need a couple of things. First, you need to be prepared to sacrifice everything in your Palm's storage. After you launch Linux, you'll lose all your settings, appointments, contacts, and even installed applications. You can reset your Palm and go back into the Palm OS, but it will be as if you'd performed a hard reset.

Second, you need a way to talk to the Palm. Unfortunately, if you want to interact with the Linux operating system running on your Palm, you need to use a serial connection and a terminal program. So, you won't be taking your Linux-powered Palm on the go with you. Here's what you need to do to get this all working. Setting up the serial connection.

If you've got a recent notebook computer, a Mac, or legacy-free PC, there's a good chance you don't have a classic serial port. However, there are many USB to serial adapters that can do the trick. The PalmConnect USB kit, shown in Figure 2-27, is a small dongle that will work for Windows and Linux users.

Figure 2-27. The PalmConnect USB kit

Although it ships with a CD-ROM, the PalmConnect hardware is of an old enough vintage that you should check http://www.palm.com to see if there are any updates to the driver (Mac OS X users will not be able to use the PalmConnect kit for this, since the Mac OS X drivers do not represent the device as a serial port). Also, Keyspan (http://www.keyspan.com) makes a variety of USB to Serial adapters that work with Windows, Mac OS X, and Linux.

Once you've installed the USB to serial adapter, you need to figure out where it lives. On Linux and Mac OS X, serial ports appear as files in the /dev directory. On Windows, they appear as COM ports. Table 2-2 shows some possible candidates for serial ports for systems with both USB to serial and built-in serial ports.

Table 2-2. Possible serial port assignments

Operating system

USB to serial



COM5 and higher

COM1 through COM4


/dev/ttyUSB0 and higher

/dev/ttyS0 through /dev/ttyS3

Mac OS X


n/a Installing Palm Linux.

Installing Linux on your Palm is as easy as installing the PRC I mentioned earlier. On Windows or Mac OS X, set up Palm Desktop and use Quick Install to install the PRC. The next time you perform a HotSync, Palm Linux will be installed. On Linux or Unix, you can use the pilot-xfer utility to install it:

 $ PILOTRATE=115200 pilot-xfer -p /dev/ttyS0 -i uClinuxPalm.prc   Listening to port: /dev/ttyS0   Please press the HotSync button now… Connected Installing uClinuxPalm.prc Time elapsed: 0:01:26 

Be sure to set the PILOTRATE to the maximum you feel your hardware can comfortably support. It took 1 minute, 30 seconds at 115200 bps, but 13 minutes at the default speed!

Once it's installed, you'll see a Loader icon in the launcher, as shown in Figure 2-28.

Figure 2-28. The Palm Linux loader Booting Linux.

Before you boot Linux, you should start talking to the serial port. If you're on Mac OS X or Windows, you've probably still got HotSync running and listening on the serial port. Since this will prevent you from opening a terminal session with the serial port, be sure to release the serial port before you proceed. You can either launch HotSync and configure it to not use the serial port, or shut it down altogether. If you do tell it to stop using the serial port, you'll need to switch it back before you can perform a HotSync again.

Once you've shut down HotSync, you can open a session with the serial port. On Windows, launch HyperTerminal (open the Start menu, choose Programs Accessories Communications HyperTerminal) and open a session with the serial port your Palm is connected to. You should use a serial port speed of 9600, and leave the rest of the settings at their defaults. On Mac OS X or Linux, you can use the screen program to connect to the serial port, as in screen /dev/ttyS0 (use Ctrl-A, K to end your session). You wont see anything at first, but once you make this connection, you're ready to boot Linux.

To boot Linux, tap the Palm Loader icon. You'll get the warning shown in Figure 2-29. Tap Boot Linux, and your serial port session will fill up with boot messages:

 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFRBCK 68EZ328 DragonBallEZ support (C) 1999 Rt-Control, Inc uClinux/MC68EZ328 Flat model support (C) 1998,1999 Kenneth Albanowski, D. Jeff Dionne PalmV support by Lineo Inc. <jeff@uClinux.com> Console driver (without boot console): mono mc68328 40x26, 1 virtual console (max 63) Calibrating delay loop.. 

Figure 2-29. The Palm Linux warning

There will be a short delay, and then the boot messages will scroll across your screen. As this is all happening, the uClinux logo appears on the Palm, as shown in Figure 2-30. Once Linux is fully booted, your serial session will display a shell prompt:

 Welcome to 

For further information check: http://www.uclinux.org/ Execution Finished, Exiting? Sash command shell (version 1.1.1) /gt;

Congratulations, you've got Linux running on your Palm. When you're ready to go back to the Palm OS, you can type reboot and press return, or simply do a soft reset.

Figure 2-30. Palm Linux is up and running

2.8.2. Roll Your Own Palm Linux Distribution

uClinux makes it possible to put together your own Linux distribution for your Palm, but it takes a bit of work to get all the pieces together. The good news is, once you've got the necessary tools, it's pretty easy to build a bootable Linux image for your Palm. In theory, you just need a cross-compiler, Palm's PRC tools, and the uClinux source. The bad news is that I could not successfully compile a kernel for my Palm Vx using the latest releases of these packages. The good news is that there is a well-documented combination of versions that works like a charm. For more information on this combination, see http://www.ucdot.org/article.pl?sid=03/02/07/1329233. Here's what I grabbed to get it all working:

An m68k cross-compiler

This toolchain runs on x86 Linux and compiles the kernel and userland applications into binaries that run on the Motorola CPU inside older Palms. You should grab the m68k-elf-tools-20020410.tar.gz file from http://www.uclinux.org/pub/uClinux/m68k-elf-tools and extract it into your root directory (/), which installs the cross-compiler into /usr/local.

PRC tools

Palm's PRC tools are yet another cross-compiler, but are designed for building Palm OS applications. Since the uClinux launcher is a Palm OS executable, you need Palm's PRC tools to compile it. You can download the correct version of the PRC Tools at http://www.uclinux.org/pub/uClinux/palm-tools/. You should grab both m68k-palmos-coff.tools-990108-linux-x86-glibc.tar.gz and prc-tools-0.5.0-5.i386.rpm. If you're on a Linux platform that doesn't support RPM, such as Ubuntu, use the alien utility to convert the RPM into a native package and install it. Extract the tar.gz file into your root directory

The kernel

Once you have PRC Tools and the m68k-elf toolchain installed, you can grab the uClinux source distribution. The file http://www.uclinux.org/pub/uClinux/dist/uClinux-dist-20020701.tar.gz worked fine for my Palm Vx. Extract this file into a working directory, cd into the top-level directory (ucLinux-dist), and run make xconfig to configure everything.

Here's how I built Linux for my Palm Vx:

  1. Select Target Platform Selection from the menu, choose 3com/PalmIIIx for the Vendor/Product, linux-2.0.x for the Kernel Version, and uC-libc for the Libc Version.

  2. Make sure that Customize Kernel Settings is set to y and click Main Menu. Click Save and Exit. Now the kernel options appear. Under the kernel options:

    1. Enter the Platform Dependent Setup section and set the CPU to MC68EZ328, enable PalmV Support, and scroll all the way down to set "Kernel executes from" to RAM.

    2. Click Next to proceed to General Setup, enable ZFlat Support, click Main Menu to return to the main menu.

    3. Enter the Networking Options, and disable TCP/IP networking.

    4. Click Next to proceed to the Network Device Support, and click n under Network Device Support. This disables all network devices.

    5. Click Main Menu to return to the main menu and click Save and Exit.

  3. You should be returned to the shell from which you ran make xconfig. Run the command make dep && make.

When it's done compiling, you should have a file called uClinuxPalm.prc in the images/ subdirectory. If something goes wrong, check out http://www.ucdot.org/article.pl?sid=03/02/07/1329233, which goes into this process in more detail. Once you've got it compiled, you can install the PRC file as described earlier in this hack.

You might get bored with the limits of running Linux on your Palm in the way described in this hack. Fortunately, you can go a bit further with some other gadgets. uClinux is used for both Nintendo DS Linux (http://www.dslinux.org/) and iPod Linux (http://www.ipodlinux.org).

Also, there are many inexpensive embedded systems and single board computers that are capable of running uClinux. Figure 2-31 shows my Nintendo DS running uClinux with the boot messages at the top and the virtual keyboard on the bottom touchscreen.

Brian Jepson

Figure 2-31. uClinux running on the Nintendo DS

Palm and Treo Hacks
Palm and Treo Hacks: Tips & Tools for Mastering Your Handheld
ISBN: 059610054X
EAN: 2147483647
Year: 2006
Pages: 115

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net