How to lock bootloader after it was unlocked

sergsinger

Senior Member
May 19, 2012
509
147
73
This method was tested on P2a42 4/32 and P2c72 4/64 (both smartphones has 251 firmware installed).

Please, pay attention and read carefully:
You have a risk that P2 will go from EDL (9008) mode to 900E while you make a reconnect of connected to PC phone.
If you haven't successfully returned it by yourself into 9008 state - the only way is repair service. See details on 4Th step below the short instruction.
ADB and EDL (9008) drivers have to be pre-installed on your PC.

For those, who faced with flashing firmware, gaining root, working with ADB and Fastboot commands, EDL mode on P2 and so on, here is the short instruction:
1. Wipe sp if you have root: dd if=/dev/zero of=/dev/block/bootdevice/by-name/sp .
2. Wipe secinfo via Fastboot: fastboot erase secinfo .
3. Wipe userdata via Fastboot: fastboot erase userdata .
4. P2 is connected to PC in EDL (9008) mode, make a reset via launching blank-flash.bat from blankflash folder.
5. Flash 251 firmware as for unlocked device using START script .
6. Choose region ( ####682# ) and then make a reset ( ####7777# ).
7. That's all folks! Now you have locked P2 with a region that you want. So you can set the phone as you always do.


Below there is the same instruction, but detailed and with pictures.

From Unlocked to Locked state on P2.
1. Wipe sp if you have root: dd if=/dev/zero of=/dev/block/bootdevice/by-name/sp .
On this step you can use Total Commander with ADB plugin (YouTube will help you, there are tons of videos about it).
I prefer not to use PC, if there is another way.
What I've done:
Android Terminal Emulator installed and launched.
Gave it permission to root access.
In Emulator typed su and pressed Enter.
Sign $ will turned to # , which means that further commands will be under root access.
Type command: dd if=/dev/zero of=/dev/block/bootdevice/by-name/sp and press Enter.
If all done right, so you will see: Screenshot 1.
View attachment 4358523

2. Wipe secinfo via Fastboot: fastboot erase secinfo .
Turn off P2.
Boot it into Fastboot mode - press and hold two buttons (Power And Volume -), on P2 screen you will see Fastboot mode: Screenshot 2.
View attachment 4358524

Connect P2 to PC (it is recommended not to use card readers; connect to USB which are situated on motherboard for PC, there is an exception for notebook (laptop)).
Press right mouse button and hold Shift on ADB folder, which is placed in the root of Disc C (С:\), choose "Open command line" - a CMD window will appear on the screen of PC.
In CMD window type fastboot erase secinfo and press Enter.
If all done properly, all drivers set properly, on the screen of your PC you will see: Screenshot 3.
View attachment 4358525

3. Wipe userdata via Fastboot: fastboot erase userdata .
Continue in CMD window. Type fastboot erase userdata and press Enter.
On the screen of your PC you will see: Screenshot 4.
View attachment 4358526

Close CMD window on PC.

4. P2 connected to PC in EDL (9008) mode, make a reset via launching blank-flash.bat from blankflash folder.
blankflash folder must be placed in the root of Disc C (С:\).
On PC you must hold opened window of "Device manager" with opened string "Ports (COM and LPT)".
Your P2 must be connected to PC in EDL (9008) mode.
Use P2 very carefully without further re-connections, because there is a high risk, that P2 can go to 900E mode.
P2 connected to PC, press and hold all three buttons (Power and both Volume).
Hold buttons (phone will be rebooted twice) until you will see "Qualcomm HS-USB QDLoader9008 (COM12)" in opened window of device manager in string "Ports (COM and LPT)".
You might get another number of port (not only 12Th), it doesn't matter.
The main aim is "Qualcomm HS-USB QDLoader9008..." string in device manager.
Please, be very careful, because even little re-press of button or re-connect of cable will send your P2 to 900E mode with constant vibration and blue LED.
Try to restore phone to EDL (9008) mode by pressing and holding three buttons.
If you have no luck (from 900E to EDL) - congrats, you've got a brick.
From this point you should ask for help in repair service.
Going further, if all is going right and P2 connected to PC in EDL (9008) mode.
In device manager window on PC you will see this: Screenshot 5.
View attachment 4358527

From blankflash folder launch (double click of left mouse button) blank-flash.bat: Screenshot 6.
View attachment 4358528

You will see a CMD window which shows you a reset process of your P2.
If all done properly (without any "ERROR False"), you will see: Screenshot 7.
View attachment 4358529

In the end of reset your P2 will automatically boots from EDL (9008) mode to Fastboot mode: Screenshot 8.
View attachment 4358530

I suppose that there is no need to speak about 5Th and 6Th steps, because it is a basic knowledge, that you should know, when you are going to lock bootloader on P2.


Important notice.
You have to use original or other cable that has been already successfully used in Fastboot mode with your Р2.
The simple way to check cable is to type fastboot oem config in CMD and look what info it will give to you.

For those, who have already locked bootloader, it is strictly recommended not to flash stock ROM via flashall.bat.
For flashing stock you should use method for unlocked device, so you need to use START script.
All will go right if you will flash via flashall.bat after bootloader was locked, without any errors, Р2 will be booted as usual - Wi-Fi, SIM-cards (with names of operators), IMEI's and Serial number - all will be OK ...
But!
Calling, SMS and Mobile data will not work, you will see crosses on antenna icons in Status bar (in the string of modem firmware in "About" you will see "X" instead of "R" (Screenshot 9, 10) as it was, modems region will be defective).
View attachment 4358708View attachment 4358709

You can switch on/of Mobile data from Notification drawer, but there will be no connection, only Wi-Fi will work.
I am searching for solution of this problem.
As soon as it will be ready, it will be posted here. See post #2.


ADB folder (download, unzip) - View attachment ADB.rar
blankflash folder (download, unzip) - View attachment blankflash.rar

All thanks addresses to https://forum.xda-developers.com/member.php?u=279908.
I've just translated it from Russian to English from 4PDA site :)

Good luck and have a nice day!
Remember ...backup rules.
 
Last edited:

sergsinger

Senior Member
May 19, 2012
509
147
73
Solution.

Your phone must be unlocked and you must already have TWRP-backups of modem (NON-HLOS) and EFS from Р2.

1. Unlock bootloader.
2. Install TWRP.
3. Restore modem (NON-HLOS) and EFS in TWRP - you will get working modem, but there might be no sound in telephony.
4. You should install modem image via TWRP for Android 6 or 7 to get back to a working telephony (for additional instructions see post #3).

Later, if there will be a method which will work without TWRP-backups and possibly without unlock of bootloader, it will be posted here.

Modem download links:
Android 6 (062): http://lenovo-forums.ru/applications/core/interface/file/attachment.php?id=75313
Android 7 (244): http://lenovo-forums.ru/applications/core/interface/file/attachment.php?id=75314
 
Last edited:

sergsinger

Senior Member
May 19, 2012
509
147
73
How to restore a modem.

Important notice - you need to use modem with the same OS version which is installed on your phone.

Look here:
Firmware 062 - this is Android 6.
Firmware 233 and higher - this is Android 7.

Flash this:
For Android 6 - Modem_P2_062_ROW.zip
For Android 7 - Modem_P2_244_ROW.zip

Flash modem via TWRP:
1. Download zip for OS that you need (do not unzip it, rename or choose extension).
2. Copy to the phone memory (or to external micro-SD card).
3. Boot to TWRP and act as it is shown on the screenshots ...
 
Last edited:

sergsinger

Senior Member
May 19, 2012
509
147
73
Is the warranty back if the bootloader is relocked?
It is a difficult question.
I suppose, that official repair service can detect it.
Remember how you unlocked P2 at first time: you asked for unlock with internet connection and Lenovo ID, there is a possibility, that some data about it stored and can be used for different purposes.
 
  • Like
Reactions: alirazaagha

Danoz88

Senior Member
Mar 14, 2016
154
26
0
It is a difficult question.
I suppose, that official repair service can detect it.
Remember how you unlocked P2 at first time: you asked for unlock with internet connection and Lenovo ID, there is a possibility, that some data about it stored and can be used for different purposes.
Thanks I thought the same. But in this case why should we go back to locked bootloader :confused::)
 

Siva Mk

Senior Member
Oct 10, 2014
310
120
0
Thiruvananthapuram
It is a difficult question.
I suppose, that official repair service can detect it.
Remember how you unlocked P2 at first time: you asked for unlock with internet connection and Lenovo ID, there is a possibility, that some data about it stored and can be used for different purposes.
I agree... But there are some reports on this forum suggesting otherwise.
One common report is the replacement of motherboard for bricked devices, that too for unlocked devices.
 

jitkr

Senior Member
Dec 17, 2012
304
228
0
New Delhi
Locked Boot-loader with just (3) steps:
1. Wipe sp if you have root: dd if=/dev/zero of=/dev/block/bootdevice/by-name/sp .
2. Wipe secinfo via Fastboot: fastboot erase secinfo .
3. Flash fastboot images(Stock files).

* I was using Cardinal AOSP 8.0.0

*Blankflash not used

Thanks :) Locked :)
 
Last edited:

Velijoža

Member
Dec 25, 2016
8
0
0
Locked Boot-loader with just (3) steps:
1. Wipe sp if you have root: dd if=/dev/zero of=/dev/block/bootdevice/by-name/sp .
2. Wipe secinfo via Fastboot: fastboot erase secinfo .
3. Flash fastboot images(Stock files).

* I was using Cardinal AOSP 8.0.0

*Blankflash not used

Thanks :) Locked :)
Oh great. Is this all it have to be done or followed by previous page? Any problems or things to be aware of?
 

Shuvamilu

Senior Member
Sep 9, 2016
226
26
0
Locked Boot-loader with just (3) steps:
1. Wipe sp if you have root: dd if=/dev/zero of=/dev/block/bootdevice/by-name/sp .
2. Wipe secinfo via Fastboot: fastboot erase secinfo .
3. Flash fastboot images(Stock files).

* I was using Cardinal AOSP 8.0.0

*Blankflash not used

Thanks :) Locked :)
I did not understand Wipe sp if you have root: dd if=/dev/zero of=/dev/block/bootdevice/by-name/sp
 

Danoz88

Senior Member
Mar 14, 2016
154
26
0
I don't understand
Every step which jitkr enumerated is explained by sergsinger who made this guide.
Read the complete first post of sergsinger. Also click on show content for full explanation.
If you farther understand nothing please clearly explain what exactly.
"I don't understand" does not help in any way.
From Unlocked to Locked state on P2.
1. Wipe sp if you have root: dd if=/dev/zero of=/dev/block/bootdevice/by-name/sp .
On this step you can use Total Commander with ADB plugin (YouTube will help you, there are tons of videos about it).
I prefer not to use PC, if there is another way.
What I've done:
Android Terminal Emulator installed and launched.
Gave it permission to root access.
In Emulator typed su and pressed Enter.
Sign $ will turned to # , which means that further commands will be under root access.
Type command: dd if=/dev/zero of=/dev/block/bootdevice/by-name/sp and press Enter.
If all done right, so you will see: Screenshot 1.
View attachment 4358523
 

Shuvamilu

Senior Member
Sep 9, 2016
226
26
0
Every step which jitkr enumerated is explained by sergsinger who made this guide.
Read the complete first post of sergsinger. Also click on show content for full explanation.
If you farther understand nothing please clearly explain what exactly.
"I don't understand" does not help in any way.
Next process
 

eried1

Senior Member
May 27, 2016
269
19
0
Stockholm
I lost my signal forever when I did a nandroid backup from another P2. I've tried it all, but nothing seems to work when it comes to restoring it.

I'm a bit confused by the first posts. OP talks about locking the bootloader and post #2 and #3 say you have to be unlocked to restore the modem? I'd have thought you wanted to lock it in order to flash the modem.
 
Last edited:
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone