Skip to content

Instantly share code, notes, and snippets.

@skochinsky
Created November 16, 2019 20:30
Show Gist options
  • Save skochinsky/3b9f16ecf33f9906fdaebe8a356a09da to your computer and use it in GitHub Desktop.
Save skochinsky/3b9f16ecf33f9906fdaebe8a356a09da to your computer and use it in GitHub Desktop.
Fujifillm
#! python2
#-------------------------------------------------------------------------------
# Name: dump_hdr.py
# Purpose: dump header of a FujiFilm FinePix firmware update
# see https://reverseengineering.stackexchange.com/questions/22549/identifying-rom-segment-in-unknown-firmware-update-file
# Author: Igor Skochinsky
#
# Created: 16-11-2019
# Copyright: (c) Igor Skochinsky 2019
# Licence: MIT
#-------------------------------------------------------------------------------
import sys
import struct
f = open("FPUPDATE.DAT", "rb")
tup = struct.unpack("<IHBxII", f.read(0x10))
#print tup
sig, unk4, nb,plfm, unkC = tup
if sig != 0x52494852: #"RIHR"
print("bad header!")
sys.exit(1)
print "unk4: %08X" % unk4
print "blocks: %d" % nb
print "platform: %08X" % plfm
print "unkC: %08X" % unkC
for i in range(nb):
typ, blkoff, blksize, unk8, cksum = struct.unpack("<HxxHHII", f.read(0x10))
print "block %d type: %d" % (i,typ)
print " offset: %x (%x)" % (blkoff, blkoff<<9)
print " size: %x (%x)" % (blksize, blksize<<9)
print " unk8: %08X" % unk8
print " checksum: %08X" % cksum
unk4: 00001001
blocks: 7
platform: 00050600
unkC: 01A40001
block 0 type: 1
offset: 1 (200)
size: 14dc (29b800)
unk8: 00048000
checksum: A1AA045A
block 1 type: 1
offset: 14dd (29ba00)
size: 731 (e6200)
unk8: 002E8000
checksum: 917C608A
block 2 type: 0
offset: 1c0e (381c00)
size: 54c (a9800)
unk8: 00430000
checksum: EA1137CD
block 3 type: 1
offset: 215a (42b400)
size: 21 (4200)
unk8: 004DA000
checksum: 8AE264F9
block 4 type: 0
offset: 217b (42f600)
size: 2a6 (54c00)
unk8: 004DA000
checksum: 8606D33F
block 5 type: 0
offset: 2422 (484400)
size: 34 (6800)
unk8: 004DA000
checksum: 802A3C3B
block 6 type: 2
offset: b420 (1684000)
size: 4 (800)
unk8: 00000000
checksum: 00000000
@petabyt
Copy link

petabyt commented Jul 22, 2021

Hey, I'm also working on a Fujifilm firmware decoder: https://github.com/petabyt/fujifilm-firmware
What model did you test this on?

@skochinsky
Copy link
Author

Hey, I'm also working on a Fujifilm firmware decoder: https://github.com/petabyt/fujifilm-firmware
What model did you test this on?

If you follow the link, you'll see it mentions FinePix S1800.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment