DS-2CD2142 static binaries.

ngst

n3wb
Dec 6, 2016
4
0
I cracked my knuckles and decided to see what I could do about hacking my grey market 2CD2142.

First step was getting a non-neutered version of some common Linux utils.

Right now I have compiled, all are attached.
  • Toybox - 0.7.3-16-g36beb530a79f BSD licensed Busybox style app
  • dropbear - SSHd server v2016.74. (5.2.5 has v2013.58)
  • bash - v4.4
  • wget - v1.19.1
  • Nano - v2.7.4 - text editor.
Format an SD card, extract the files onto it, put it in the camera, SSH into the camera and change PATH to include the bin directories.

You can also put them on an NFS share and run them there.

Tools used:

- musl libc is lightweight, fast, simple, free, and strives to be correct in the sense of standards-conformance and safety.
- GitHub - richfelker/musl-cross-make: Simple makefile-based build for musl cross compiler to build a ARM cross compiler
 

Attachments

Good start. You should compile for the target libraries/SDKs though. That will save precious RAM and make binaries more compatible.

Here are some SDKs used in hik cameras:

R6: gcc-linaro-arm-linux-gnueabihf-4.8-2013.09
G0: arm-hisiv300-linux
K51`: arm-hisiv400-linux
K41: arm-hisiv100-linux
 
  • Like
Reactions: ngst and fenderman
From what I can tell the 2CD2142 doesn't have a hardfloat (no FPU)

Processor : ARMv6-compatible processor rev 5 (v6l)
BogoMIPS : 525.92
Features : swp half fastmult edsp java
CPU: ARMv6-compatible processor [4117b365] revision 5 (ARMv6TEJ), cr=00c5387f


I went with musl because it weighs in at smaller than uClibc, dietlibc, and glibc: Comparison of C/POSIX standard library implementations for Linux

For 'RAM' I ended up grabbing an old tiny SD card and making a 64MB swapfile on it.

total used free shared buffers
Mem: 93M 90M 3.0M 0 148K
-/+ buffers/cache: 90M 3.2M
Swap: 64M 800K 63M

And my static toybox build, with more tools enabled (165 vs busyboxy's 55) is smaller too:

# ./ls -lah toybox
-r-xr-xr-x 1 65534 65533 408K 2017-03-30 18:30 toybox
# ./ls -lah $(which busybox)
-rwxr-xr-x 1 root root 416K 2014-07-11 03:26 /bin/busybox

 
Last edited: