A method for updating firmware includes dividing a memory of a computer device
into five portions, wherein an initial program, an old program, an old backup firmware,
the checksum of the old firmware, and the checksum of the old backup firmware are
saved, respectively, in the first portion, the second portion, the third portion,
the fourth portion and the fifth portion; executing the initial program in the
first portion; writing a new firmware into the second portion from an external
device for replacing the old firmware; writing the checksum of the new firmware
into the fourth portion; writing the new firmware into the third portion for replacing
the old backup firmware; writing the checksum of the new firmware into the fifth
portion; and executing the new firmware in the second portion for operating the
computer device.