• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[GUIDE/TUTORIAL/HOWTO] HTC One M8 stock to Android 10 Q / LineageOS 17.1

Search This thread

djibe89

Senior Member
May 24, 2014
700
412
Google Nexus 4
[Guide/tutorial] HTC One M8 stock to Android 10 Q / LineageOS 17.1
[GUIDE/TUTORIAL/HOWTO] HTC One M8 any version (single SIM: m8ul, m8vzw and m8spr or dual SIM: m8dug and m8dwg) stock to Android 10 Q / LineageOS 17.1

This detailed step-by-step guide helps you transform your HTC One M8 (any version) to a powerful one with Android 10 >.
Make sure you have the One M8 model, in Android, go to Settings > About phone and check the model.


CHANGELOG OF TUTORIAL -----------

v3. Updated pack with latest Magisk
v2.1. Drop ADB 15 sec installer and use latest adb and fastboot.
v2. Update pack and tutorial for TWRP 3.4.0-1
v1. Initial release


1 ) DOWNLOAD ---------------------

- djibe HTC One M8 pack (~40 Mo) : https://bit.ly/djibe-onem8-pack
(includes HTC USB Drivers 4.2.0.001, recovery TWRP 3.4.0-1 for all m8, Magisk Root 21.4, Magisk Manager 8.0.7, adb.exe, fastboot.exe).
Unzip the djibe folder from the zip on root folder of C:\ drive.

- ROM Official Lineage OS 17.1 for M8: https://forum.xda-developers.com/ht...-lineageos-17-0-nightlies-htc-one-m8-t3976989
Download latest build for M8 single SIM variant (m8ul, m8vzw and m8spr) here: https://download.lineageos.org/m8
Download latest build for M8 dual SIM variant (m8dug and m8dwg) here: https://download.lineageos.org/m8d

- OpenGApps ARM 10 nano (or pico): https://opengapps.org/?arch=arm&api=10.0&variant=nano

- Charge phone to 100 %
- MicroSD card formatted in FAT32
- Copy ROM + GApps + both Magisk files on microSD card. Insert it in phone.

WARNING. This tutorial uses Microsoft Windows.
WARNING. Warranty is now void.
WARNING. Read carefully the sentences starting with ###.


2 ) BACKUP DATA AND INSTALL DRIVERS

Disable Antivirus.
Install drivers from my pack:
right click on HTCDriver.exe > click on Run as administrator and continue the setup.

Connect HTC One (while phone on) to PC, let drivers install.
In Windows explorer, HTC One should be available.
### If not make sure phone connection is in File transfer mode (see Android notifications).
### Phone is still not visible in Windows Explorer ? See fix at end of tutorial.

Collect all personal photos, videos, etc ... and backup these on PC.

Use an app like Backupyourmobile/SMS Backup & Resotre to backup texts, contacts, etc.
Check that backup is located on microSD card.
Then copy the backup on your PC.

Disconnect phone.

### If your phone is Simlocked/carrier locked/Network locked, don't go further.
Visit official website of your network carrier (or call their support) to retrieve your desimlock code.
Ask them for details on how to remove simlock.
How do I know my phone is simlocked ? When you insert a SIM card from another operator, network is inaccessible.
Only a stock ROM can remove simlock.
To go back from custom ROM to stock, see dedicated section at the end of tutorial.


3 ) UNLOCK BOOTLOADER

In Android, go to Settings > About > Software information > More.
Tap 7 times on Build number. It unlocks Developer options.
Go back to the About menu, you can see the new Developer options menu.
Tap on it, accept the warning.
Toggle on the USB debugging option.

Connect phone, a message appears on phone : Allow USB debugging?
check Always allow and confirm by tapping on OK.

Now, open a Windows command on my "flash" folder (hold Shift + right click on folder -> Open a windows command here).
### Then navigate to my flash folder (if it is on desktop) with this command :
Code:
cd /d C:\djibe\flash

Enter command :
Code:
adb devices
, confirm by pressing Enter.
Command returns :
Code:
List of devices attached
HT35******   device
### If no device is found, uninstall and reinstall properly the drivers while antivirus is off. Or see fix at the end of this tuto.
### Or start fresh on another PC.

Now type :
Code:
adb reboot bootloader
Phone restarts in Fastboot mode. Wait till phone screen is blank in fastboot mode.

Type :
Code:
fastboot devices
Command returns :
Code:
HT35****   fastboot
### You may have to fix drivers again (see fix at the end of tuto)

Type :
Code:
fastboot oem get_identifier_token
, confirm by pressing Enter.
Command returns multiple lines.
Select with your mouse all the lines from
Code:
<<<< Identifier Token Start >>>>
(included)
to the line
Code:
<<<<< Identifier token end >>>>>
(included).

