[how to] lock/unlock your bootloader without htcdev(s-off required)

Search This thread

scotty1223

Inactive Recognized Contributor
Jan 3, 2011
2,813
3,056
READ THIIS!
*this thread is for m9. it will NOT work on m7,or any older device. please check the general forum for your particular device for a similar thread.


this thread will let you unlock your bootloader without htcdev,or let you change your hboot watermark from relocked or locked back to stock.


advantages
-no hassle with htcdev,tokens,or unlock codes
-no submitting your phones personal info to htc
-the ability to get back to 100% stock without any visual traces or records of having been s off or unlocking your bootloader.

you do NOT need to downgrade your hboot. this simple adb command works without any scary hboot downgrades.

*you must be s off.
*you must have superuser installed

read this:
this will not work if your s on. its not a way to magically unlock

the usual disclaimers:
use this info at your own risk. if it melts your phone into a little pile of aluminum goo,its not my fault.

credits
-beaups for schooling me on echo comand protocol
-strace for originally discovering the location of the lock status flag(check out this thread for more info)
- @Mutasek24 for fearlessly testing all commands

IF you are an advanced user with adb/fastboot set up and some basic knowlede of the cmd window,you can skip to #2
1)set up adb(windows 7 and older)


-download this file
-install drivers: if you have htc sync installed,you should allready have drivers. if not,you can install htc sync,or install these modified htc drivers from revolutionary (driver mirror)
-unzip your miniadb_v1031.zip file. this is native funtionality in windows 7. you otherwise may need a utility such as "7-zip" to extract,or unzip it. place the unzipped folder onto the root of your C drive on your PC. root means the top level,not inside any folders. so just copy and paste,or drag and drop the folder onto C with everything else that is there. you may want to rename it to "miniadb_m7" since youll be putting some device specific files in here.
-open a command window. on windows 7,click the start bubble in the lower left and type "command" in the search box. xp i believe is similar or the same. doing this should open a small black command window.
-change to your miniadb_m7 directory. type the following at the prompt in your cmd window:

cd c:\miniadb_m7

your command promt should change to "c:miniadb_m7>" provided you: 1)unzipped the miniadb_v1031 zip file,and 2)put the folder on your c drive,and 3)entered the name of the folder correctly ("miniadb_m7" in this case)

-now make sure usb debugging is checked in developer options(you will need to turn it on first),and plug your phone into your PC with a usb cable
-make sure your phone is being recognized- type:

adb devices

if your drivers are installed correctly,this should return your phones serial number. you should hear the "found device" noises when you plug your phone in. if it starts installing drivers,wait for it to finish before typing the adb devices command.

if you get your serial number back,then enter this command:
adb reboot bootloader

this should take your phone to the "fastboot" screen,wich is white with colored letters. this is one mode of your bootloaders interactive modes. at the top youll see fastboot devices as confirmation youre in fastboot.

now enter:
fastboot devices
again,this should return your phones serial number. you should hear the "found device" noises when you plug your phone in. if it starts installing drivers,wait for it to finish before typing the adb devices command.

if you get your serial number back,you can enter the following to boot back to the phones OS:
fastboot reboot

and now,youve installed adb/fastboot and tested youre phones drivers. if at either spot,you have trouble and dont get your serial number back,there is some sort of connection issue. use these steps to troubleshoot:
troubleshooting connectivity issues:
-try a reboot of the PC
-try different usb cables and ports
-dont use a usb hub
-dont use usb 3.0
-make sure nothing capable of comunicating with the phone is enabled and running. htc sync,pdanet,easy tether,and even itunes have all been known to cause issues.
-windows 8 has been known to have issues. try a windows 7 or older machine

failing the above,
-i use these drivers for fastboot and adb(donwload and run as admin): http://downloads.unrevoked.com/HTCDriver3.0.0.007.exe (mirror)

failing that,try manually updating the drivers in the following manner:
-put the phone in fastboot mode(select fastboot from the hboot menu)
-open device manager on the PC
-plug in phone,watch for it to pop up in device manager.
-update drivers with device manager,pointing the wizard to the extracted
driver download folder from above

note that you can check the connectivity of the phone,and make sure drivers are working by in the following manner:
-open cmd window. change to directory containing adb/fastboot utilities

