Relocking the bootloader and returning to stock ROM

troy5890

Senior Member
Jun 14, 2014
1,571
541
143
Hey guys, I was planning on sending my Axon 7 in to get a new battery since I'm going to be keeping this for a very long time(until its successor maybe) and I was wondering if there is a way to relock the bootloader to do so?

Here's my original plan to do so:
• Repartition to my original GPT from treble
• Wipe everything (format data, clean internal storage)
• put it into EDL mode and flash B19 with MIFlash(only one with fastboot commands)
• Try the procedure by going into developer options, enable OEM unlock, reboot to fastboot mode, type in "fastboot oem lock"
• Profit?
 

KH_Lionheart

Senior Member
Sep 25, 2011
135
42
0
Central Texas
I was just thinking about doing this earlier today for the same reason, and while I am no expert, that was the same thought process I was going by for returning to full stock. Although someone more experienced, such as @Oki, might be able to provide a more confident answer to if this is the best/proper way.
 
  • Like
Reactions: troy5890

troy5890

Senior Member
Jun 14, 2014
1,571
541
143
I was just thinking about doing this earlier today for the same reason, and while I am no expert, that was the same thought process I was going by for returning to full stock. Although someone more experienced, such as @Oki, might be able to provide a more confident answer to if this is the best/proper way.
Glad I wasn't the only one thinking about this process. Its relieving. I might just shoot him a PM and ask for his input on the matter.
 

Oki

Senior Member
Jul 6, 2006
1,009
1,861
0
East Coast
Glad I wasn't the only one thinking about this process. Its relieving. I might just shoot him a PM and ask for his input on the matter.
Well, I prefer to answer questions in the forum instead of PM, this way the community could benefit from the outcome of the thread. Just mention me by typing @Oki and I will be notified about someone mentioning me.

---------- Post added at 12:25 ---------- Previous post was at 12:23 ----------

Hey guys, I was planning on sending my Axon 7 in to get a new battery since I'm going to be keeping this for a very long time(until its successor maybe) and I was wondering if there is a way to relock the bootloader to do so?

Here's my original plan to do so:
1. Repartition to my original GPT from treble
2. Wipe everything (format data, clean internal storage)
3. put it into EDL mode and flash B19 with MIFlash(only one with fastboot commands)
4. Try the procedure by going into developer options, enable OEM unlock, reboot to fastboot mode, type in "fastboot oem lock"
5. Profit?
No need for step 1. Flashing a Full EDL package of a stock rom will repartition the GPT to the stock configuration.
 
Last edited:

troy5890

Senior Member
Jun 14, 2014
1,571
541
143
Well, I prefer to answer questions in the forum instead of PM, this way the community could benefit from the outcome of the thread.

---------- Post added at 12:25 ---------- Previous post was at 12:23 ----------


No need for step 1. Flashing a Full EDL package of a stock rom will repartition the GPT to the stock configuration.
Thank you Oki for the response and you're right. Having it answered here is better for the community as whole. Do the rest of the steps look pretty good to you after flashing the full EDL package?
 

Oki

Senior Member
Jul 6, 2006
1,009
1,861
0
East Coast
Thank you Oki for the response and you're right. Having it answered here is better for the community as whole. Do the rest of the steps look pretty good to you after flashing the full EDL package?
I am planning to complete the unlock / restore to stock guide by including the relock procedure. For doing so I believe the best method is:

1. Full format of data and cache partitions to EXT4
2. Flash The factory ROM. This is Android M ROM
3. Flash patched fastboot for Android M (as if you were going to unlock)
4. Boot the system, enable developers menu, and in that menu enable OEM unlocking and USB debugging options.
5. in your computer prompt type adb reboot bootloader
6. in your computer write fastboot devices to ensure it is in fastboot mode.
7. Type fastboot lock or fastboot oem lock or fastboot oem lock-go. I do not remember the exact command right now but one of them will be recognized.
8. Reflash the same EDL package to have a locked Axon 7 with the original firmware.
9. Enter stock recovery (VolUp+Power) and do a factory reset.
 
Last edited:
  • Like
Reactions: KH_Lionheart

troy5890

Senior Member
Jun 14, 2014
1,571
541
143
I am planning to complete the unlock / restore to stock guide by including the relock procedure. For doing so I believe the best method is:

