How To Guide [GUIDE] How to unlock the bootloader for Nokia 2.2

Search This thread

BobStrop

Member
Jul 31, 2021
10
0
Don't remember if we talked about this before, but leave adequate space for where you want to store the readback, not enough space means the readback fails. I'd say leave at least 16 GB free to be on the safe side.

If that didn't fix the problem (or you already have enough space) It's possible your USB cable/port could be malfunctioning: try a different cable or use a different USB port. Also shorter USB cables are more recommended since the readback process requires fast read speeds and read speed deteriorates the longer the cable is.
Thanks.

I made some more space on my hard drive and attempted readback with several shorter cables but it is as though there is no connection on the shorter connection. Perhaps those particular cables have a diferent use?

Could somebody confirm the readback address length and value for the Nokia 2.2.?
 

TheBeast941

Senior Member
Apr 6, 2021
59
5
Actually, you were not right about that – flashing Magisk on Android 11 is in fact possible (and I managed to have it working!), but you need to disable vbmeta first (where Magisk worked fine on Android 9 without disabling vbmeta anyway). So I believe I was right – this wasn't due to incompatible scatter file, but because of boot verification failing on checksum check (or at least AFAIK that's how boot verification). I've also succeed getting the same stock boot image (and vbmeta image) by extracting images from OTA update – so the Android 9 scatter file works fine on Android 11.

So basically to get Magisk working on Nokia 2.2 after Android 11 update, you just need to flash a patched image and disable boot verification in vbmeta (I did that by passing both --disable-verification and --disable-verity flags while flashing Android 11 stock vbmeta).

Here I shared a screenshot as a proof it really can work (at least on Magisk 23.0).

