Flashing the GSM Firmware

From Openmoko

Revision as of 09:57, 17 March 2009 by PaulFertser (Talk | contribs)

Jump to: navigation, search

((please also refer to this thread on devel-ML))

Contents

Introduction

This is a step-by-step description of how the firmware is upgraded on a Neo with FLUID running on the device. Note that this process tolerates almost no variations. Stray from the instructions at your own peril. Instructions based on a posting by Werner (http://lists.openmoko.org/pipermail/openmoko-devel/2008-April/002605.html), thanks.

Please note: Update to MOKO9-beta firmware isn't recommended by OM, and probably won't fix any recent issues like #1024 et al.

Please see http://people.openmoko.org/joerg/calypso_moko_FW for more recent FW-images.

Please see http://people.openmoko.org/joerg/calypso_moko_FW/all_version__CHANGELOG.txt for changelog.

For now there is some moko10, which should fix #666, and also has a new command AT+CSIM. This version is not supposed to fix #1024 We are planning to include this version in the factory image of the A7 run.

We recommend you don't update by following this procedure, unless you feel very comfortable with commandline. Don't miss-spell any FLUID command! There will be a SD-image shortly, that greatly simplifies the whole GSM-update process - we suggest everybody who's not feeling completely comfortable with the procedure described herein to wait for this improved method (for beta version see end of page).

Warning: there are chances to _completely_ brick your GSM modem on messing around with FLUID! Please watch out for typos!

The GSM-firmware didn't differ from GTA01 to GTA02, as the GSM-hardware didn't either. This means you can flash MOKO10 (or any other recent GSM-FW) to GTA01 as well. According to mwester, this worked for him to update from MOKO1 on a GTA01Bv4 to MOKO10b2, by following the steps described herein.


Any reports on successful update, as well as problems encountered, or SIMs seen to work after update, all highly appreciated. Please add to the "discussion" tab of this wikipage. Thanks!

Phase 1: Preparations

  • Download and install a distribution to your device that gives you SSH access. We recommend the fso-console image:
mickey@amethyst$ cd /tmp
mickey@amethyst$ wget http://people.openmoko.org/mickey/images/openmoko-fso-console-image-glibc-ipk--20081028-om-gta02.rootfs.jffs2.summary
mickey@amethyst$ dfu-util -a rootfs -R -D ./openmoko-fso-console-image-glibc-ipk--20081028-om-gta02.rootfs.jffs2.summary
mickey@amethyst$ wget http://people.openmoko.org/mickey/images/uImage-2.6.24+r10+gitr75999+54524f4531c8b262431b794fea610d81bb351c86-r10-om-gta02.bin
mickey@amethyst$ dfu-util -a kernel -R -D ./uImage-2.6.24+r10+gitr75999+54524f4531c8b262431b794fea610d81bb351c86-r10-om-gta02.bin
root@om-gta02:~# opkg install http://people.openmoko.org/joerg/calypso_moko_FW/fluid_0.0+svn20070817-r2_armv4t_eabi.ipk
root@om-gta02:~# opkg install http://people.openmoko.org/joerg/calypso_moko_FW/s3c24xx-gpio_1.0+svnr4130-r2.1_armv4t.ipk

and place it into the /home/root directory:

root@om-gta02:~# cd $HOME
root@om-gta02:~# wget http://people.openmoko.org/joerg/calypso_moko_FW/gsm_ac_gp_fd_pu_em_cph_ds_vc_cal35_ri_36_amd8_ts0-moko10.m0

Phase 2: The Lobotomy

  • Make sure nothing is accessing the GSM modem. If you're using the fso-console image from the link above, this will happen automagically on boot. On other systems, kill processes as you see fit.
  • Powercycle the modem:
root@om-gta02:~# echo 0 >/sys/bus/platform/devices/neo1973-pm-gsm.0/power_on
root@om-gta02:~# echo 1 >/sys/bus/platform/devices/neo1973-pm-gsm.0/power_on
root@om-gta02:~# s3c24xx-gpio b7=0
root@om-gta02:~# echo "AT@POFF" >/dev/ttySAC0
  • Launch the FLUID binary:
root@om-gta02:~# cd /usr/sbin
root@om-gta02:/usr/sbin# FLUID_PORT=/dev/ttySAC0 FLUID_FLOWCONTROL=h fluid.exe \
-oO -b 115200 \
-f $HOME/gsm_ac_gp_fd_pu_em_cph_ds_vc_cal35_ri_36_amd8_ts0-moko10.m0

It should say something like this (takes a few seconds to load the file):

FLUID Revision 2.27, ...
Bootloader: (reset target)

(if this fails repeatedly, or flashing aborted and you have a broken and "bricked" gsm-firmware due to this, try -oo instead of -oO, to use the calypso ROM bootloader instead of the firmware bootloader. Also try without the 'FLUID_FLOWCONTROL=h' part, there are reports on ROM-bootloader not working with hardware-flowcontrol. Changing the -b to some lower baudrate might improve stability of flashing-process - the bootloader does autobaud, so you're free to use any rate)

  • Start a second SSH session and start the modem:
root@om-gta02:~# s3c24xx-gpio b7=1

FLUID should now say something like this (it will take a couple of minutes to finish):

(fluid, version 3) ok
Checksumming (269 * 8kB = 2152kB):  ok
Flash Detect: (0xEC, 0x22A0) Samsung K5A3240CT ok
Program: (34 sectors, 267*8k=2136k) (*******************) ok

Note: If you get this instead: MESSAGE: File cmd.m0 not found, then you didn't do the cd /usr/sbin. Please pay attention ;-)

If FLUID does nothing, curse your bad luck and repeat the reset sequence, this is the whole 'echo 0/1, b7=0/1 stuff'.

  • To verify that everything went well, do this in either of the two sessions:
root@om-gta02:~# cat /dev/ttySAC0 &
root@om-gta02:~# echo -en 'AT\r' >/dev/ttySAC0
root@om-gta02:~# echo -en 'AT+CGMR\r' >/dev/ttySAC0
+CGMR: "HW: GTA, GSM: gsm_ac_gp_fd_pu_em_cph_ds_vc_cal_amd8_ts0-Moko10"
root@om-gta02:~# kill %1

In some case you may receive this:

(fluid, version 3) ok
Checksumming (269 * 8kB = 2152kB):  ok
Flash Detect: (0xEC, 0x22A0) Samsung K5A3240CT ok
Program: (0 sectors, 0*8k=0k) () ok

It means the checksums of all sectors in calypso's FW and the new file to flash are identical. Probably you're trying to flash same version of FW that's already installed.

Never downgrade to a version earlier than Moko6, or you will render the GSM unusable (certain internal data structures changed between Moko5 and Moko6).

Troubleshooting

Some users weren't able to complete the upgrade since they got an error while the firmware was uploading in the GSM chip (like Flash operation timeout).

However a solution has been found and it allows to use again the GSM modem. (please note this topic resides on devel-ML. Don't spread over multiple lists please, as it won't help in getting a response to your request just in time, and most people following the main thread likely will miss your postings anyway)

Use the following fluid command:

FLUID_PORT=/dev/ttySAC0 fluid.exe -oo -b 115200 -f $HOME/gsm_ac_gp_fd_pu_em_cph_ds_vc_cal35_ri_36_amd8_ts0-moko10.m0

(Without FLOWCONTROL and with -oo to choose the ROM bootloader)

Then on a second ssh session please use this instead of the gpio command:

echo 0 > /sys/bus/platform/devices/neo1973-pm-gsm.0/power_on
echo 1 > /sys/bus/platform/devices/neo1973-pm-gsm.0/power_on

The firmware download should start now.

Half-flashed GTA01bv4 GSM Modem

For GTA01 the process of flashing when the main firmware is absent is more complicated as we have no easy way to power-cycle the modem.

I recently had to do a special process to recover my GTA01bv4 after breaking the gsm modem with a failed flash. The process is actually fairly simple.

  • Unplug USB and remove the battery for about 10s to ensure that the GSM chipset is powered off, then replace the battery and re-connect the USB
  • boot up from a distro that is neutered so that it does not access or turn on the gsm modem at all (this is a really important prerequisitive, as nothing should turn on the modem by touching MODEM_ON line until fluid is ready to connect to it); one can do that simply by disabling start of ophonekitd (and to be on the safe side framworkd too) on SHR
  • issue this stty command twice:
 stty 0:4:18b2:8a00:0:0:7f:15:4:0:0:0:0:0:0:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0 -F /dev/ttySAC0
  • cd /usr/sbin
  • issue this fluid command (replace $HOME/filename.m0 with path to firmware you want to flash):
 FLUID_PORT=/dev/ttySAC0 fluid.exe -oo -od13,13 -b115200 -f $HOME/filename.m0
  • in another ssh session, issue this command:
 echo 1 > /sys/bus/platform/devices/neo1973-pm-gsm.0/power_on

After this, the flashing proceeded as expected. You don't need to do any special checks to ensure you have successfully flashed; if fluid reports everything is ok, it is actually ok.

uSD-card Image

There's a beta version for flashing MOKO11 to GTA02 Freerunner only.

  • (apply `sudo` or use root-terminal according to your taste ;)
  • Insert a uSD to your PC, `umount` all uSD-partitions that might have been automounted (use `mount` or `df -h` to check). Do not use "safely remove" for this.
  • `dd` the image "flash-moko11-2.image" to the physical(!) uSD-device (this will erase all data from your uSD!). `Sync` or `eject <device>`.
  • Insert uSD to your FR, boot from NOR-U-Boot to uSD, wait until green "d_o_n_e" shows on screen (takes some 6min). Remove bat and uSD, or login via ssh. `mickeyterm` will access modem.

NOTE: If you don't have a uSD reader on your PC, you can `dd` from neo: install task-base-smbfs, u(n)mount /media/card, mount the directory in which you have the "flash-moko11-2.image" file and do the dd stuff. This will take about 12 minutes.

Personal tools

((please also refer to this thread on devel-ML))

Introduction

This is a step-by-step description of how the firmware is upgraded on a Neo with FLUID running on the device. Note that this process tolerates almost no variations. Stray from the instructions at your own peril. Instructions based on a posting by Werner (http://lists.openmoko.org/pipermail/openmoko-devel/2008-April/002605.html), thanks.

Please note: Update to MOKO9-beta firmware isn't recommended by OM, and probably won't fix any recent issues like #1024 et al.

Please see http://people.openmoko.org/joerg/calypso_moko_FW for more recent FW-images.

Please see http://people.openmoko.org/joerg/calypso_moko_FW/all_version__CHANGELOG.txt for changelog.

For now there is some moko10, which should fix #666, and also has a new command AT+CSIM. This version is not supposed to fix #1024 We are planning to include this version in the factory image of the A7 run.

We recommend you don't update by following this procedure, unless you feel very comfortable with commandline. Don't miss-spell any FLUID command! There will be a SD-image shortly, that greatly simplifies the whole GSM-update process - we suggest everybody who's not feeling completely comfortable with the procedure described herein to wait for this improved method (for beta version see end of page).

Warning: there are chances to _completely_ brick your GSM modem on messing around with FLUID! Please watch out for typos!

The GSM-firmware didn't differ from GTA01 to GTA02, as the GSM-hardware didn't either. This means you can flash MOKO10 (or any other recent GSM-FW) to GTA01 as well. According to mwester, this worked for him to update from MOKO1 on a GTA01Bv4 to MOKO10b2, by following the steps described herein.


Any reports on successful update, as well as problems encountered, or SIMs seen to work after update, all highly appreciated. Please add to the "discussion" tab of this wikipage. Thanks!

Phase 1: Preparations

  • Download and install a distribution to your device that gives you SSH access. We recommend the fso-console image:
mickey@amethyst$ cd /tmp
mickey@amethyst$ wget http://people.openmoko.org/mickey/images/openmoko-fso-console-image-glibc-ipk--20081028-om-gta02.rootfs.jffs2.summary
mickey@amethyst$ dfu-util -a rootfs -R -D ./openmoko-fso-console-image-glibc-ipk--20081028-om-gta02.rootfs.jffs2.summary
mickey@amethyst$ wget http://people.openmoko.org/mickey/images/uImage-2.6.24+r10+gitr75999+54524f4531c8b262431b794fea610d81bb351c86-r10-om-gta02.bin
mickey@amethyst$ dfu-util -a kernel -R -D ./uImage-2.6.24+r10+gitr75999+54524f4531c8b262431b794fea610d81bb351c86-r10-om-gta02.bin
root@om-gta02:~# opkg install http://people.openmoko.org/joerg/calypso_moko_FW/fluid_0.0+svn20070817-r2_armv4t_eabi.ipk
root@om-gta02:~# opkg install http://people.openmoko.org/joerg/calypso_moko_FW/s3c24xx-gpio_1.0+svnr4130-r2.1_armv4t.ipk

and place it into the /home/root directory:

root@om-gta02:~# cd $HOME
root@om-gta02:~# wget http://people.openmoko.org/joerg/calypso_moko_FW/gsm_ac_gp_fd_pu_em_cph_ds_vc_cal35_ri_36_amd8_ts0-moko10.m0

Phase 2: The Lobotomy

  • Make sure nothing is accessing the GSM modem. If you're using the fso-console image from the link above, this will happen automagically on boot. On other systems, kill processes as you see fit.
  • Powercycle the modem:
root@om-gta02:~# echo 0 >/sys/bus/platform/devices/neo1973-pm-gsm.0/power_on
root@om-gta02:~# echo 1 >/sys/bus/platform/devices/neo1973-pm-gsm.0/power_on
root@om-gta02:~# s3c24xx-gpio b7=0
root@om-gta02:~# echo "AT@POFF" >/dev/ttySAC0
  • Launch the FLUID binary:
root@om-gta02:~# cd /usr/sbin
root@om-gta02:/usr/sbin# FLUID_PORT=/dev/ttySAC0 FLUID_FLOWCONTROL=h fluid.exe \
-oO -b 115200 \
-f $HOME/gsm_ac_gp_fd_pu_em_cph_ds_vc_cal35_ri_36_amd8_ts0-moko10.m0

It should say something like this (takes a few seconds to load the file):

FLUID Revision 2.27, ...
Bootloader: (reset target)

(if this fails repeatedly, or flashing aborted and you have a broken and "bricked" gsm-firmware due to this, try -oo instead of -oO, to use the calypso ROM bootloader instead of the firmware bootloader. Also try without the 'FLUID_FLOWCONTROL=h' part, there are reports on ROM-bootloader not working with hardware-flowcontrol. Changing the -b to some lower baudrate might improve stability of flashing-process - the bootloader does autobaud, so you're free to use any rate)

  • Start a second SSH session and start the modem:
root@om-gta02:~# s3c24xx-gpio b7=1

FLUID should now say something like this (it will take a couple of minutes to finish):

(fluid, version 3) ok
Checksumming (269 * 8kB = 2152kB):  ok
Flash Detect: (0xEC, 0x22A0) Samsung K5A3240CT ok
Program: (34 sectors, 267*8k=2136k) (*******************) ok

Note: If you get this instead: MESSAGE: File cmd.m0 not found, then you didn't do the cd /usr/sbin. Please pay attention ;-)

If FLUID does nothing, curse your bad luck and repeat the reset sequence, this is the whole 'echo 0/1, b7=0/1 stuff'.

  • To verify that everything went well, do this in either of the two sessions:
root@om-gta02:~# cat /dev/ttySAC0 &
root@om-gta02:~# echo -en 'AT\r' >/dev/ttySAC0
root@om-gta02:~# echo -en 'AT+CGMR\r' >/dev/ttySAC0
+CGMR: "HW: GTA, GSM: gsm_ac_gp_fd_pu_em_cph_ds_vc_cal_amd8_ts0-Moko10"
root@om-gta02:~# kill %1

In some case you may receive this:

(fluid, version 3) ok
Checksumming (269 * 8kB = 2152kB):  ok
Flash Detect: (0xEC, 0x22A0) Samsung K5A3240CT ok
Program: (0 sectors, 0*8k=0k) () ok

It means the checksums of all sectors in calypso's FW and the new file to flash are identical. Probably you're trying to flash same version of FW that's already installed.

Never downgrade to a version earlier than Moko6, or you will render the GSM unusable (certain internal data structures changed between Moko5 and Moko6).

Troubleshooting

Some users weren't able to complete the upgrade since they got an error while the firmware was uploading in the GSM chip (like Flash operation timeout).

However a solution has been found and it allows to use again the GSM modem. (please note this topic resides on devel-ML. Don't spread over multiple lists please, as it won't help in getting a response to your request just in time, and most people following the main thread likely will miss your postings anyway)

Use the following fluid command:

FLUID_PORT=/dev/ttySAC0 fluid.exe -oo -b 115200 -f $HOME/gsm_ac_gp_fd_pu_em_cph_ds_vc_cal35_ri_36_amd8_ts0-moko10.m0

(Without FLOWCONTROL and with -oo to choose the ROM bootloader)

Then on a second ssh session please use this instead of the gpio command:

echo 0 > /sys/bus/platform/devices/neo1973-pm-gsm.0/power_on
echo 1 > /sys/bus/platform/devices/neo1973-pm-gsm.0/power_on

The firmware download should start now.

Half-flashed GTA01bv4 GSM Modem

For GTA01 the process of flashing when the main firmware is absent is more complicated as we have no easy way to power-cycle the modem.

I recently had to do a special process to recover my GTA01bv4 after breaking the gsm modem with a failed flash. The process is actually fairly simple.

  • Unplug USB and remove the battery for about 10s to ensure that the GSM chipset is powered off, then replace the battery and re-connect the USB
  • boot up from a distro that is neutered so that it does not access or turn on the gsm modem at all (this is a really important prerequisitive, as nothing should turn on the modem by touching MODEM_ON line until fluid is ready to connect to it); one can do that simply by disabling start of ophonekitd (and to be on the safe side framworkd too) on SHR
  • issue this stty command twice:
 stty 0:4:18b2:8a00:0:0:7f:15:4:0:0:0:0:0:0:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0 -F /dev/ttySAC0
  • cd /usr/sbin
  • issue this fluid command (replace $HOME/filename.m0 with path to firmware you want to flash):
 FLUID_PORT=/dev/ttySAC0 fluid.exe -oo -od13,13 -b115200 -f $HOME/filename.m0
  • in another ssh session, issue this command:
 echo 1 > /sys/bus/platform/devices/neo1973-pm-gsm.0/power_on

After this, the flashing proceeded as expected. You don't need to do any special checks to ensure you have successfully flashed; if fluid reports everything is ok, it is actually ok.

uSD-card Image

There's a beta version for flashing MOKO11 to GTA02 Freerunner only.

  • (apply `sudo` or use root-terminal according to your taste ;)
  • Insert a uSD to your PC, `umount` all uSD-partitions that might have been automounted (use `mount` or `df -h` to check). Do not use "safely remove" for this.
  • `dd` the image "flash-moko11-2.image" to the physical(!) uSD-device (this will erase all data from your uSD!). `Sync` or `eject <device>`.
  • Insert uSD to your FR, boot from NOR-U-Boot to uSD, wait until green "d_o_n_e" shows on screen (takes some 6min). Remove bat and uSD, or login via ssh. `mickeyterm` will access modem.

NOTE: If you don't have a uSD reader on your PC, you can `dd` from neo: install task-base-smbfs, u(n)mount /media/card, mount the directory in which you have the "flash-moko11-2.image" file and do the dd stuff. This will take about 12 minutes.