I have multiple IP-Cameras from China based on Hi3516A SOC. They works well, and I want to get access to them using VPN. I decide to install tinc-vpn on camera because I have full access to camera's shell using telnet.

Ok, well, using buildroot I've successfully create cross-compile toolchain and build tinc. But tinc require support for tun/tap devices what camera doesn't support by default. So, using dmesg and uname -a i found, what camera use Linux 3.4.35 kernel. I download kernel source code, add support for TUN/TAP as loadable kernel module and compile it:

~$ make ARCH=arm CROSS_COMPILE=/opt/hisilicon/arm/usr/bin/arm-linux- defconfig
~$ make ARCH=arm CROSS_COMPILE=/opt/hisilicon/arm/usr/bin/arm-linux- menuconfig 
# add building of TUN/TAP driver
~$ make ARCH=arm CROSS_COMPILE=/opt/hisilicon/arm/usr/bin/arm-linux- -k

Kernel compiled well, and I put tun.ko to my camera. After executing insmod ./tun.ko I've got

insmod: can't insert 'tun.ko': invalid module format

~ # dmesg | tail -n 1
tun: version magic '3.4.35 mod_unload ARMv5 p2v8 ' should be '3.4.35 mod_unload ARMv7 p2v8 '

Googling for some time I found this solution. After what, module successfully loaded, but then I try to read or write to /dev/net/tun execution crashes with segmentation fault and starting tincd ends with undefined error.

So, any ideas how can I build TUN/TAP driver for my cameras?


~ # dmesg | head -n 10
Booting Linux on physical CPU 0
Linux version 3.4.35 (root@wang) (gcc version 4.8.3 20131202 (prerelease) (Hisilicon_v300) ) #3 Mon Aug 10 15:39:44 CST 2015
CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine: hi3516a
Memory policy: ECC disabled, Data cache writeback
On node 0 totalpages: 32768
free_area_init_node: node 0, pgdat c04c0878, node_mem_map c04e0000
  Normal zone: 256 pages used for memmap
  Normal zone: 0 pages reserved

I've use same version of compiler and and Linux kernel

~ # cat /proc/cpuinfo 
Processor       : ARMv7 Processor rev 5 (v7l)
BogoMIPS        : 1196.85
Features        : swp half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt 
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 5

Hardware        : hi3516a
Revision        : 0000
Serial          : 0000000000000000

I've tried to build cross-compile for ARM Cortex-A7 using buildroot and compile linux kernel with it, but without result.

Thanks in advance.

  • Hello. While I have no experience with this particular ip camera and soc, I do have a fair amount of experience with hisilicon SoCs in general, and have used buildroot to build kernel and userspace for linux versions 4.8+. If you're interested in joining me in my project of secure security systems (funny phrase, that), you can find me on freenode #exploiteers (nick hanetzer) – hanetzer Jan 1 '17 at 6:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.