1. Full format of data and cache partitions to EXT4
2. Flash The factory ROM. This is Android M ROM
3. Flash patched fastboot for Android M (as if you were going to unlock)
3. Boot the system, enable developers menu, and in that menu enable OEM unlocking and USB debugging options.
4. in your computer prompt type adb reboot bootloader
5. in your computer write fastboot devices to ensure it is in fastboot mode.
6. Type fastboot lock or fastboot oem lock or fastboot oem lock-go. I do not remember the exact command right now but one of them will be recognized.
This method looks quite helpful. I did notice that you said flash back to Marshmallow. I remember relocking and unlocking on B19, but I think I might just do that to make sure I don't mess anything up.
 

Oki

Senior Member
Jul 6, 2006
1,009
1,861
0
East Coast
This method looks quite helpful. I did notice that you said flash back to Marshmallow. I remember relocking and unlocking on B19, but I think I might just do that to make sure I don't mess anything up.
You can use N if you want. The problem with N is the removal of edl boot using the key combo. It is very useful in case something fails. Booting edl mode using the button combo helps you recover it easily.
 
Last edited:

troy5890

Senior Member
Jun 14, 2014
1,571
541
143
You can use N if you want. The problem with N is the removal of edl boot using the key combo. It is very useful in case something fails. Booting edl mode ising the button combo helps you recover it easily.
I recall B19 has the EDL combo still intact when I would use it. I'll see if I can try that out in a few days, but I'll definitely keep that in mind if something goes wrong.
 

KH_Lionheart

Senior Member
Sep 25, 2011
135
42
0
Central Texas
I am planning to complete the unlock / restore to stock guide by including the relock procedure. For doing so I believe the best method is:

1. Full format of data and cache partitions to EXT4
2. Flash The factory ROM. This is Android M ROM
3. Flash patched fastboot for Android M (as if you were going to unlock)
4. Boot the system, enable developers menu, and in that menu enable OEM unlocking and USB debugging options.
5. in your computer prompt type adb reboot bootloader
6. in your computer write fastboot devices to ensure it is in fastboot mode.
7. Type fastboot lock or fastboot oem lock or fastboot oem lock-go. I do not remember the exact command right now but one of them will be recognized.
8. Reflash the same EDL package to have a locked Axon 7 with the original firmware.
9. Enter stock recovery (VolUp+Power) and do a factory reset.
I might be having to do this as my phone as of last night will not connect to mobile networks at all suddenly and for seemingly no reason.

Could I do the full wipe, reboot to fastboot from recovery, then do the relock (while I still have easy access to it), then since I'll still have a bootstack with ELD button combo installed, use MiFlash to flash B35 from djkuz's edl tool thread? If not, by following this list should I flash B29 which is the oldest M firmware from his thread had they already removed fastboot with that one?
 

troy5890

Senior Member
Jun 14, 2014
1,571
541
143
I might be having to do this as my phone as of last night will not connect to mobile networks at all suddenly and for seemingly no reason.

Could I do the full wipe, reboot to fastboot from recovery, then do the relock (while I still have easy access to it), then since I'll still have a bootstack with ELD button combo installed, use MiFlash to flash B35 from djkuz's edl tool thread? If not, by following this list should I flash B29 which is the oldest M firmware from his thread had they already removed fastboot with that one?
I ended up relocking the bootloader by doing the following

1. Repartition the vendor if you are running treble and backup your internal storage
2. Wipe the device in Twrp by Data, dalvik cache, System ,etc
3. Reboot into EDL mode, open MiFlash and flash the B19 EDL zip(don't flash TWRP afterwards for it to have the stock recovery)
4. Unplug, wait 2-3 seconds, reboot by holding the power button and get past the setup from Mifavor.
5. Go into developers mode and enable USB debugging(your phone should still be unlocked, so the option to enable oem unlocking should be greyed out).
6. Reboot into the bootloader and plug it in to the computer
7. Pull up your command prompt from your computer, make sure you have ADB and fastboot drivers installed, and make sure you put in "fastboot devices"
8. If it shows up, then type "fastboot oem lock" and your phone will go black and reboot to recovery for it to wipe your internal storage. After that is completed, you should be back to a locked bootloader on B19 firmware. If you want to upgrade to B35, you can perform the software upgrade in the settings to get there.