Firmware Mod Tool for Hikvision NVR and IP camera devices.
What is this tool?
It’s a short piece of code that makes it easily possible to change the ‘Language’ flag on the firmware update files that Hikvision provides for their range of NVRs and IP cameras. The user does not need programming expertise to use this tool.
The tool also provides some advanced facilities to extract the contents from the main body of a firmware upgrade file for inspection or further development. The tool can also re-package the updated changed or added contents into a new firmware update file that can be applied to the IP camera or NVR as a normal upgrade.
Why would I need it?
It’s common that after purchasing Hikvision IP cameras and NVRs from low-cost sources such as Chinese internet-based sellers, users encounter some problems such as ‘Language mismatch’ when trying to integrate the devices or update the firmware. Hikvision applies ‘Region codes’ and ‘language flags’ to their IP cameras and NVRs and to the associated firmware updates, and tries to ensure their products are sold via their ‘Authorised Distributor Network’. Sellers can modify internal region and language settings in various ways to cheaply sell products from one region in another region, in a way that can cause later problems for the buyer when updates are attempted.
Advanced users can modify or add files to the firmware image, to customise the capabilities and behaviour of their IP camera or NVR.
How does the tool work?
The tool scans and decodes the NVR or IP camera firmware update file that the user would like to use to update the device, and allows the ‘Language flag’ to be changed, such that ‘Language mismatch’ errors that occur on an attempted update can be eliminated.
The tool extracts all the individual files from the main section of the firmware upgrade file, making them available for inspection or changing.
How do I use it?
The steps are straightforward, but do need some care to be taken, and require an understanding that although the tool is reliable and has been tested, it may not take account of future changes such as the firmware update file structure being re-engineered, or new checksums being incorporated.
Please proceed as follows:
- Have available a Windows PC, with the Hikvision Support Tools package available, which mainly consists of a TFTP server and the instructions on how this can be used to recover a failed firmware update on an NVR or IP camera. A good source of information on this are the many threads on Hikvision devices in the forum www.ipcamtalk.com
- Store in a folder on the PC the NVR or IP camera firmware upgrade file that you would like to use, along with the ‘hiktools.exe’ firmware mod tool program. This could be the same folder as used by the TFTP program.
- Ensure the NVR or IP camera is powered on and connected to the same local network as the PC, and ensure that you can log on to the web admin GUI with an administrator account (usually admin).
- On the Windows PC, start a command-line window, usually with ‘Start | CMD’. Change the drive and directory to that holding the hiktools.exe program.
- First check that the firmware file to be changed can be correctly decoded. Assuming that the firmware filename is ‘digicap.dav, execute the following command:
hiktools digicap.dav
and inspect the result on the screen.
The tool will show the header raw data, the header decoded data, a summary of key values in the header, and the full decoded data including a list of the embedded files and their checksums.
An important value to check in the summary of key values is that the ‘magic number’ is ‘0x484B5753’ and that the iLanguage value is 1 or 2 The iHeadTotalLen varies with the number of files in the main section of the firmware update file. The value is 64 bytes plus 44 bytes x (the number of files held in the main section). This can be 108 for NVR firmware that typically has a single CRAMFS image, and 1208 for camera firmware holding 26 files. This should give a reasonable confidence level that the file is in a format that can be decoded. If the results do not match these values – DO NOT PROCEED further.
- Make a backup copy of the original firmware file with the following command:
‘copy digicap.dav digicap.dav.backup’
- At this point it is possible to simply change the ‘Language flag’ by executing the following command, using ‘1’ for English or Multi, and ‘2’ for Chinese device. If you want flash english firmware to chinese IPC or NVR you need set language to 2:
hiktools lang digicap.dav 2
- The modified firmware file is now ready to be applied to the NVR or IP camera. Log in to the web admin GUI, and use the ‘Configuration | Maintenance | Remote Upgrade’ menu to select the new firmware file, and click the ‘Upgrade’ button. Observe the progress indicator, and the reboot progress. After reboot, check that the ‘Language mismatch’ problem has been eliminated.
Advanced use of the Firmware Mod Tool
In addition to the ability to modify the language flag in a firmware update file, the tool can be used to split the firmware file into its header section and all the component parts of the main or rootfs section, and also to create a new firmware file by joining a header section to a new main section that holds files from within a specified folder where the user may have modified the contents.
This clearly provides opportunities for customising the behaviour of your NVR or IP camera, however it is suggested that these facilities should only be used by those knowledgeable in the structure and practice of embedded Linux firmware files as implemented by Hikvision in their NVR and IP camera products.
For reference, the advanced commands of the firmware mod tool are as follows:
hiktools split digicap.dav destinationdir
The output on the screen lists the names of the files extracted from the main section of the firmware file. These files are created in the specified destination directory, and can be inspected and used when the extraction is complete.
In the version 03R and later of the hiktools program, there is a facility to recombine the extracted files, some of which the user may have since modified, or added to, into an original, valid firmware file that could be used by the firmware upgrade process in the IP camera or NVR. It is therefore possible for the user to modify and customise the IP camera or NVR behaviour should they wish to do so.
hiktools create header_from_digicap.dav sourcedir
The tool creates a new firmware file by combining the header extracted from the first argument with the contents of the directory from the second argument. Those contents could be files previously extracted, some of which were since modified, or with additional files to be included in the firmware image.
Special thanks alastairstevenson
UPDATE 19-06-15
version 05R1
1. Fixed minor bugs
What is this tool?
It’s a short piece of code that makes it easily possible to change the ‘Language’ flag on the firmware update files that Hikvision provides for their range of NVRs and IP cameras. The user does not need programming expertise to use this tool.
The tool also provides some advanced facilities to extract the contents from the main body of a firmware upgrade file for inspection or further development. The tool can also re-package the updated changed or added contents into a new firmware update file that can be applied to the IP camera or NVR as a normal upgrade.
Why would I need it?
It’s common that after purchasing Hikvision IP cameras and NVRs from low-cost sources such as Chinese internet-based sellers, users encounter some problems such as ‘Language mismatch’ when trying to integrate the devices or update the firmware. Hikvision applies ‘Region codes’ and ‘language flags’ to their IP cameras and NVRs and to the associated firmware updates, and tries to ensure their products are sold via their ‘Authorised Distributor Network’. Sellers can modify internal region and language settings in various ways to cheaply sell products from one region in another region, in a way that can cause later problems for the buyer when updates are attempted.
Advanced users can modify or add files to the firmware image, to customise the capabilities and behaviour of their IP camera or NVR.
How does the tool work?
The tool scans and decodes the NVR or IP camera firmware update file that the user would like to use to update the device, and allows the ‘Language flag’ to be changed, such that ‘Language mismatch’ errors that occur on an attempted update can be eliminated.
The tool extracts all the individual files from the main section of the firmware upgrade file, making them available for inspection or changing.
How do I use it?
The steps are straightforward, but do need some care to be taken, and require an understanding that although the tool is reliable and has been tested, it may not take account of future changes such as the firmware update file structure being re-engineered, or new checksums being incorporated.
Please proceed as follows:
- Have available a Windows PC, with the Hikvision Support Tools package available, which mainly consists of a TFTP server and the instructions on how this can be used to recover a failed firmware update on an NVR or IP camera. A good source of information on this are the many threads on Hikvision devices in the forum www.ipcamtalk.com
- Store in a folder on the PC the NVR or IP camera firmware upgrade file that you would like to use, along with the ‘hiktools.exe’ firmware mod tool program. This could be the same folder as used by the TFTP program.
- Ensure the NVR or IP camera is powered on and connected to the same local network as the PC, and ensure that you can log on to the web admin GUI with an administrator account (usually admin).
- On the Windows PC, start a command-line window, usually with ‘Start | CMD’. Change the drive and directory to that holding the hiktools.exe program.
- First check that the firmware file to be changed can be correctly decoded. Assuming that the firmware filename is ‘digicap.dav, execute the following command:
hiktools digicap.dav
and inspect the result on the screen.
The tool will show the header raw data, the header decoded data, a summary of key values in the header, and the full decoded data including a list of the embedded files and their checksums.
An important value to check in the summary of key values is that the ‘magic number’ is ‘0x484B5753’ and that the iLanguage value is 1 or 2 The iHeadTotalLen varies with the number of files in the main section of the firmware update file. The value is 64 bytes plus 44 bytes x (the number of files held in the main section). This can be 108 for NVR firmware that typically has a single CRAMFS image, and 1208 for camera firmware holding 26 files. This should give a reasonable confidence level that the file is in a format that can be decoded. If the results do not match these values – DO NOT PROCEED further.
- Make a backup copy of the original firmware file with the following command:
‘copy digicap.dav digicap.dav.backup’
- At this point it is possible to simply change the ‘Language flag’ by executing the following command, using ‘1’ for English or Multi, and ‘2’ for Chinese device. If you want flash english firmware to chinese IPC or NVR you need set language to 2:
hiktools lang digicap.dav 2
- The modified firmware file is now ready to be applied to the NVR or IP camera. Log in to the web admin GUI, and use the ‘Configuration | Maintenance | Remote Upgrade’ menu to select the new firmware file, and click the ‘Upgrade’ button. Observe the progress indicator, and the reboot progress. After reboot, check that the ‘Language mismatch’ problem has been eliminated.
Advanced use of the Firmware Mod Tool
In addition to the ability to modify the language flag in a firmware update file, the tool can be used to split the firmware file into its header section and all the component parts of the main or rootfs section, and also to create a new firmware file by joining a header section to a new main section that holds files from within a specified folder where the user may have modified the contents.
This clearly provides opportunities for customising the behaviour of your NVR or IP camera, however it is suggested that these facilities should only be used by those knowledgeable in the structure and practice of embedded Linux firmware files as implemented by Hikvision in their NVR and IP camera products.
For reference, the advanced commands of the firmware mod tool are as follows:
hiktools split digicap.dav destinationdir
The output on the screen lists the names of the files extracted from the main section of the firmware file. These files are created in the specified destination directory, and can be inspected and used when the extraction is complete.
In the version 03R and later of the hiktools program, there is a facility to recombine the extracted files, some of which the user may have since modified, or added to, into an original, valid firmware file that could be used by the firmware upgrade process in the IP camera or NVR. It is therefore possible for the user to modify and customise the IP camera or NVR behaviour should they wish to do so.
hiktools create header_from_digicap.dav sourcedir
The tool creates a new firmware file by combining the header extracted from the first argument with the contents of the directory from the second argument. Those contents could be files previously extracted, some of which were since modified, or with additional files to be included in the firmware image.
Special thanks alastairstevenson
UPDATE 19-06-15
version 05R1
1. Fixed minor bugs
Attachments
Last edited by a moderator: