[ROM][5.1.1] AOSP-5.1.1 / CM-12.1 for Lenovo a2109 (20160901)

PJBrs

Senior Member
Developer
Dec 29, 2014
480
405
This is Android-5.1.1 Lollipop for Lenovo A2109.

Cyanogenmod:

cm-12.1-20160914-UNOFFICIAL-kai.zip (md5: 2a5444116855d8ba7753ed991965a2f7;
Security fixes up to and including August 2016)

AOSP:
aosp_kai-ota-eng-5.1.1-May_2016.pj.zip (md5: ee454f6b160278b2e147500b30ff4074; Security fixes up to and including May 2016)

Note that AOSP will overwrite your recovery and it does not come pre-rooted.

Lollipop is on feature parity with KitKat and stock, and more secure.

Recent changes include security fixes for the kernel as well as for the android sources. More importantly, we're now back to stock proprietary libs, which fixes video conferencing.

THANKS TO:
@profeet, @fusm, @joebine, @killer2020 @jeremy6652 , @jam97, @Mister X and @DBlake for taking the time and having the courage for further testing.

And apologies to @joebine, @killer2020, @jam97, @johan111 and @kin-kwok who have all bricked their tablet during the development of lollipop for A2109, due to a firmware bug in the Samsung internal memory, that we finally were able to find the fix for.

Great thanks to the people behind p880-dev! Laufersteppenwolf, adam77root and thoemy have been a great inspiration and enabler for this rom! And thanks to cyanogenmod for a great rom and to all those real devs writing compatibility patches.

Donations remain welcome for funding motherboards.

Features
Working:
  • Sound (mic and speakers)
  • EGL
  • Video-playback
  • HDMI-out
  • Bluetooth
  • Bluesleep
  • Wifi
  • Wifi-direct (wifi-p2p)
  • GPS
  • Camera
  • Video recording
  • USB-OTG
  • External sdcard
  • SeLinux
  • Hardware rotation lock button
Bugs:
  • Cast screen to chromecast doesn't work
  • Screen recording results in a soft reboot
  • Let me know :)

Installation
These are general installation instructions for people coming from kitkat, who already have flashed a recovery image. I'm assuming that you're either using twrp or cwm-6.0.5.1. If you're using cwm, please ignore its offer to fix root after installation, on lollipop root works quite differently than on kitkat. 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 opengapps nano on your SD-Card (all other packages are too large)
  3. Install fastboot and adb on PC
  4. Reboot to recovery
  5. (Optional) back-up current ROM
  6. Clean cache and dalvik cache
  7. Install new ROM
  8. Reboot
Note that first boot takes ages.

Sources are here:
PJBrs/android_device_lenovo_kai · GitHub

Build instructions for Cyanogenmod
For Cyanogenmod 12.1, 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-12.1
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

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

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, grouper-unique-blob-list.txt and binary-hack-files.txt for suggestions and (mediocre) documentation. Download the grouper binaries for KitKat-5.1.1 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 self-extracting 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

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

PJBrs

Senior Member
Developer
Dec 29, 2014
480
405
Anyone know what to do about this error?
Code:
make: *** No rule to make target `frameworks/rs/scriptc/rs_cl.rsh', needed by `/home/pj/Src/Android/cyanogenmod/out/target/common/obj/APPS/Galaxy4_intermediates/src/RenderScript.stamp'.  Stop.
make: *** Waiting for unfinished jobs....

To answer my own question - one does not do anything about this error. Rather, I took out the Galaxy 4 and HoloSpiral wall paper, as well as some testing package, and that lets the build finish. Or in terms of local_manifest.xml:

Code:
  <remove-project name="CyanogenMod/android_packages_wallpapers_HoloSpiral" />
  <remove-project name="CyanogenMod/android_packages_wallpapers_Galaxy4" />
  <remove-project name="platform/frameworks/testing" />

So! I just installed my first Lollipop build! The recovery does not seem to work much, and the build itself offers a prolonged (indefinitely) view of the Lenovo logo while not giving any output via logcat. Hello square one, here we are. o_O
 
Last edited:

profeet

Senior Member
Aug 17, 2014
42
7
PJBrs, I think new recovery build first, then new rom. You have bootloop. Bad result is result too. Can't wait lollipop for testing.
 

