Thank you for your quick reply.That's not an R0 series camera. The brickfixV2 method should not be attempted on it.
What are you trying to do, and what problem are you trying to deal with?
That's not an R0 series camera. The brickfixV2 method should not be attempted on it.
What firmware are you trying to install?I stuck in the step 2, [2020-04-15 14:25:05] TFTP server[192.0.0.128] initialized, and no further reaction.
What firmware are you trying to install?
OK, so how did you do the initial brickfixV2 firmware install, which needs the Hikvision tftp updater? (assuming no access to the serial console)The world is slightly complicated because I have no windows machine here (lots of mac/linux ... but no Microsoft unless I install a virtual machine up)
This is created on the first reboot after the brickfixV2 firmware has been installed, by this script.So one observation; For some reason /dav/fixup_stage1.txt didn't exist and I had to create it.
#!/bin/sh
if [ -e /dav/notice ]; then
echo "[Brick-fix tool] Initialising fixup_log.txt" > /dav/fixup_log.txt
echo "Hello Hikvision! Enabling rollback ..."
cat /dav/notice > /dev/mtdblock8
rm /dav/notice
echo "Enabled."
echo "Payload dropped, rollback re-enabled" >> /dav/fixup_log.txt
echo "Initialising fixup current status to stage1" >> /dav/fixup_log.txt
rm /dav/fixup_stage?.txt
echo "Fixup stage1 completed - rollback payload dropped" > /dav/fixup_stage1.txt
fi
echo "[Brick-fix tool] Initiating reboot into min-system " >> /dav/fixup_log.txt
/usr/sbin/set_sysflag -m 1
/sbin/reboot
Not necessarily - on earlier firmware the checksum wasn't checked and could be wrong in mtd6.Trying to checksum the mtd6ro_orig file gives me values different to those in it, so presumably my maths is out somewhere
I'm impressed!Replacement for the TFTP hikvision tool was standard tftp server (to send brickfixv2CN.dav) + little python script that responds to the hikvision handshake on udp 9978
epol/script
A bit of a hangover - the original brickfix required that some mtd1 get a tweak as they were interpreted as an indication of prior update failure, so the camera reboots into recovery. But in brickfixV2 I get it overwritten with a valid template to save the user some effort.mtd1ro_orig sent to tftp server
I've attached a couple of valid samples for you to check.
Name | Checksum from HxD | Byte Swapped from HxD | Checksum in File |
mtd6ro_mod_1 | 0C D2 | D2 0C | D2 0C |
mtd6ro_mod_2 | 0D 5B | 5B 0D | 5B 0D |
mtd6ro_mod_3 | 09 A6 | A6 09 | A6 09 |
mtd6ro_mod_4 | 09 A4 | A4 09 | A4 09 |
mtd6ro_mod_5 | 0D 21 | 21 0D | 21 0D |
Nice one. Well done, and thanks for sharing.So now that I've worked out what hikvisions checksum is actually doing here's a, rather wordy, linux script to calc the checksum
Unlikely, it's limited - but interesting to try.Wondering if the shell on the device (ash?) is up to doing the checksum / writing a binary file. At which point hex editor etc isn't required.
alastair@PC-I5 ~ $ ssh admin@192.168.1.105
admin@192.168.1.105's password:
repacked
BusyBox v1.19.3 (2017-01-13 20:51:32 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.
# prtHardInfo
Start at 2020-04-19 16:54:07
Serial NO :DS-2CD2432F-IW20141105CCCH487719881
V5.4.5 build 170123
NetProcess Version: 1.6.1 [17:24:18-Jan 13 2017]
Db Encrypt Version: 65537
hardwareVersion = 0x0
hardWareExtVersion = 0x0
encodeChans = 1
decodeChans = 1
alarmInNums = 1
alarmOutNums = 1
ataCtrlNums = 0
flashChipNums = 0
ramSize = 0x4000000
networksNums = 1
language = 1
devType = 0x9812
net reboot count = 0
Path: .
Working Copy Root Path: /usr/local/jenkins/workspace/Frontend_BaseLine_Publish_Build_InterfaceII/2539
URL: https://192.0.0.140/Camera/Platform/Branches/branches_frontend_software_platform/IPC_develop_branch/ipc_5.4.0_R0
Repository Root: https://192.0.0.140/Camera
Repository UUID: df2d70c3-7593-7941-af1e-571b313c0946
Revision: 253120
Node Kind: directory
Schedule: normal
Last Changed Author: liudan9
Last Changed Rev: 253065
Last Changed Date: 2017-01-23 17:45:28 +0800 (Mon, 23 Jan 2017)
#
#
#
# cd /home
# df -h
Filesystem Size Used Available Use% Mounted on
rootfs 7.9M 7.6M 342.0K 96% /
/dev/root 7.9M 7.6M 342.0K 96% /
udev 46.3M 76.0K 46.3M 0% /dev
/dev/ubi1_0 19.8M 13.2M 5.6M 70% /dav
/dev/ubi3_0 1.3M 160.0K 1.0M 13% /davinci
/dev/ubi4_0 1.3M 132.0K 1.0M 11% /config
#
# mount
rootfs on / type rootfs (rw)
/dev/root on / type ext2 (rw,relatime)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
ramfs on /home type ramfs (rw,relatime)
udev on /dev type tmpfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
/dev/ubi1_0 on /dav type ubifs (rw,relatime)
/dev/ubi3_0 on /davinci type ubifs (rw,relatime)
/dev/ubi4_0 on /config type ubifs (rw,relatime)
#
# ls -al /mnt
drwxrwxrwx 13 root root 1024 Jan 13 2017 .
drwxr-xr-x 20 root root 1024 Apr 21 2020 ..
drwxrwxrwx 2 root root 1024 Jan 13 2017 mmc01
drwxrwxrwx 2 root root 1024 Jan 13 2017 mmc02
drwxrwxrwx 2 root root 1024 Jan 13 2017 nfs0
drwxrwxrwx 2 root root 1024 Jan 13 2017 nfs00
drwxrwxrwx 2 root root 1024 Jan 13 2017 nfs01
drwxrwxrwx 2 root root 1024 Jan 13 2017 nfs02
drwxrwxrwx 2 root root 1024 Jan 13 2017 nfs03
drwxrwxrwx 2 root root 1024 Jan 13 2017 nfs04
drwxrwxrwx 2 root root 1024 Jan 13 2017 nfs05
drwxrwxrwx 2 root root 1024 Jan 13 2017 nfs06
drwxrwxrwx 2 root root 1024 Jan 13 2017 nfs07
# mount -t nfs -o nolock 192.168.1.201:/cctv1 /mnt/nfs00
# ls -al /mnt/nfs00/c*.sh
-rwxrwxrwx 1 503 100 1579 Apr 21 15:41 /mnt/nfs00/checksum.sh
#
#
# cat /dev/mtd6ro > mtdfile
# ls -al
drwxr-xr-x 6 root root 0 Apr 21 16:56 .
drwxr-xr-x 20 root root 1024 Apr 21 16:38 ..
drwxr-xr-x 2 root root 0 Apr 19 16:53 applib
-rwxrwxrwx 1 root root 6674 Apr 19 16:53 initrun.sh
-rw-r--r-- 1 root root 524288 Apr 21 16:56 mtdfile
---------- 1 root root 0 Apr 19 16:53 pidfile
drwxr-xr-x 2 root root 0 Apr 19 16:53 process
drwxr-xr-x 2 3008 3008 0 Apr 19 16:53 sound
drwxr-xr-x 5 root root 0 Apr 19 16:53 webLib
#
# /mnt/nfs00/checksum.sh mtdfile
/mnt/nfs00/checksum.sh: line 43: syntax error: bad for loop variable
#
# rm mtdfile
# umount /mnt/nfs00
# Connection to 192.168.1.105 closed.
alastair@PC-I5 ~ $
Yes - that's because the Region is still set to China.Serial still has reference to CCCH serial.
Does this suggest that it works well enough :the printf's may be a different issue.
alastair@PC-I5 ~ $ ssh admin@192.168.1.105
admin@192.168.1.105's password:
repacked
BusyBox v1.19.3 (2017-01-13 20:51:32 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.
#
# set
HISTFILE='/.ash_history'
HOME='/'
IFS='
'
LOGNAME='admin'
OPTIND='1'
PATH='/usr/bin:/bin'
PPID='7228'
PS1='# '
PS2='> '
PS4='+ '
PWD='/'
SHELL='/bin/psh'
SSH_CLIENT='192.168.1.99 35964 22'
SSH_CONNECTION='192.168.1.99 35964 192.168.1.105 22'
SSH_TTY='/dev/pts/0'
TERM='xterm-256color'
USER='admin'
#
# printf "$PATH Hello world\n"
/usr/bin:/bin Hello world
#
# Connection to 192.168.1.105 closed.
alastair@PC-I5 ~ $
The current re-write of mtd6ro_mod was done under the min-system recovery environment that the brickfixV2 method installed.So on the firmware side: If we want to get it out of China region 5.2.5 is the last working firmware? Also if, like me, we've upgraded to 5.4.5 that'll probably explode if we do any further writes to mtd6?
Does this suggest that it works well enough :
BusyBox v1.19.3 (2014-03-28 16:33:55 CST)