LG Optimus Black (p970)

Added by Linus Drumbler over 3 years ago

From its Wikipedia article (http://en.wikipedia.org/wiki/LG_Optimus_Black) this phone was originally released with Android 2.2, but its latest possible upgrade is 4.0. So I think a port of 4.0 would be better than 4.2. Nevertheless, you're the developer.

Replies (23)

RE: LG Optimus Black (p970) - Added by Paul Kocialkowski over 3 years ago

We are still not sure we're going to maintain 4.0 once 4.2 is out. We don't have extensive human resources and have to do what's best.
A port looks doable however, it is very unlikely that the kernel is signed (it builds the kernel on CM) and most basic functionalities will work.

RE: LG Optimus Black (p970) - Added by Linus Drumbler over 3 years ago

I'll save you some work: I'm going to try to buy this device and port to it. I'll post updates on this thread. Stay tuned!

RE: LG Optimus Black (p970) - Added by Paul Kocialkowski over 3 years ago

Wow that would be great! What are you programming skills?
About whether to do 4.0 over 4.2, it may depend on how graphics work out on 4.2: if it's too slow, 4.0 may be better. However, omap3 devices should be pretty fast.
I am still wondering whether to backport the improvements I did for 4.2 to 4.0, maybe you could have some weight in my thinking.

RE: LG Optimus Black (p970) - Added by Linus Drumbler over 3 years ago

This does not look good. I found the list of proprietary blobs: https://github.com/CyanogenMod/android_device_lge_p970/blob/cm-10.1/proprietary-files.txt. Even judging by only the file names I can understand, they control the camera, GPS, sensors, audio and video playback...I think we'll be lucky just to get telephony working on this one.

RE: LG Optimus Black (p970) - Added by Paul Kocialkowski over 3 years ago

Wait, don't jump to conclusions so fast. Amongst these proprietary files, you have to find out exactly which are:
  • firmwares
  • non-replaceable libraries
  • replaceable libraries
Here is my analysis of it:
  • WiFi firmwares:
  • Bluetooth firmware:
  • RIL-related libraries:

We will need to replace lge-ril.so depending on what protocol it uses. I downloaded the build CyanogenMod zip (http://download.cyanogenmod.org/?device=p970).
Now running strings against lge-ril.so shows lots of strings like:

ERROR: AT COMMAND failed: %s

So it is definitely AT, and there is free software for that, so it's replaceable.

  • Camera-related firmwares and config (some may be avoidable if the firmware is already preinstalled on the chip):
  • Camera-related libraries

    Many different situations can happen here:
  • The camera needs firmwares and/or calibration data and cannot work without, so camera won't work out of the box with Replicant in any way
  • The camera interface is standard V4L2, so it is easy to trace and you can write an implementation for it
  • It is not standard v4l2 and you have to see if you can figure it out (but it may be very complex)
  • Camera may depend on proprietary libraries for handling the stream (resizing, format conversion, encoding JPEG, etc) which will be a no-go
  • GPS binaries:

The GPS is BCM4751, so there is no hope it'll work.

  • Sensors:

Sensors are always possible to replace if you know enough about the maths behind them. Worst case scenario, you may have to figure out calibration algorithms, but you'll probably still get light, accelerometer and a few others working with some work. Success also depends on how much documentation there is about the chips.

  • Audio in/out:

libtinyalsa is free software, I don't know why it is listed here. It shows that it uses ALSA, which means that with some work on getting the controls right, you'll make it work.

  • Audio/video decoding/encoding:

IIRC there is a free implementation for omap3, so you may get this to work, but perhaps it also needs firmwares, I don't remember. We usually drop all support for this anyway and use software decoding instead.

  • Graphics acceleration

We gave up on trying to replace all that long ago…

So in the end, here is what I believe to be a realistic expectation about that phone:
  • 2D graphics: omap3 are supposedly fast enough
  • 3D graphics: will be missing
  • Sound: will work with some work from you
  • Telephony/data: will work with some work from you
  • WiFi/Bluetooth: not working without the firmwares
  • GPS: will be missing
  • Sensors: you'll probably make most of them work if you work hard enough
  • Camera: that really depends, but I wouldn't count on it

Overall is pretty good, at least it matches our basic standards. Now you may be interested in learning details about the phone's hardware and how isolated its modem is (look for a Service Manual of some kind).

RE: LG Optimus Black (p970) - Added by Paul Kocialkowski over 3 years ago

Some notes about the hardware:
  • Modem is XMM6160 with AT (very common baseband, same as the Nexus S's one)
  • Modem isolation looks good from the service manual
  • The modem storage is apparently a separate chip from the SoC's memory which is good
  • The codec is independent
  • GPS is definitely BCM4751

RE: LG Optimus Black (p970) - Added by Linus Drumbler over 3 years ago

I've got the phone, but it's so locked up tight I can't seem to boot into recovery to install CyanogenMod. It could be that I have the P970g (which differed only in software, as far as I knew).

RE: LG Optimus Black (p970) - Added by Linus Drumbler over 3 years ago

I should add that the SDK (fastboot and adb) doesn't recognize the device, even though I've enabled USB debugging.

RE: LG Optimus Black (p970) - Added by Linus Drumbler over 3 years ago

xda-developers thread: forum.xda-developers.com/showthread.php?p=47713467

RE: LG Optimus Black (p970) - Added by Linus Drumbler over 3 years ago

This really does not look good. Installing CyanogenMod requires installing a custom recovery, which seems to require proprietary software. I'm communicating with the developer, asking him to release the source code.

RE: LG Optimus Black (p970) - Added by Paul Kocialkowski over 3 years ago

From reading the instructions, it looks to me like it's using ClockworkMod, which is free. The device repository at CyanogenMod also holds all the needed pieces to build CWM for the device, so I think it will work.

Now as you apparently understood, the big piece left is how to flash recovery to the device. The relevant thread is: http://forum.xda-developers.com/showthread.php?t=1111771
This thread makes it seems like only proprietary tools can be used to flash.

However, there is http://theunlockr.com/2012/11/11/how-to-install-clockworkmod-recovery-on-the-lg-optimus-black/ which flashes using a (windows) batch script that does this:

adb push recovery-clockwork-touch- /data/local/tmp/
adb shell "su -c 'dd if=/data/local/tmp/recovery-clockwork-touch- of=/dev/block/mmcblk0p4'" 
adb shell "rm /data/local/tmp/recovery-clockwork-touch-" 

So that's a lead (don't try these commands directly though)!

Which would only succeed if you are root on the device. Can you enable usb debugging on the device, then run (on the host pc):

sudo adb kill-server
sudo adb start-server
adb shell

and see whether you are root or not?

Sidenote: apparently, the device uses u-boot! If it is not signed, it will be possible to replace it with a free version of u-boot. Maybe we should look into that at some point.

RE: LG Optimus Black (p970) - Added by Linus Drumbler over 3 years ago

That worked perfectly, and I'm not root. So it seems we need to root the device first.

The Optimus Black I have is running Froyo, and the root exploits seem to focus on Gingerbread. Now, it appears that upgrades to Gingerbread can only be flashed using non-free tools. (Of course, we've determined in the thread on the L9 that anything we run on the phone is fine because it's going to be erased anyway.)

I tried running GingerBreak, but it didn't work after 10 minutes (the borderline according to http://forum.xda-developers.com/showpost.php?p=41105811&postcount=4). Our only remaining option is the root utility Blackjack, mentioned in that same post. But that looks non-free too.

RE: LG Optimus Black (p970) - Added by Paul Kocialkowski over 3 years ago

Ok apparently, some of the applications that do root exploits have their source code available, so perhaps they are free software.
If there is a generic way to get root that is free software, then we should mention it in the installation instructions, or we could leave it up to the user to root the phone.

In any way, it is important that succeed at getting root on the current system. When this is achieved, we should look into building recovery for your device.
However, it seems that the phone does not have 4.0 support in CyanogenMod's device repository, so you will have to work with Replicant 4.2, which is not ready yet.
The best solution is probably to wait until I declare 4.2 ready to accept new ports. In the meantime, you should try to install CyanogenMod on the phone.

RE: LG Optimus Black (p970) - Added by Linus Drumbler over 3 years ago

That's exactly what I've been trying to do! CyanogenMod gives instructions for actually installing the .zip file, but not for installing the recovery necessary to install that. So I'm in uncharted territory.

I've contacted the author of the root exploit for the Optimus Black running Froyo, asking him to release the source code. Let's keep our fingers crossed.

RE: LG Optimus Black (p970) - Added by Linus Drumbler over 3 years ago

Am I ever glad I discovered these! http://theunlockr.com/2012/11/11/how-to-install-clockworkmod-recovery-on-the-lg-optimus-black/#comment-765028686 http://forum.xda-developers.com/showthread.php?t=2094640

Looks like you need to install a custom ROM first, then ClockworkMod, but the tools to do so are non-free.

RE: LG Optimus Black (p970) - Added by Linus Drumbler over 3 years ago

Okay, issue cleared up. http://forum.xda-developers.com/showpost.php?p=47779649&postcount=12

As I find more about this device, it really looks to be a limited scope of support. If users are running Froyo, a non-free (at least until that author responds) exploit is required to root flash ClockworkMod. If they're running Ice Cream Sandwich, flashing ClockworkMod (even as root) will brick the device, and downgrading to Gingerbread appears to require non-free tools.

I have access to a Windows computer, and could use that to flash Gingerbread and install CWM and CyanogenMod, but I'm holding off for a while to see if the Froyo exploit author responds.

RE: LG Optimus Black (p970) - Added by Linus Drumbler over 3 years ago

The good news is, I was pointed to this: http://forum.xda-developers.com/showthread.php?t=2160394 to unlock the bootloader and install CWM for Ice Cream Sandwich, but it requires root. There's a fix for everything but Froyo...

RE: LG Optimus Black (p970) - Added by Paul Kocialkowski over 3 years ago

So basically, you still didn't find any way to get root on the device? It seems that once root is acquired, using dd to the recovery partition will work and make it possible to install CM/Replicant/whatever.

Fun fact: I met someone who owned this device yesterday (the guy recognized the phone while I was reading its service manual at a local free software event) and he told me the only way he succeeded at flashing his device was with using the windows flash tool. I am however still convinced that it can work with a root exploit. Also, even if not designed for your phone, there are generic root exploits for froyo (and likely other versions of Android as well) and I bet some of them are free software.

Now that you have adb shell working, you can basically build one of these, push it to the device, run it and see.

RE: LG Optimus Black (p970) - Added by Linus Drumbler over 3 years ago

Okay, success! I got this response: http://forum.xda-developers.com/showthread.php?p=47805359#post47805359, and I found this source code for one of the files: https://sites.google.com/site/root4android/rooting/psneuter-c, and everything else is free software or has source available. And it's all run on the phone!

As soon as that user can point me to the binaries, we're good to go for both Gingerbread and Froyo. I'll look into Ice Cream Sandwich next.

RE: LG Optimus Black (p970) - Added by Paul Kocialkowski over 3 years ago

Nice, let me know if you succeed at:
1. getting root
2. installing recovery
3. installing CyanogenMod

RE: LG Optimus Black (p970) - Added by Linus Drumbler over 3 years ago

I got root, I installed recovery, and I installed CyanogenMod...and now I can't boot the device. http://forum.xda-developers.com/showthread.php?p=47837753

RE: LG Optimus Black (p970) - Added by Paul Kocialkowski over 3 years ago

Most likely you forgot to wipe data/factory reset in recovery.

RE: LG Optimus Black (p970) - Added by Linus Drumbler over 3 years ago

You are correct! Note to self: follow CyanogenMod's installation instructions exactly. I've now installed CyanogenMod on the device. Graphics are quite fast, but that may change once I get rid of the blobs.