-adb with the phone in the booted OS,usb debug enabled,enter:
adb devices in a cmd window

-fastboot with phone in fastboot,enter:
fastboot devices in cmd window

in either case,a properly connected phone with working drivers installed should report back the phones serial number.

this process,in your cmd window,should look something like this:
Code:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\Scott>[COLOR="red"]cd c:\miniadb_m7[/COLOR]

c:\miniadb_m7>adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
FAxxxxxxxxxx    device


c:\miniadb_m7>[COLOR="red"]adb reboot bootloader[/COLOR]

c:\miniadb_m7>[COLOR="red"]fastboot devices[/COLOR]
FAxxxxxxxxxx    fastboot

c:\miniadb_m7>[COLOR="red"]fastboot reboot[/COLOR]
rebooting...

finished. total time: 0.037s

c:\miniadb_m7>


2)reset your "lock status flag"

to LOCK your bootloader,enter the following:

adb devices

adb shell

su (if needed to get a # prompt)

echo -ne '\x00\x00\x00\x00' | dd of=/dev/block/mmcblk0p2 bs=1 seek=33796
(i would very strongly recomend you copy/paste this)

exit
(exit a second time if you need to to get back to a normal > prompt)

adb reboot bootloader

verify you are now locked
_____________________________________________________________________________________________

to UNLOCK your bootloader,enter the following:

adb devices

adb shell

su (if needed to get a # prompt)

echo -ne "HTCU" | dd of=/dev/block/mmcblk0p2 bs=1 seek=33796
(i would very strongly recomend you copy/paste this)

exit
(exit a second time if you need to to get back to a normal > prompt)

adb reboot bootloader

verify you are now unlocked





other useful threads:
restore software status: original banner: http://xdaforums.com/one-m9/general/how-to-restore-software-status-original-t3092882
change mid: fastbooot oem writemid xxxxxxxxx
change cid: fastboot oem writecid xxxxxxxx
 
Last edited:

scotty1223

Inactive Recognized Contributor
Jan 3, 2011
2,813
3,056
Thanks a lot for your very useful information. I have 2 questions??
1) When I am s-on and need to get s-off, then I need to be unlocked and rooted, so to do these still I need to use HTC-dev to unlock and root.
2) Does this method wipe data like when we use HTC-dev?

1)yes. the first time you root,you will need to use htcdev to unlock the bootloader. the biggest benefit of this is the ability to return to a locked status for warranty. while s on,the best youll be able to do is relocked.

2)no,it will not wipe your data. it just changes the flag that hboot checks in order to decide if its locked,or not.
 

Nima78600

Senior Member
Apr 22, 2015
301
71
1)yes. the first time you root,you will need to use htcdev to unlock the bootloader. the biggest benefit of this is the ability to return to a locked status for warranty. while s on,the best youll be able to do is relocked.

2)no,it will not wipe your data. it just changes the flag that hboot checks in order to decide if its locked,or not.

Thanks a lot mate. Appreciate for your replying
 

an0ther

Senior Member
Sep 21, 2013
671
267
I am a little confused. How do I unlock my boot loader without root? I have s-off and i'm just messing around with trying to get rid of modified status but how does the "su" work without root?
 

blueberry60

Senior Member
Nov 13, 2010
1,182
894
Thanks for your very important knowledge.This question is not related to this thread, do you know which adb commands we can use to remove tampered flag as such in M7 and M8? I wonder mmcblk0p blocks might be different.
 

scotty1223

Inactive Recognized Contributor
Jan 3, 2011
2,813
3,056
Thanks for your very important knowledge.This question is not related to this thread, do you know which adb commands we can use to remove tampered flag as such in M7 and M8? I wonder mmcblk0p blocks might be different.
The block where the tampered flag is write protected,so it cannot be written to with adb and have the change "stick". We know the command,it just doesn't work.

An ruu won't be available for all variants,so there will still be a work around,it will just be a bit more complicated. I just need to make sure it works and try to make it as user friendly as possible.
 

scotty1223

Inactive Recognized Contributor
Jan 3, 2011
2,813
3,056
Last edited:

Behold_this

Senior Member
Jul 15, 2011
2,975
4,506
Las Vegas
im a little confused on what methods reset the flag,and which dont :eek:

