How to manually install PalmOS on a LifeDrive HDD

Palm LD

So your LifeDrive HDD has died or you've somehow managed to wipe it? These instructions explain (AT YOUR OWN RISK) how to reinstall PalmOS manually. This will definitely void your warranty, so you're best off getting Palm to do it instead if you can.

Note: This article is now maintained on the wiki. Try there fore newer versions.

Edit: You can use this technique and customise the ROM zip. For example I just fully removed that 'AddIt' program.

Stuff you need:

  • CF card reader or IDE->CF adapter
  • PC running Linux or similar (*BSD would probably do as well)
  • Standard GNU system utils (dd, cat, xargs etc)
  • unzip
  • cabextract
  • unshield
  • subversion (you could use the SF ViewVC interface instead)
  • Python (probably at least version 2.4 for the base64 decoding)

Obtaining PalmOS
Palm was nice enough to include basically everything we need in LifeDrive 2.0 update. Goto palm.com and grab the appropriate version for your language.

I tried both of these:

There doesn't seem to be any differences in the actual ROM partition, so it probably doesn't matter which you use.

First you need to unpack the PalmOS out of the installer:

$ unzip ~/downloads/LifeDrive_Update_2_0_EFIGS_win.zip
Archive: /home/ato/downloads/LifeDrive_Update_2_0_EFIGS_win.zip

inflating: LifeDrive 2.0 Updater.exe

$ cabextract 'LifeDrive 2.0 Updater.exe'
Extracting cabinet: LifeDrive 2.0 Updater.exe
extracting Disk1/data1.cab
extracting Disk1/data1.hdr
extracting Disk1/data2.cab
extracting Disk1/ikernel.ex_
extracting Disk1/layout.bin
extracting Disk1/Setup.exe
extracting Disk1/Setup.ini
extracting Disk1/setup.inx

All done, no errors.

$ mkdir data
$ cd data
$ unshield ../Disk1/data1.cab
Cabinet: ../Disk1/data1.cab
extracting: ./corecomp.ini
extracting: ./ctor.dll
extracting: ./objectps.dll
...

Now you should find a whole bunch of pdb and prc files. The ones we're interested are a split up zip file (brahma-palmos.zip.X.pdb) that contains everything that's part of the devices' 'ROM area'. To put it back together grab the unpdb.py tool from Hack&Dev subversion:

$ svn cat https://svn.sourceforge.net/svnroot/hackndev/linux4palm/tools/unpdb.py > unpdb.py

We then unpack each of the pdb files, stick them together in order and skip the first 32 bytes, since it contains a 'HACKSPLIT' header.

$ ls brahma-palmos.zip.?.pdb | sort | xargs -ti python unpdb.py {} - | dd skip=1 bs=32 > brahma-palmos.zip
python unpdb.py brahma-palmos.zip.a.pdb -
python unpdb.py brahma-palmos.zip.b.pdb -
python unpdb.py brahma-palmos.zip.c.pdb -
python unpdb.py brahma-palmos.zip.d.pdb -
python unpdb.py brahma-palmos.zip.e.pdb -
python unpdb.py brahma-palmos.zip.f.pdb -
python unpdb.py brahma-palmos.zip.g.pdb -
python unpdb.py brahma-palmos.zip.h.pdb -
python unpdb.py brahma-palmos.zip.i.pdb -
python unpdb.py brahma-palmos.zip.j.pdb -


Check to make sure brahma-palmos.zip is valid:

$ du -b brahma-palmos.zip
20479778 brahma-palmos.zip
$ md5sum brahma-palmos.zip
242847c981475636f7b74c7ba9a40379 brahma-palmos.zip
$ unzip -l brahma-palmos.zip
Archive: brahma-palmos.zip
Length Date Time Name
-------- ---- ---- ----
110616 11-03-05 13:43 1.jpg
165927 11-03-05 13:43 10.jpg
524288 11-03-05 13:43 100.asf__512k_a
...

Sector offset: 134079
Byte offset: 134079*512 == 68648448

To make a valid ROM partition, we need to stick an 'acecafe0' header on the front of the zip that tells the PalmOS bootloader where on the disk (in sectors) and how long (in bytes) the zip is. I wrote makecafe.py to do just that:

$ svn cat https://svn.sourceforge.net/svnroot/hackndev/linux4palm/tools/makecafe.py > makecafe.py
$ python makecafe.py -c brahma-palmos.zip > rom-partition
$ md5sum rom-partition
639952c7a50e8d12d1d9351f3cbe9aa6 rom-partition

Since PalmOS expects some strange C/H/S values that confused every partition manager I tried we need to manually partition the disk. The command below will write the stock partition table to the file table.sct.

$ echo 'AAAAAAAAAAAAAAAAAAAAAQEABlgPCD8AAACACwIAAFgQCAAoHAu/CwIAgLAAAAAoHQsLz13xP7wCAIBLdwAAAAAAAAAAAAAAAAAAAAAAVao=' | python -c 'import base64,sys;sys.stdout.write("\0"*432+base64.b64decode(sys.stdin.read()))' > table.sct

The next step WILL VOID YOUR WARRANTY. Remove the two rubber non-slip things from the screw holes near the top of the back of the LifeDrive. Unscrew the screws with a torx or appropriately sized flathead screwdriver. Insert something strong and flat into the slits on the sides of the handheld. Only insert it part of the way or you'll damage the plastic. Carefully prise the metal back off. Unscrew the two screws at the bottom holding the plastic frame in place. Disconnect the speaker plug (in the square hole next to the speaker) and remove the plastic frame. Disconecct the battery plug. Void you warranty by breaking the 'void if removed' sticker and remove the microdrive.

Plug the microdrive into your PC. If you're using an IDE->CF adapter, turn your PC off first and when you turn it back on, issue this command to turn off DMA:

hdparm -d0 /dev/hdX

If you're using a USB CF reader /dev/XdX will be something like /dev/sda. With a IDE->CF adapter it will be something like /dev/hdc.

Write the partition table to disk:

$ dd if=table.sct of=/dev/XdX conv=notrunc

1+0 records in
1+0 records out

And now the actual ROM partition:

$ dd if=rom-partition of=/dev/XdX seek=134079 bs=512 conv=notrunc

40001+1 records in
40001+1 records out

Put the microdrive back in your LifeDrive, reconnect the battery and with any luck, watch it boot PalmOS. The other two partitions will be automatically formatted by PalmOS, so you don't need to worry about them.

Thanks to rayban and Shadowmite for information about the structure of the updater and ROM partition, pronobozo for funding card reader and beer and fabio_kell for reminding me to try this out.

Changes

  • 23-05-2006 Updated links to new SVN layout
  • 24-05-2006 Python 2.4 is required, not 2.1. Thanks Sebastion.