need help to port ubuntu touch on Xiaomi MI2s

Discussion in 'Xiaomi Mi 2 / Mi 2S' started by tomheng, Jun 23, 2014.

  1. tomheng

    tomhengMembers

    Jun 5, 2014
    6
    3
    13
    Male
    I am trying to port ubuntu touch to Xiaomi MI2s with m1cha repo code (cm 11.0)for MI2s, but some errors happened when compliling.

    Code:
    hardware/qcom/display/msm8960/libgralloc/gpu.cpp: In constructor 'gralloc::gpu_context_t::gpu_context_t(const private_module_t*, gralloc::IAllocController*)':
    hardware/qcom/display/msm8960/libgralloc/gpu.cpp:49:5: error: 'allocSize' was not declared in this scope
    make: *** [/home/tom/git/ubuntu_touch/out/target/product/aries/obj/SHARED_LIBRARIES/gralloc.msm8960_intermediates/gpu.o] Error 1
    any help will be apprecited.
     
  2. linuxx

    linuxxMembers

    Jul 6, 2013
    1,436
    717
    220
    Male
    CyanogenMod
    Italy
    It won't work anyway, it needs alot of changes because of tdb
     
  3. Paulus123

    Paulus123Members

    Sep 2, 2013
    61
    27
    30
    Male
    Netherlands
    I don't understand why... Roms don't need (and have) knowledge about TDB, or do they ...
     
  4. linuxx

    linuxxMembers

    Jul 6, 2013
    1,436
    717
    220
    Male
    CyanogenMod
    Italy
    they have to. Try booting any n4 rom on your mi2, it won't boot, why? partitions aren't mounted in the right way because of tdb

    Sent from my nexus 7
     
  5. tomheng

    tomhengMembers

    Jun 5, 2014
    6
    3
    13
    Male
    They had update the porting tutorial to v2, that something may be changed. We can try it again.
     
  6. linuxx

    linuxxMembers

    Jul 6, 2013
    1,436
    717
    220
    Male
    CyanogenMod
    Italy
    try, lol. It doesn't change anything, it won't work anyway

    Sent from my nexus 7
     
  7. discom

    discomMembers

    Jun 6, 2013
    270
    82
    50
    @linuxx perhaps the is a place where TDB partitioning is explained?
     
  8. @linuxx stop talking shit :D
    TDB only is a problem if you install the ROM to system2.

    Anyway the problem with UbuntuTouch is that they use cm-10.2 as base and we don't have working sources for that.
     
    dextructor and MSephiroth like this.
  9. manohar

    manoharMembers

    Jun 6, 2013
    904
    243
    80
    Male
    Lol...
     
  10. XperianPro

    XperianProMembers

    Oct 26, 2013
    648
    217
    80
    Male
    Then how is possible that Mako build is based on CM11?
     
  11. linuxx

    linuxxMembers

    Jul 6, 2013
    1,436
    717
    220
    Male
    CyanogenMod
    Italy
    utouch is based on kk

    Sent from my mi²s
     
  12. tomheng

    tomhengMembers

    Jun 5, 2014
    6
    3
    13
    Male
    @M1cha I think that Ubuntu touch is Base on Aosp 4.4.2, so may be we can try to build it for mi2s.

    below is something info about that.

    1.Call for testing: experimental 4.4.2 based images

    https://lists.launchpad.net/ubuntu-phone/msg06352.html

    2.AOSP-based 4.4.2 Phablet repositories are now available

    https://lists.launchpad.net/ubuntu-phone/msg06378.html

    3.AOSP 4.4.2 based images are finally available via the trusty-proposed channel

    https://lists.launchpad.net/ubuntu-phone/msg06531.html

    Besides above, in the new tutorial(indeed not newest) https://wiki.ubuntu.com/Touch/Porting.

    Code:
    phablet-dev-bootstrap --sources aosp --repo-branch phablet-4.4.2_r1 -c [target_directory]
    phablet-4.4.2_r1 may be referered to AOSP 4.4.2。

    Though i am newbie to ROM build(actually i am a php engineer), I will try to recompile it again.
     
  13. That's weird because the "Enabling a new device" section still uses cm-10.2
     
  14. tomheng

    tomhengMembers

    Jun 5, 2014
    6
    3
    13
    Male
    Maybe they have no time to update the wiki fully or something else.

    but according to their mail list archives, they actually move to 4.4.2 .
     
  15. But it sounds like they use AOSP now but mi2 doesn't work with AOSP.
    I hope we can merge their code into CM11.
     
  16. linuxx

    linuxxMembers

    Jul 6, 2013
    1,436
    717
    220
    Male
    CyanogenMod
    Italy
    Yes they do, I asked to one of the dev of core apps, they use aosp and or cm11 as base for builds. So there are a lot of things to fix but it's easier

    Sent from my nexus 7
     
  17. tomheng

    tomhengMembers

    Jun 5, 2014
    6
    3
    13
    Male
    Yes, i also think they had switched from CM to AOSP.

    Unlucky, their wiki is very confusing.

    we should follow https://wiki.ubuntu.com/Touch/AOSPBuild and https://wiki.ubuntu.com/Touch/Porting.

    mi2s can use Mokee Open source project (based on AOSP) code.
     
    MSephiroth likes this.
  18. I'd rather start from scratch using n4 sources because mokee and Ivan made many changes to aosp sources

    Sent from my MI 2 using Tapatalk
     
    MSephiroth likes this.
  19. manohar

    manoharMembers

    Jun 6, 2013
    904
    243
    80
    Male
  20. tomheng

    tomhengMembers

    Jun 5, 2014
    6
    3
    13
    Male
    I had built it and installed it on mi2s last night, but it failed to boot.

    It is a more smooth progress than i thought originally, what i do is list below.

    1. copy mako device.mk and BoardConfig.mk to aries dir, then modify something to suit mi2s.

    2. modify TARGET_KERNEL_UBUNTU_META in BoardConfig.mk to use mako kernel.

    i dont know how to build kernel for ubuntu touch. finally, i got recovery.img, boot.img, system.img.

    3. use rootstock-touch-install tool to flash it(some fixed, but succeed finally).

    it went to black screen, after flash new recovery image, but adb can connect with the device.

    The screen is black when booting to the normal mode. i found ubuntu touch rootfs is not mounted correctly by adb shell.

    so, i guess the kernel or rootstock install step make some errors.
     
    MSephiroth and cvncbn92 like this.
  21. Transfusion

    May 9, 2014
    4
    3
    13
    #21Transfusion,Jul 25, 2014
    Last edited: Jul 25, 2014
    I made progress with porting ubuntu touch utopic based on the latest porting guide. I got the FS to mount properly, but wcnss_8960 module is causing a kernel panic. (I will try with MoKee's kernel later)
    How I set up my build directory: I followed https://wiki.ubuntu.com/Touch/Porting#Enabling_a_new_device and added kernel, device, and vendor trees from M1cha's github repository, CM11 branch (Their wiki is outdated, obviously CM11 corresponds to 4.4.2 and above) I didn't edit device.mk and BoardConfig.mk.
    I'm not sure how to go about porting apparmor; but I imagine we could take the mako-aa3-backport branch and look at the changes to the defconfig and follow https://wiki.ubuntu.com/SecurityTeam/AppArmorForPhabletKernels .
    rootstock_touch_install is just a shell-script that copies things around when in adb recovery. I'm using M1cha's CWM TDB recovery and there were no issues there. If you notice, on line 49 prepare_ubuntu_system() just creates the FS .img at /data. To get it to work with TDB on my second partition, I booted into recovery, selected System 2, selected Mounts and Storage, wiped /system and /data then mounted /system, /cache, and /data, then I ran ./rootstock-touch-install ./utopic-preinstalled-touch-armhf.tar.gz ../system.img . My System 1 is untouched.
    I encountered tomheng's error at the top of this thread; I edited /hardware/qcom/display/msm8960/common.mk , line 17 to become " common_flags += -Werror -Wno-error=narrowing "
    The rootfs not being mounted correctly is because the initrd attempts to mount /dev/mmcblk0p26 at /tmpmnt ; follow http://forum.xda-developers.com/showthread.php?t=1413308 this guide to take apart boot.img and look in /initrd/scripts/touch . I'm not sure if it's due to TDB or if the same situation happens without TDB enabled, but look at how CWM recovery and other ROMs mount a specific data partition; they mount /dev/mmcblk0p26 to /data_root and then they mount -o bind /data_root/systemX /data (where X is your 0th or 1st partition.) . So edit and repack the boot.img after editing the touch script: http://pastebin.com/3LnMvWFZ (lines 72 and 105 are the lines in question). This is the mkbootimg command I used: http://pastebin.com/Te7ekAxD
    Kernel seems to boot well, except for one thing http://pastebin.com/EA7jNTK3 Why does wcnss_8960 crash (I think it's the networking driver?)
    BTW, is there an IRC channel where you guys hang out in... I'm interested in CM dev and idle on IRC 24/7, i heard in #miuiandroid on freenode that most dev goes on in G+ hangouts
     

Share Our Site