Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Reverse engineering Android from binary to source (dmitry.gr)
121 points by dmitrygr on Feb 21, 2016 | hide | past | favorite | 21 comments


This article is fascinating, and having done board bringup work, I understand the challenges that the author faced. He did absolutely top-notch work. Getting a board that does nothing, has no debugger, no output of any kind going is really hard. However, to me the most important quote in the story is this:

> As per the GPL (under which the Linux kernel is licensed), the manufacturer had to have provided a written offer of sources. Needless to say that a random chinese company (SmartQ, currently owned by Huami) does not care even a little about this sort of thing. I checked theit site every which way I could, and found no sources. Emaling them produced no reply, of course. Of course, why would it? I tried to find some people on LinkedIn who might help, but I was told in no uncertain terms to go away.

With increasing amounts of SW development moving to low-cost countries, this sort of attitude may well eventually destroy the availability of the 'free' software that these manufacturers rely on (besides hurting the GPL + homebrew firmware communities).


On the other hand, how the Chinese system of "openness" works means that detailed hardware documentation is often freely available if you know where to look, even that which would be NDA'd and basically impossible to get from a Western company:

http://www.bunniestudios.com/blog/?p=4297

Consider if the SoC was from Broadcom or Qualcomm or some other Western company. You'd probably be able to get source code, but having that doesn't show as much about what else the hardware can do as they're not going to share datasheets with you (and there's unlikely to be anyone willing to leak them either.)

Edit: have you looked at Ingenic's site? They have what appears to be Linux source code available:

http://www.ingenic.cn/en/?product/id/6/lm/1.html


Ingenic does. Which is of no help as it has no drivers for this watch. See last paragraph of my article


Yes, and many times to get that information you need to find someone to contact, talk to them, present yourself as a good connection, and hope that they actually give you what you ask for.


one of my frustrations when working at Qualcomm was my inability to get data sheets released without an NDA. Hackerspaces don't want to sign NDAs.


> With increasing amounts of SW development moving to low-cost countries, this sort of attitude may well eventually destroy the availability of the 'free' software that these manufacturers rely on (besides hurting the GPL + homebrew firmware communities).

Even in developed countries, a lot of projects that historically chose BSD or MIT ("why should we choose GPL? Companies will contribute back anyway") are starting to change their mind because more and more companies just take publicly available code and sell it, never contributing back. Just think about Google (which uses Apache code, but doesn’t contribute back) or VMware (which openly violates the GPL).

As long as humans are greedy, we’ll have to find a technical solution to protect against such immoral people or organizations.


I'm not sure why you put "Google (which uses Apache code, but doesn’t contribute back)" and "VMware (which openly violates the GPL)" in the same sentence. One is legal, the other one isn't. You're not forced to contribute to anything, GPL or not.

But it's worth remembering that Google's involvement goes further than just extra commits. For example - if Google uses something, they'll likely do a better security testing of the product than many other companies. Their security reports always go back to other projects.


> I'm not sure why you put "Google (which uses Apache code, but doesn’t contribute back)" and "VMware (which openly violates the GPL)" in the same sentence. One is legal, the other one isn't. You're not forced to contribute to anything, GPL or not.

Simple: While legally there’s a difference between Apache and GPL, from a purely ethical standpoint, there isn’t really – you took something that belonged to the public, you contribute back to the public.


> > I'm not sure why you put "Google (which uses Apache code, but doesn’t contribute back)" and "VMware (which openly violates the GPL)" in the same sentence. One is legal, the other one isn't. You're not forced to contribute to anything, GPL or not.

> Simple: While legally there’s a difference between Apache and GPL, from a purely ethical standpoint, there isn’t really – you took something that belonged to the public, you contribute back to the public.

Which leads to the question "why not use the GPL for everything?". To be honest, I actually fall into the camp of "we should be pushing for the GPL for most non-trivial software".


> Google (which uses Apache code, but doesn’t contribute back

I disagree. Outside of Raleigh, I think Google is currently one of the biggest champions of 'giving back' in letter and spirit (code contributions and research papers). Would you mind expanding on how Google doesn't give back?


Have you seen what happened with the Android Open Source Project recently?

Google took the code and closed almost all of it.

They took, but don’t give back: The Email Client, the Launcher, the Dialer, the Calendar, the Contacts app – all of that is now closed source.

You can’t do anything on Open Source Android anymore.


It's a shame they seem to be getting away with it, too.

Not the least because it's quite unfair competition for companies based in countries where the GPL is more likely to be enforced!


The company that bought them (Huami) has USA offices, so they are not as well insulated from the law as they might think :)


> With increasing amounts of SW development moving to low-cost countries, this sort of attitude may well eventually destroy the availability of the 'free' software that these manufacturers rely on (besides hurting the GPL + homebrew firmware communities).

Yeah that's why you need trade deals which include strong intellectual property provisions like ACTA, TPP, TTIP. Ohh wait we're all supposed to hate those because Hollywood. But yeah if you want copyright protection for GPL code you also get copyright for other things.


dimity - nice hack :)

I'd argue that the most critical piece of work is power management for the watch. Did this magically port over or does the system just run at full whack?

Cheers,

Nick


Android does power management relatively well. In the kernel I am working on (the one I mentioned in the end - the almost-working one) I have a few cool hacks I am trying, like using the JZ4775's DMA engine as a sensor hub (it is a small MIPS cpu that cna run arbitrary code)


What I'm interested in is running Debian and X on the watch... any pointers?


0x3A28213A, 0x6339392C, 0x7363682E...

But in all seriousness, getting Debian/X on this probably wouldn't be that hard after dmitry's work, probably just getting a basic working framebuffer driver, packing a modified Debian ramdisk and the kernel blob in an aboot image, and having the ramdisk bootstrap the rootfs on the NAND, start X with fbdev, and load MicroWM or something. That was basically what I did a while back trying to get Angstrom on a Chinese camera that ran Android and it worked okay...


It already has a linux kernel with WiFi support. Android build tools will happily package your ramdisk together with the kernel into an android boot image. The "system" image you provide to the unbricking tool will be written unmodified unto the system partition.

That is to say that the work is all done for you. Enjoy :)


Cheers. Sounds promising :)


If you do get this running (or even get started) I'd be interested - I've had a project for a long time to get Debian running on the Nexus 4.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: