[ROM][4.4.4] Cyanogenmod-11 for Lenovo A2109 (20160510)

PJBrs

Senior Member
Developer
Dec 29, 2014
480
405
EDIT May 10, 2016: Android security patch for May 1.
EDIT April 25, 2016: Various security fixes, especially the kernel.
EDIT March 18, 2016: Turn off GPS logging because it filled up /data/gps/log/ with garbage
EDIT March 04, 2016: Kernel fix for suspected firmware bug that can potentially hard brick your device, and perhaps a few security fixes from Google
EDIT October 01: 1) Fix battery drain (no deep sleep) when wifi disabled; 2) Fix Bluetooth mouse has no pointer; 3) Fix Bluetooth sound is popping / crackly when screen turned off; 4) Fix autobrightness still a bit wonky. 5) Switch to row i/o scheduler for better latency
EDIT August 24: Fix Wifi rotation lock switch
EDIT July 20: Fix Wifi-direct, bluesleep
EDIT June 25: Sensors working, vold working (usb-otg, external sdcard)

This is Cyanogenmod-11 for Lenovo IdeaTab A2109.
This ROM is currently more feature complete than 4.2.2 and on feature parity with stock 4.1.1. You need to upgrade cwm first, older cwm's do not support kitkat roms. Also, the older cwm included a kernel bug with a potential risk to brick your device (see here for details)

Recovery:
cwm-6.0.5.1-20160217-UNOFFICIAL-kai.img (MD5: 2709d97274ebb8d09b14365695a46dc0)

KitKat (Cyanogenmod-11):
cm-11-20160510-UNOFFICIAL-kai.zip (md5: b1bca2bfcb7c3126e28c34511e04adc4)

Features
Working:
  • Sound (mic and speakers)
  • EGL
  • Video-playback
  • HDMI-out
  • Bluetooth
  • Bluesleep
  • Wifi
  • Wifi-direct (wifi-p2p)
  • GPS
  • Camera
  • USB-OTG
  • External sdcard
  • SeLinux
  • Hardware rotation lock button
Bugs:
  • Cast screen to chromecast doesn't work
  • Recovery appears to list external SD-Card twice
  • Let me know :)

Installation
General installation instructions for people coming from stock (I added some commands that work on Linux, I'm not familiar with Windows beyond XP):
  1. Put the ROM on your SD-Card
  2. (Optional) put gapps on your SD-Card
  3. Install fastboot and adb on PC
  4. Reboot to bootloader (e.g., via adb: $ adb reboot bootloader)
  5. Unlock bootloader ($ fastboot -i 0x17ef oem unlock) WARNING: this results in a factory reset
  6. Flash recovery ($ fastboot -i 0x17ef flash recovery cwm-6.0.5.1-UNOFFICIAL-kai.img)
  7. Reboot to recovery
  8. (Optional) back-up current ROM
  9. Clean cache and dalvik cache
  10. Install new ROM
  11. Reboot
Basics for installation are over here:
[HOW TO] Install ClockworkMod Recovery and Root | Android Tablet Forum
Unlock A2109 Boot Loader with Ubuntu | Android Tablet Forum

Sources are here:
PJBrs/android_device_lenovo_kai · GitHub

Donations
Donations are currently quite welcome to support ongoing development of Lollipop.

Build instructions
For Cyanogenmod 11.0, first install repo. Then create a root directory for your cyanogenmod source (e.g. ~/src/cyanogenmod). Go into that directory and do:
Code:
$ repo init -u https://github.com/CyanogenMod/android.git -b cm-11.0

The -b switch selects which branch you'll build.

Add my local_manifest.xml to .repo/local_manifests/ in the root of your source tree, and then do:
Code:
$ repo sync
You probably need to get some cyanogenmod prebuilts:
Code:
$ cd vendor/cm
$ ./get-prebuilts

The most difficult step is to get the proprietary blobs. Connect your device, activate adb and put it in your path, go into device/lenovo/kai and run
Code:
$ ./extract-files.sh
Note that the script expects stock Jelly Bean to be installed!

I've made a setup-makefiles.sh script that is able to mix kai binaries with grouper binaries, but it does need the grouper vendor tree to be present. See proprietary-files.txt and grouper-unique-blob-list.txt for suggestions and (mediocre) documentation. Download the grouper binaries for KitKat-4.4.4 from here:

Binaries for Nexus Devices

You probably don't need them all but I haven't really thought about which ones to leave out. Basically this is a set of archives that each contain one selfextracting script. If you all run them in the root directory of your cyanogenmod tree, you end up with a vendor tree for grouper. Next, go to the device/lenovo/kai tree and run the following:
Code:
$ ./setup-makefiles.sh
Now go back to your the root of your source tree, and then it should be as simple as:
Code:
$ . build/envsetup.sh && brunch cm_kai-userdebug

Thanks to cyanogenmod for a great rom and to all those real devs writing compatibility patches!

Finally, a few keywords so that this post at least can be found from Google:
Custom Rom, Lenovo IdeaTab A2109, Android KitKat 4.4.4, Cyanogenmod 11
 
Last edited:

profeet

Senior Member
Aug 17, 2014
42
7
Wow, nice job, thx for your hard work.
But I will test it later. I need otg and ext sdcard working. Wait for fix.
And what about gps? Is it working?
 

DBlake

Senior Member
Nov 29, 2013
90
24
Wow, nice job, thx for your hard work.
But I will test it later. I need otg and ext sdcard working. Wait for fix.
And what about gps? Is it working?
He said GPS was working in the older test build so I assume it is here.
 

DBlake

Senior Member
Nov 29, 2013
90
24
He said GPS was working in the older test build so I assume it is here.
Also, since my USB cable broke (new one in the mail), I installed the new recovery via DD (risky yes, works yes):

Code:
dd if=/sdcard/recovery-image-file.img of=/dev/block/platform/sdhci-tegra.3/by-name/SOS

EDIT1 FIRST BUG: Android crashes to boot screen (hotboots) sometimes when switching apps.

EDIT2: noticed this in aLogcat:

Code:
E/AudioManagerAndroid(15925): BLUETOOTH permission is missing!
 
Last edited:

PJBrs

Senior Member
Developer
Dec 29, 2014
480
405
Also, since my USB cable broke (new one in the mail), I installed the new recovery via DD (risky yes, works yes):

Code:
dd if=/sdcard/recovery-image-file.img of=/dev/block/platform/sdhci-tegra.3/by-name/SOS

EDIT1 FIRST BUG: Android crashes to boot screen (hotboots) sometimes when switching apps.
Yep... We need to get logcat for this one. I noticed that the app switcher doesn't display screen dumps. Might be related.
EDIT2: noticed this in aLogcat:

Code:
E/AudioManagerAndroid(15925): BLUETOOTH permission is missing!

I googled that one, shouldn't be a problem.

Thanks very much for testing!
 

DBlake

Senior Member
Nov 29, 2013
90
24
Yep... We need to get logcat for this one. I noticed that the app switcher doesn't display screen dumps. Might be related.


I googled that one, shouldn't be a problem.

Thanks very much for testing!

No problem. I might try a grouper 4.4 ROM now that we have the kernel and recovery for it.

Did you happen to get a tracking number or anything for that package?
 

PJBrs

Senior Member
Developer
Dec 29, 2014
480
405
No problem. I might try a grouper 4.4 ROM now that we have the kernel and recovery for it.

A small note on this. I initially replaced a few stock libraries with grouper EGL and GLES libraries (the nvidia blobs) to my first build and the actually worked fine without setting additional build flags. I don't quite remember which ones, but they included, IIRC:
Code:
gralloc.tegra3.so
hwcomposer.tegra3.so
libEGL_tegra.so
libGLESv1_CM_tegra.so
libGLESv2_tegra.so
libnvos.so
libnvrm.so
libnvrm_graphics.so
libnvddk_2d.so
libnvwsi.so
libardrv_dynamic.so
libcgdrv.so
libnvddk_2d_v2.so
libnvtvmr.so

These all go to /system/lib, except the first two, which go to /system/lib/hw (they are HALs). Also, I renamed them gralloc.tegra.so and hwcomposer.tegra.so, with symlinks to their original names. This means that our tablet runs current CM (and possibly even AOSP) by just using a few grouper libs. Nice path to the future, don't you think :).

The only problem with them is that our camera HAL is incompatible with them. If we could work around that problem, then working on Lollipop would be all the more easy. However, for now I took a different route, reverting to our older, stock nvidia blobs, and adding two build flags to BoardConfig.mk

Code:
BOARD_EGL_SKIP_FIRST_DEQUEUE := true
BOARD_EGL_WORKAROUND_BUG_10194508 := true

So, I'm especially curious if you get the grouper camera HAL working. If not, you might try to experiment with tf700t or tf300t camera HALs (and libnvcamerahdr.so, see previous thread for an example) to see whether that works. And else I have one more idea that shouldn't, but might work :)

Good luck!
 
Last edited:

fusm

Senior Member
Jun 5, 2014
58
8
smooth and fast. But not stable currently, after several automatically reboots, I have to restore to previous version.
Awaiting stable version.
Thanks for your hard work.
 

PJBrs

Senior Member
Developer
Dec 29, 2014
480
405
smooth and fast. But not stable currently, after several automatically reboots, I have to restore to previous version.
Awaiting stable version.
Thanks for your hard work.
Did you manage to capture logcat? I tried another build flag but it didn't seem to work, the issue might actually be a bug in our stock EGL drivers.
 

fusm

Senior Member
Jun 5, 2014
58
8
Did you manage to capture logcat? I tried another build flag but it didn't seem to work, the issue might actually be a bug in our stock EGL drivers.
I'm glad to, but how to capture logcat?
 

DBlake

Senior Member
Nov 29, 2013
90
24
I'm glad to, but how to capture logcat?
If you have the LeTools installed, open a Command Prompt window in the folder it is installed to (usually C:\Program Files (x86)\Lenovo\LeTools\), connect your tablet to your computer via the USB cable, and issue this command in the prompt you prepared:
Code:
adb.exe logcat > "%userprofile%\Desktop\Log.txt"
Leave that command running in the background as you play around with your tablet and wait for the hotboot error to occur (tablet goes to bootscreen). After that, you can close that command prompt window and upload the Log.txt that is now on your desktop.
 

fusm

Senior Member
Jun 5, 2014
58
8
Uploaded the logcat output. It's very hard to copy it to my computer, why I cannot see it via media storage from usb connection?
 

Attachments

  • logcat_fusm.txt
    401.8 KB · Views: 1,063

PJBrs

Senior Member
Developer
Dec 29, 2014
480
405
@DBlake thanks very much for the logcat instruction!

Uploaded the logcat output. It's very hard to copy it to my computer, why I cannot see it via media storage from usb connection?

@fusm Thanks for the logcat. Your crash points at libEGL, as do the crashes I collected. Yours is different from mine, so I think it is hard tot repair... I'll upload a non-crashing alternative in a couple of days.
 
Top