Refactor common fw code; add autoupdate

The autoupdate upgrade type checks the target file system to see which
partition is currently in use and updates the opposite one.