factor out flash upgrade support.