Thursday, October 16, 2008

Gumstix-OE Connex on QEmu

I'm newbies to Gumstix and OpenEmbedded platform so I try to emulate it for working easier and more safety with my experiments.

From this and this tutorial , those're for verdex , you can change a bit for you connex easily.

First you have to install qemu (version 0.9.1 or later) to you system. I'm using Debian so do this way.

sudo apt-get update
sudo apt-get install qemu

Second you need to find the 3 file for creating the qemu image. These consist of

  1. U-boot
    This is the boot loader for you gumstix. You can build your own from source or get the pre-built file from the gumstix webstie here.
    Example is "u-boot-connex-400-r1604.bin".

  2. Kernel Image
    It's the kernel for your system. It's usually start with 'uImage'. Of course you can build your own via this tutorial or pick the right pre-built image from gumstix website here. About the difference between glibc and uclibc you can googling to find out yourself.
    Example is "uImage-2.6.21-r1-gumstix-custom-connex.bin".

  3. Filesystem Image
    It's the files for your gumstix including many packages installed. You can built it your own from the same tutorial above or pick it here.
    Example is "Angstrom-gumstix-basic-image-glibc-ipk-2007.9-test-20080512-gumstix-custom-connex.rootfs.jffs2".

Now you can create the qemu image by this way.

dd of=flash.img bs=128k count=128 if=/dev/zerodd of=flash.img bs=128k conv=notrunc if=u-boot-connex-400-r1604.bindd of=flash.img bs=128k conv=notrunc seek=2 if=gumstix-basic-image-gumstix-custom-connex.jffs2dd of=flash.img bs=128k conv=notrunc seek=120 if=uImage-2.6.21-r1-gumstix-custom-connex.bin

The italic have to be changed according to your files. The bold are those difference from the reference tutorial. Because of memory, the verdex has 32 MB flash memory but the connex has only 16MB. So 256*128k changes to 128*128k. The kernel is on the end of the memory (Size -1MB) so (256-8)*128k changes to (128-8)*128k.

Now there will be a "flash.img". This is your qemu image file.
You can run it by

qemu-system-arm -M connex -m 289 -nographic -monitor null -pflash flash.img

And see it booted. But my problem now is I can't exit the qemu. -_-" Ctrl+A x doesn't work.

I think buildroot platfrom can do this method too. Because it builds to the 3 files as above and then use the same method to emulate it.