PJBrs

Senior Member
Developer
Dec 29, 2014
480
405
Well, the bootloop is not the worst of the problems, haha!

First problem is that I have made some mistake somewhere causing none of the vendor blobs to be copied over. Hope I'll fix that soon. With regard to recovery... I wouldn't know where to begin yet, so I'm first focused on getting EGL going. I expect small problems with selinux. I expect big problems with sound and camera, I hope the rest will be fine. Regarding recovery... I really hope we can keep using CWM a bit more.

I added the following to default.prop inside the boot.img:
Code:
ro.adb.secure=0
ro.secure=0
ro.debuggable=1
persist.sys.usb.config=mtp,adb

Now at least I can contact adb and have some output :)
 

PJBrs

Senior Member
Developer
Dec 29, 2014
480
405
WE HAVE EGL!!!

YYYYEEEEEEEAAAAAAHHHHHH!!!!

:cool:

***EDIT***

We also have wifi, accellerometer, and lightsensor.

No sound, no camera. GPS does not seem to work either.

Did not test bluetooth, but seems okay.
 
Last edited:

jam97

Senior Member
Mar 26, 2013
95
15
Great news,

You are the man!

Thank you.

Sent from my SM-N910P using Tapatalk
 

PJBrs

Senior Member
Developer
Dec 29, 2014
480
405
To do:
GPS
Camera
Selinux
Rotation lock button

To test:
Bluetooth
USB-OTG
HDMI

Anyone want to test? Let me know, and what you can test.
 
Last edited:

jam97

Senior Member
Mar 26, 2013
95
15
Download link, please?
Can flash it through the old cm recovery?
Thanks,

Sent from my SM-N910P using Tapatalk
 

PJBrs

Senior Member
Developer
Dec 29, 2014
480
405
Download link, please?
Can flash it through the old cm recovery?

Almost ready for a download link, need to try and fix a build with a camera wrapper first though.

I also found that video playback works only in very few cases. Also, selinux=enforcing currently seems to prevent surfaceflinger from starting...

But things are looking better and better! I just was able to fix gps by using the glgps binary from tf300t :)
 

PJBrs

Senior Member
Developer
Dec 29, 2014
480
405
This is the christmas edition ;)

Here's a first build, still no camera, doesn't boot by itself because I still kept selinux at restrictive, but I added a tailor-made boot.img that you can use to kick off. Don't try this if you don't know what the following means!!! Note that I'm assuming a Linux user, the fastboot command might be a little bit different on Windows, I don't know. If you know how, you might be able to flash the boot.img with dd. But watch out not to brick your devices!

cm-12.1-20151224-UNOFFICIAL-kai.zip (md5: 7b61d51599005a2bdb3b67747a5065dd)
boot.img (md5: 9c9c5cd8a5df0c39c8282cbaf4444856)

Make sure you have fastboot installed, and preferably adb as well. Install the rom via cwm as usual. Then reboot to recovery and do:
Code:
# fastboot -i 0x17ef flash boot boot.img && fastboot -i 0x17ef reboot

Bad news: Selinux doesn't work, camera doesn't work, video-playback problems
Good news: Rotationlock button now works :)

Main working list:
  • EGL
  • WIFI
  • Sound
  • GPS
In need of testing:
  • USB-OTG
  • External sd-card
  • Bluetooth
  • HDMI
HAPPY TESTING!
 
Last edited:

PJBrs

Senior Member
Developer
Dec 29, 2014
480
405
Nice. Now all we need is a good optimized kernel.

I'm actually quite pleased with the current kernel, which I think should be completely Lollipop-proof given the amount of patches I included from Google's lollipop kernel branch for grouper. But if you want to add more, please clone my A2109-l4t-r16-r2 kernel branch and add what patches you think are useful.

My own priorities are:
  • Selinux
  • Power hal
  • Camera / video playback
  • Kernel 3.4 (required for Marshmallow)
By the way, did you get to do some testing?
 
Last edited:

DBlake

Senior Member
Nov 29, 2013
90
24
Haven't really been interested in much development. I suppose I'll have to dig the A2109 out and install this. Mostly haven't been interested because I've been looking for a MagSafe 1 charger for my MacBook Pro 2006.
 
Top