Recovering from a Firmware Flash

This post has already been read 11393 times!

So with new firmware images coming from Nokia (which is a good thing) you have to start to deal with picking up the pieces after a flash. The built in control panel ‘Backup’ does a questionable job – while it does seem to work, it also seems to have made my 770 totally wonky, and I’ve been better off not using it after re-flashing 51.

So what to do?

One solution is again the ever-maturing Synchronisation and backup using rsync & make by Andrew Flegg at Bleb- be sure and read his solution which is clearly outlined at his site.

Meanwhile, I’ve put together some very simple scripts which can help bootstrap your 770 right after a firmware flash.

I’m assuming that you have a MMC card, and you’ll keep these scripts on the card along with your 3rd party packages- so that they are available right after a flash.

You’ll have to install xterm using the 770 GUI and then run these scripts just one time. One for user and one for root.

As you can see, I keep the public RSA keys from my main desktop computers also on the MMC card, so that I can ssh right in after running these scripts. These scripts are very simple but hopefully they can save you some time after your next flash.

User script:

#!/bin/sh
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/var/lib/install/usr/lib' >> /home/user/.profile
echo 'export PATH=$PATH:/var/lib/install/usr/bin:/var/lib/install/usr/sbin' >> /home/user/.profile
echo 'set nocompatible' >> /home/user/.vimrc

mkdir /home/user/.ssh
cat /media/mmc1/keys/id_rsa_mac >> /home/user/.ssh/authorized_keys
cat /media/mmc1/keys/id_rsa_XP >> /home/user/.ssh/authorized_keys
chmod 400 /home/user/.ssh/authorized_keys 
chmod 700 /home/user/.ssh

Root script:

#!/bin/sh
echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/var/lib/install/usr/lib' >> /root/.profile
echo 'export PATH=$PATH:/var/lib/install/usr/bin:/var/lib/install/usr/sbin' >> /root/.profile
echo 'set nocompatible' >> /root/.vimrc
app-installer-tool install /media/mmc1/Installers/load-plugin_0.2.4-1_arm.deb
app-installer-tool install /media/mmc1/Installers/dropbear-client_0.46-2_arm.deb
app-installer-tool install /media/mmc1/Installers/dropbear-key_0.46-2_arm.deb
app-installer-tool install /media/mmc1/Installers/dropbear-server_0.46-2_arm.deb
app-installer-tool install /media/mmc1/Installers/vim-tiny_5.6.070-1.1_all.deb
app-installer-tool install /media/mmc1/Installers/fbreader-maemo_0.7.1b-1_arm.deb

ln -s /var/lib/install/etc/init.d/dropbear-server /etc/rc2.d/S20dropbear-server 

Note: this does not address backing up any data… see Andrew’s solution for that. At this point I really don’t keep anything on the 770 that I can’t reload after a flash from my Macintosh. But if you are keeping data on it, make sure to take some action and back it up before you flash.

10 thoughts on “Recovering from a Firmware Flash

  1. […] Firmware bootstrap scripts […]

  2. dillera

    Yes, backups are critical and I think that Flegg has a better jump on that side. I’m more worried about having a quick and easy way to set things back up once I’ve flashed the device.

  3. […] Downside for the upgrading is still the fact that making a complete backup of the system is impossible. At least installed applications and browser cookies disappear. Luckily I remembered to manually take backups of my Monkey Island save files. An extra backup of your /home/user directory is worth doing. Some solutions for making post-upgrade hassle little easier can be found from here and here. All in all… these upgrades are making the device much more pleasant to use. Just keep em coming. […]

  4. Of course, a really smart script would identify if it’s running as root or not:

    if [ `id -u` == “0” ]; then
    ….
    fi

  5. Regarding one script: that would be neater, but what about someone that hasn’t enabled R&D mode- I want them to have something also.

    We can come up with just one all encompassing root script to run if you have root, otherwise a user script.

    The point about sudoing the commands as ‘install’ user is a good point. I’ll update them to show that. I haven’t tried to remove any packages, so I’ve never run into that.

  6. Another thought: instead of having two scripts (one for the user to run, one to run as root); combine them into one with some appropriate chmods and chowns.

    Makes it that bit neater, IMHO…

  7. Riku Voipio

    run app-installer-tool in the user script as:

    sudo -u install app-installer-tool install ..

    else you may not be able to (un)install anything with gui anymore.

    Alternative is to tar/cp -a /var/lib/lib/install and /home/user and preserve permissions.

    I would also recommend starting dropbear-sshd as needed as user, instead of at boot as root. More secure and leaves you more ram..

  8. Ta :-)

  9. Opps, I fixed your name spelling.

    Yeah, the scripts get me to the point that I consider the absolute baseline:

    1. i can ssh in from my mac
    2. i can use VIM

  10. One typo: s/Klegg/Flegg/ – it’s an uncommon surname, but never had “Klegg” before :-)

    I like the idea of bootstrapping via scripts. I’ve added a link here from my synchronisation bit.

    Cheers,

    Andrew

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.