Before flashing a firmware, Pentax K-30 (as well as K-50 and K-500) XOR-decrypts it and then performs the following checks to make sure the file isn't designated for some other model and it isn't broken.
Hardware IDs checking Edit
HWID checking consists of two parts:
- Hardware ID (00 00 02 0C for K-30, 00 00 02 21 for K-50, 00 00 02 26 for K-500) should be at offsets 00000F10, 0009FFE0, 00C00110.
- "Doubled" hardware ID (02 0C 02 0C, 02 21 02 21, 02 26 02 26) should be at 00000FF8, 0009FFF4, 00AFFFF8, 00BFFFF8, 00C00100, 00C3FFF0. And the signature A5 5A 5A A5 should be in the DWORDs right after these ones.
Checksum validation Edit
The firmware file internally in divided in three main blocks:
- 00000000 - 00C00000,
- 00C00000 - 00C40000,
- 00020000 - 000A0000.
The sum of all big-endian DWORDs in each block should be equal to 0.
Before summing, the camera checks the DWORDs at the following offsets:
If the value is FFFFFFFF, the sum of the corresponding block is not made.
Fixing the checksum Edit
In case some code/data is changed in a block, the same offsets above can be used to adjust the block's checksum.
Please note the blocks #1 and #3 are overlapping, so you should first adjust the block #3, then #2 and finally #1.