This Little Camera

Some time ago I came across a strange product on Banggood. It was a small camera, with a base and separate camera head on top. The camera head supports pan and tilt, like a bobblehead.

Digoo DG-M1Z

The specs aren’t half bad: supports 1080p, has wifi and ethernet on board, and has a microSD card slot. These are intended for home security. The idea is you set these down somewhere and it streams live video over wifi. Sounds great!

The strange thing was the price: these cameras go for $15-$20 on Banggood and similar Chinese sites. Turns out that’s not the complete price however: you’re supposed to buy a monthly subscription for the “cloud service”. The camera uploads video to this cloud, and you can watch it there with your paid account.

The cloud in question is some Chinese service, and of course the camera cannot work without it: you can’t just stream your own video off of your own camera. So it needs a working internet connection as well.

So for $15 + a monthly fee you buy a spyware device that uploads your house’s video to China. You’d have to be insane to think that’s a good deal; I think it’s downright offensive.

It occurred to me that these things would be awesome if you could only put your own software on them, so it wouldn’t connect to anywhere – just store or stream video locally. That really would get you a $15 camera without the Chinese mass surveillance feature.

I decided to look a little closer at the hardware, and see how doable this would be. As expected at this price, the system is mostly a single chip – the GK7101 – with only the barest essentials to support it. This very capable chip is an SoC made by Goke Micro, a Chinese company. The chip has an older ARM 1176 CPU core and a ton of peripherals:

I set about finding a serial port of sorts on the board. There’s usually one there for debugging, but sometimes it take a little effort to find it. No problem this time though:

X marks the spot

As usual for hardware of this caliber, it runs Linux. Also as usual, none of the changes made to the Linux kernel for this hardware have been upstreamed. There are a ton of kernel modules, all of which are marked as GPL. The kernel itself is an old 3.4.43 version, also with many changes.

It seems to me I’d need to, in order:

  1. get a mainline kernel running on the board
  2. port the modules one by one into new drivers, reverse engineering their functionality as I go
  3. get a basic root filesystem going and look at implementing a streaming API, and whatever else seems handy

Of course the sharp-eyed reader will have noticed that, in fact, points 1 and 2 (porting the kernel) are actually optional. After all, the userspace software is the bit that locks you in to this Chinese cloud stuff; if that software can use the video coming out of that custom kernel, I can write software to do the same.

But you know what? Porting the kernel is, to me, by far the most interesting part of this. It’s a pretty big project, since the SoC has so much functionality on board.

It’s also really hard, because there is no datasheet available for the chip. I’ve tried contacting various people at Goke, but the only person that replied was a sales guy – who stopped replying the moment he realized I wasn’t going to buy 10k units. Needless to say requests for their GPL’ed code didn’t get anywhere.

There is an SDK they give to customers, but that is also not publicly available.

What a challenge this is. Let’s go!