Project

General

Profile

LG Optimus Black (p970)

Added by Linus Drumbler almost 4 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 (27)

RE: LG Optimus Black (p970) - Added by Paul Kocialkowski almost 4 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 almost 4 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 almost 4 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 almost 4 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 almost 4 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:
    etc/firmware/fw_bcm4329.bin
    etc/firmware/fw_bcm4329_ap.bin
    
  • Bluetooth firmware:
    etc/firmware/BCM43291A0_003.001.013.0066.xxxx_B-Project.hcd
    
  • RIL-related libraries:
    bin/rild
    lib/libril.so
    lib/lge-ril.so
    

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:

AT+CSCA?
+CSCA:
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):
    etc/omapcam/fw3a.conf
    etc/omapcam/cid43_imx072_awb_tuning.bin
    etc/omapcam/imx072_dtp.dat
    etc/omapcam/imx072.rev
    
  • Camera-related libraries
    lib/libcapl.so
    lib/libyuvfastconvert.so
    lib/libicamera.so
    lib/libaf_lg_2.0.so
    lib/hw/camera.omap3.so
    

    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:
    lib/hw/gps.omap3.so
    bin/glgps
    

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

  • Sensors:
    lib/hw/sensors.omap3.so
    lib/libmpl.so
    lib/libmllite.so
    lib/libmlplatform.so
    

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:
lib/hw/audio_policy.default.so
lib/hw/audio.primary.default.so
lib/libtinyalsa.so

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:
lib/libini.so
lib/dsp/g729enc_sn.dll64P
lib/dsp/nbamrdec_sn.dll64P
lib/dsp/monitor_tiomap3430.dof64P
lib/dsp/star.l64P
lib/dsp/h264vdec_sn.dll64P
lib/dsp/conversions.dll64P
lib/dsp/m4venc_sn.dll64P
lib/dsp/g729dec_sn.dll64P
lib/dsp/qosdyn_3430.dll64P
lib/dsp/720p_divx_mp4vdec_sn.dll64P
lib/dsp/mpeg4aacdec_sn.dll64P
lib/dsp/720p_h264venc_sn.dll64P
lib/dsp/g722enc_sn.dll64P
lib/dsp/dctn_dyn.dll64P
lib/dsp/dfgm.dll64P
lib/dsp/ilbcdec_sn.dll64P
lib/dsp/mp3dec_sn.dll64P
lib/dsp/wbamrdec_sn.dll64P
lib/dsp/g722dec_sn.dll64P
lib/dsp/wmv9dec_sn.dll64P
lib/dsp/g726enc_sn.dll64P
lib/dsp/jpegenc_sn.dll64P
lib/dsp/yuvconvert.l64p
lib/dsp/720p_h264vdec_sn.dll64P
lib/dsp/chromasuppress.l64p
lib/dsp/ddspbase_tiomap3430.dof64P
lib/dsp/wbamrenc_sn.dll64P
lib/dsp/dynbase_tiomap3430.dof64P
lib/dsp/ringio.dll64P
lib/dsp/g711enc_sn.dll64P
lib/dsp/h264venc_sn.dll64P
lib/dsp/720p_wmv9vdec_sn.dll64P
lib/dsp/wmadec_sn.dll64P
lib/dsp/eenf_ti.l64P
lib/dsp/ipp_sn.dll64P
lib/dsp/ittiam_divx3vdec_sn.dll64P
lib/dsp/g726dec_sn.dll64P
lib/dsp/sparkdec_sn.dll64P
lib/dsp/nbamrenc_sn.dll64P
lib/dsp/usn.dll64P
lib/dsp/720p_mp4vdec_sn.dll64P
lib/dsp/baseimage.map
lib/dsp/vpp_sn.dll64P
lib/dsp/g711dec_sn.dll64P
lib/dsp/ilbcenc_sn.dll64P
lib/dsp/baseimage.dof
lib/dsp/mp4vdec_sn.dll64P
lib/dsp/postprocessor_dualout.dll64P
lib/dsp/720p_mp4venc_sn.dll64P
lib/dsp/jpegdec_sn.dll64P
lib/dsp/mpeg4aacenc_sn.dll64P
lib/libaffw_2.0.so
lib/libImagePipeline.so
lib/libicapture.so
vendor/lib/drm/libdrmwvmplugin.so
lib/libOMX.TI.mp4.splt.Encoder.so
lib/libOMX.TI.h264.splt.Encoder.so
lib/libOMX.TI.720P.Encoder.so
lib/libOMX.TI.720P.Decoder.so
lib/libOMX.ITTIAM.AAC.encode.so
lib/libOMX.ITTIAM.AAC.decode.so

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
vendor/lib/libpvrANDROID_WSEGL.so
vendor/lib/libsrv_init.so
vendor/lib/liblvverx.so
vendor/lib/libwvm.so
vendor/lib/libglslcompiler.so
vendor/lib/libsrv_um.so
vendor/lib/libwvdrm_L3.so
vendor/lib/hw/gralloc.omap3.so
vendor/lib/libWVStreamControlAPI_L3.so
vendor/lib/liblvvetx.so
vendor/lib/libusc.so
vendor/lib/libPVRScopeServices.so
vendor/lib/libIMGegl.so
vendor/lib/egl/libGLESv2_POWERVR_SGX530_125.so
vendor/lib/egl/libGLESv1_CM_POWERVR_SGX530_125.so
vendor/lib/egl/libEGL_POWERVR_SGX530_125.so
vendor/lib/libpvr2d.so
bin/pvrsrvctl
bin/fw3a_core
bin/pvrsrvinit

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 almost 4 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 almost 4 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 almost 4 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 almost 4 years ago

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

