Restructure firmware_image so that the firmware image checksum gets check before reading from the
device. Also, merge the extract header and initialize functions.