Now on keyboard copy (Ctrl + C combo), then open Notepad.
In Notepad, paste those lines (Ctrl + V combo).
Now manually remove all the (bootloader) strings from each line.
Your notepad should now look like this :

<<<< Identifier Token Start >>>>
37A5DBF4FE5F0D9F4425E54AA91AFDBF
2A20E9C67C3BB4FAE60263F76BDEC6AC
847BF9FFB11DAEA4AB88AC8710435449
9BC12E93DF4C54FFE3D064C4C810C49A
2CDAF2E0CD3A164FED4A568CB0FD2AC6
C01AA991733D949C00987062D691DE91
8AA1C97CEBC3ACE83FECE75A1D03CE72
62414C7DC36A73AFCBF433E1EBE2EDC7
E272F73309632D3EF8C86E472B65E8EF
37E46B52FE3F94FC69D1854CA3DE6F48
C3E10001B233A70B1EAF35134F51FCC6
353E0CC98534E6E60A241A7063D0BE2F
A5B752E75C1C47E6F739BDBE67D024DA
3292A14278247557632639802722A86C
E61424F7666AE085AA9905096FEED1AD
5ECBBD867544E95ABDDA277690B8CB55
<<<<< Identifier Token End >>>>>


Now visit this website : https://www.htcdev.com/bootloader/
Register on the site. Confirm registration with your email.
In the select menu, chose HTC One (M7), click Begin unlock Bootloader button.
Agree to legal terms.
Next page, go to the bottom and click continue to step 5.
In the bottom of this page, in the lower textarea "My Device Identifier Token",
copy and paste the multiple lines you just edited (my example is just above).
Click Submit.
HTC tells you : Token Submitted Successfully.

Open your mailbox (associated to your HTC account).
Copy the Unlock_code.bin file attached to email in my "flash" folder you unzipped.

In Windows command, type :
Code:
fastboot flash unlocktoken Unlock_code.bin
, confirm with Enter.
Command should return :
Code:
unlock token check successfully

Back to phone, press Volume+ to select "Yes, unlock bootloader", then Power button to confirm flash.

Now wait while phone is going to Factory reset.
Don't let Android restart by holding both Power + Volume- to enter bootloader immediately.

FASTBOOT menu is overlined in red.


4 ) FLASH TWRP RECOVERY

Using the same Windows command prompt, enter :
Code:
fastboot devices
to make sure phone is still available.
Then
Code:
fastboot flash recovery twrp-3.4.0-1-m8.img

Command returns :
Code:
finished. total time: x.xxxxs

Now on phone, press Volume- to highlight HBOOT, confirm with Power button.
You are back to the booloader screen (UNLOCKED is written on top line), press Volume- to navigate to RECOVERY, and confirm with Power button.

Phone reboots in TWRP recovery.


5 ) BACKUP STOCK SYSTEM

In TWRP, check Never show this screen and Swipe to Allow Modifications.
You land on TWRP Home screen.

Always make a backup of your stock system. We never know when a weird bug will decapitate the system.
Go to Backup menu, select all partitions and Backup to microSD card.

Backup the generated TWRP folder content from your microSD card to PC.


6 ) WIPE PARTITIONS

Back to Home menu, go to Wipe > Advanced wipe.
Select Dalvik / ART Cache, Cache, System, Data, Internal Storage then Swipe to Wipe, go back to Wipe menu.
### Don't wipe SDcard


7) FLASH ROM, ROOT/MAGISK AND GAPPS

Back to Home screen, tap on Install > choose lineage*.zip,
(if you don't see the files, tap on Select Storage and make sure Micro SDCard is active)
then Add more Zips -> Magisk*.zip,
then Add more Zips -> open_gapps*.zip,
then Swipe to confirm Flash.
Wait for operation to end (can be long).

When completed successfully, tap on Reboot.
Tap on Do not install when TWRP asks for the app install.

Wait during long first boot.
Setup Android.


8) You can use Backupyourmobile to restore data,
use GPS Status & Toolbox app to enhance GPS fix.


9) ROOT

Use built-in Files app > tap on Menu icon > select Option called "M8" (phone's name).
Scroll down to MagiskManager.apk, confirm Install.
You can now manage Superuser permissions from this app.

That's it.


Enjoy,
djibe

THANKS --------------
Teams of : TWRP, LineageOS team, ckpv5, tarkzim, alray, .🅱, Flyhalf205, icxj1, R1ghtC, gimmeitorilltell, All M8 contributors.

##################################################

A) Fastboot devices doesn't show any device connected

