Re: Firmware upgrade technique

From: Geoff McCaughan (geoffm_at_spam.fqdn.com)
Date: 01/21/04


Date: Wed, 21 Jan 2004 21:11:35 GMT

Dmytro Bablinyuk <dmytro.bablinyuk@tait.co.nz> wrote:
> I am working on a firmware upgrade/downgrade procedure for our
> embedded board.
> The board is running embedded linux, 64Mb ram and 4mb flash.
> The software will be downloaded via service kit and should be deployed
> on the board. The roll back mechanism in case of failure should be
> provided. Basically the board will roll back to the previous software
> version through the boot loader notification that upgrade was done and
> restart failed, so the boot loader on next re-start will start an old
> software.
> There can be entire filesystem or a set of folders to upgrade.

> Does somebody know any specific/standard procedures or can suggest me
> anything about what the best way to do that.

> Thank you for any suggestions.

How large is the software image you're dealing with? Do you have any mass
storage other than the 4mb flash?

I devised the following system for an embedded linux system:

In flash I have:-

Backup Kernel
Backup Ramdisk
Operational Kernel
Operational Ramdisk
Bootloader

These images are compressed and checksummed.

When I load firmware, I buffer the image in RAM, verify the checksum, and
then copy over the operational firmware in flash. The Bootloader is never
field upgraded.

At boot time I set a flag in static RAM and count boot attempts. If a boot
fails the watchdog will reset the system. I cycle through each possible
combination of Kernel and Ramdisk [starting with the operational copies
and trying each combination 3 times if necessary].

When the system has booted, I start a little task that interrogates the
flags set by the bootloader, works out which images it booted from, compares
the checksum of the images it booted from with the images it didn't boot
from, and if they're different the image we booted from is copied over the
image we didn't boot from.

So far, I have never had a system fail to boot, despite power interruptions
during firmware upgrades and other fun things.



Relevant Pages

  • Re: mounting LVM partitions fails after etch upgrade
    ... RAID1 would not mount cleanly anymore after upgrade from sarge to ... disks, and found out what was wrong. ... > the first problem is that during boot, ... mounted filesystem with ordered data mode. ...
    (Debian-User)
  • RE: ES40s wont boot!
    ... Subject: ES40's won't boot! ... a copy of the AS4100's system disk, ... they upgraded another ES40 at another ... site (in-box upgrade of CPUs from 667MHz to 833MHz), ...
    (comp.os.vms)
  • Releng-6.2 upgrade HINT for iwi0 user !!
    ... well this posting is send before, part of, the specific upgrade hint regarding the iwi0 driver! ... CLEANING SYSTEM AND RUNNING BUILDWORLD!! ... BOOT UP IN SINGLE MODE, MERGEMASTER AND INSTALLWORLD!! ...
    (freebsd-questions)
  • Re: Thinkpad T60P: bricked by grub transition
    ... no access to the broken system (since it wouldn't boot) to provide the kind ... |>> Upon a recent routine upgrade, ... |>> thought that I should try grub2 as I was encouraged to do. ... No menu and no grub command-line prompt. ...
    (Debian-User)
  • Question on best method to report install issues.
    ... I've run into a had a couple of issues when doing an upgrade. ... and it failed when boot didn't have enough space. ... Forced reboot, and it would boot from the old ... and it was the same one from the Fedora ...
    (Fedora)

Loading