Saturday, July 7, 2007

Palm TX PCMCIA status

We've done some tests with Marex lately (he told me what to do and I tried it on real device) and maybe we've got some results. What it is looks like at the moment? It seems, that PalmTX WiFi is connected to PCMCIA at address 0x28000000. There is also another used PCMCIA - 0x20000000. Marex thinks that it can be NAND memory. So it sounds very promising. Unfortunately we don't have proper PCMCIA driver for TX yet :-( Maybe we are still missing some GPIOs (we tried some promising ones but with no results). Great news at last, Marex is coming to Prague (Thursday this week) to see my TX, so PCMCIA driver can be ready soon ;-) These are just some notes, but as you can see work is in progress ;-)


dump of 0x20000000

00005a00
00000000
c0000000
c0000000
30318f57
00000000
000c000c
00040004
00000005
ffff0000
c0011e90
c0005f6c
ffff0014

Thursday, July 5, 2007

Image selector, part 2 ;-)

I did it. When no one believed in my developing skills... Ok, that was for fun, now let's talk about something more serious. As I mentioned before (in my previous post), I was thinking about writing interactive image selector purely in shell. So job done ;-) Many thanks to kEdAR who prepared busybox for me (I needed some usual shell utilities which wasn't included in my old ramdisk). So how does my image selector work? After loading ramdisk and configuration file from SD/MMC Card, it shows you what configurations you can choose from. Also it marks one of them as selected one (first configuration from your list). If you press enter, it will choose next one. When any configuration became marked as selected, you've got several seconds to change your mind. If you don't press enter during that period, selected image will be loaded.You can specify different SQUASROOT and ROOT for each of your choices. I hope it will be enough.

I nearly forgotten to mention where you can get it. As usual, you can get it from my pages (it's in squashfs-lzma now) and you can also get there documented example of configuration file. And last thing to add, screenshot ;-) It's taken on PC, but it looks same on Palm ;-)


Sunday, July 1, 2007

Image selector

Basic idea

I was thinking, with squashfs-lzma, I can have several rootfs on my card and with my ramdisk, I can eassily switch between them by simply editing configuration file. But it can be even more simple. What about bootup menu which let you decide, what rootfs image you want to boot? Well, it can be implemented in PalmOS so it just modify your configuration file, but why? I like to have as simple bootloader as it can be. I prefer solving this issue in Linux. So we can write C program, compile it and use it. But it's not cool ;-) Everybody can do that and you have to take care about libraries and such. So why don't write it in shell? :-D Yes, this sounds cool. Couse Palm doesn't have keyboard. We've got only few keys - some of them are FX and then we've got Dpad. So I've decided to write rootfs selector, which can be controlled by single key :-D I'll use just enter. Main idea is to wait X seconds (where X is user definable) and then run current image. By using enter key, you can switch between several rootfs.

Implementation

How to implement something like this in shell? We need several processes and we need them to communicate with each other somehow. We need one process to wait for enter key and another process to wait and count seconds. So I divided it into 3 different files. First of them is main. It looks simple:


#!/bin/sh

mkdir /tmp/chooser.$$
sh ./dialog 5 /tmp/chooser.$$ 2> /dev/null
. /tmp/chooser.$$/action
rm -r /tmp/chooser

echo $NUM

It's just a simple example. It just runs dialog with 5 seconds of timeout and after that it read's up, what it should do and do it ;-) Now let's take a look at dialog script.


#!/bin/sh

[ "$1" ] && TIME=$1
[ "$2" ] && WDIR=$2
[ "$NUM" ] || NUM=1

echo NUM=$NUM > $WDIR/action
sh ./timedkill $TIME $WDIR $$ &
read tmp
echo switched
NUM=`expr $NUM + 1`
kill `cat $WDIR/killing`
. ./dialog

Here comes my main idea. We call somebody and tell him, what is our PID. That somebody waits X seconds and then kill us. But if user press enter, we will be faster and kill him first. All the time, we are storing current selection, so when we died, our parent would know, how far we get and can run selected operation. Last script is easy, timedkill just wait and then kill ;-)


#!/bin/sh

echo $$ > $2/killing
sleep $1
kill $3
echo action

Conclusion

You can say, I'm mad. You can say that I totaly lost my mind. But I think that in cases like this, the power of shell shows itself. Isn't it really pretty? We can do nearly everything in shell. That's why I like UNIX. Shell RULEZ!

PS: I'll add some graphics and configuration files to it and I'll include it in my future initramdisk ;-) Currently tested only on real computer, but I'll try it on Palm too ;-)