iPAQ is the brand name of a range of PDAs produced by Hewlett Packard (older models are branded Compaq). The original model, 3600, was released in 1999 and featured a 206-Mhz StrongArm processor with 32 MB ROM and 32 MB RAM, running the PocketPC 2000 operating system. Since then, many models have been introduced with a variety of different options. The current top-of-the-range models sport built-in Bluetooth, Wi-Fi, and SDIO capabilities and run the PocketPC 2003 OS. All of these devices are plenty powerful enough to run Linux nicely. This article discusses why you might choose to do this and explores some the possible options.
An obvious question to consider before getting into the details of installing and using Linux on your iPAQ is, why switch to using Linux from PocketPC 200x?
Avoiding the vastly overused (in certain circles -- I'm looking at you, Slashdot readers) "because you can" response, there are actually a number of valid reasons, including:
- Personal taste: Many people are simply more comfortable with the Linux environment as a user or developer.
- Ongoing upgrades/support: Linux is continually being improved and having security bugs fixed. The original software, however, may well be out of support and in many cases cannot be upgraded to later versions. Even in cases where the OS/applications can be upgraded, this is unlikely to be free of charge.
- Freedom: Many people prefer to use open source software from an ideological point of view or because they appreciate many other benefits (such as the ability to fix bugs themselves and a strong user community, among others).
- Capabilities: Running Linux opens up a large number of possibilities that are either difficult, expensive, or impossible to achieve using PocketPC.
- Applications: By running a standard Linux distribution, you can easily port many applications (some with no changes at all, many with only very few changes).
- OS functionality: The OS has Remote X, Raw sockets.
Once you decide you want to try Linux on iPAQ, you need to first choose the iPAQ hardware to use. In general, older hardware is better supported (given that developers have had more time to come to grips with it). Safe bets are H3100, H3600, H3700, H3800, H3900, H5100, H5400, and H5500. Support for newer devices is being added all the time, so if you have a more recent iPAQ, all hope is not lost -- you have the option of getting involved with development versions (even just to test the software, if you have no development experience) or keeping an eye out until your hardware is officially supported. In the meantime, if you can't wait, you could always pick up an older machine secondhand to play with. For my testing, I was able to make use of a rather long-in-the-tooth H3650 model, which we had lying around the office.
Okay, now that you've got some hardware sorted out, the next thing to decide is where to get Linux and how to install it on the device.
Assuming you aren't planning on rolling your own system (which is perfectly feasible, but extremely time consuming), the easiest way to get Linux onto your device is to get one of the specialized distributions that are available to support these devices. One of the most popular distributions (and the one I have decided to use) is provided by the Familiar Project (see Resources for a link to the Web site), hereafter referred to as simply "Familiar."
Like most desktop Linux distributions, Familiar is made up from two distinct components:
- The kernel and base system
- The GUI/desktop environment
Familiar is available for download in three distinct user flavors (a fourth, developer-only, flavor with no GUI is also available). Each of these flavors consists of the same kernel and base system but with different GUIs. The analogy in the desktop Linux world is installing a distribution such as Red Hat or Mandrake and getting a choice of desktop environments, such as KDE or GNOME. Indeed, once you start to look at the options, you can see that the similarities to different desktop environments run even deeper.
The three user flavors are:
- GPE (GPE Palmtop Environment), which is based on GTK and is most akin to GNOME in the desktop world
- OPIE (Open Palmtop Integrated Environment), which is based on Qtopia and most akin to KDE in the desktop world
- pypaq, which is based on Python and GTK
The first two, GPE and OPIE, are more commonly used than pypaq. If you have no strong reason to choose one over the other, then just choose one (they don't take long to install, so you can always restart with another flavor if you don't like your choice).
Once you have chosen the appropriate files to download (I went for GPE), it's time to install.
For detailed installation instructions, consult the release notes on the Familiar Web site. The following instructions should give you a feel for the process, but, as ever in the world of Linux, these steps may well change.
The first step of the installation is to install a new bootloader. Akin to LILO or GRUB in a normal desktop system, this is the initial program that runs when the iPAQ starts and allows you to load Linux.
The bootloader installation is supplied as two files, WindowsCE executable (BootBlaster.exe) and the bootloader itself. To install the bootloader, you first need to transfer these files to the iPAQ. This can be done in a number of ways, such as via ActiveSync, via a storage card (CF/SD/MMC) if your handheld supports it, or via a network connection (if you have it configured).
Once the bootloader installation program and bootloader file are on the device, simply run the .exe and follow the onscreen instructions to back up the existing bootloader and operating system (in case you ever want to go back to the existing configuration). Two things to note:
- If you are backing up the existing OS via a serial link, be patient: it took approximately 15 minutes on my machine.
- The bootloader installation program seems to expect the bootloader file to be in the My Documents folder (or a subfolder).
Now that the bootloader is installed, if you restart the device, you should be greeted with a different screen from normal -- that of the new bootloader.
The next step is to install the OS itself, which is distributed as a single jffs2 (journaling flash file system version 2) archive file. Depending on what hardware you have available, there are now three distinct options for how to proceed:
If you have a CompactFlash Jacket and a CompactFlash storage card (SD/MMC cards are not supported for this process), then by far the simplest method is to copy three files (the jffs2 file, reflash.ctl, and md5sums) to the root of the CF card using either WinCE or another computer and place the card in the Jacket (and the iPAQ in the Jacket as well, obviously). Now simply reset the device by holding in the record button (on the left side) and you should see a list of images on the card (usually only one). Select the image using the joypad and install it directly -- this takes a few minutes.
If you don't have a CF Jacket/card, then you need to use a serial cable/cradle. Unfortunately, USB cables/cradles don't work, so if your device came only with one of these, then you will need to buy one (they are widely available and reasonably inexpensive). Again, it is best to consult the installation instructions supplied with the device for detailed instructions, but the basic process is to connect the iPAQ to a host computer and transfer the jffs2 file (using the ymodem protocol) to the iPAQ over the serial line. Once the file is on the device, it is flashed using the command
boot, which will flash the device as before.
Note that the transfer can take some time (it took over 20 minutes for me).
- If you have a CF jacket, it is possible to install Linux on a CF memory card without re-flashing the internal device, thereby leaving PocketPC relatively untouched. I say "relatively" because, due to the way in which PocketPC stores user data (in DRAM), when Linux is booted, it will erase all the user data (as Linux uses all of the available DRAM). This is still a useful method as it does allow a primitive form of dual-booting (albeit requiring an additional backup/restore when switching to/from Linux). Unfortunately, there is little information available on this method; it is not supported directly in the Familiar distribution as it requires the user to create a custom initrd filesystem. For those interested in this method, there is a specialised distribution (an off-shoot from Familiar) tailored for those with large capacity (160 Mb+) CF cards called Intimate. Unfortunately, it doesn't look like this distribution is actively being developed: the last release was in November 2001, and the last news item on the Web page is dated June 2003.
Whichever method you decide to use, the flashing process is now complete -- congratulations! If everything went well, you should now have a Linux-based PDA.
Your PDA is now a fully fledged, complete working system in its own right. Depending on which GUI component you decided to go with (GPE, OPIE, etc.), the exact set of applications available will differ, broadly speaking. However, the basic level of functionality is the same: each distribution includes a Web browser, diary, address book, e-mail client, etc. -- all the things you would expect from a PDA.
Unless you are planning to use the PDA in a completely disconnected mode, the first thing you should do is set up some connectivity. The most basic level of connectivity is simple serial/USB synchronization with a host PC for maximum flexibility, but I recommend that you set up full TCP/IP network connectivity. Once again, the exact steps will vary according to what hardware you have -- ranging from full wireless access if you have a supported (built-in/CF/PCMCIA) Wi-Fi card, through LAN access (again with a supported card), TCP/IP over Bluetooth, dial-up with a supported modem, down to tunnelling TCP/IP over the USB or serial cable via the host PC.
Due to a lack of hardware, I was limited to setting up TCP/IP over the serial cradle using PPP connected to a Linux desktop machine and setting up the Linux machine to perform NAT and forward packets to/from the iPAQ on to the LAN. This is reasonably simple, and instructions are at handhelds.org (see Resources for a link). Again, one of the advantages of the system is that, because the iPAQ is a real Linux machine, if you have experience with this sort of setup using normal desktop Linux machines, those skills are directly transferable to your handheld setup.
With a full TCP/IP network connection, you can take advantage of one of the great strengths of Familiar: its simple package management system. Based on Debian, Familiar's package management is similar to Debian's dpkg system, called ipkg (which stands for Itsy Package). Using just a simple set of commands, you can install a large volume of pre-built packages.
For instance, let's say you want to run a Web server on your iPAQ. Yes, I know this may sound like a strange thing to do, but it could be useful in a variety of circumstances. For instance, you could go to a client site and demonstrate the Web site you have been developing for them by running it directly on the same Web server (such as Apache) that it will be deployed on in real-life!
To install Apache using ipkg, use this command:
ipkg install apache
ipkg takes care of all dependencies for you, automatically downloading and installing not only the Web server but also any packages that it needs in order to function correctly.
I like to use the
-V 2 option when installing, to give more verbose messages.
You can remove packages with the
ipkg remove apache
remove command does not remove dependencies, so you may need to use additional
ipkg remove commands to remove packages you no longer need.
Similarly, you can keep all your software up to date (including security fixes) with the following commands:
Now that you know how to obtain and install existing software for your new OS, you may be interested in what options exist for running your bespoke software or simply existing OS software that has not yet been ported by the existing developers.
The first thing you will need, rather obviously, is a compiler and associated tool chain (assembler, linker, etc.) There are two main options to consider here:
Self-hosted compiler: here the compiler is installed and executes on the device itself. This is a perfectly viable setup; in fact, gcc is available via ipkg. For most people, however, unless you really have a need to perform development on the move (and, let's face it, with the limited input devices, it's going to be pretty painful), it's probably overkill. The compilation is likely to be much slower than a cross-compilation setup (unless your desktop machine is really slow) and will use up a lot of disk space on the device for the compiler, headers, libraries, etc. The more likely setup for most users, therefore, is:
- Cross-compiling setup: here the compiler and tool chain are installed on a separate desktop machine -- often Linux-based, but other options are possible, including Windows (via Cygwin), Mac OS X, and others. The compiler executes on the development machine but is configured as a cross compiler; hence, rather than producing executables that will execute on the desktop machine, it outputs ARM binaries that can be run on the handheld. The compiler most people use is gcc, which can be a little daunting to set up (particularly as a cross-compiler) if you have never done this before. Fortunately, there is plenty of help available online. For simplicity, you can install and use a pre-made cross-compiler (see Resources for a link) or, if you need to build your own (if, for instance, you need a later version), then there are scripts available (such as crosstool; see Resources) that can help you build a cross-compiling gcc just by answering a few simple questions.
If for some reason you decide that Linux on iPAQ is not for you, it is a simple matter to reinstall PocketPC. The procedure is exactly the same as used earlier to install Linux via serial, except this time, instead of transferring the Linux jffs2 file, transfer and install the PocketPC image that was saved earlier. The documentation doesn't specify whether the CF method can be used to restore; I suspect it can, but I don't have a CF jacket available to test this theory.
For the bootloader, you can either leave the new bootloader you installed earlier on the device (it will quite happily boot PocketPC) or, if you prefer, you can reinstall the original bootloader. As flashing the bootloader is the most potentially dangerous step (for your iPAQ), I would recommend leaving the new bootloader on there unless you have specific reasons not to.
Installing Linux on your iPAQ isn't for everyone: there are still a few wrinkles to be ironed out here and there. During the writing of this article, for instance, I found that a few times the screen lock would enable on my device, but the touchscreen would not work properly, so I would not be able to unlock it. The only way I have found to recover from this is to either log into the machine via the serial port and kill off the lock program, or hard-reboot the machine. Neither are particular attractive solutions if you are on the road and in the middle of some work.
In addition, most of the newer devices with very attractive features such as built in Wi-Fi are not currently supported, though this situation will only improve as developers come to grips with the new machines.
Finally, Linux on iPAQ could gain mass acceptance if a dual-boot procedure were made possible (particularly as the specs continue to improve, giving more room to store two OSes). This would make people much more likely to start playing with Linux on their iPAQs and use one or two applications -- even if there are certain PocketPC "killer apps" they can't live without that do not (yet) have Linux equivalents. There is no doubt (in my mind, at any rate) that Linux on the desktop would not currently be as popular if dual-booting were impossible.
The Linux distribution Martyn used for this article is Familiar and is distributed by handhelds.org.
The PPPHowto on handhelds.org provides instructions for setting up a PPP connection.
Pre-made cross compilers are also available from handhelds.org.
For those wanting to build their own cross-compiling gcc, crosstool is available from Dan Kegel's Building and testing gcc/glibc cross toolchains site.
ipaqLinux.com is dedicated to all things regarding running Linux on the iPAQ.
For a look at running Web services on PDAs, read Cross-platform programming with Java technology and the IBM Web Services Toolkit for Mobile Devices (developerWorks, February 2003).
Open source wireless tools emerge (developerWorks, August 2003) gives an overview of, and outlook for, open source software on handhelds.
Running on Linux on an iPAQ, the Distributed Wireless Security Auditor is a mobile tool developed by IBM Research for performing wireless security assessments.
- Previously on developerWorks, Martyn wrote Boot Linux from a FireWire device (developerWorks, July 2004), Connecting KDE applications using DCOP (developerWorks, February 2004), Postmortem memory profiling with PERL (developerWorks, December 2003), and the Significant trace series of articles (developerWorks, April 2003).
- Find more resources for Linux developers in the developerWorks Linux zone, and more resources for Wireless developers in the developerWorks Wireless zone
- Browse for books on these and other technical topics.
- Develop and test your Linux applications using the latest IBM tools and middleware with a developerWorks Subscription: you get IBM software from WebSphere®, DB2®, Lotus®, Rational®, and Tivoli®, and a license to use the software for 12 months, all for less money than you might think.
- Download no-charge trial versions of selected developerWorks Subscription products that run on Linux, including WebSphere Studio Application Developer, WebSphere Application
Server, DB2 Universal Database, Tivoli Access Manager, and Tivoli Directory Server,
and explore how-to articles and tech support, in the Speed-start your Linux app section of developerWorks.
Martyn Honeyford graduated from Nottingham University with a B.Sc. in computer science in 1996. He has worked as a Software Engineer at IBM UK Labs in Hursley, England, ever since. His current role is as a developer in the WebSphere MQ Everyplace development team. When not working, Martyn can usually be found either playing the electric guitar (badly) or playing video games more than most people would consider healthy. You can contact Martyn at email@example.com.