Flashing the neofreerunner with the leo2moko calypso firmware

There is now a sequel to this write up which details a second method.

The leo2moko-r1 firmware represents the first small steps toward free GSM firmware on the freerunner. This new firmware is currently believed to function no worse than moko11, but if you experience something different, particularly any regressions, please report your experiences to the OM community mailing list.

This writeup describes a method to flash any firmware (leo2moko or the official moko11) onto your freerunner. You will need a small uSDcard (2GB is more than ample) to hold a prepared distro and a T191 unlock cable to connect your freerunner's audio jack to a PC USB port.

There are various suggested sources for the T191 unlock cable at osmocomBB site , but as from January 2016 official FreeCalypso branded cables are available from George at UberWaves. Please consider supporting this supplier by ordering from uberwaves@gmail.com.

This is not the only method, you may also want to take a look at software therapy, where another tester describes his experience. The method described here does have the advantage that it is booted from an existing entry in the U-boot NOR menu - you do not need to flash anything to NAND, nor disturb whatever distro you have there.

Incidentally I did attempt to make both methods possible from this distro, but although I successfully added a build environment (since removed) and compiled the loadtools, they did not reliably work. Not sure at this time why this failed - possibly it's because of the old kernel (it's a uSDcard version of a modified fso-console image). This is unfortunate because not needing the cable *and* not needing to alter a system in NAND or compile software on the PC would be ideal - it remains a project for the future.

This has now been done - see the sequel

Preparing your PC

You will need a build environment on your PC to compile the loadtools utility and a wine install if, unlike me, you want to compile the firmware yourself.

Download the firmware and utility software from here

I used the precompiled firmware (not wishing to struggle with wine and a windows compiler)

ftp://ftp.ifctf.org/pub/GSM/FreeCalypso/leo2moko-r1-bin.tar.bz2

and the loadtools source

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

Follow the instructions to build and install loadtools and if you want to compile the firmware yourself, do that also.

Preparing the SDcard

Download the angstrom based distro which is a uSDcard version of a modified fso-console image.

Partition your uSDcard with an 8MB vFAT primary partition and a ext2 partition on the remainder. In fdisk it should look something like this (it's /dev/sdb on my machine, but not necessarily on yours):-
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048       18431        8192    6  FAT16
/dev/sdb2           18432     3862527     1922048   83  Linux
Create the file systems:-
mkfs.vfat /dev/sd?1
mkfs.ext2 /dev/sd?2
where the ? character represents the actual device the uSDcard appears as on your PC. Mount both partitions at convenient locations on your file system eg:-
mount -t vfat /dev/sd?1 /mnt
mount -t ext2 /dev/sd?2 /media/usb

Unpack angstrom.tar.gz archive into the linux partition. Move the kernel image uImage.bin to the vFat partition and unmount both partitions.

With the uSDcard in the freerunner, press and hold the AUX and POWER buttons to get the NOR U-Boot menu, scroll to the 2nd item Boot from microSD (FAT +ext2) with AUX and select with POWER. Once the distro has booted, login over ssh from your PC; with my setup the freerunner appears as usb0 rather than eth* as on qtmoko and shr. The ip address is

198.168.0.202

and the password is empty

Accessing the freerunners modem from the PC

Connect the T191 unlock cable to a second usb port on the PC (you still need to have a window with a ssh connection open) and the freerunners audio jack and open a second terminal window. Start the loadtools on your PC from the directory that contains the compiled firmware:-

root@mapoko # fc-loadtool -h gta02 /dev/ttyUSB0
This assumes the freerunner appears at USB0. The output should report Sending beacons to /dev/ttyUSB0 and you'll probably see this happening on the freerunner's screen. You should not expect to see these beacons on the freerunner screen if you use the new calypso-flash.tar.gz rather than the angstrom.tar.gz distro . Back in the window with the ssh session:-
root@om-gta02:~# mode.sh 1
This command simply toggles the values in the power_on and download files in /sys/devices/platform/neo1973-pm-gsm.0/ and should result in a loadtool> prompt in the fc-loadtool window.

If you do not get the loadtool prompt that may be because you have not done things in the correct order as described above. Try running mode.sh 0 on the freerunner, stopping and restarting the fc-loadtool command and mode.sh 1 again.

Backing up vital calibration data

Once you have the prompt, the first job is to backup vital parts of the calypso memory to your PC. You should retain the my-flashdump.bin file against possible future mishaps.

loadtool> flash dump2bin my-flashdump.bin

Flashing the firmware

loadtool> flash erase 0 0x300000
loadtool> flash program-m0 gsm-fw.m0
Now boot up qtmoko on the freerunner you'll see Revision:"FreeCalypso leo2moko port" in the modem section of the System Info app. SHR should tell you the same - not quite sure where to find that though.

If you wanted to switch back to moko11 (or upgrade from an earlier official version), fetch the firmware from here, then:-

loadtool> flash erase 0 0x300000
loadtool> flash program-m0 calypso-moko11.m0