Aug 28, 2017

Flashing lineageOS 14.1 in Moto E (Ist Gen)

1. Collect all the important software needed
    a. https://download.lineageos.org/condor : lineage-14.1-20170821-nightly-condor-signed.zip
    b. Download twrp-3.1.1-0-condor.img : https://dl.twrp.me/condor/twrp-3.1.1-0-condor.img.html : https://dl.twrp.me/condor/twrp-3.1.1-0-condor.img
        (APK link : TWRP recovery link for Moto E (condor) : https://dl.twrp.me/twrpapp/me.twrp.twrpapp-26.apk.html : https://dl.twrp.me/twrpapp/me.twrp.twrpapp-26.apk)
    c. Lineage OS GApps :    http://opengapps.org/app/ and http://opengapps.org/?api=7.0&variant=pico
    d. Installing adb and fastboot : https://wiki.lineageos.org/adb_fastboot_guide.html#installing-adb-and-fastboot : https://dl.google.com/android/repository/platform-tools-latest-windows.zip
    e. Motorola Device Manager contains USB drivers and software : https://mobilesupport.lenovo.com/us/en/solution/MS88481 : http://www.motorola.com/getmdmwin
    f. Enable the USB Debugging Mode on the Moto E by navigating to Settings > Developer Options > check the box for USB
   
2. Install adb and fastboot (Read ref d)
    a. download platform-tools-latest-windows.zip in PC from https://dl.google.com/android/repository/platform-tools-latest-windows.zip
    b. unzip it to a local drive
    c. Add the unzip path to System PATH
    d. Verify commands
        adb devices
        fastboot devices (will work only in bootloader)
    e. Other commands
        adb shell - launches a shell on the device
        adb push - pushes the file to
        adb pull [] - pulls the file to . If isn’t specified, it will pull to the current folder.
        adb logcat - allows you to view the device log in real-time. You can use adb logcat -b radio to view radio logs, and adb logcat -C to view logs in colour
        adb install - installs the given .apk file to your device
       
        adb reboot bootloader : Reboot to bootloader : Another way -> by pressing VolumeDown + Power button for about 6-7 seconds
       
3. Unlocked bootloader on the Moto E (condor)  : http://www.cyanogenmods.org/forums/topic/unlock-bootloader-motorola-phone-step-step-guide/
    Before moving further do verify the mobile is getting connected via usb and adb verify commands are working.
    if not need to install "Motorola USB drivers" : https://motorola-global-portal.custhelp.com/app/answers/detail/a_id/88481
   
    adb devices
    fastboot devices
    fastboot oem get_unlock_data
   
        F:\keshav_pers\Lenovo_backup\lineage_OS\platform-tools
        ? fastboot devices
        ZX1B334PNR      fastboot

        F:\keshav_pers\Lenovo_backup\lineage_OS\platform-tools
        ? fastboot oem get_unlock_data
        (bootloader) slot-count: not found
        (bootloader) slot-suffixes: not found
        (bootloader) slot-suffixes: not found
        ...
        (bootloader) 3A95030165931159#5A583142333334
        (bootloader) 504E5200585431303232000000#F6D3
        (bootloader) 7E6A3CCC08AA9124652A86057BB277B
        (bootloader) 1A89E#5916150412000000000000000
        (bootloader) 0000000
        OKAY [  0.275s]
        finished. total time: 0.277s

        F:\keshav_pers\Lenovo_backup\lineage_OS\platform-tools  
       
    copy only the Alpha-Numeric data (including the # or any other symbol in between) by discarding the (bootloader) on Windows output
    3A95030165931159#5A583142333334504E5200585431303232000000#F6D37E6A3CCC08AA9124652A86057BB277B1A89E#59161504120000000000000000000000
    or can use  Data scrub Tool : https://motorola-global-portal.custhelp.com/app/standalone/bootloader/data_scrub
    copy the final one line loooong string into the Motorola Bootloader Unlock page and click on Can my device be unlocked?
    If your device can be unlocked then Request unlock key button will appear.
   
   
    The unlock key will be mailed to you on your e-mail Id
    unique code to unlock the bootloader of your Motorola phone. : CEPN3OG2Y6WTQWOBDGWM
   
    copy the Unlock Key and execute the following command : fastboot oem unlock UNLOCK_KEY
   
        F:\keshav_pers\Lenovo_backup\lineage_OS\platform-tools      
        ? fastboot devices                                      
        ZX1B334PNR      fastboot                                
                                                                 
        F:\keshav_pers\Lenovo_backup\lineage_OS\platform-tools  
        ? fastboot oem unlock CEPN3OG2Y6WTQWOBDGWM              
        (bootloader) slot-count: not found                      
        (bootloader) slot-suffixes: not found                    
        (bootloader) slot-suffixes: not found                    
        ...                                                      
        (bootloader) Unlock code = CEPN3OG2Y6WTQWOBDGWM          
                                                                 
        (bootloader) Unlock completed! Wait to reboot
         
        finished. total time: 17.114s                                
                                                                     
        F:\keshav_pers\Lenovo_backup\lineage_OS\platform-tools      
           
    Now your Motorola phone’s bootloader is unlocked.
   
4. Now install TWRP
    a. move to the folder in PC where twrp-3.1.1-0-condor.img
    b. rename the twrp-3.1.1-0-condor.img to recovery.img
    c. reboot in bootloader : adb reboot bootloader
    c. execute in PC : fastboot flash recovery recovery.img

        F:\keshav_pers\Lenovo_backup\lineage_OS                  
        ? fastboot flash recovery recovery.img                  
        (bootloader) slot-count: not found                      
        (bootloader) slot-suffixes: not found                    
        (bootloader) slot-suffixes: not found                    
        (bootloader) has-slot:recovery: not found                
        target reported max download size of 299892736 bytes    
        sending 'recovery' (6890 KB)...                          
        OKAY [  0.250s]                                          
        writing 'recovery'...                                    
        OKAY [  0.704s]                                          
        finished. total time: 0.960s                            
                                                             
        F:\keshav_pers\Lenovo_backup\lineage_OS              

    d. From fastboot mode, you must press the Volume Down, highlight the recovery and press down the Power key to select it.
    e. Now your Moto E is booting to recovery mode. Wait for a minute for the touch feature on the phone to start working as it needs to catch up.
   
5. Take NANDROID Backup (Read: How to Take NANDROID Backup on TWRP Recovery: http://www.cyanogenmods.org/forums/topic/take-nandroid-backup-twrp-recovery/)
6. Clean/Wipe Data using TWRP (Read:How to Clean/Wipe Data using TWRP on any Android Phone : http://www.cyanogenmods.org/forums/topic/clean-wipe-data-partitions-using-twrp/ )
7. Install Lineage OS (Read: http://www.cyanogenmods.org/forums/topic/how-to-install-lineage-os-android-phone/)
    Before taking this step rembember to copy
        open_gapps-arm-7-pico-20170825.zip
        lineage-14.1-20170821-nightly-condor-signed.zip
    to internal memory of mobile.

8. Finally



   
References:
Using ADB and fastboot :     https://wiki.lineageos.org/adb_fastboot_guide.html#popular-adb-commands
The official OpenGApps.org app : http://opengapps.org/app/opengapps-app-v16.apk : http://opengapps.org/app/
How to Enter Recovery Mode on Moto E (2015) : http://www.teamandroid.com/2015/06/24/enter-recovery-mode-moto-e-2015/
HOW TO INSTALL A CUSTOM ROM WITHOUT PC LINEAGE OS IN MOTOROLA MOTO E ANDROID 7.1.1 : https://www.youtube.com/watch?v=MHFtDKgKImM&feature=youtu.be
How to restore stock firmware on Motorola Moto G : http://www.nerdoholic.com/mobiles/restore-stock-firmware-motorola-moto-g/
Install Lineage OS on Moto E (condor) : https://hacksandgeeks.com/single-post/2017/01/05/Install-Lineage-OS-141-On-Moto-E-condor-1
How to prevent TWRP / CWM from automatically getting replaced by Stock recovery : https://forum.hovatek.com/thread-10992.html