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