MediaDeb: Debian For Mediatek Cellphones

In this small note I’ll tell you how to turn an old MediaTek SoC-based cellphone,(The one that’s probably gathering dust somewhere on your shelf, with no updates from vendor) into… a server running Debian Stretch! I’ve done this for UMI-X2 and iOcean X8 and you can download ready to flash firmware for these devices at the bottom of this post. Since a typical Chinese mtk cellphone now features 2GB or more RAM and 4 or more ARM cores the result packs way more performance than a typical Raspberry PI.

So what’s our target? A typical cheap cellphone, support’s been dropped by vendor, it receives no android updates. Unofficial (cyanogen, etc) firmware is sometimes available, sometimes not. It most likely has a plenty of processing power, ram and flash and is more than capable of running a more recent android. But the vendor dropped support for it. Or, perhaps, the screen is shattered, plastic is scratches and broken, antenna cable got torn… It’s been a while since we got ourself a new cellphone, but still don’t know what to do with the old one.

These are precisely the devices I had around sitting in the attic so I decided to turn them into something useful.

So I started what I called ‘MediaDeb’ project. An effort to run debian on old mediatek cellphones. And no, it’s not the chroot method, it the “real thing” ™: A full-blown Debian Stretch installation with a custom initrd, custom-built kernel (that has all the options required for systemd, iotop and the rest of the goodies to work, and has a few android features that break things turned off). Android itself wastes not a single byte of RAM or flash since it’s gone for good.

if you have a supported cellphone you can just grab SP Flash Tool, flash your phone with debian, plug in usb cable and here you go: the device will appear as a composite device with a virtual network interface and a virtual serial port (with console). You can use the serial port to access debian console in case you don’t like default network settings (The default uses DHCP client to get an IP address). So at this moment you can put this zombie on the shelf and pretend you’ve just rented a small dedicated server!

What is this zombie good for?

in my case I use a bunch of these zombie-phones to cross-compile my software packages for arm platform using Jenkins CI. A typical cellphone packs enough power to run a personal blog (This very blog ran for a very long time on a similar ARM board).

Wouldn’t the battery bloat after being plugged into the chager for months?

Yep, we all know that if you keep your cellphone plugged into the charger for months e.g. the battery will be kept at 4.2 volts or so, in some time it will bloat. Digging deep into the stinky (Yikes!) sources of mediatek’s kernel I found this value to be hardcoded in the charger driver. Therefore, a small edit to the sources and we can hack it to be something like 3.7-3.8 volts. This way the battery will last for a very long time and if the power goes off – we still have a plenty of time to shut things down. This batteryhack is implemented for UMI-X2, Iocean-X8 is next

What is the state of this project?

This project is still in the early stage (e.g. it compiles and works on my hardware). I’ve added support for UMI-X2 (MT6589, 4 ARM cores) and iOcean X8 (MT6592, 8 ARM cores). Adding support for other cellphones on this platform should be pretty much straightforward. Therefore if you want to help out – head directly to github. You can download ready-to-flash releases at the releases page there.

In the upcoming blog posts I’ll try to cover more details about porting debian to mediatek phones.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.