Monthly Archives: December 2013

flashing openmoko gta-02 with leo2moko firmware

There was an announcement in openmoko community mailing list, called First small steps towards free GSM firmware.

I am very pleased to announce that after many years of searching, I have finally found a copy of TI’s firmware deliverable package for their Leonardo development board, i.e., for their Calypso/Iota/Rita chipset reference platform. It is the package which TI must have given to all of their chipset customers including Nokia, Motorola, Compal, FIC/Openmoko, LG, BenQ and many others, and which was used by all of these companies as the starting point for making their unique proprietary firmwares.

The news are, we don’t only have a firmware source, which can be flashed(though it may be illegal in some countries) but we have also completely free and legal loader tools for flashing that firmware. Before, openmoko users had to use proprietary TI tool for that.

So, I decided to try, and here are my notes on how to build and install leo2moko firmware.

Instead of dealing with crosscompilers, I prefer to build the firmware and loader tools right on device. I use SHR distribution on my GTA-02 Openmoko Neo Freerunner.

==install compiler and dev tools on openmoko==

opkg install gcc
opkg install gcc-symlinks
opkg install libc6-dev
opkg install binutils
opkg install make 
opkg install coreutils

It is good to sync time before building:

/etc/init.d/fsotdld restart

or in newer distributions

systemctl restart fsotdld.service

download the flasher source:

wget ftp://ftp.ifctf.org/pub/GSM/FreeCalypso/loadtools-r1.tar.bz2

Unpack

mkdir loadtools
cd loadtools

tar jxvf ../loadtools-r1.tar.bz2

edit makefile, as suggested in readme, set CFLAGS to

CFLAGS= -O2 -march=armv4t -mtune=arm920t -DGTA0x_AP_BUILD

and

EXTRA_OBJ=gtapower.o

then make it

make
make install

these three binaries are now installed in /usr/local/bin

fc-iram fc-loadtool fc-xram

==build firmware==
skip this step if you want to flash already precompiled firmware

unfortunately it’s impossible to build the firmware with free compiler yet, so we need to use windows only tools from TI. Fortunately, tools are possible to run with wine under GNU/Linux box. The environment heavily relies on traditional Unix tools, ported to windows. It would be much easier to deal just with those tools natively.

So, get these files:

ftp://ftp.ifctf.org/pub/GSM/FreeCalypso/leo2moko-r1.tar.xz – the source
ftp://ftp.ifctf.org/pub/GSM/TI_src/wine/installed-env.tar.xz – build tools
wget ftp://ftp.ifctf.org/pub/GSM/TI_src/wine/nowhine.c

gcc -o nowhine nowhine.c
cp nowhine /usr/local/bin

nowhine is a simple utility which strips unnecessary whining messages from whine. you can use it as wine wrapper.

There is a build script, you will find when unpack tarballs. It will run build process and compile the firmware.

==already precompiled firmware==
wget ftp://ftp.ifctf.org/pub/GSM/FreeCalypso/leo2moko-r1-bin.tar.bz2 — already built firmware.

==flashing==

need to kill some daemons running in the openmoko, before flashing:

killall fsodeviced
killall fsoaudiod
killall fsousaged
killall fsodatad
killall fsonetworkd
killall fsogsmd
killall phonefsod
killall phoneuid
killall frameworkd
s3c24xx-gpio b7=0

fc-loadtool -h gta02 /dev/ttySAC0

You should see a bunch of messages followed by a loadtool> prompt.

when you reach that prompt, enter this command:

flash dump2bin my-flashdump.bin

This is a backup of your current calibration data. It may be necessary if something will go wrong with the flash. Transfer it to pc, back it up.

flash erase 0 0x300000
flash program-m0 gsm-fw.m0

quit

reboot

==imei==
This is also very interesting project, on how to read and write gsm device filesystem.
ftp://ftp.ifctf.org/pub/GSM/FreeCalypso/mpffs-tools-r1.tar.bz2

openmoko firmware screenshot