Sunday 24 June 2007

Testing Linux4Palm on qemu

Anyone who's done some handheld hacking will know that testing on a physical device is usually a real pain. If the lack of decent input and tiny screen don't get to you then it's the tiring compile, copy-to-sd, put-sd-in-handheld, test, reboot, put-sd-back-in-pc, fix-code cycle. Today I'm going to explain how you can boot an unmodified linux4palm kernel zImage and rootfs inside the emulator qemu. First though a big thanks to Andrzej "balrog-kun" Zaborowski who as part of his work for OpenedHand added support for XScale processors to qemu and helped Marek and I get the Hack&Dev kernel working properly within it.

Installing qemu (with H&D patches)

Windows

It's your lucky day, we're making things easy. Grab these binaries and unzip them somewhere.

Linux and others

Today I committed the OpenMoko qemu tree with the palm machine support patches into H&D SVN. So the first step is to grab a copy of tree:
svn co https://hackndev.svn.sourceforge.net/svnroot/hackndev/qemu/trunk qemu-hnd
cd qemu-hnd
Alternatively get the version I wrote this guide against from the SF release page. Next you'll need to make sure you have gcc 3.x installed (look for /usr/bin/gcc-3.*). Unfortunately qemu will not build with gcc 4. Gentoo users can grab 3.4.6 with:
emerge -av =gcc-3.4.6-r2
Next we configure and make, choosing only to build the arm-softmmu target and using the 3.4.6 compiler:
./configure --disable-system --disable-user --target-list=arm-softmmu --cc=gcc-3.4.6
make -j3
Once the build is complete, you'll find a qemu-system-arm executable in arm-softmmu/.

Booting qemu

You can check which machines qemu supports using this command:
./arm-softmmu/qemu-system-arm -M ?
As of this writing the partially supported palms are palmld, palmt650, palmt680, palmtc, palmz72 and palmtx. Grab and unpack a bootpack for your desired machine. I'm going to use Stepan's Fire and Water 0.0.3 palmld bootpack as an example.

Now simply fire up qemu, telling it to use the kernel and rootfs from the bootpack. I'm omitting the initrd since the palmld bootpack expects to boot off the HDD but it's easier to boot it off the SD card in qemu. The psplash=false option is to disable the OE splash screen so that I can view the startup messages.

./arm-softmmu/qemu-system-arm -M palmld -kernel zImage \
    -sd Angstrom-opie-image-palmld-0.0.3-alpha.rootfs.ext2 \
    -append "root=/dev/mmcblk0 psplash=false"
It may take a while to boot so be patient. Eventually you should see the OPIE touchscreen callibration screen:

Since qemu doesn't currently support the palms' touchscreens press Ctrl+Alt+3 to get to the serial console. You can then login as root. Press Ctrl+Alt+1 if you want to get back to the graphical output.

Edit: More screenshots

Saturday 23 June 2007

Hack&Dev Upgrades

Lately I've been discussing the problems with Hack&Dev. We have a major communication problem, the only way anybody finds out what's going on is if they jump on IRC and ask people. Even then it's not all that helpful. Since I've got a couple of weeks relatively relaxed at the moment, I thought I'd have a shot at this problem. See the forum for the current ideas. I'd mention Planet Hack&Dev here but you're probably reading this post from there. ;-) Email me alex (at-sign) hackndev (dot) com if you write or know of a Hack&Dev developer's blog (with RSS) that should be added to the planet.