RE: LG Optimus Black (p970) - Added by Linus Drumbler almost 4 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 almost 4 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-5.8.1.3-p970.img /data/local/tmp/
adb shell "su -c 'dd if=/data/local/tmp/recovery-clockwork-touch-5.8.1.3-p970.img of=/dev/block/mmcblk0p4'" 
adb shell "rm /data/local/tmp/recovery-clockwork-touch-5.8.1.3-p970.img" 

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 almost 4 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 almost 4 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 almost 4 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 almost 4 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 almost 4 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 almost 4 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 almost 4 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 almost 4 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 almost 4 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 almost 4 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 almost 4 years ago

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

RE: LG Optimus Black (p970) - Added by Linus Drumbler almost 4 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.

RE: LG Optimus Black (p970) - Added by David Hedlund about 2 months ago

Here's the battery specifications I received from LG Care Center in a email:

BL-44JN 3.7V
1.5AH
300mAH

RE: LG Optimus Black (p970) - Added by David Hedlund about 2 months ago

Specifications for the phone

Can you please fill this for me Paul?

Documentation about the device should will be committed to the Replicant wiki
when possible!

LG Optimus Black (P970)
  • Free hardware: Y/N

No.

  • Free firmwares: Y/N

No.

  • Free modem system: Y/N

No.

  • Free bootrom and bootloader: Y/N

Bootrom is read-only, so no. It can be seen as hardware, though.
The device is however supported by U-Boot, a free software bootloader.

  • Free system and applications: Y/N

Will be when Replicant supports the device. However, some features like graphics
acceleration, GPS and Wi-Fi won't be supported.

  • Baseband processor integrated in the same chip or into separate chips: Y/N

Separate chips.

  • Baseband processor isolated from
    • GPS: Y/N

Likely.

  • RAM: Y/N

Likely.

  • user I/O: Y/N

Likely.

  • storage: Y/N

Likely.

  • camera: Y/N

Likely.

  • microphone: Y/N

Likely.

It's impossible to say for sure, we can only find out about that from leaked
datasheets, but we can't check that they match the actual device layout.

(1-25/27)