[ROM] AOSP/CM Jelly Bean 4.2.2 for a2109

Discussion in 'Lenovo IdeaTab A2109 Development' started by PJBrs, Dec 29, 2014.

  1. PJBrs

    PJBrs Senior Member Developer

    Joined:
    Dec 29, 2014
    Messages:
    358
    Likes Received:
    289
    Trophy Points:
    225
    ***EDIT 20150509***

    Hi, this thread is about compiling AOSP (preferably) and/or Cyanogenmod (if AOSP fails). AOSP-4.1.2 worked quite well. We're now at 4.2.2 / CM-10.1, and both seem quite alright, I'd say good enough for daily use (barring any remaining PEBCAK issues that I caused myself in the latest build).

    AOSP-4.2.2 (md5sum: b84c6d039edff8fd57766615d46f0f6b)
    CM-10.1 (md5sum: 12d29e6dd6aae23b808a49022bdaa1a1)
    Clockworkmod-6.0.3.7

    Source:
    http://github.com/PJBrs/android_device_lenovo_kai

    Build instructions for CM-10.1 are in the 86th post.
    Build instructions for AOSP-4.2.2 are in the 3rd post.

    Not working:
    • Hardware rotation lock button
    • Wifi-direct / wifi p2p
    • Bluetooth receive files on AOSP
    Autobrightness and bluetooth MAC address are "wonky".

    Of course, your suggestions are more than welcome!

    PJBrs

    ***ORIGINAL POST***
    Hi, I'm trying to build aosp Jelly Bean for a2109a. I'm trying to use as few blobs from lenovo as possible to get the tablet running. You can check out over here:

    http://github.com/PJBrs/android_device_lenovo_kai

    This work is very much based on what superhansi and kahlo007 have done! I am basically using their repo's, but trying to copy as little as possible. The end-goal is to have a working device tree that produces a quicker rom than stock (which is especially slow on internet) that can serve as an "easy" upgrade path to 4.2 and 4.3.

    I didn't include the proprietary blobs yet--I'm not sure whether that's legally allowed, even. However, the device_kai.mk file should give you a good idea of what I put where.

    Current status: device boots with EGL enabled. Some videos can be played. MTP-service appears to work. Bluetooth might work (but I'd be very surprised). Wifi doesn't work, audio doesn't work, camera doesn't work. So this is alpha work.

    Biggest current hurdle is wifi. The kernel module (bcmdhd) appears to load fine, I think I put all the firmware in the right locations, but I get something like:

    WifiStateMachine( 287): Failed to load driver!

    in logcat, and something like:

    WLAN placed in RESET

    in dmesg. My next step is to try a self-compiled kernel to get wifi going, haven't done so yet. The importance of having wifi is twofold--without wifi this whole thing is pointless anyway, and with wifi it's very easy to add a couple of apps from Google play to do some real testing.

    Anyone with a suggestion would be more than welcome!

    Best, PJ
     
    Last edited: May 9, 2015
    • Like Like x 3
  2. tasinofan

    tasinofan Senior Member

    Joined:
    Jan 13, 2013
    Messages:
    92
    Likes Received:
    23
    Trophy Points:
    180
    Location:
    Antwerp
    Tablet / Device:
    Medion Lifetab MD 99300 (S9714) aka Lenovo A2110
    Interesting idea to make an AOSP (which then hopefully can be upgraded 4.x 5.x)
    Do you have a complete build recipe I can try out?
     
  3. PJBrs

    PJBrs Senior Member Developer

    Joined:
    Dec 29, 2014
    Messages:
    358
    Likes Received:
    289
    Trophy Points:
    225
    *** EDITED for AOSP-4.2.2***

    Build recipe... Lemme see :) Step zero, get repo and, ideally, put it in your path. (Most information is presented over here: https://source.android.com/source/downloading.html).

    First, sync the android-4.2.2_r1.2 branch of the android aosp repo. Something like:

    $ mkdir aosp; cd aosp
    $ repo init -u https://android.googlesource.com/platform/manifest -b android-4.2.2_r1.2

    Add my device tree by adding my local manifest file (local_manifest.xml) to the directory ".repo/local_manifests/", which should be in the root of your aosp directory. Then, run:

    $ repo sync

    And now you should have the same sources that I have.

    Second, add the proprietary files. Connect the ideatab and activate adb on the tablet. On the host, make sure that adb is in your path. Go to the device/lenovo/kai directory in your aosp tree and run:

    $ ./extract-files.sh

    Next, download the grouper binaries for JellyBean from here: https://developers.google.com/android/nexus/drivers#grouperjdq39. 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 aosp tree, you end up with a vendor tree for grouper. Next, go to the device/lenovo/kai tree and run the following:

    $ ./setup-makefiles.sh

    This should "convert" the grouper device tree into a kai device tree. It uses grouper blobs by default, but it adds in a2109a blobs that are uncommented in proprietary-files.txt. You can experiment with different combinations of (un)commented blobs.

    (I have tested this script various times and it seems to do what it needs to do.)

    Third, to build, run your usual:

    $ . build/envsetup.sh
    $ lunch
    (choose 7. full_kai-userdebug)
    $ make -j n
    ... with n being your number of processor cores plus 1.

    Hope this works.
     
    Last edited: Apr 11, 2015
    • Like Like x 2
  4. PJBrs

    PJBrs Senior Member Developer

    Joined:
    Dec 29, 2014
    Messages:
    358
    Likes Received:
    289
    Trophy Points:
    225
    and a bit of good news--wifi works :)

    I actually don't know why, might be because I added a couple of more sensors libs (be sure to run extract-files.sh again), or just because I did make clobber. So no need to compile a new kernel after all. Next step should be audio and/or camera.
     
    • Like Like x 2
  5. tasinofan

    tasinofan Senior Member

    Joined:
    Jan 13, 2013
    Messages:
    92
    Likes Received:
    23
    Trophy Points:
    180
    Location:
    Antwerp
    Tablet / Device:
    Medion Lifetab MD 99300 (S9714) aka Lenovo A2110
    Thanks for kindly sharing instructions. I will try it soon, but not immediately (because of too much work).
     
  6. PJBrs

    PJBrs Senior Member Developer

    Joined:
    Dec 29, 2014
    Messages:
    358
    Likes Received:
    289
    Trophy Points:
    225
    Just a short update here. I guess the best way of describing a learning process is an iteration of failures and reflection ;-)

    Reflecting on my efforts of building aosp for a2109a, I think it was a failure to add proprietary libs to the device make file under the heading PRODUCT_COPY_FILES. Question--am I correct that every proprietary blob needs to have a specific makefile and be put in the vendor tree, in order for the rest of the build to correctly link to them? Because if so, that at least would explain what I don't have gps or camera, and possibly audio. Please let me know what your experiences are.

    Assuming this is the case, I am already working on a next try. I'm still using the grouper blobs as a basis, and I'm adding in blobs from our device, but this time I'll add them to the vendor blob makefiles. That'll take some time to properly script.

    I'm currently using the following inspirations for this whole porting business:

    * Superhansi's device repo for 4.2.2
    * Kahlo007's cm-repo
    * The Cyanogenmod tf700t repo
    * The nexus 7 device tree

    Also, I try to check for dependencies with $ readelf -d .

    I have no experience porting andriod before, I can not write android apps and I'm mostly unfamiliar with the android build process (apart from being able to produce a build, but that's rather basic). I am quite familiar with linux and I know how to grep my way around directory trees and how to produce simple shell scripts. Being a regular linux user, I also have often compiled packages from source, including the kernel. I don't plan to compile an a2109a kernel before I get completely stuck with all the other options, but please correct me if I'm wrong. In the meantime, if you have any additional advice for me, I'd be very happy to hear it.

    Current status.

    Working: EGL works, wifi works (but probably no p2p), usb MTP and PTP modes appear to work (not tested), bluetooth is able to send files, jack sense works.

    Not working: GPS, audio, camera. Probably wifi p2p, browsing the device via bluetooth, USB OTG

    Unknown: hdmi (but improbable), bluetooth headset support, NFC (does a2109a even have that?)

    Sources available at http://github.com/PJBrs/android_device_lenovo_kai/

    Tasinofan--the build currently doesn't work (go back a few commits and it should work again). I'll let you know when it works again.
     
    • Like Like x 1
  7. PJBrs

    PJBrs Senior Member Developer

    Joined:
    Dec 29, 2014
    Messages:
    358
    Likes Received:
    289
    Trophy Points:
    225
    So, the build currently works again, but somehow my vendor blobs seem to be ignored if I take them from the ideapad itself. I suspect that something small is wrong. I think one of the symptoms is that I have several goldfish an default libraries in the system/lib/hw directory, in addition to their tegra or kai counterparts. The result - boot fails at loading EGL. The big difference with the previous approach is that I just copied over all the kai blogs by adding thema tot PRODUCT_COPY_FILES in device-kai.mk. In the current approach I really add thema tot a vendor tree in the form of product packages defined in an Android.mk file.

    If anybody has an idea what I'm doing wrong I'd really like tot hear it. By the way, I updated the build instructions above.
     
    • Like Like x 1
  8. PJBrs

    PJBrs Senior Member Developer

    Joined:
    Dec 29, 2014
    Messages:
    358
    Likes Received:
    289
    Trophy Points:
    225
    PROGRESS!!!!

    Finally. And yes, it was very simple, but had nothing at all to do with the build system. I added some symlinks in the /system/lib/hw directory, linking files ending in tegra.so to tegra3.so. And suddenly the camera and audio HALs loaded. Camera preview works, taking pictures works as well. Videorecording crashes gallery.

    My next step will be to add nividia's repo's for libtinyalsa to fix sound and libjpeg, to reduce the number of binaries I need to add.

    Tasinofan, let me know if you have anything to add. Also, as of now the build works, if you simply follow the instructions in my 3rd post. One small thing, on Slackware-14.1, my OS of choice, webkit fails to build due to a missing perl module, switch.pm. Simply google the build error and you'll find your patch. Or add the switch module to your OS.
     
    Last edited: Jan 12, 2015
    • Like Like x 1
  9. tasinofan

    tasinofan Senior Member

    Joined:
    Jan 13, 2013
    Messages:
    92
    Likes Received:
    23
    Trophy Points:
    180
    Location:
    Antwerp
    Tablet / Device:
    Medion Lifetab MD 99300 (S9714) aka Lenovo A2110
    Hi PJBrs
    Sorry, I have not found any time to try the build yet, sorry for that. Congratulations and thanks for providing and updating instructions. Keep you informed.
     
  10. PJBrs

    PJBrs Senior Member Developer

    Joined:
    Dec 29, 2014
    Messages:
    358
    Likes Received:
    289
    Trophy Points:
    225
    Small update - playing sound seems to work, video recording works badly, so there's more progress here. Unfortunately, I keep discovering small mistakes in my build instructions. I'll try to keep the online versions in a state that do allow a succesful build. I hope I'll have something people might want to test soon.
     
    • Like Like x 2
  11. fusm

    fusm Member

    Joined:
    Jun 5, 2014
    Messages:
    53
    Likes Received:
    8
    Trophy Points:
    90
    Great work.
    Hope we can get 4.4 rom from you.
    Thanks a lot!
     
  12. PJBrs

    PJBrs Senior Member Developer

    Joined:
    Dec 29, 2014
    Messages:
    358
    Likes Received:
    289
    Trophy Points:
    225
    Still slowly making progress. I must admit I threw in the towel a bit by just adding most nvidia libs I could find from a2109, not grouper. But the result is that GPS now works and video playback works too. Microphone now works as well. And that's in addition to wifi, bluetooth, and EGL, which already appeared to be mostly working. Video recording on 480p works, but 720p and 1080p don´t really.HDMI doesn't. (Really, I´m losing track of all this thing can do... If anyone can point me to a feature matrix?) Really, I could use any suggestion for those latter bits.

    The biggest problem right now is the camera. The problem is finding the right combination of libjpeg(-turbo) and libskia, and I haven't found it yet. Haven't really looked at it in a very structured way. However, there's several combinations to try for either. Stock, of course. Then there's the proprietary libs from a2109a. Then there's nvidia's repository at
    nv-tegra.nvidia.com. And there's the suggestion of using libjpeg-turbo instead of stock libjpeg. I think I've tried most of those, but in most cases when I take a picture the gallery crashes.

    I think I'll try to put something to test online sometime during next week, if anyone's interested. Probably boot and system images, that can be flashed via fastboot.

    With regard to 4.2 and up -- yeah, I hope I'll get there. Looking at other repositories, it seems that once everything's working on one version, the next version gets a lot easier :)
     
    • Like Like x 1
  13. tasinofan

    tasinofan Senior Member

    Joined:
    Jan 13, 2013
    Messages:
    92
    Likes Received:
    23
    Trophy Points:
    180
    Location:
    Antwerp
    Tablet / Device:
    Medion Lifetab MD 99300 (S9714) aka Lenovo A2110
    Hi PJBrs
    As communicated in private conversation, I could follow your build recipe, but my build environment seems too new and gives (java) build errors.
    Thanks
     
    • Winner Winner x 1
  14. joebine

    joebine Member

    Joined:
    Jan 14, 2015
    Messages:
    98
    Likes Received:
    20
    Trophy Points:
    90
    Hi guys,

    I am very interested in your work. I have a A2109 and trying to push it a bit.

    Great work, thanks
     
  15. PJBrs

    PJBrs Senior Member Developer

    Joined:
    Dec 29, 2014
    Messages:
    358
    Likes Received:
    289
    Trophy Points:
    225
    Thanks for the interest! I have a small update. I've compiled a readme over at github which now lists those features that I think the a2109a has. You'll note that a few things just flat out don't work (HDMI out, WiFi-direct, taking panorama pictures), but most stuff seems quite solid now (EGL, Wifi, video recording, taking normal pictures) and some bits I can't test right now ( I don't have a cable for USB-OTG, I've never gotten bluetooth to work reliably on my laptop, ...). I'll put together an update image tomorrow evening, so people can try out this work on their own devices.

    Personally, I would very much appreciate some testing of those things unknown to work (see readme). And of course suggestions for fixing WiFi-direct, panorama pictures and HDMI-out. With regard to the latter two, some tweaking of media_codecs.xml might help. I don't know. I'll get back to you when I have an update package.

    With regard to next steps--this depends on whether we'll find ways to fix what's not working soon. It would be best to get everything working first, and then move on to 4.2 and 4.3.
     
    • Like Like x 2

Share This Page

Search tags for this page

github android videorecording

,
9714s cyanogen
,
a2109 lollipop
,

a2109a aosp

,
android update ideatab a2109a
,
aosp a2109
,
aosp a2109 pjbrs
,
aosp rom jelly bean bug fixes
,
cyanogenmod lifetab s9714
,
gallery and camera do not work android medion lifetab
,
jelly bean for viewpad 10s 2015
,
lenovo ideatab a2109 blob file
,

lifetab s9714 cyanogenmod

,

medion lifetab s9714 cyanogenmod

,
rom jellybean for a2109
,

s9714 cyanogenmod

,
s9714 firmware
,
stock gps apk lenovo ideatab
,
system update a2109a
,
twrp s9714