Access to H2200 Linux command line
WARNING
There're a generic instructions for setting up a USB Networking on (any) handheld running Linux, it may contain newer information (and not contain outdated) - UsbNet.
Caching is broken in the current kernels, so pay attention:
-
mempolicy = uncached: stable, but slow
-
mempolicy = writeback: stable & fast, but CF memory cards don't work
-
mempolicy = writethrough: unstable & fast, CF works
Introduction
New! You no longer need a serial cable to access a Linux command line on your HP iPAQ h2200 (h2210, h2215 or h2212e).
See
our pictures.
Here's what you need now:
-
The USB cradle
-
A GNU/Linux host
-
You also need to be familiar with GNU/Linux, otherwise you won't find enough details in the below instructions.
-
A good pair of glasses... you'll see why! (Depending on used Bootloader/System-Image???)
-
Linux host System with the following kernel-options (As showed in menuconfig):
-
Full NAT
-
MASQUERADE
-
Multi Purpose USB Networking framework
-
CDC Ethernet support
-
Simple USB Network links
-
Embedded ARM Linux links
-
USB Gadget drivers (select: Ethernet Gadget (with CDC Ethernet support) !!!)
-
- Netfilter configuration:
Thanks to USB networking, you can now:
-
Access to a Linux command line on your h2200 through ssh.
-
Use a directory structure on your PC as the root filesystem of Linux on your iPAQ, thanks to NFS.
-
You can run graphical applications too!
Having your root filesystem on NFS is particularly useful for kernel development. You cross compile modules on your PC, copy them to the device root filesystem, load the module, test it, remove it, fix the source and cross compile it, reload the module. You can do this over and over again, without having to reboot.
NFS setup on your computer
Download the latest rootfs.tar.bz2 file from http://handhelds.org/~michaelo/ipaq/starterkit/ or its mirrors:
(The only link that had good working images for me was: http://handhelds.org/~mreimer/nfs/ - It booted GPE with SD support, after loading mmc* modules -
Arthur)
Extract its contents to /home/ipaq_rootfs
It has to be this exact path as its what the initrd scripts expect.
Add the below line to your /etc/exports file:
/home/ipaq_rootfs 192.168.0.202/32(rw,insecure,sync,no_wdelay,no_root_squash)
It has been known that some NFS servers do not grant writing rights in the rootfs with that configuration. If it is your case, just write the following instead:
/home/ipaq_rootfs 192.168.0.202/32(rw,insecure,no_root_squash)
Run "man exports" for more details about this file
Start (or restart) the NFS services on your computer:
'exportfs -ra' or '/etc/init.d/nfs restart' (example from Fedora Core 1)
Start Linux on your h2200
Download the latest zImage, initrd, haret.exe and startup.txt files from http://opdenacker.org/pda/ipaq/starterkit/ or http://www.gwynux.ca/h2200/ . Rename the first 2 files to "zImage" and "initrd" (be aware, that the zImage & initrd have to match your rootfs, especially the kernel-version!).
Make these files available to your iPAQ in the same directory:
-
either by copying them to a SD or CF card (if you have a card reader)
-
or by copying them with the
synce tools. Then, move them to the "IPAQ File Store" directory. In there, they are not stored in RAM and won't be lost after running Linux. You won't have to copy them over and over again.
Put your device on its cradle, connect the USB cable to your computer, and start HaRET.
HaRET doesn't always work at the first try. If you don't see the red liquid rising in the thermometer up to the top, you will have to reset your device and try to running HaRET again until it works.
After a few seconds, you will see boot messages on the screen!
Put your glasses on if you haven't done so yet!
Initialize USB networking
After roughly 5 seconds, you should see the below message on the h2200 screen:
Waiting for the PC host (192.168.0.200) to be available trough the USB ethernet connection...
You should also see something like this in /var/log/messages on your PC:
Mar 9 15:21:10 localhost kernel: usb.c: USB disconnect on device 02:0a.0-1 address 36 Mar 9 15:21:10 localhost kernel: usbserial.c: PocketPC PDA converter now disconnected from ttyUSB0 Mar 9 15:21:10 localhost devlabel: devlabel service started/restarted Mar 9 15:21:13 localhost kernel: hub.c: new USB device 02:0a.0-1, assigned address 37 Mar 9 15:21:13 localhost kernel: usb0: register usbnet usb-02:0a.0-1, Linux Device Mar 9 15:21:16 localhost usb.agent[13162]: missing kernel or user mode driver usbnet Mar 9 15:21:16 localhost devlabel: devlabel service started/restarted
If you don't see this, check that the "usbnet" module is loaded. It should be automatically loaded by your distribution. Otherwise, run "modprobe usbnet". If you can't do it, you'll have to recompile your kernel with support for this module.
Another option, without having to modify your GNU/Linux distribution, is to use the Knoppix GNU/Linux live CD (http://www.knopper.net/knoppix/index-en.html), which automatically loads the usbnet module when needed. Of course, you will still have to copy the supplied root filesystem somewhere on your computer, and have knoppix mount it on /home/ipaq_rootfs.
Now, run the below commands:
ifconfig usb0 192.168.0.200 #(this exact IP address is expected by the iPAQ) route add 192.168.0.202 dev usb0 ping -c 1 192.168.0.202 #(to check that the connection works)
After this, the h2200 should tell you:
Connection to the PC host established!
Connecting to your iPAQ
Run the below command:
ssh -l root 192.168.0.202
The root password is "rootme".
After a few seconds, you will have access to the command line in the "/root" directory.
You're done! Run whatever you want and make changes to the root partition if you wish (either from the iPAQ or the PC)
Access to the Internet
You have to setup IP masquerading on your PC host to let your iPAQ access the Internet through it.
Here's an example from Fedora Core 1:
iptables -t nat -I POSTROUTING -j MASQUERADE -s 192.168.0.202 iptables -I FORWARD -s 192.168.0.202 -j ACCEPT iptables -I FORWARD -d 192.168.0.202 -j ACCEPT echo 1 > /proc/sys/net/ipv4/ip_forward
See http://www.ibiblio.org/mdw/HOWTO/IP-Masquerade-HOWTO/ (DEAD LINK!) and UsbNet for more details.
Now, you should be able to ping an Internet IP address from your iPAQ!
DNS setup
The proposed rootfs assumes that you are running a name server (named daemon) on your PC host. In addition to the performance benefits that that DNS caching brings to your PC host, it's also more convenient for us to have a setting that you won't have to change according to your ISP DNS settings.
See http://www.tldp.org/HOWTO/DNS-HOWTO.html for details.
On your iPAQ, you can configure name resolution by copying the contents of /etc/resolv.conf on your PC to the same file on your iPAQ.
If you don't wish to run your own name server on your PC host, you can just copy your /etc/resolv.conf file to the iPAQ root filesystem. Just make sure you keep this file up to date when you download a new rootfs update!
Running graphical applications
Starting Opie
Just run:
/etc/init.d/opie start
If the initial screen calibration settings are so bad that you can't even reach the screen calibration icon on the "Settings" tab, just remove the /etc/pointercal file. This triggers Opie's screen calibration.
Running X applications on your PC screen
You can start GPE applications on your PDA and play with them on your PC display, for more viewing comfort (you're free to make the windows wider!)
Example:
ssh -X -l root 192.168.0.202 (note the -X option) dillo & gpe-minicalc &
Notes:
-
On your PC, you may have to run the "xhost +" command
-
You may also need to check that your X server is not
running with the "-nolisten tcp" option. To fix that in Fedora Core 1, I had to set "!DisallowTCP=false" in the /etc/X11/gdm/gdm.conf file.
Conclusion
Once all this is successfully configured, here are nice things that you can do on your iPAQ:
-
Directly write to your root partition from your PC
-
Cross-compile kernel modules on your PC and copy them to your iPAQ
to test them.
-
Use the ipkg command ("ipkg -h" for details) to update tools on
your iPAQ
-
Connect directly to the internet and download files for example
(wget is your friend)
-
Start graphical applications
Known issues and limitations
-
If this procedure fails (failure in the NFS mount), restarting
NFS services on your PC may help
-
See our issue list on the HpIpaqH2200Tasks page
