I have been examining the contents of the SPI flash chip on some Mikrotik RouterBOARDs, and I noticed that in the Hard and Soft configuration partitions, it has the magic draH or tfoS, then a 32-bit checksum, then a series of configuration fields.
I want to be able to modify the RouterBOOT settings in the Soft configuration partition from within OpenWRT, but I need to calculate the correct checksum so that RouterBOOT doesn't just erase it and write default values.
Does anybody happen to know what algorithm is used to calculate the checksum, and what parts it is calculated over? I've tried all the combinations with CRC32, and none of them produced the value actually stored in flash at this position.
Example soft_config on RB433AH:
root@OpenWrt:/# hexdump -C /dev/mtdblock3
00000000 74 66 6f 53 a1 43 88 3b 00 04 00 0c 00 00 03 60 |tfoS.C.;.......`|
00000010 00 04 00 0a 00 00 00 02 00 04 00 01 00 00 00 00 |................|
00000020 00 04 00 02 00 00 00 02 00 04 00 03 00 00 00 01 |................|
00000030 00 04 00 04 00 00 00 00 00 04 00 05 00 00 00 00 |................|
00000040 00 04 00 07 00 00 00 00 00 04 00 09 00 00 00 01 |................|
00000050 00 04 00 0f 00 00 00 00 00 04 00 15 00 00 00 00 |................|
00000060 00 04 00 17 00 00 00 00 00 04 00 0d 00 00 00 00 |................|
00000070 00 08 00 06 33 2e 31 38 00 00 00 00 00 08 00 0b |....3.18........|
00000080 00 00 00 00 00 00 01 4f 00 00 00 00 00 00 00 00 |.......O........|
00000090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00001000