Running Linux on iPaq 1940
Corrections:
- Andrew Booth
- Ilia Bazliancov
I have just received the latest issue of the Hungarian Linux magazine Linuxvilag. There was a note in the introduction, that this issue contained an article about the implementation of Linux on PDAs. I had previously researched this topic without any great success. The most famous – and maybe the only – Linux distribution for PDAs is Familiar Linux. The Familiar Project is quite active and I have just one problem with it: currently Familiar is supported “only” on these handhelds: iPAQ 3100, 3600/3700, 3800, 3900, 5100/5400/5500 series, HP Jornada 565/568 and 720 series and Sharp Zaurus SL-5500/SL-5600, SL-6000, SL-C750/SL-C760/SL-C860, but I have an iPaq 1940.
I quickly read the Linuxvilag’s article and I realized that this article was describing Familiar Linux as well. So, I’ve started Googling the web to see is there anything new about this topic. I found a page on Handhelds.org but it had “Work in progress” next to the project name. However, while browsing the links on this site I found a page with the following title: “iPAQ 1930/1940 adventures“. Cool, that’s what I searching for. The author talks about OpenEmbedded and the page contains some precompiled kernel images for different purposes:
- SSH: we can connect to the handheld through the SSH protocol.
- NFS Root: this image mounts a predefined NFS partition, and than starts GPE or OPIE from this NFS share.
The Bootldr – PDA Boot Loader – is currently not supported on the 1940, but HaRET – Handheld Reverse Engineering Tool – can help us to boot Linux on the PDA. HaRET is a small PDA application which loads a Linux kernel based on the predefined configuration file (default.txt). Here is the content of a possible default.txt:
set MTYPE 347 set KERNEL "zImage" set INITRD "initrd" set RAMADDR 0x30000000 set CMDLINE "console=ttySAC2,115200n8 root=/dev/ram ramdisk_size=4096 init=/linuxrc panic=30" bootlinux
But be careful, because HaRET clears everything from the memory of PDA. The data can remain on File Storage and on SD/MMC card but everything else will be deleted (it’s equivalent to a hardware reset).
To start with, I chose the SSH image and copied the files (config, default.txt, initrd, zImage and of course haret.exe) to my SD card through ActiveSync. I executed haret.exe – which read the configuration from default.txt – then I clicked on “Run” and Linux started to boot.
The screen went black and then the well-known and lovely penguin was displayed in the corner of the screen and some minutes later the “h1940 login:” as well. Unfortunately the linux console doesn’t support the virtual keyboard, so I had to login through ssh because I don’t have external keyboard for my handheld. The downloaded image sets the IP address of the iPAQ to 192.168.6.2. I had to change the IP address on my notebook as well, but first I had to remove and reattach the USB cable between the iPaq and the laptop. The connection was established by executing the command ‘ifconfig usb0 192.168.6.1′ on the laptop. I could ping the handheld, so, I tried ssh as well. It was successful so, in the first step I tested the most important commands of Linux. It seemed that everything worked the same as on a desktop computer, so my next goal was to run GPE on the PDA.
It wasn’t that easy. I downloaded the NFS image and I installed an NFS server on my laptop. I extracted one of the gpe images (from the previously-mentioned site) to the NFS partition. I copied the necessary files to the handheld, and then I executed HaRET. The PDA had mounted the appropriate NFS drive during the boot process and started GPE from that. The USB connection between the devices was very unreliable – maybe because of NFS. I had to ping the PDA from an other console to know when the connection was broken. When it happend I had to remove/reattach the USB cable and re-execute ‘ifconfig usb0 192.168.6.1′ to continue the booting process. Some minutes later the GPE login screen was displayed on the PDA’s screen.
I could run the GUI on the handheld but I could see it isn’t so useful if the external NFS partition is required for running. My great idea was to mount the GPE image through the loopback interface instead of NFS. I had to do the following:
- Preparing a GPE image:
dd if=/dev/zero of=gpe bs=1k count=40k mke2fs -i 1024 -b 1024 -m 3 -F -v gpe mount -o loop gpe /mnt/rootfs //copying files from GPE image to /mnt/rootfs umount /mnt/rootfs
So, we now have a file which contains the GPE image.
- Modifying the linuxrc in initrd:
gunzip -d < initrd > initrd_unzipped mount -o loop initrd_unzipped /mnt/rootfs vi /mnt/rootfs/linuxrc //do the modifications umount /mnt/rootfs gzip -9 initrd_uncompressed mv initrd_uncompressed.gz initrd
My linuxrc looks like this:
#!/bin/sh export PATH="/bin:/sbin:/usr/sbin" echo "Booting Linux" > /dev/tty1 sleep 3 echo "Using kernel `uname -r`" > /dev/tty1 echo "Configuring usb0 to 192.168.6.2..." > /dev/tty1 ifconfig usb0 192.168.6.2 echo "Mounting /dev/mmcblk0p1 to /mnt/sdcard..." > /dev/tty1 mount /dev/mmcblk0p1 /mnt/sdcard echo "Setting up loop device..." > /dev/tty1 losetup /dev/loop0 /mnt/sdcard/gpe echo "Mounting rootfs to /mnt/temproot..." > /dev/tty1 mount -t ext2 -o rw /dev/loop0 /mnt/temproot echo "Executing pivot_root..." > /dev/tty1 cd /mnt/temproot if [ ! -d initrd ]; then mkdir initrd fi pivot_root . initrd echo "Executing init..." > /dev/tty1 exec chroot . /sbin/init > /dev/tty1 2>&1 echo "Unmounting ramdisk..." > /dev/tty1 umount /initrd
My new initrd is able to chroot to an image – in our example to gpe – and run its init script. The work was finished.
However, unfortunately some hardware components and features are currently not supported on this handheld (as far as I could see). It doesn’t handle the sound card, bluetooth but the worst: there is no power management, so I wasn’t able to suspend the system when I finished my work and I had to reboot the system every time when I turned on the iPaq. Hopefully I can solve these issues by compiling my own kernel.
I tried some tests with OPIE as well but they were unsuccessful. I did the same as with the GPE image but the boot process never finished. I could see some error messages when I monitored the boot process via SSH, but I haven’t started to solve these issues.
3 Responses to Running Linux on iPaq 1940
MINDEN VÉLEMÉNY SZÁMÍT! Kilépés a válaszból
Fotók



Hello, i’m trying to run linux on my H1940 too and i’m getting stuck on:
Waiting 5sec before mounting root device…
mmc0 : host does not support reading read-only switch. assuming write-enable
mmcblk0: mmc0:b368 SMI 999936KiB
mmcblk0: P1 P2
I’m not too good on linux, so i guess it is not mounting fileystem, but, my question is, do you guess or know why could this be happening?
I have used the 1940stepbystep instructions so i’ve made two partitions on my SD card, 1st FAT16, 2nd ext2 (both primary) and the use haret to load kernel. Do you have any clue on what i’m doing wrong or what should i do?.
Thanks in advance.
It was a long time ago when I hacked on my H1940. I have already sold it and I don’t really remember how I installed linux on it. Everything I know is in the post. Sorry for that, I can’t help you
Thanks Anyway