could someone clarify the results of

-flash 0PJAIMG.zip via download mode from sd card

-flash 0PJAIMG.zip via RUU mode from pc

-run .exe from windows machine

-any other methods??

thanks :D
Ruu.exe worked for me.

Sdcard worked for @Mutasek24, but download mode manual flash did not (as reported in your other thread).

Because all methods are flashing the exact same SIGNED zip, and exe flashes through RUU mode, it's likely that flashing zip manually from RUU mode would reset the flag while using download mode does not. That needs to be tested tho.
 
Last edited:
  • Like
Reactions: scotty1223

Top Liked Posts

  • There are no posts matching your filters.
  • 48
    READ THIIS!
    *this thread is for m9. it will NOT work on m7,or any older device. please check the general forum for your particular device for a similar thread.


    this thread will let you unlock your bootloader without htcdev,or let you change your hboot watermark from relocked or locked back to stock.


    advantages
    -no hassle with htcdev,tokens,or unlock codes
    -no submitting your phones personal info to htc
    -the ability to get back to 100% stock without any visual traces or records of having been s off or unlocking your bootloader.

    you do NOT need to downgrade your hboot. this simple adb command works without any scary hboot downgrades.

    *you must be s off.
    *you must have superuser installed

    read this:
    this will not work if your s on. its not a way to magically unlock

    the usual disclaimers:
    use this info at your own risk. if it melts your phone into a little pile of aluminum goo,its not my fault.

    credits
    -beaups for schooling me on echo comand protocol
    -strace for originally discovering the location of the lock status flag(check out this thread for more info)
    - @Mutasek24 for fearlessly testing all commands

    IF you are an advanced user with adb/fastboot set up and some basic knowlede of the cmd window,you can skip to #2
    1)set up adb(windows 7 and older)


    -download this file
    -install drivers: if you have htc sync installed,you should allready have drivers. if not,you can install htc sync,or install these modified htc drivers from revolutionary (driver mirror)
    -unzip your miniadb_v1031.zip file. this is native funtionality in windows 7. you otherwise may need a utility such as "7-zip" to extract,or unzip it. place the unzipped folder onto the root of your C drive on your PC. root means the top level,not inside any folders. so just copy and paste,or drag and drop the folder onto C with everything else that is there. you may want to rename it to "miniadb_m7" since youll be putting some device specific files in here.
    -open a command window. on windows 7,click the start bubble in the lower left and type "command" in the search box. xp i believe is similar or the same. doing this should open a small black command window.
    -change to your miniadb_m7 directory. type the following at the prompt in your cmd window:

    cd c:\miniadb_m7

    your command promt should change to "c:miniadb_m7>" provided you: 1)unzipped the miniadb_v1031 zip file,and 2)put the folder on your c drive,and 3)entered the name of the folder correctly ("miniadb_m7" in this case)

    -now make sure usb debugging is checked in developer options(you will need to turn it on first),and plug your phone into your PC with a usb cable
    -make sure your phone is being recognized- type:

    adb devices

    if your drivers are installed correctly,this should return your phones serial number. you should hear the "found device" noises when you plug your phone in. if it starts installing drivers,wait for it to finish before typing the adb devices command.

    if you get your serial number back,then enter this command:
    adb reboot bootloader

    this should take your phone to the "fastboot" screen,wich is white with colored letters. this is one mode of your bootloaders interactive modes. at the top youll see fastboot devices as confirmation youre in fastboot.

    now enter:
    fastboot devices
    again,this should return your phones serial number. you should hear the "found device" noises when you plug your phone in. if it starts installing drivers,wait for it to finish before typing the adb devices command.

    if you get your serial number back,you can enter the following to boot back to the phones OS:
    fastboot reboot

    and now,youve installed adb/fastboot and tested youre phones drivers. if at either spot,you have trouble and dont get your serial number back,there is some sort of connection issue. use these steps to troubleshoot:
    troubleshooting connectivity issues:
    -try a reboot of the PC
    -try different usb cables and ports
    -dont use a usb hub
    -dont use usb 3.0
    -make sure nothing capable of comunicating with the phone is enabled and running. htc sync,pdanet,easy tether,and even itunes have all been known to cause issues.
    -windows 8 has been known to have issues. try a windows 7 or older machine

    failing the above,
    -i use these drivers for fastboot and adb(donwload and run as admin): http://downloads.unrevoked.com/HTCDriver3.0.0.007.exe (mirror)

    failing that,try manually updating the drivers in the following manner:
    -put the phone in fastboot mode(select fastboot from the hboot menu)
    -open device manager on the PC
    -plug in phone,watch for it to pop up in device manager.
    -update drivers with device manager,pointing the wizard to the extracted
    driver download folder from above

    note that you can check the connectivity of the phone,and make sure drivers are working by in the following manner:
    -open cmd window. change to directory containing adb/fastboot utilities

    -adb with the phone in the booted OS,usb debug enabled,enter:
    adb devices in a cmd window

    -fastboot with phone in fastboot,enter:
    fastboot devices in cmd window

    in either case,a properly connected phone with working drivers installed should report back the phones serial number.

    this process,in your cmd window,should look something like this:
    Code:
    Microsoft Windows [Version 6.1.7601]
    Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
    
    C:\Users\Scott>[COLOR="red"]cd c:\miniadb_m7[/COLOR]
    
    c:\miniadb_m7>adb devices
    * daemon not running. starting it now on port 5037 *
    * daemon started successfully *
    List of devices attached
    FAxxxxxxxxxx    device
    
    
    c:\miniadb_m7>[COLOR="red"]adb reboot bootloader[/COLOR]
    
    c:\miniadb_m7>[COLOR="red"]fastboot devices[/COLOR]
    FAxxxxxxxxxx    fastboot
    
    c:\miniadb_m7>[COLOR="red"]fastboot reboot[/COLOR]
    rebooting...
    
    finished. total time: 0.037s
    
    c:\miniadb_m7>


    2)reset your "lock status flag"

    to LOCK your bootloader,enter the following:

    adb devices

    adb shell

    su (if needed to get a # prompt)

    echo -ne '\x00\x00\x00\x00' | dd of=/dev/block/mmcblk0p2 bs=1 seek=33796
    (i would very strongly recomend you copy/paste this)

    exit
    (exit a second time if you need to to get back to a normal > prompt)

    adb reboot bootloader

    verify you are now locked
    _____________________________________________________________________________________________

    to UNLOCK your bootloader,enter the following:

    adb devices

    adb shell

    su (if needed to get a # prompt)

    echo -ne "HTCU" | dd of=/dev/block/mmcblk0p2 bs=1 seek=33796
    (i would very strongly recomend you copy/paste this)

    exit
    (exit a second time if you need to to get back to a normal > prompt)

    adb reboot bootloader

    verify you are now unlocked





    other useful threads:
    restore software status: original banner: http://xdaforums.com/one-m9/general/how-to-restore-software-status-original-t3092882
    change mid: fastbooot oem writemid xxxxxxxxx
    change cid: fastboot oem writecid xxxxxxxx
    4
    will test when I get a chance (fastboot flash recovery ... while LOCKED), and report back :angel:

    It works. I have personally done it twice, and the verizon crowd does it all the time. I have helped a few folks through it :D

    Boot to download mode, then fastboot flash recovery


    Sent from my HTC One
    3
    Thanks a lot for your very useful information. I have 2 questions??
    1) When I am s-on and need to get s-off, then I need to be unlocked and rooted, so to do these still I need to use HTC-dev to unlock and root.
    2) Does this method wipe data like when we use HTC-dev?

    1)yes. the first time you root,you will need to use htcdev to unlock the bootloader. the biggest benefit of this is the ability to return to a locked status for warranty. while s on,the best youll be able to do is relocked.

    2)no,it will not wipe your data. it just changes the flag that hboot checks in order to decide if its locked,or not.
    3
    Thanks for your very important knowledge.This question is not related to this thread, do you know which adb commands we can use to remove tampered flag as such in M7 and M8? I wonder mmcblk0p blocks might be different.
    The block where the tampered flag is write protected,so it cannot be written to with adb and have the change "stick". We know the command,it just doesn't work.

    An ruu won't be available for all variants,so there will still be a work around,it will just be a bit more complicated. I just need to make sure it works and try to make it as user friendly as possible.