Install HTC USB drivers
Reboot PC

Open Windows Device Manager (Windows + R shortcut on keyboard > devmgmt.msc > hit Enter)
Search for phone at Other devices submenu > Device is named Android 1.0 or My_HTC
### If it is My_HTC > select it > right click > Uninstall. Disconnect phone. Reconnect phone. Now recognised as Android 1.0.

Select device Android 1.0 > right click > Update Driver
Search locally for driver > Show a list
Select ASUS Android Device.
Manufacturer: select Google, Inc. and set driver to Android Bootloader Interface
Confirm install.


B) Go back to stock from a custom ROM with a HTC One M8

- Either restore your TWRP backup with TWRP recovery

- Or restore a community TWRP backup with TWRP recovery (https://forum.xda-developers.com/htc-one-m8/help/tutorial-how-to-stock-stock-twrp-t3086860 see posts 2 & 3)
### With S-ON and keep device Unlocked
To find suitable backup for device, boot phone in Bootloader mode (Power + Volume-)
Look at your hboot version (hboot 3.19.0000 is most frequent)
Launch a fastboot command:
Code:
fastboot getvar all
Make sure IMEI is a valid number.
Look at your CID and MID values. Try to find exact same TWRP backups for your phone.
### Flash only exact model versions.
Then wipe all partitions and restore the correct TWRP backup an angel made for you.

- If TWRP restore fails, start with these posts :
You will need a Rom Update Utility (RUU) for your exact model version.
This is compatible with S-ON, will need to relock your Bootloader (save your Unlock_code.bin +++) and need original recovery
https://forum.xda-developers.com/htc-one-m8/help/tutorial-how-to-stock-stock-twrp-t3086860
https://forum.xda-developers.com/htc-one-m8/general/guide-restore-european-htc-one-m8-to-t3072235

C) No IMEI visible and no cellphone network detected with hTC One M8

Composing *#06# shows an empty IMEI dialog window.
or Settings > About phone > IMEI. IMEI: Unknown, IMEI SV: Unknown

Refer to B) tutorial to get back to stock.
 
Last edited:
  • Like
