Porting halium to LeEco Le Max2 aka x2 (x820)

  • Here you have the steps I followed to port halium to LeEco Le Max2 and what I’ve archieved so far.

    Setup sources

    Follow the Porting Guide for halium-7.1 here https://docs.halium.org
    my manifest: https://gist.github.com/maylton/bc1243ce24fd0ad3646f63f8b9720d41

    For this I choose to use @shenoy_13 kernel for Le Max2 which he used for building SailfishOS and already has some configs for halium. Instead of adding it to my manifest I just cloned it to my local repository with the following command:

    git clone - b hybris-14.1 https://github.com/VigneshShan/android_kernel_leeco_msm8996 kernel/leeco/msm8996

    I had to remove hs20-osu from device/leeco/msm8996-common/msm8996.mk
    and removed the line ‘include frameworks/base/packages/SettingsLib/common.mk’ from device/leeco/msm8996-common/doze/Android.mk

    Kernel Image

    kernel config: kernel/leeco/msm8996/arch/arm64/configs/lineage_x2_defconfig

    These are the changes I have made to the kernel:


    Building kernel

    source build/envsetup.sh
    breakfast x2
    mka mkbooting
    mka build hybris-boot

    build system image

    mka build systemimage

    test and debug

    Follow steps here http://docs.halium.org/en/latest/porting/debug-build/

    Build hybris-recovery
    My phone bootlooped so I had to build hybris-reocery with mka build hybris-recovery

    Install rootfs.img and system.img

    Defaut halium-installer from https://github.com/Halium/halium-scripts did not work for me, só I used this one https://raw.githubusercontent.com/reivilibre/halium-scripts/master/halium-install-hostbuild by @reivilibre

    I had to change default system image partition size in the installer from 160MB to 560MB since my system image has 523MB.

    So I installed with ./halium-install-hostbuild halium-rootfs-20170630-151006.tar.gz system.img

    I rebooted, logged in telnet
    Once phone bootloops after ‘echo continue > /init-ctl/stdin’ i had to disable lxc with the following tips (must be logged in telnet):

    ~ # cd /target/
    /target # TERM=linux HOME=/root TH=/sbin:/bin:/usr/sbin:/usr/bin:$PATH chroot . /bin/bash
    root@(none):/# systemctl disable lxc@android
    root@(none):/# systemctl mask lxc@android
    root@(none):/# exit
    ~ # echo continue > /init-ctl/stdin

    I rebooted to TWRP and followed the steps to create an password in:

    Now I’m stuck at the point that i can’t connect ssh because when i configure it and try to connect i got the following message:

    ssh: connect to host localhost port 22: Connection refused

  • Hey maylton

    you showed on telegram some strange image contents. So lets verify whether your images are ok now. With the halium-install-hostbuild you posted, both images are created locally on your laptop. And the images are not deleted at the end. That is good. So now you can inspect them.

    Just make sure you look at the right ones. The line here: mktemp -d /tmp/halium-install.XXXXX will create a new temporary folder everytime you run the script. I suggest you remove all the existing ones. Then run the script once. Now you should have one /tmp/halium-install-blabla folder.

    Inside you have the system.img and the rootfs.img. mount them both on your laptop, list the contents and post the output:

    mkdir /mnt-rootfs
    mkdir /mnt-system
    mount rootfs.img /mnt-rootfs
    mount system.img /mnt-system
    ls -l /mnt-rootfs
    ls -l /mnt-system
    umount /mnt-rootfs
    umount /mnt-system
    rmdir /mnt-rootfs
    rmdir /mnt-system 

    And juuust to be extra double sure that there is nothing else going on, boot the device into twrp, adb into it and show the same output as above ON the device.

    Edit: For me, ON the device, it looks like this: https://paste.ubuntu.com/p/SZJpmMbB8z/

    Edit2: The more I think about what you had shown on telegram, please perform this mount&ls test above three times:

    1. format data in twrp
    2. install
    3. show the mount&ls results on laptop
    4. show the mount&ls results from twrp
    5. try to boot once with hybris-boot
    6. back to twrp and show the mount&ls results again

    I wonder whether it changes between 4 and 6.

  • Hello, dohniks,

    First of all thank you for all help you have given me so far on porting halium to Le Max2.

    I did just what you said, and here you have the results:

    Images mounted on laptop:

    From twrp BEFORE booting once:


    My friends, I do not know what happened, but I tried to login in ssh and guess what?! it worked! If you ask me if I did anything different from other times I am totally sure I did not. I don't really know why this worked this time. The only information I can give you about this is the following:

    When I failed to login ssh I was first running Linux Mint 18 and after Ubuntu 16.04. (Linux mint 18 is based on Ubuntu 16.04 {coincidence?})
    My phone was running Lineage 15.1 official (android 8.1) before I format my partitions.

    Now WHEN IT WORKED, I was running a stock-based rom, upon android 6.0 and ubuntu 18.04 LTS.

    Do you think any of it has relation with my fails and my recent success?

Log in to reply