EDIT: Some minior changes in the text sense, it didn't showed correctly what I was meant about when writing the post, which could lead to misinterpretation.
Is there any specific way you managed to get it working? Let's assume that you've just finished following the original guide and are now on Android 9 with an unlocked bootloader. Did the bootloader stay unlocked while installing the Android 11 OTA? If not, how did you go about installing the Android 11 update while being able to flash vbmeta with --disable-verification and --disable-verity flags? Are you using the same lk and/or preloader on Android 9 for Android 11 (because I'm comparing the ones from Android 9 and Android 11 and they are different sizes)?

If possible, please create a simple guide for how you managed to get it to work so that I can try it on my device too.


UPDATE: Successfully managed to update to Android 11 with Magisk, ty for mentioning about the vbmeta image and its flags
 
Last edited:
  • Like
Reactions: AAditya846

AAditya846

Member
May 16, 2016
26
0
Is there any specific way you managed to get it working? Let's assume that you've just finished following the original guide and are now on Android 9 with an unlocked bootloader. Did the bootloader stay unlocked while installing the Android 11 OTA? If not, how did you go about installing the Android 11 update while being able to flash vbmeta with --disable-verification and --disable-verity flags? Are you using the same lk and/or preloader on Android 9 for Android 11 (because I'm comparing the ones from Android 9 and Android 11 and they are different sizes)?

If possible, please create a simple guide for how you managed to get it to work so that I can try it on my device too.


UPDATE: Successfully managed to update to Android 11 with Magisk
Teach me senpai

Edit: Is your device's bootloader still unlocked? And if it is, can you successfully boot any android 11 GSI into your device now? (Even Android 10 Lineage OS would be great. Anything greater than 9). I'm assuming now that we have the Android 10 or 11 vendor already installed newer GSIs must boot. Please let us noobs know how to do it?
 
Last edited:

TheBeast941

Senior Member
Apr 6, 2021
59
5
Teach me senpai

Edit: Is your device's bootloader still unlocked? And if it is, can you successfully boot any android 11 GSI into your device now? (Even Android 10 Lineage OS would be great. Anything greater than 9). I'm assuming now that we have the Android 10 or 11 vendor already installed newer GSIs must boot. Please let us noobs know how to do it?
I just reverted any modifications I did so it's basically like how the device should be after you complete the guide, and then let the device install the Android 11 OTA. Then I waited for the device to first boot, flashed the Android 11 boot image with Magisk and flashed that and vbmeta (with its flags) in fastboot (yes bootloader does in fact stay unlocked) and rebooted and voila.

Nokia 2.2 Android 11 ROM:


https://android.googleapis.com/packages/ota-api/package/b582d98a7aee43730a6106679872b86ea2b2649d.zip (00EEA Variant)

Check which version you need from the build number in settings, extract the payload.bin and use payload dumper to extract the ROM files out of that. You'll just need the boot and vbmeta images.

I haven't tried to flash any GSI at the moment but I might try in the future.
 

SB3P

Member
Aug 11, 2021
15
3
Is there any specific way you managed to get it working? Let's assume that you've just finished following the original guide and are now on Android 9 with an unlocked bootloader. Did the bootloader stay unlocked while installing the Android 11 OTA? If not, how did you go about installing the Android 11 update while being able to flash vbmeta with --disable-verification and --disable-verity flags? Are you using the same lk and/or preloader on Android 9 for Android 11 (because I'm comparing the ones from Android 9 and Android 11 and they are different sizes)?

If possible, please create a simple guide for how you managed to get it to work so that I can try it on my device too.


UPDATE: Successfully managed to update to Android 11 with Magisk
OK, here's the procedure how to make it work (from scratch, i.e. default ROM with locked image):

1. Unlock bootloader (if you have unlocked it already, skip this step).

2. Update to Android 11. You can do a full security update if you wish to (please note I haven't tested from which security update you're safe to patch, but it's very likely all of them would work with this procedure, at least from my knowledge).

3. Check your active partition slot with this command:

Rich (BB code):
fastboot getvar active-slot

Save it somewhere or remember – it will be needed in the next step.

4. Do a readback with SP Flash tool of boot and vbmeta partitions. You need to know your partition slot for that task (A or B), so you won't flash a wrong image later, possibly breaking your OS. I did a readback with MTK6761_Android_scatter.txt file and I took from it the proper partition lenghts. So, if you for instance search for a boot partition of slot A (boot_a), you should copy the start and lenght values from the properties as shown on the screenshot below:
1629054876268.png

It is recommended to seperate these two images for a readback – so, in total, you should have two entries, first for a boot partition and second for vbmeta:
1629055359490.png

When adding an SP Flash Tool entry, I recommended to call it with following scheme (where {partition}_{slot} should be repaced with parition name):

Code:
{partition}_{slot}.img

...because you're doing a readback of a single partition, not a full readback as you did before to unlock the bootloader. Moreover, you don't even need to extract the boot image, hence it is an image of a single partition already, not a ROM image containing multiple images inside of it – so you can flash it directly after patching.

5. Boot your device, copy the boot image you got from the readback and patch it with official Magisk Manager application on your phone (of course, install it first, if you don't have it already). Currently I tested the 23.0 version, so take that in mind the newer/older versions may not work at all and produce an incompatible image format. I won't guide you how to patch images with Magisk, you should know that if you're read this guide.

6. Flash the image and patch the vbmeta image to disable the verification. The command to do that is as follows:

Rich (BB code):
fastboot --disable-verification --disable-verity flash vbmeta <path-to-vbmeta-image>
fastboot flash boot <path-to-magisk-boot-image>

(replace <path-to-vbmeta-image> and <path-to-magisk-boot-image> with correct image paths)

7. Reboot your device and if there's no bootloop at the process, you're done. If not, flash stock Android 11 image you got from the readback and reboot. If you will boot successfully, then it may be due to some security update being incompatible with magisk (which is very unlikely to happen, but I wouldn't say that's impossible) or due to not disabled boot verification with vbmeta. If you can't even reboot with the stock Android 11 image, you're likely did a readback wrong, reflash the stock Android 9 image and try doing all of the steps again, making this time sure you took the correct values from the scatter file.

(Similar procedure may work for Android 10, althrough I haven't tested it yet.)

EDIT: Some fixes to the instrucions.
 
Last edited:

SB3P

Member
Aug 11, 2021
15
3
I just reverted any modifications I did so it's basically like how the device should be after you complete the guide, and then let the device install the Android 11 OTA. Then I waited for the device to first boot, flashed the Android 11 boot image with Magisk and flashed that and vbmeta (with its flags) in fastboot (yes bootloader does in fact stay unlocked) and rebooted and voila.

Nokia 2.2 Android 11 ROM:


https://android.googleapis.com/packages/ota-api/package/b582d98a7aee43730a6106679872b86ea2b2649d.zip (00EEA Variant)

Check which version you need from the build number in settings, extract the payload.bin and use payload dumper to extract the ROM files out of that. You'll just need the boot and vbmeta images.

I haven't tried to flash any GSI at the moment but I might try in the future.
Yea, just make sure if you did any of the security updates to use readback instead of boot OTA images if you want to be able to do updates after doing a flash (yes, most security updates won't break Magisk patching, unless some important changes would be made to the boot image like the kernel update to the new major version or/and changes within the ramdisk format).

PS: This is how I believe I broke it for myself + I got issues with fastboot, althrough that may not be the cause of wrong boot image...
 

areallydumbperson

Senior Member
For me Magisk (tested 23.0, 22.1 and 23001 Canary) doesn't seems to work on Android 11 (it does bootloop), either by using this ROM or patching my own Android 11 stock boot image (that boots fine when flashing boot partition with `fastboot`). Moreover, by comparing MD5 checksums in both patched files (yours vs mine), they seems to be identical files. What could cause that and do I need to tweak something else?

Also, when trying to patch Android 9 boot image with Magisk everything seems to work alright...
I am so sorry I forgot to take the images down

edit: wow u have a tutorial on getting magisk working kudos to you :)
 

areallydumbperson

Senior Member
I know root + Android 9 works, but are there any chances to use that (Android 11) image? Has anyone tested it and confirmed, or
@areallydumbperson just sent it there untested and not working? As I pointed, I was able to reproduce this image with Magisk on Android 11 as well, but unfortunelly I was unable to flash it.



As I said earlier:



However, I don't remember if I flashed Magisk then, so I would need to test that again to prove you more details about what could gone wrong.
I had taken down and reposted magisk images for android 11 because it didn’t work but 2nd time did so I posted it I forgot how many more stages there was to flash it rip
 

areallydumbperson

Senior Member
I just reverted any modifications I did so it's basically like how the device should be after you complete the guide, and then let the device install the Android 11 OTA. Then I waited for the device to first boot, flashed the Android 11 boot image with Magisk and flashed that and vbmeta (with its flags) in fastboot (yes bootloader does in fact stay unlocked) and rebooted and voila.

Nokia 2.2 Android 11 ROM:


https://android.googleapis.com/packages/ota-api/package/b582d98a7aee43730a6106679872b86ea2b2649d.zip (00EEA Variant)

Check which version you need from the build number in settings, extract the payload.bin and use payload dumper to extract the ROM files out of that. You'll just need the boot and vbmeta images.

I haven't tried to flash any GSI at the moment but I might try in the future.
unrelated to magisk or anything in this thread but I had seen some work on the Xperia l1 with a boot menu that has a recovery mode and a normal mode option which seems cool and the ported it from an Amazon fire kernel boot menu which is crazy I tried to atleast do it and failed miserably lol
 

TheBeast941

Senior Member
Apr 6, 2021
59
5
Yea, just make sure if you did any of the security updates to use readback instead of boot OTA images if you want to be able to do updates after doing a flash (yes, most security updates won't break Magisk patching, unless some important changes would be made to the boot image like the kernel update to the new major version or/and changes within the ramdisk format).

PS: This is how I believe I broke it for myself + I got issues with fastboot, althrough that may not be the cause of wrong boot image...
ngl I wouldn't care too much about the security patches (unless there was an important one) because we were using security patches that were two years old before updating to Android 11, at least updating to Android 11 itself would make the device more secure than it would have been before
 

areallydumbperson

Senior Member
ngl I wouldn't care too much about the security patches (unless there was an important one) because we were using security patches that were two years old before updating to Android 11, at least updating to Android 11 itself would make the device more secure than it would have been before
About android 11 (goes for 10 too maybe) I wanted to try port twrp for fun (yes I know I have weird obsessions to try and port stuff onto this phone :p) and I go into sbin in the boot image and the recovery is just gone I really wonder what magic is Nokia doing or google
 

AAditya846

Member
May 16, 2016
26
0
About android 11 (goes for 10 too maybe) I wanted to try port twrp for fun (yes I know I have weird obsessions to try and port stuff onto this phone :p) and I go into sbin in the boot image and the recovery is just gone I really wonder what magic is Nokia doing or google
That means no recovery on android 11? Damn it! 😑
I just tried a few android 11 GSI (2 AOSP and 1 Andy Yann's LineageOS build). None of them booted. Reinstalled stock system.img extracted from payload and glad that everything went back like a time machine. The fact that there is no specific recovery partition to this device reallly gives me headache. Have to be seriously prepared everytime I have to do something.
 

AAditya846

Member
May 16, 2016
26
0
ANDROID 12 GSI: SUCCESSFUL BOOT 😍

UPDATE: MY OVER EXCITED SELF COMPLETELY OVERLOOKED THAT IT WAS NOT MEANT TO BE A DAILY DRIVER. PASS THIS ONE, IT'S NOT WORTH IT 🥱

Guys I was able to boot into android 12 GSI (AOSP)!
I was on Android 11, trying every single GSI I could find. Accidentally downloaded the only android 12 GSI on github , flashed it, then realised I made a mistake, but tried to see what happens if I try to boot and it booted in like 30 seconds.

--what works--


I've tested WiFi, calls, 3G (I don't have 4G SIM, never needed it), camera (video quality is trash as it is in every non-stock system), sound from speakers and earpiece, gps. I also saw option to take scrolling screenshot.

--what doesn't works--


headphone jack :(

Also there is no browser but the default Webview tester.

Screenshot_20210816-113220.png
Screenshot_20210816-113226.png
Screenshot_20210816-113243.png
Screenshot_20210816-113332.png
Screenshot_20210816-113359.png
Screenshot_20210816-113402.png
Screenshot_20210816-113406.png
Screenshot_20210816-113657.png
Screenshot_20210816-115509.png
Screenshot_20210816-115621.png


I don't think there's much to test in Nokia 2.2

It's funny how absolutely no daily driver OS I tried booted successfully. Only this was successful which had 0 expectations and mattered the least...
Thanks to everyone on this thread for ebery bit of help. I guess I'll be going back to stock for while.

One more thing - I didn't flashed vbmeta after I flashed system. After which I did fastboot erase userdata since fastboot -w did nothing.
 
Last edited:

TheBeast941

Senior Member
Apr 6, 2021
59
5
That means no recovery on android 11? Damn it! 😑
I just tried a few android 11 GSI (2 AOSP and 1 Andy Yann's LineageOS build). None of them booted. Reinstalled stock system.img extracted from payload and glad that everything went back like a time machine. The fact that there is no specific recovery partition to this device reallly gives me headache. Have to be seriously prepared everytime I have to do something.
I might try to take the old Android 9 ported TWRP and update it to use the Android 11 boot image soon, just need the time to be able to do so
 

TheBeast941

Senior Member
Apr 6, 2021
59
5
ANDROID 12 GSI: SUCCESSFUL BOOT 😍
Guys I was able to boot into android 12 GSI (AOSP)!
I was on Android 11, trying every single GSI I could find. Accidentally downloaded the only android 12 GSI on github , flashed it, then realised I made a mistake, but tried to see what happens if I try to boot and it booted in like 30 seconds.

--what works--


I've tested WiFi, calls, 3G (I don't have 4G SIM, never needed it), camera (video quality is trash as it is in every non-stock system), sound from speakers and earpiece, gps. I also saw option to take scrolling screenshot.

--what doesn't works--


headphone jack :(

Also there is no browser but the default Webview tester.

View attachment 5386901View attachment 5386903View attachment 5386905View attachment 5386907View attachment 5386909View attachment 5386911View attachment 5386913View attachment 5386915View attachment 5386917View attachment 5386919View attachment 5386921

I don't think there's much to test in Nokia 2.2

Thanks to everyone on this thread.

One more thing - I didn't flashed vbmeta after I flashed system. After which I did fastboot erase userdata since fastboot -w did nothing.
Seems like that is just a test image that was meant to be run on emulators, better to stick to a full version of Android 11 than use an experimental version of Android 12
 

TheBeast941

Senior Member
Apr 6, 2021
59
5
I tried porting my old TWRP image to the new Android 11 Magisk patched boot image, magisk works fine but as soon as you reboot into recovery you get stuck at the boot logo :(

I guess I'll just have to make one for Magisk and one for TWRP, like before.
 

AAditya846

Member
May 16, 2016
26
0
I tried porting my old TWRP image to the new Android 11 Magisk patched boot image, magisk works fine but as soon as you reboot into recovery you get stuck at the boot logo :(

I guess I'll just have to make one for Magisk and one for TWRP, like before.
You've done so much for this crappy device. I'm just thankful for the working TWRP man. 🤲🏼
Also, can you tell me one thing: If i'm installing a GSI, which is rooted (like those with 'su' in the name), can they cause system to not boot? I'm new to these things.
Also, I tried Installing Android 11 GSIs available at ci.android.com but those also didn't go as planned.
I'm thinking about modifying the system.img kind of how flashable zip ROMs were being made 3-4 years back. What do you say?
 
Last edited:

areallydumbperson

Senior Member
That means no recovery on android 11? Damn it! 😑
I just tried a few android 11 GSI (2 AOSP and 1 Andy Yann's LineageOS build). None of them booted. Reinstalled stock system.img extracted from payload and glad that everything went back like a time machine. The fact that there is no specific recovery partition to this device reallly gives me headache. Have to be seriously prepared everytime I have to do something.
Weird thing the phone boots into android 11 specific recovery
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Fastboot > flash system > flash vbmeta from stock OS (Android 9) > fastboot -w > reboot
    Right?
    yepp , thats right
  • 10
    To moderators: There's no Nokia 2.2 forum in XDA-Developers, please move this topic when available.
    To content farms: DO NOT COPY AND PASTE THE ENTIRE GUIDE!

    Now the last piece of puzzle of Nokia x.2 series bootloader unlock line has been completed, thanks to the help of a member called Woke_World.
    After I read his procedure, I decided to optimize the entire procedure and use my own firmware file to achieve it.

    Step 1: Do full backup
    (For this case please use SP Flash Tool 5.1924 or newer that can be found on spflashtool.com )

    The firmware for this procedure can be downloaded here: https://www.androidfilehost.com/?fid=2188818919693749336
    SHA256: D056631A8A795A06795B3A4E5F334DBF9B55C3C71269831F8E7926FA3ABA5637

    Please follow the procedure in this topic to do readback: https://forum.xda-developers.com/t/...-global-nokia-5-1-plus-unbrick-guide.3858253/
    For this case, you need to keep Download Agent file as the same came with SP Flash Tool, and altunlock-MT6761_Android_scatter.txt

    Once readback done, please extract these images inside your backup for later use:
    Code:
    nvcfg.img
    nvram.img
    proinfo.img
    protect1.img
    protect2.img

    DO NOT SKIP STEP 1, OR YOUR PHONE WILL NOT HAVE IMEI AND SN!

    Step 2: Format all + Download to flash the firmware with altunlock scatter file
    Switch to Download tab, and choose format all + download to flash the entire phone with this scatter file: "altunlock-MT6761_Android_scatter.txt"
    Once flash complete, disconnect the phone.

    Step 3: Bootloader unlock
    Press and hold volume down key and connect to PC - keep that condition for around 12 seconds then the phone will boot to Fastboot mode.
    Execute these 2 commands to perform bootloader unlock:
    Code:
    fastboot flashing lock_critical
    fastboot oem unlock

    Look at your phone and press volume up to confirm unlock. Once done, disconnect the phone and remove the battery, wait 5 seconds and place the battery back.

    Step 4: Do readback again
    Once readback done, please extract these images inside your backup for later use:
    Code:
    sec1.img
    seccfg.img

    Step 5: Format all + Download to flash the firmware with original scatter file
    Switch to Download tab, and choose format all + download to flash the entire phone with the original scatter file named as "MT6761_Android_scatter.txt" - note there's no altunlock at the beginning of filename.
    Once flash complete, disconnect the phone.

    Step 6: Power on the phone and enable USB debugging, root the phone with MTK Easy SU
    [NOTE: DO NOT INSERT ANY SIM CARDS AND YOU MUST SKIP INTERNET CONNECTION]

    You can download the MTK Easy SU apk from here : https://github.com/JunioJsv/mtk-easy-su/releases/latest
    And Magisk APK from here : https://github.com/topjohnwu/magisk/releases/latest

    When you have both MTK Easy Su and Magisk APK installed, please enable the "Run as 64 Bits" option, and tap the hash (#) button to enable root.
    Once root complete, we can now re-enable bootloader unlock and restore IMEI.

    Step 7: Re-enable bootloader unlock and restore IMEI
    Please copy the 7 img files to your phone's internal storage:
    Code:
    nvcfg.img
    nvram.img
    proinfo.img
    protect1.img
    protect2.img
    sec1.img
    seccfg.img
    We assume you copied them to root directory of internal storage (a.k.a. /storage/emulated/0/ )

    Then execute these commands on your PC:
    Code:
    adb shell
    su
    dd if=/storage/emulated/0/nvcfg.img of=/dev/block/bootdevice/by-name/nvcfg
    dd if=/storage/emulated/0/nvram.img of=/dev/block/bootdevice/by-name/nvram
    dd if=/storage/emulated/0/proinfo.img of=/dev/block/bootdevice/by-name/proinfo
    dd if=/storage/emulated/0/protect1.img of=/dev/block/bootdevice/by-name/protect1
    dd if=/storage/emulated/0/protect2.img of=/dev/block/bootdevice/by-name/protect2
    dd if=/storage/emulated/0/sec1.img of=/dev/block/bootdevice/by-name/sec1
    dd if=/storage/emulated/0/seccfg.img of=/dev/block/bootdevice/by-name/seccfg

    When it's done, please perform factory reset to apply the NVRAM restoration.

    Please watch this video for entire procedure demonstration:

    That wraps up the entire procedure of bootloader unlock, and have fun for modding this device!

    Credits:
    Woke_World from triple-color company product community
    diplomatic for his MTK-SU Exploit and simplified utility called JunioJsv
    topjohnwu for MagiskSU
    3
    @areallydumbperson @VR25

    You may notice that this thread now is located at its own Nokia 2.2 forum.

    Along with this change, several other threads have been moved to this forum as well.

    Please report any thread outside this forum needs to be moved. Thank you very much and hope you enjoy the new place for Nokia 2.2. :D
    2
    TWRP 11 Bugfix:

    Fixed system refusing to mount (finally) thanks lopestorm :) ur fstab flie really helped me out
    bootloops from twrp.me is soon gonna be fixed hopefully i have made a pull request in their git
    more partitions should be able to be backed up (again thanks to lopestorm)