Reactions: murphylim

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    [Guide/tutorial] HTC One M8 stock to Android 10 Q / LineageOS 17.1
    [GUIDE/TUTORIAL/HOWTO] HTC One M8 any version (single SIM: m8ul, m8vzw and m8spr or dual SIM: m8dug and m8dwg) stock to Android 10 Q / LineageOS 17.1

    This detailed step-by-step guide helps you transform your HTC One M8 (any version) to a powerful one with Android 10 >.
    Make sure you have the One M8 model, in Android, go to Settings > About phone and check the model.


    CHANGELOG OF TUTORIAL -----------

    v3. Updated pack with latest Magisk
    v2.1. Drop ADB 15 sec installer and use latest adb and fastboot.
    v2. Update pack and tutorial for TWRP 3.4.0-1
    v1. Initial release


    1 ) DOWNLOAD ---------------------

    - djibe HTC One M8 pack (~40 Mo) : https://bit.ly/djibe-onem8-pack
    (includes HTC USB Drivers 4.2.0.001, recovery TWRP 3.4.0-1 for all m8, Magisk Root 21.4, Magisk Manager 8.0.7, adb.exe, fastboot.exe).
    Unzip the djibe folder from the zip on root folder of C:\ drive.

    - ROM Official Lineage OS 17.1 for M8: https://forum.xda-developers.com/ht...-lineageos-17-0-nightlies-htc-one-m8-t3976989
    Download latest build for M8 single SIM variant (m8ul, m8vzw and m8spr) here: https://download.lineageos.org/m8
    Download latest build for M8 dual SIM variant (m8dug and m8dwg) here: https://download.lineageos.org/m8d

    - OpenGApps ARM 10 nano (or pico): https://opengapps.org/?arch=arm&api=10.0&variant=nano

    - Charge phone to 100 %
    - MicroSD card formatted in FAT32
    - Copy ROM + GApps + both Magisk files on microSD card. Insert it in phone.

    WARNING. This tutorial uses Microsoft Windows.
    WARNING. Warranty is now void.
    WARNING. Read carefully the sentences starting with ###.


    2 ) BACKUP DATA AND INSTALL DRIVERS

    Disable Antivirus.
    Install drivers from my pack:
    right click on HTCDriver.exe > click on Run as administrator and continue the setup.

    Connect HTC One (while phone on) to PC, let drivers install.
    In Windows explorer, HTC One should be available.
    ### If not make sure phone connection is in File transfer mode (see Android notifications).
    ### Phone is still not visible in Windows Explorer ? See fix at end of tutorial.

    Collect all personal photos, videos, etc ... and backup these on PC.

    Use an app like Backupyourmobile/SMS Backup & Resotre to backup texts, contacts, etc.
    Check that backup is located on microSD card.
    Then copy the backup on your PC.

    Disconnect phone.

    ### If your phone is Simlocked/carrier locked/Network locked, don't go further.
    Visit official website of your network carrier (or call their support) to retrieve your desimlock code.
    Ask them for details on how to remove simlock.
    How do I know my phone is simlocked ? When you insert a SIM card from another operator, network is inaccessible.
    Only a stock ROM can remove simlock.
    To go back from custom ROM to stock, see dedicated section at the end of tutorial.


    3 ) UNLOCK BOOTLOADER

    In Android, go to Settings > About > Software information > More.
    Tap 7 times on Build number. It unlocks Developer options.
    Go back to the About menu, you can see the new Developer options menu.
    Tap on it, accept the warning.
    Toggle on the USB debugging option.

    Connect phone, a message appears on phone : Allow USB debugging?
    check Always allow and confirm by tapping on OK.

    Now, open a Windows command on my "flash" folder (hold Shift + right click on folder -> Open a windows command here).
    ### Then navigate to my flash folder (if it is on desktop) with this command :
    Code:
    cd /d C:\djibe\flash

    Enter command :
    Code:
    adb devices
    , confirm by pressing Enter.
    Command returns :
    Code:
    List of devices attached
    HT35******   device
    ### If no device is found, uninstall and reinstall properly the drivers while antivirus is off. Or see fix at the end of this tuto.
    ### Or start fresh on another PC.

    Now type :
    Code:
    adb reboot bootloader
    Phone restarts in Fastboot mode. Wait till phone screen is blank in fastboot mode.

    Type :
    Code:
    fastboot devices
    Command returns :
    Code:
    HT35****   fastboot
    ### You may have to fix drivers again (see fix at the end of tuto)

    Type :
    Code:
    fastboot oem get_identifier_token
    , confirm by pressing Enter.
    Command returns multiple lines.
    Select with your mouse all the lines from
    Code:
    <<<< Identifier Token Start >>>>
    (included)
    to the line
    Code:
    <<<<< Identifier token end >>>>>
    (included).

    Now on keyboard copy (Ctrl + C combo), then open Notepad.
    In Notepad, paste those lines (Ctrl + V combo).
    Now manually remove all the (bootloader) strings from each line.
    Your notepad should now look like this :

    <<<< Identifier Token Start >>>>
    37A5DBF4FE5F0D9F4425E54AA91AFDBF
    2A20E9C67C3BB4FAE60263F76BDEC6AC
    847BF9FFB11DAEA4AB88AC8710435449
    9BC12E93DF4C54FFE3D064C4C810C49A
    2CDAF2E0CD3A164FED4A568CB0FD2AC6
    C01AA991733D949C00987062D691DE91
    8AA1C97CEBC3ACE83FECE75A1D03CE72
    62414C7DC36A73AFCBF433E1EBE2EDC7
    E272F73309632D3EF8C86E472B65E8EF
    37E46B52FE3F94FC69D1854CA3DE6F48
    C3E10001B233A70B1EAF35134F51FCC6
    353E0CC98534E6E60A241A7063D0BE2F
    A5B752E75C1C47E6F739BDBE67D024DA
    3292A14278247557632639802722A86C
    E61424F7666AE085AA9905096FEED1AD
    5ECBBD867544E95ABDDA277690B8CB55
    <<<<< Identifier Token End >>>>>


    Now visit this website : https://www.htcdev.com/bootloader/
    Register on the site. Confirm registration with your email.
    In the select menu, chose HTC One (M7), click Begin unlock Bootloader button.
    Agree to legal terms.
    Next page, go to the bottom and click continue to step 5.
    In the bottom of this page, in the lower textarea "My Device Identifier Token",
    copy and paste the multiple lines you just edited (my example is just above).
    Click Submit.
    HTC tells you : Token Submitted Successfully.

    Open your mailbox (associated to your HTC account).
    Copy the Unlock_code.bin file attached to email in my "flash" folder you unzipped.

    In Windows command, type :
    Code:
    fastboot flash unlocktoken Unlock_code.bin
    , confirm with Enter.
    Command should return :
    Code:
    unlock token check successfully

    Back to phone, press Volume+ to select "Yes, unlock bootloader", then Power button to confirm flash.

    Now wait while phone is going to Factory reset.
    Don't let Android restart by holding both Power + Volume- to enter bootloader immediately.

    FASTBOOT menu is overlined in red.


    4 ) FLASH TWRP RECOVERY

    Using the same Windows command prompt, enter :
    Code:
    fastboot devices
    to make sure phone is still available.
    Then
    Code:
    fastboot flash recovery twrp-3.4.0-1-m8.img

    Command returns :
    Code:
    finished. total time: x.xxxxs

    Now on phone, press Volume- to highlight HBOOT, confirm with Power button.
    You are back to the booloader screen (UNLOCKED is written on top line), press Volume- to navigate to RECOVERY, and confirm with Power button.

    Phone reboots in TWRP recovery.


    5 ) BACKUP STOCK SYSTEM

    In TWRP, check Never show this screen and Swipe to Allow Modifications.
    You land on TWRP Home screen.

    Always make a backup of your stock system. We never know when a weird bug will decapitate the system.
    Go to Backup menu, select all partitions and Backup to microSD card.

    Backup the generated TWRP folder content from your microSD card to PC.


    6 ) WIPE PARTITIONS

    Back to Home menu, go to Wipe > Advanced wipe.
    Select Dalvik / ART Cache, Cache, System, Data, Internal Storage then Swipe to Wipe, go back to Wipe menu.
    ### Don't wipe SDcard


    7) FLASH ROM, ROOT/MAGISK AND GAPPS

    Back to Home screen, tap on Install > choose lineage*.zip,
    (if you don't see the files, tap on Select Storage and make sure Micro SDCard is active)
    then Add more Zips -> Magisk*.zip,
    then Add more Zips -> open_gapps*.zip,
    then Swipe to confirm Flash.
    Wait for operation to end (can be long).

    When completed successfully, tap on Reboot.
    Tap on Do not install when TWRP asks for the app install.

    Wait during long first boot.
    Setup Android.


    8) You can use Backupyourmobile to restore data,
    use GPS Status & Toolbox app to enhance GPS fix.


    9) ROOT

    Use built-in Files app > tap on Menu icon > select Option called "M8" (phone's name).
    Scroll down to MagiskManager.apk, confirm Install.
    You can now manage Superuser permissions from this app.

    That's it.


    Enjoy,
    djibe

    THANKS --------------
    Teams of : TWRP, LineageOS team, ckpv5, tarkzim, alray, .🅱, Flyhalf205, icxj1, R1ghtC, gimmeitorilltell, All M8 contributors.

    ##################################################

    A) Fastboot devices doesn't show any device connected

    Install HTC USB drivers
    Reboot PC

    Open Windows Device Manager (Windows + R shortcut on keyboard > devmgmt.msc > hit Enter)
    Search for phone at Other devices submenu > Device is named Android 1.0 or My_HTC
    ### If it is My_HTC > select it > right click > Uninstall. Disconnect phone. Reconnect phone. Now recognised as Android 1.0.

    Select device Android 1.0 > right click > Update Driver
    Search locally for driver > Show a list
    Select ASUS Android Device.
    Manufacturer: select Google, Inc. and set driver to Android Bootloader Interface
    Confirm install.


    B) Go back to stock from a custom ROM with a HTC One M8

    - Either restore your TWRP backup with TWRP recovery

    - Or restore a community TWRP backup with TWRP recovery (https://forum.xda-developers.com/htc-one-m8/help/tutorial-how-to-stock-stock-twrp-t3086860 see posts 2 & 3)
    ### With S-ON and keep device Unlocked
    To find suitable backup for device, boot phone in Bootloader mode (Power + Volume-)
    Look at your hboot version (hboot 3.19.0000 is most frequent)
    Launch a fastboot command:
    Code:
    fastboot getvar all
    Make sure IMEI is a valid number.
    Look at your CID and MID values. Try to find exact same TWRP backups for your phone.
    ### Flash only exact model versions.
    Then wipe all partitions and restore the correct TWRP backup an angel made for you.

    - If TWRP restore fails, start with these posts :
    You will need a Rom Update Utility (RUU) for your exact model version.
    This is compatible with S-ON, will need to relock your Bootloader (save your Unlock_code.bin +++) and need original recovery
    https://forum.xda-developers.com/htc-one-m8/help/tutorial-how-to-stock-stock-twrp-t3086860
    https://forum.xda-developers.com/htc-one-m8/general/guide-restore-european-htc-one-m8-to-t3072235

    C) No IMEI visible and no cellphone network detected with hTC One M8

    Composing *#06# shows an empty IMEI dialog window.
    or Settings > About phone > IMEI. IMEI: Unknown, IMEI SV: Unknown

    Refer to B) tutorial to get back to stock.