- Mar 10, 2014
- 717
- 203
I put together this region code hack and worked fine for cameras with 5.2.3 and older, but something has changed where I believe it's
checking checksum or something that makes it no longer work. I'm going to publish this in hopes that someone can help me figure out what's different in 5.2.5.
I realize there are haters and as Taylor Swift once said, Haters going to hate, hate, hate. They have personal financial interest in this like
CBX and iTuneDVR, but I feel this should be public information. I figured this out 100% on my own, did not reverse engineer anyone else's work so I consider it mine to share. So I prefer they bud out since they will make comments to try and distract this project like they did at cctvforum, but is subterfuge, it can be done and it's not that hard.
So here's how it's done. First there's two files, /dev/mtd5 and /dev/mtd6 that contain the language flag. It's at the 1620th byte in MTD5 and 16th in MTD6 and has duplicates sometimes in MTD6, but have never updated the duplicates in the past, but that may be where I've gone
wrong with 5.2.5.
First you need MTDUTILS, free open source Linux utilities to read/write to MTD. So easy enough. I've cross-compiled them for ARM
and put them here - http://www.wrightwoodsurveillance.com/stuff/mtd.zip
Then what you need to do is create a Windows share on your PC, unzip the file into this directory, telnet into the camera and mount this share, like mount -t cifs //192.168.1.50/mtdutils /mnt/nfs07 -o username=pcuser,password=pcpass.
While logged into the camera, cd /mnt/nfs07/mtdutils-1.5.0-arm-linux-gnueabi/sbin to run the commands.
Start with these commands to read flash as these will put the flash in your windows share -
./nanddump -nof mtd5_temp /dev/mtd5
./nanddump
-nof mtd6_temp /dev/mtd6
From here you can use a Windows hex editor like HxD to read these files and note that in the locations above (decimal, you will need to change to hex to see the language flag) is 02 for Chinese, changing it to 01 makes it English.
I did this in Linux, actually on the camera itself like this;
echo -ne \\x01 | dd conv=notrunc seek=1620 bs=1 count=1 of=mtd5_temp
echo -ne \\x01 | dd conv=notrunc seek=16 bs=1 count=1 of=mtd6_temp
Then you can't just write MTD, you have to erase it. Simple enough with the flash_eraseall command;
/flash_eraseall
/dev/mtd5
/flash_eraseall /dev/mtd6
Then you'll need to use nandwrite to write the image you edited back to flash;
./nandwrite -o /dev/mtd5 mtd5_temp
./nandwrite -o /dev/mtd6 mtd6_temp
This will brick a 5.2.5 camera and my belief it that's related to the checksum, which I feel is the first 4 bytes of the mtd files as that's what is different between cameras but have not tried it.
If for some reason the camera is bricked, there may be a way to recover this from the console via the UART port.
What has been done in the past to help test and debug this is to install Sourcery Codebench Lite. It's the operating system used by Hikvision. I have not tried it, but would assume you can install Linux on there, move the files, scripts and such over and use their gui debugger to help out.
Also, what's interesting is how iTuneDVR makes firmware files. I've researched this and determined that what's in the digicap.dav firmware file is the same as what's in the /dav directory on the cameras itself. I've been able to easily extra files from digicap.dav firmware files that are in /dav. It seems as though they are a concatenated list of files from this directory. Any help is figuring this out will help the cause.
checking checksum or something that makes it no longer work. I'm going to publish this in hopes that someone can help me figure out what's different in 5.2.5.
I realize there are haters and as Taylor Swift once said, Haters going to hate, hate, hate. They have personal financial interest in this like
CBX and iTuneDVR, but I feel this should be public information. I figured this out 100% on my own, did not reverse engineer anyone else's work so I consider it mine to share. So I prefer they bud out since they will make comments to try and distract this project like they did at cctvforum, but is subterfuge, it can be done and it's not that hard.
So here's how it's done. First there's two files, /dev/mtd5 and /dev/mtd6 that contain the language flag. It's at the 1620th byte in MTD5 and 16th in MTD6 and has duplicates sometimes in MTD6, but have never updated the duplicates in the past, but that may be where I've gone
wrong with 5.2.5.
First you need MTDUTILS, free open source Linux utilities to read/write to MTD. So easy enough. I've cross-compiled them for ARM
and put them here - http://www.wrightwoodsurveillance.com/stuff/mtd.zip
Then what you need to do is create a Windows share on your PC, unzip the file into this directory, telnet into the camera and mount this share, like mount -t cifs //192.168.1.50/mtdutils /mnt/nfs07 -o username=pcuser,password=pcpass.
While logged into the camera, cd /mnt/nfs07/mtdutils-1.5.0-arm-linux-gnueabi/sbin to run the commands.
Start with these commands to read flash as these will put the flash in your windows share -
./nanddump -nof mtd5_temp /dev/mtd5
./nanddump
-nof mtd6_temp /dev/mtd6
From here you can use a Windows hex editor like HxD to read these files and note that in the locations above (decimal, you will need to change to hex to see the language flag) is 02 for Chinese, changing it to 01 makes it English.
I did this in Linux, actually on the camera itself like this;
echo -ne \\x01 | dd conv=notrunc seek=1620 bs=1 count=1 of=mtd5_temp
echo -ne \\x01 | dd conv=notrunc seek=16 bs=1 count=1 of=mtd6_temp
Then you can't just write MTD, you have to erase it. Simple enough with the flash_eraseall command;
/flash_eraseall
/dev/mtd5
/flash_eraseall /dev/mtd6
Then you'll need to use nandwrite to write the image you edited back to flash;
./nandwrite -o /dev/mtd5 mtd5_temp
./nandwrite -o /dev/mtd6 mtd6_temp
This will brick a 5.2.5 camera and my belief it that's related to the checksum, which I feel is the first 4 bytes of the mtd files as that's what is different between cameras but have not tried it.
If for some reason the camera is bricked, there may be a way to recover this from the console via the UART port.
What has been done in the past to help test and debug this is to install Sourcery Codebench Lite. It's the operating system used by Hikvision. I have not tried it, but would assume you can install Linux on there, move the files, scripts and such over and use their gui debugger to help out.
Also, what's interesting is how iTuneDVR makes firmware files. I've researched this and determined that what's in the digicap.dav firmware file is the same as what's in the /dav directory on the cameras itself. I've been able to easily extra files from digicap.dav firmware files that are in /dav. It seems as though they are a concatenated list of files from this directory. Any help is figuring this out will help the cause.
Last edited: