Easy recovery without serial: Dahua IPC EASY unbricking / recovery over TFTP
Thanks so much for this recovery..
Unbricked my IPC-HDW4431C-A.. It wasn't connecting to pc and the IR was always on.. Your the Boss man.. Thanks
Easy recovery without serial: Dahua IPC EASY unbricking / recovery over TFTP
Thanks so much for this recovery..
Unbricked my IPC-HDW4431C-A.. It wasn't connecting to pc and the IR was always on.. Your the Boss man.. Thanks
Something is still wrong?
Code:▒ U-Boot 2010.06-svn4911 (Sep 04 2017 - 11:31:28) I2C: ready DRAM: 118 MiB gBootLogPtr:00b80008. spinor flash ID is 0x1940ef partition file version 2 rootfstype squashfs root /dev/mtdblock5 gParameter[0]:node=bootargs, parameter=console=ttyS0,115200 mem=118M root=/dev/mtdblock5 rootfstype=squashfs init=/linuxrc. TEXT_BASE:01000000 Net: Detected MACID:e0:50:8b:11:04:11 PHY:0x001cc816,addr:0x00 s3l phy RTL8201 init MMC: sdmmc init link down Using ambarella mac device TFTP from server 192.168.254.254; our IP address is 192.168.1.108; sending through gateway 192.168.1.1 Download Filename 'upgrade_info_7db780a713a4.txt'. Download to address: 0x5000000 Downloading: * Retry count exceeded; starting again Try again use backup_serverip *** ERROR: `serverip' not set Failed to get info.txt Fail to get info file! Init error! Using ambarella mac device TFTP from server 192.168.254.254; our IP address is 192.168.1.108; sending through gateway 192.168.1.1 Download Filename 'failed.txt'. Download to address: 0x2000000 Downloading: * Retry count exceeded; starting again Support backupVer:255 state:ff,err_count:04 SPI probe: 32768 KiB W25Q256FV at 0:0 is now current device ## Booting kernel from Legacy Image at 02000000 ... Image Name: Linux-3.10.73 Created: 2017-09-04 2:58:37 UTC Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 1534196 Bytes = 1.5 MiB Load Address: 00208000 Entry Point: 00208000 Verifying Checksum ... OK Loading Kernel Image ...OK OK partition file version 2 rootfstype squashfs root /dev/mtdblock5 fail to load bootargsParameters.txt fail to load bootargsParameters.txt file crashflasg:1, logmagic:54410011. Starting kernel ... ▒ U-Boot 2010.06-svn4911 (Sep 04 2017 - 11:31:28) I2C: ready DRAM: 118 MiB gBootLogPtr:00b80008. spinor flash ID is 0x1940ef partition file version 2 rootfstype squashfs root /dev/mtdblock5 gParameter[0]:node=bootargs, parameter=console=ttyS0,115200 mem=118M root=/dev/mtdblock5 rootfstype=squashfs init=/linuxrc. TEXT_BASE:01000000 Net: Detected MACID:e0:50:8b:11:04:11 PHY:0x001cc816,addr:0x00 s3l phy RTL8201 init MMC: sdmmc init Hit any key to stop autoboot: 0 >********************************************* Unknown command '*********************************************' - try 'help' >setenv ipaddr 192.168.0.19 >setenv gatewayip 192.168.0.1 >setenv netmask 255.255.255.0 >setenv serverip 192.168.0.78 >ping $serverip Using ambarella mac device Abort ping failed; host 192.168.0.78 is not alive >run dr Using ambarella mac device TFTP from server 192.168.0.78; our IP address is 192.168.0.19 Download Filename 'romfs-x.squashfs.img'. Download to address: 0x2000000 Downloading: ################################################################# ################################################################# ################################################################# ############################################################## done Bytes transferred = 1310784 (140040 hex) ## Checking Image at 02000000 ... Legacy image found Image Name: romfs Created: 2017-09-04 7:52:44 UTC Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 1310720 Bytes = 1.3 MiB Load Address: 00270000 Entry Point: 003c0000 Verifying Checksum ... OK Programing start at: 0x00270000 SPI probe: 32768 KiB W25Q256FV at 0:0 is now current device write : 100% done >run dk Using ambarella mac device TFTP from server 192.168.0.78; our IP address is 192.168.0.19 Download Filename 'kernel.img'. Download to address: 0x2000000 Downloading: ################################################################# ################################################################# ################################################################# ################################################################# ######################################## done Bytes transferred = 1534324 (176974 hex) ## Checking Image at 02000000 ... Legacy image found Image Name: kernel Created: 2017-09-04 7:52:39 UTC Image Type: ARM Linux Firmware (uncompressed) Data Size: 1534260 Bytes = 1.5 MiB Load Address: 000f0000 Entry Point: 00270000 Verifying Checksum ... OK Programing start at: 0x000f0000 write : 100% done >run du Using ambarella mac device TFTP from server 192.168.0.78; our IP address is 192.168.0.19 Download Filename 'user-x.squashfs.img'. Download to address: 0x2000000 Downloading: ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################# done Bytes transferred = 15224896 (e85040 hex) ## Checking Image at 02000000 ... Legacy image found Image Name: user Created: 2017-09-04 7:53:00 UTC Image Type: ARM Linux Standalone Program (uncompressed) Data Size: 15224832 Bytes = 14.5 MiB Load Address: 00a40000 Entry Point: 01a70000 Verifying Checksum ... OK Programing start at: 0x00a40000 write : 100% done >run dw Using ambarella mac device TFTP from server 192.168.0.78; our IP address is 192.168.0.19 Download Filename 'web-x.squashfs.img'. Download to address: 0x2000000 Downloading: ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ###################### done Bytes transferred = 6434880 (623040 hex) ## Checking Image at 02000000 ... Legacy image found Image Name: web Created: 2017-09-04 7:52:46 UTC Image Type: ARM Linux Standalone Program (uncompressed) Data Size: 6434816 Bytes = 6.1 MiB Load Address: 003c0000 Entry Point: 00a40000 Verifying Checksum ... OK Programing start at: 0x003c0000 write : 100% done >run dp Using ambarella mac device TFTP from server 192.168.0.78; our IP address is 192.168.0.19 Download Filename 'partition-x.cramfs.img'. Download to address: 0x2000000 Downloading: * ARP Retry count exceeded; starting again >run dc Using ambarella mac device TFTP from server 192.168.0.78; our IP address is 192.168.0.19 Download Filename 'custom-x.squashfs.img'. Download to address: 0x2000000 Downloading: * ARP Retry count exceeded; starting again >save Saving Environment to SPI Flash... Erasing SPI flash... Writing to SPI flash... done >
run dp and run dc looks strange.
after reboot it shows only starting kernel and nothing else, so I thought it hasn´t sucseeded. But I was wrong. After loading defaults with camera button it can configure it through config tool.
I didn´t checked if the serial output shows more than loading kernel and if this behavior is normal.
U-Boot 2010.06-svn2661 (Jul 10 2015 - 17:23:04)
DRAM: 1 GiB
gBootLogPtr:80b80008.
NAND: Check nand flash controller v610. found
Special NAND id table Version 1.36
Nand ID: 0x98 0xF1 0x80 0x15 0xF2 0x16 0x08 0x00
NAND_ECC_NONE selected by board driver. This is not recommended !!
128 MiB
partition file version 2
rootfstype squashfs root /dev/mtdblock7
In: serial
Out: serial
Err: serial
TEXT_BASE:81000000
Net: PHY found at 3
state:ff,err_count:02
ETH0: PHY(phyaddr=-1, rmii) not link!
Try again use backup_serverip
ETH0: PHY(phyaddr=-1, rmii) not link!
Failed to get info.txt
Fail to get info file!
Init error!
ETH0: PHY(phyaddr=-1, rmii) not link!
## Booting kernel from Legacy Image at 82000000 ...
Image Name: Linux-3.4.35
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2232408 Bytes = 2.1 MiB
Load Address: 80008000
Entry Point: 80008000
Loading Kernel Image ...OK
OK
partition file version 2
rootfstype squashfs root /dev/mtdblock7
fail to load bootargsParameters.txt
fail to load bootargsParameters.txt file
get bootargs info failed
cmdLine mem=349M console=ttyS0,115200 root=/dev/mtdblock7 rootfstype=squashfs
crashflasg:1, logmagic:54410011.
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
First of all I need to understand exactly what does it mean:Extract the firmware image for your camera somewhere, use some ZIP program like 7zip. It might complain about invalid ZIP file (since Dahua changes the ZIP header from PK to DH) you can either fix the ZIP with a HEX editor or use another program to unzip it.
Start the TFTP server and point it to the files you have extracted from the firmware image.
And now for the final part: Flashing the firmware!
I'll flash following partitions in order:
- romfs (root linux filesystem with busybox)
- kernel (The holy Linux Kernel)
- user (Dahuas programs and kernel modules)
- web (Webinterface)
- partition ("Partition table" - text files which describe the layout on the flash chip)
- custom (Language files)
Are you referring to the original firmware distribution, or a full flash image recovery file?Sorry, but how can I extract these files from my image.bin file ?
I have only .bin files downloaded also from a dahua repository and from other websites
The .bin files are actually slightly modified ZIP files, with the first 2 bytes changed as above, and without the .zip extension.The firmware is just a normal zipfile with the first 2 bytes switched from PK (Phil Katz - remember him? PKware) to DH, inside the zip archive are the various components.
Change DH to PK
U-Boot 2010.06-svn2661 (Jul 10 2015 - 17:23:04)
DRAM: 1 GiB
gBootLogPtr:80b80008.
NAND: Check nand flash controller v610. found
Special NAND id table Version 1.36
Nand ID: 0x98 0xF1 0x80 0x15 0xF2 0x16 0x08 0x00
NAND_ECC_NONE selected by board driver. This is not recommended !!
128 MiB
partition file version 2
rootfstype squashfs root /dev/mtdblock7
In: serial
Out: serial
Err: serial
TEXT_BASE:81000000
Net: PHY found at 3
state:ff,err_count:03
Hit any key to stop autoboot: 0
> printenv
bootcmd=kload 0x82000000; bootm 0x82000000
bootdelay=1
baudrate=115200
ipaddr=192.168.1.108
serverip=192.168.1.1
gatewayip=192.168.1.1
netmask=255.255.255.0
bootfile="uImage"
wifiaddr=00:12:34:56:78:91
dh_keyboard=1
sysbackup=1
loglevel=4
ethact=gmac
filesize=1A595C5
fileaddr=82000000
da=tftp 0x82000000 dhboot.bin.img;flwrite;tftp 0x82000000 dhboot-min.bin.img;nand protect off;flwrite;
dr=tftp 0x82000000 romfs-x.squashfs.img; flwrite;
dk=tftp 0x82000000 kernel.img;flwrite;
du=tftp 0x82000000 user-x.squashfs.img; flwrite
dw=tftp 0x82000000 web-x.squashfs.img; flwrite
dp=tftp 0x82000000 partition-x.cramfs.img;flwrite;
dc=tftp 0x82000000 custom-x.squashfs.img; flwrite
up=tftp 0x82000000 update.img;flwrite;
tk=tftp 0x82000000 uImage;bootm;
HWID=VTO3221D:01:04:01:36:1A:17:01:11:03:03:04:258:00:02:00:00:00:00:00:00:200:FF
appauto=1
ID=4E05687PAZD2581
ethaddr=38:AF:29:65:B9:F0
bootargs=mem=349M console=ttyS0,115200 root=/dev/mtdblock7 rootfstype=squashfs
stdin=serial
stdout=serial
stderr=serial
verify=n
ver=U-Boot 2010.06-svn2661 (Jul 10 2015 - 17:23:04)
Environment size: 1065/131068 bytes
>
> run dr
ETH0: PHY(phyaddr=-1, rmii) link UP: DUPLEX=FULL : SPEED=100M
MAC: 38-AF-29-65-B9-F0
Using gmac device
TFTP from server 192.168.254.254; our IP address is 192.168.1.108; sending through gateway 192.168.254.254
Download Filename 'romfs-x.squashfs.img'.
Download to address: 0x82000000
Downloading:#################################################
done
Bytes transferred = 1204288 (126040 hex)
## Checking Image at 82000000 ...
Legacy image found
Image Name: romfs
Image Type: ARM Linux Standalone Program (gzip compressed)
Data Size: 1204224 Bytes = 1.1 MiB
Load Address: 01200000
Entry Point: 01a00000
Verifying Checksum ... OK
Programing start at: 0x01200000
write : 100%
done
> run dk
ETH0: PHY(phyaddr=-1, rmii) link UP: DUPLEX=FULL : SPEED=100M
MAC: 38-AF-29-65-B9-F0
Using gmac device
TFTP from server 192.168.254.254; our IP address is 192.168.1.108; sending through gateway 192.168.254.254
Download Filename 'kernel.img'.
Download to address: 0x82000000
Downloading: #################################################
done
Bytes transferred = 2232536 (2210d8 hex)
## Checking Image at 82000000 ...
Legacy image found
Image Name: kernel
Image Type: ARM Linux Firmware (uncompressed)
Data Size: 2232472 Bytes = 2.1 MiB
Load Address: 00d00000
Entry Point: 01200000
Verifying Checksum ... OK
Programing start at: 0x00d00000
write : 100%
done
> run du
ETH0: PHY(phyaddr=-1, rmii) link UP: DUPLEX=FULL : SPEED=100M
MAC: 38-AF-29-65-B9-F0
Using gmac device
TFTP from server 192.168.254.254; our IP address is 192.168.1.108; sending through gateway 192.168.254.254
Download Filename 'user-x.squashfs.img'.
Download to address: 0x82000000
Downloading: #################################################
done
Bytes transferred = 22237248 (1535040 hex)
## Checking Image at 82000000 ...
Legacy image found
Image Name: user
Image Type: ARM Linux Standalone Program (gzip compressed)
Data Size: 22237184 Bytes = 21.2 MiB
Load Address: 02200000
Entry Point: 03b80000
Verifying Checksum ... OK
Programing start at: 0x02200000
write : 100%
done
> run dw
ETH0: PHY(phyaddr=-1, rmii) link UP: DUPLEX=FULL : SPEED=100M
MAC: 38-AF-29-65-B9-F0
Using gmac device
TFTP from server 192.168.254.254; our IP address is 192.168.1.108; sending through gateway 192.168.254.254
Download Filename 'web-x.squashfs.img'.
Download to address: 0x82000000
Downloading: #################################################
done
Bytes transferred = 1355840 (14b040 hex)
## Checking Image at 82000000 ...
Legacy image found
Image Name: web
Image Type: ARM Linux Standalone Program (gzip compressed)
Data Size: 1355776 Bytes = 1.3 MiB
Load Address: 01a00000
Entry Point: 01e00000
Verifying Checksum ... OK
Programing start at: 0x01a00000
write : 100%
done
> run dp
ETH0: PHY(phyaddr=-1, rmii) link UP: DUPLEX=FULL : SPEED=100M
MAC: 38-AF-29-65-B9-F0
Using gmac device
TFTP from server 192.168.254.254; our IP address is 192.168.1.108; sending through gateway 192.168.254.254
Download Filename 'partition-x.cramfs.img'.
Download to address: 0x82000000
Downloading: #################################################
done
Bytes transferred = 4160 (1040 hex)
## Checking Image at 82000000 ...
Legacy image found
Image Name: partition
Image Type: ARM Linux Standalone Program (gzip compressed)
Data Size: 4096 Bytes = 4 KiB
Load Address: 00500000
Entry Point: 00600000
Verifying Checksum ... OK
Programing start at: 0x00500000
write : 100%
done
> run dc
ETH0: PHY(phyaddr=-1, rmii) link UP: DUPLEX=FULL : SPEED=100M
MAC: 38-AF-29-65-B9-F0
Using gmac device
TFTP from server 192.168.254.254; our IP address is 192.168.1.108; sending through gateway 192.168.254.254
Download Filename 'custom-x.squashfs.img'.
Download to address: 0x82000000
Downloading: #################################################
done
Bytes transferred = 16448 (4040 hex)
## Checking Image at 82000000 ...
Legacy image found
Image Name: custom
Image Type: ARM Linux Standalone Program (gzip compressed)
Data Size: 16384 Bytes = 16 KiB
Load Address: 00600000
Entry Point: 00980000
Verifying Checksum ... OK
Programing start at: 0x00600000
write : 100%
done
>
▒
U-Boot 2010.06-svn2661 (Jul 10 2015 - 17:23:04)
DRAM: 1 GiB
gBootLogPtr:80b80008.
NAND: Check nand flash controller v610. found
Special NAND id table Version 1.36
Nand ID: 0x98 0xF1 0x80 0x15 0xF2 0x16 0x08 0x00
NAND_ECC_NONE selected by board driver. This is not recommended !!
128 MiB
partition file version 2
rootfstype squashfs root /dev/mtdblock7
In: serial
Out: serial
Err: serial
TEXT_BASE:81000000
Net: PHY found at 3
state:ff,err_count:01
Hit any key to stop autoboot: 0
> boot
## Booting kernel from Legacy Image at 82000000 ...
Image Name: Linux-3.4.35
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2232408 Bytes = 2.1 MiB
Load Address: 80008000
Entry Point: 80008000
Loading Kernel Image ...OK
OK
partition file version 2
rootfstype squashfs root /dev/mtdblock7
fail to load bootargsParameters.txt
fail to load bootargsParameters.txt file
get bootargs info failed
cmdLine mem=349M console=ttyS0,115200 root=/dev/mtdblock7 rootfstype=squashfs
crashflasg:1, logmagic:54410011.
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
U-Boot 2010.06-svn2661 (Jul 10 2015 - 17:23:04)
DRAM: 1 GiB
gBootLogPtr:80b80008.
NAND: Check nand flash controller v610. found
Special NAND id table Version 1.36
Nand ID: 0x98 0xF1 0x80 0x15 0xF2 0x16 0x08 0x00
NAND_ECC_NONE selected by board driver. This is not recommended !!
128 MiB
partition file version 2
rootfstype squashfs root /dev/mtdblock7
In: serial
Out: serial
Err: serial
TEXT_BASE:81000000
Net: PHY found at 3
state:ff,err_count:02
ETH0: PHY(phyaddr=-1, rmii) link UP: DUPLEX=FULL : SPEED=100M
MAC: 38-AF-29-65-B9-F0
Using gmac device
TFTP from server 192.168.254.254; our IP address is 192.168.1.108; sending through gateway 192.168.1.1
Download Filename 'upgrade_info_7db780a713a4.txt'.
Download to address: 0x84000000
Downloading: *
Retry count exceeded; starting again
Try again use backup_serverip
ETH0: PHY(phyaddr=-1, rmii) link UP: DUPLEX=FULL : SPEED=100M
MAC: 38-AF-29-65-B9-F0
*** ERROR: `serverip' not set
Failed to get info.txt
Fail to get info file!
Init error!
ETH0: PHY(phyaddr=-1, rmii) link UP: DUPLEX=FULL : SPEED=100M
MAC: 38-AF-29-65-B9-F0
Using gmac device
TFTP from server 192.168.254.254; our IP address is 192.168.1.108; sending through gateway 192.168.1.1
Download Filename 'failed.txt'.
Download to address: 0x82000000
Downloading: *
Retry count exceeded; starting again
## Booting kernel from Legacy Image at 82000000 ...
Image Name: Linux-3.4.35
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2232408 Bytes = 2.1 MiB
Load Address: 80008000
Entry Point: 80008000
Loading Kernel Image ...OK
OK
partition file version 2
rootfstype squashfs root /dev/mtdblock7
fail to load bootargsParameters.txt
fail to load bootargsParameters.txt file
get bootargs info failed
cmdLine mem=349M console=ttyS0,115200 root=/dev/mtdblock7 rootfstype=squashfs
Starting kernel ...
Uncompressing Linux... done, booting the kernel.