Howto put Familiar Linux on the iPaq H2200
by Jack Dodds <brmdamon@aci.on.ca> or <backupbrmdamon@fastmail.fm>
2008-05-04 - Draft - tested with GPE on CF only.
2008-05-07 - Draft - tested with GPE on SD.
Any comments would be received with appreciation.
This is based on documentation at
http://www.handhelds.org/moin/moin.cgi/CardBoot. I have created a
script to automate some of the setup procedures, along with some of the
required text files with modifications as per the documentation.
Warning: This procedure requires the
disk partition utility to be run as root. You can destroy your
host system by making a mistake. It is also conceivable that you
could "brick" your h2200, making recovery difficult or impossible.
Be careful and observe the
precautions listed in the following. The procedure has received
only limited testing. I do not accept any responsibility
for damage that results from its use. Use it at your own risk.
Purpose:
Document the procedure that I have used to install the Familiar
distribution of Linux on my iPaq h2200, with either a Compact Flash or
Secure Digital card as the system disk.
With this procedure, the original operation system is not overwritten. From
a cold start, the user boots Windows Mobile, and then runs HaRET to
boot Familiar.
Pocket PC system:
Thia is the system that I actually used to test this procedure.
iPaq Pocket PC H2200 serial number TWC420V05.
192 MB Compact Flash memory card from Sandisk
OR
512 MB Secure Digital card from Henry's cameras (actual manufacturer unknown).
Host system:
Pentium running Debian Etch Linux with Internet access.
USB adapter with slots for CF and SD.
Downloads:
Set up a working directory on your host computer for this procedure. All subsequent operations
are assumed to take place with that working directory as the current directory.
Go to http://handhelds.org/familiar/releases/v0.8.4/install/download.html, select stable - h2200 - GPE and download that image. Put it in the working directory.
Download the HaRET bootloader and save it in the working directory.
More information can be found at http://handhelds.org/moin/moin.cgi/HaRET.
Download fstabCF, startupCF.txt, and h2200setupCF.sh. (for a CF install), or
fstabSD, startupSD.txt, and h2200setupSD.sh. (for a SD install), and save them in the working directory.
I have put these online at http://cyberspirit.dyndns.org:81/~jack/familiarsetup/. Alternatively they
are listed at the end of this document.
Set the permissions of the SetupFamiliarCF.sh or SetupFamiliarSD.sh file to allow execution.
chmod 755 SetupFamiliarCF.sh
Untar the archive.
tar -xvf boot*.tar
Now list the working directory, and the subdirectory created from the archive.
ls -l -R
The directory should look something like this.
total 40064
drwxr-xr-x 2 jack jack 4096 2006-09-08 20:10 bootgpe-v0.8.4-h2200
-rw-r--r-- 1 jack jack 40826880 2008-05-04 11:22 bootgpe-v0.8.4-h2200.tar
-rw-r--r-- 1 jack jack 313 2008-05-04 17:37 fstabCF
-rw-r--r-- 1 jack jack 128000 2008-05-04 18:14 haret-0.5.1.exe
-rwxr-xr-x 1 jack jack 1438 2008-05-04 18:11 SetupFamiliarCF.sh
-rw-r--r-- 1 jack jack 119 2008-05-04 17:38 startupCF.txt
./bootgpe-v0.8.4-h2200:
total 39924
-rw-r--r-- 1 jack jack 21659648 2006-08-18 14:30 bootgpe-v0.8.4-h2200.jffs2
-rw-r--r-- 1 jack jack 16565127 2006-08-18 14:47 bootgpe-v0.8.4-h2200.tar.bz2
-rw-r--r-- 1 jack jack 1200640 2006-08-19 14:18 LAB-image-h2200.htc
-rw-r--r-- 1 jack jack 1390316 2006-08-14 21:37 zImage-2.6.15-hh2-h2200
The .tar file is the original archive that has been extracted to the subdirectory.
The fstabCF or fstabSD file must be copied to /etc/fstab on the ext2 partition of the memory card.
The startupCF.txt or startupSD.txt file must be copied to the vfat
partition of the memory card. It contains a script read by HaRET.
The .jffs2 file is used only if Familiar is being installed on the
h2200 memory. Not needed for a system that resides on a memory
card.
The .htc file is ??? . Not needed for a system that resides on a memory card.
Partition the memory card:
Determine the name of the CF or SD card in the memory card adapter.
If you don't already know it, one way that may work is to put the
memory card in the adapter and as root list all the known block devices
with this command
fdisk -l
!! WARNING !! Make absolutely sure that you have the correct device, since you
will be running cfdisk as root and can destroy your system if you
format the wrong device!!! For this reason I do not attempt to
automate the partioning of the disk. Using cfdisk interactively
will provide feedback so that you are less likely to do something
catastrophic.
This document is written on the basis that the memory card is /dev/sdc.
Put the CF or SD card into the USB memory card adapter.
In a terminal, navigate to the working directory, become root and enter
cfdisk /dev/sdc (substituting here the correct memory card device)
!!! Make sure
that the total size of the device displayed by cfdisk agrees with the size of thememory card that you are using, as a
final verification that you have the correct device. !!!
!!! If cfdisk shows a partition FS Type "Linux swap", STOP!!!
!!! If cfdisk shows a partition with flag "Bootable", STOP!!!
You have probably selected your main host system disk instead of the memory card.
When you are sure that you have the correct disk, delete all existing partitions.
Create a new primary partition, size 10 MB, at the beginning of the free space, type 06 (FAT16).
Create a new primary partition, size default (remainder of disk) type 83 (Linux).
Now you should see something like:
Disk Drive: /dev/sdc
Size: 192413696 bytes, 192 MB
Heads: 6 Sectors per Track: 62 Cylinders: 1010
Name
Flags Part Type FS
Type
[Label] Size (MB)
------------------------------------------------------------------------------
sdb1
Primary
FAT16
10.10
sdb2
Primary
Linux
182.28
!!! Check once again that the partition sizes are consistent with the memory card size !!!
Write the partition table to disk and Quit.
Make two mount points for the two disk partition, if they don't already
exist. The script used in the next step expects exactly these mount points to be present:
For a Compact Flash card:
mkdir /media/CF1
mkdir /media/CF2
Or, for a Secure Digital card
mkdir /media/SD1
mkdir /media/SD2
Load the system on the memory card:
As root, run the script to put all the necessary files on the memory card. Here I have used /dev/sdc for the memory card.
!!! Be very careful to specify the correct device for the memory card on your host. !!!
For a Compact Flash install,
./SetupFamiliarCF.sh /dev/sdc (substituting here the correct memory card device)
or for a Secure Digital install,
./SetupFamiliarSD.sh /dev/sdc (substituting here the correct memory card device)
(The script runs for almost two minutes on my host system.)
Remove the memory card from the USB card interface.
Note that, once the working directory is set up on the host, and the
memory card is partitioned, you can repeat this step to load a fresh
system on the memory card as many times as you wish.
Boot the system:
Put the memory card in the h2200.
You may need to do a hard reset of the h2200 to get back
to Windows
Mobile so that you can boot Familiar. This is done by
simultaneously holding down (for several seconds) buttons 1 and 4 on
the front of the h2200, while using the stylus to press the Reset
button in the small hole in the back of the h2200. Then release
the bottons, put the h2200 in its charger cradle, and the Windows
Mobile start up screen should appear. Then go through the setup
procedure for Windows Mobile.
To boot Familiar:
Start - Programs - File Explorer - My Documents - My Device - CF Card (or SD Card) - haret
Screen goes blank for about 40 s - then displays the splash screen.
After another 2 minutes, you are into the Familiar setup procedure.
What's next?
When I find the time ...
... document setting up an Internet connection via a USB cable to the host computer.
... document setting up an Internet connection via a GPRS (GSM) CF card modem.
Script and config file listings:
These are also available at
http://cyberspirit.dyndns.org:81/~jack/familiarsetup/.
SetupFamiliarCF.sh
# Script to set up a Compact Flash memory card to boot Familiar.
# Takes one parameter, the memory card device to be set up
#
# e.g. ./SetupFamiliarCF.sh /dev/sdb
#
# The memory card must be paritioned, but with no file systems.
# The script must be run as root. The current directory must
# contain the necessary files, and a subdirectory containing
# the untar'ed distribution file.
#
if [ "`mount |grep $1`" != "" ]
then
# Abort - the device or a partition on it is already mounted!
# This is a final protection against damaging the host file
# system by an error in the parameter to this script.
echo "Device $1 is mounted. Are you sure this the correct device?"
else
# Make a vfat partition from which Windows Mobile can
# run the boot loader to boot Familiar.
mkfs -t vfat $11
# Make a Linux partition to hold the Familiar system.
mkfs -t ext2 $12
# Mount the file systems.
mount -t vfat $11 /media/CF1
mount -t ext2 $12 /media/CF2
# Go to the untar'ed distribution directory.
cd boot*
# Copy files to the vfat partition.
cp ../haret* /media/CF1/haret
cp zImage* /media/CF1/zImage
cp ../startupCF.txt /media/CF1/startup.txt
# Untar the Familiar system.
tar -jxpf boot*.tar.bz2 -C /media/CF2
# Replace fstab.
cp ../fstabCF /media/CF2/etc/fstab
chown root /media/CF2/etc/fstab
# Unmount.
umount /media/CF1
umount /media/CF2
fi
fstabCF
/dev/hda2
/ ext2
defaults 1 1
proc
/proc proc
defaults 0 0
sys
/sys sysfs
defaults 0 0
tmpfs
/var
tmpfs defaults 0 0
/dev/hda1
/media/cf auto
defaults,sync,noauto,noatime,exec,suid 0 0
/dev/mmcblk0p1
/media/card auto
defaults,sync,noauto,noatime,exec,suid 0 0
startupCF.txt
set KERNEL zImage
set MTYPE 341
set CMDLINE "root=/dev/hda2 rootdelay=5 console=ttyS0,115200n8 console=tty0"
bootlinux
SetupFamiliarSD.sh
# Script to set up a Secure Digital memory card to boot Familiar.
# Takes one parameter, the memory card device to be set up
#
# e.g. ./SetupFamiliarSD.sh /dev/sdc
#
# The memory card must be paritioned, but with no file systems.
# The script must be run as root. The current directory must
# contain the necessary files, and a subdirectory containing
# the untar'ed distribution file.
#
if [ "`mount |grep $1`" != "" ]
then
# Abort - the device or a partition on it is already mounted!
# This is a final protection against damaging the host file
# system by an error in the parameter to this script.
echo "Device $1 is mounted. Are you sure this the correct device?"
else
# Make a vfat partition from which Windows Mobile can
# run the boot loader to boot Familiar.
mkfs -t vfat $11
# Make a Linux partition to hold the Familiar system.
mkfs -t ext2 $12
# Mount the file systems.
mount -t vfat $11 /media/SD1
mount -t ext2 $12 /media/SD2
# Go to the untar'ed distribution directory.
cd boot*
# Copy files to the vfat partition.
cp ../haret* /media/SD1/haret
cp zImage* /media/SD1/zImage
cp ../startupSD.txt /media/SD1/startup.txt
# Untar the Familiar system.
tar -jxpf boot*.tar.bz2 -C /media/SD2
# Replace fstab.
cp ../fstabSD /media/SD2/etc/fstab
chown root /media/SD2/etc/fstab
# Unmount.
umount /media/SD1
umount /media/SD2
cd ..
fi
fstabSD
/dev/mmcblk0p2
/ ext2
defaults 1 1
proc
/proc proc
defaults 0 0
sys
/sys sysfs
defaults 0 0
tmpfs
/var
tmpfs defaults 0 0
/dev/hda1
/media/cf auto
defaults,sync,noauto,noatime,exec,suid 0 0
/dev/mmcblk0p1
/media/card auto
defaults,sync,noauto,noatime,exec,suid 0 0
startupSD.txt
set KERNEL zImage
set MTYPE 341
set CMDLINE "root=/dev/mmcblk0p2 rootdelay=5 console=ttyS0,115200n8 console=tty0"
bootlinux
