I wrote this while trying to get a full tree of primary.bin files. Maybe someone else will find it useful.
Description:
Find the code normally found at the start of ROM.
Default mode detects dryos or vxworks sig at any offset.
If -fix is given, re-write the dump file after removing anything before the start sig
If -vxworks or -dryos is given, just check that the corresponding sig is found at the start of the dump, and print a message/return status
-quiet will suppress the message and only return status.
If you have a tree full of dumps you want to check/fix, use find, e.g.
find . -path ./*sub/* \! -path *.svn* -type d -exec dumpchk '{}/primary.bin' \;
will check primary.bin in each of the platform/sub directories, skipping .svn, reporting missing or zero sized files.
You can use -fix with the above command if you feel lucky.
Note that -fix DOES NOT MAKE ANY BACKUP, and is NOT PARTICULARLY SAFE.
The two start sigs work for all dumps I have tested, which includes almost every camera supported by chdk and some that aren't