Cubot Pocket: unlock bootloader and flashing GSI/lineageOS

Search This thread

santosst

Senior Member
Oct 7, 2020
117
54
Sao Paulo
Moto G
Xiaomi Mi A1
Hello guys. I got my pocket and am trying to unlock bootloader, but having trouble with fastboot. I searched far and wide and installed every driver recommended, but still no luck working.

windows 11
cubot pocket firmware 1.2, usb debugging checked, oem unlocking checked

these are the steps i do:
1. connect phone to laptop
2. open cmd as admistrator in adb folder
3. run command adb devices, so far everything works, device listed
4. run command adb reboot fastboot, phone reboots to fastbootd
5. run command fastboot devices, and nothing. if i try running anything in fastboot i get "waiting for devices".

optional step: i even tried running it with 'disabled driver signature enforcement', still no luck

any idea what am missing? and how to make it work.
Hmmm, you'll need a modded fastboot, as cited in the first post. I used it in a Linux environment, but maybe you can use WSL2 inside win11. If it doesn't work, maybe you'll need a Live USB with any Linux distribution, like Ubuntu.
 

tellko53

Member
Dec 26, 2015
42
2
Hmmm, you'll need a modded fastboot, as cited in the first post. I used it in a Linux environment, but maybe you can use WSL2 inside win11. If it doesn't work, maybe you'll need a Live USB with any Linux distribution, like Ubuntu.
EDIT: got it. will post results later. thank a lot for the help
 
Last edited:

tellko53

Member
Dec 26, 2015
42
2
EDIT:
Info:Unlock bootloader success! OKAY [320.009s]
finished. total time: 320.010s

finally after 5 days of trying lol. am such a noob. now to get root...

thank you @santosst
 
Last edited:
  • Like
Reactions: santosst

santosst

Senior Member
Oct 7, 2020
117
54
Sao Paulo
Moto G
Xiaomi Mi A1
Did that already. Cheers for that boot btw. Saved me more headaches.

Now looking for some bugless roms without gapps, probably android 11.
Quick question though. Once i erase system and flash new GSI, do I lose the patched boot and vbmeta?
No problem!
To be honest, I did not try any Android 11 GSI, only A12 and A13. All of them have the issue with wired earphones. A13 GSIs had issues with Bluetooth, but they are now solved.

About boot and vbmeta, if you just flash the GSI, you won't lose them, but if you need to flash stock ROM, yeah, you'll need to flash them again.

im omitting these two steps as i have no idea how to get these files. is there a nice, easy to follow steps to get them?

all my attempts so far at flashing gsi ended in a bootloop.
Hmmm, I didn't tell before how to get them, right? The easiest way is loading the stock ROM's pac file in Upgrade Download, then the app will create a folder with all the images that compound the stock ROM (I don't remember if this folder is in the same directory of the Upgrade Download tool or the pac file). Just pick there both images, copy and paste them anywhere.
 
Jan 28, 2021
14
0
No problem!
To be honest, I did not try any Android 11 GSI, only A12 and A13. All of them have the issue with wired earphones. A13 GSIs had issues with Bluetooth, but they are now solved.

About boot and vbmeta, if you just flash the GSI, you won't lose them, but if you need to flash stock ROM, yeah, you'll need to flash them again.


Hmmm, I didn't tell before how to get them, right? The easiest way is loading the stock ROM's pac file in Upgrade Download, then the app will create a folder with all the images that compound the stock ROM (I don't remember if this folder is in the same directory of the Upgrade Download tool or the pac file). Just pick there both images, copy and paste them anywhere.
Hi, in which gsi works bluetooth? I'm on los 18.1, i'm searching for an android 13 rom similar to los but with safetynet for gpay.
 

tellko53

Member
Dec 26, 2015
42
2
Im happy to announce several successful GSI flashes. 🤘
The problem was in picking the wrong imgs.
I thought our phone was vndk positive, but all those ended in a bootloop. If anyone can share some light on this.


All of them have the issue with wired earphones

Thats a huge bummer. I bought an adapter for nothing 🤦
 

santosst

Senior Member
Oct 7, 2020
117
54
Sao Paulo
Moto G
Xiaomi Mi A1
Im happy to announce several successful GSI flashes. 🤘
The problem was in picking the wrong imgs.
I thought our phone was vndk positive, but all those ended in a bootloop. If anyone can share some light on this.

Nice!! About the vndklite image, I have two hypotheses: our phone doesn't support unsparsed images, or our phone doesn't support images with unshared blocks. These are the two differences between the normal and the vndklite GSIs (besides the added libraries in the vndklite, but they won't cause bootloops by themselves).

Thats a huge bummer. I bought an adapter for nothing 🤦
I did the same lol
It's annoying not to have wired earphones working properly. I moved to stock some weeks ago because of the Bluetooth issue when I couldn't use any earphones in GSIs. Now I could return to PE 13 and use Bluetooth earphones, but I'll probably stay in stock for a bit more time
 

tellko53

Member
Dec 26, 2015
42
2
I did the same lol
It's annoying not to have wired earphones working properly. I moved to stock some weeks ago because of the Bluetooth issue when I couldn't use any earphones in GSIs. Now I could return to PE 13 and use Bluetooth earphones, but I'll probably stay in stock for a bit more time
I did some testing, its only a12 and a13 that are busted. Los18 for example, has working wired headphones.
I was unable to try PE13, file too big. Resizing or deleting partition didnt help.
LeOS with microG was "almost" perfect for my needs, but it has minor bugs and is not as smooth as Los from AndyYan.

Also, when I tried to update Magisk in automatic mod (direct install), something breaks and i get into bootloop. Same thing happens when you try to uninstall it from the Magisk app.

Do we have some working custom recovery? Lineage or twrp? I tried sideloading from stock recovery or SDcard, but that wasnt working. I got either of these errors:
E: failed to verify whole-file signature
E: signature verification failed
 

santosst

Senior Member
Oct 7, 2020
117
54
Sao Paulo
Moto G
Xiaomi Mi A1
I was unable to try PE13, file too big. Resizing or deleting partition didnt help.
I tried the "slim" version of PE 13. It was okay for me to flash. I don't remember if I tried the main version.
However, if you like LeOS, PE will be too heavy for you lol

Also, when I tried to update Magisk in automatic mod (direct install), something breaks and i get into bootloop. Same thing happens when you try to uninstall it from the Magisk app.
It's impossible to directly install/update Magisk because the boot image must be signed with the same key present in vbmeta, and I believe it's impossible to do this now on Magisk.
We need to patch a boot.img file in the Magisk app, then sign and correct the image size using some Python scripts.

Do we have some working custom recovery? Lineage or twrp? I tried sideloading from stock recovery or SDcard, but that wasnt working. I got either of these errors:
Sadly not, as far as I know
 

wepecko

Member
Oct 19, 2013
13
1
plus.google.com
hello,
after multiple attempts i still cannot get the bootloader unlocked.
could you please advise?

unlock OEM in android - checked
using custom fastboot in linux - check

able to follow the guide to point of creating signature.bin
when trying to flash with ./fastboot flashing unlock_bootloader signature.bin, response is:
downloading OK
unlocking...
FAILED: remote: unlock bootloader fail.

to generate the signature file, im using file present in the archive - rsa4096_vbmeta.pem
might be i need to get some other instead?
 

wori

Member
May 7, 2010
27
15
when trying to flash with ./fastboot flashing unlock_bootloader signature.bin, response is:
downloading OK
unlocking...
FAILED: remote: unlock bootloader fail.

Are you sure the step before that works? there's already a signature.bin in the archive, but it will not be for your phone. Can you make sure a new one is generated in the signature generation step?
 

wepecko

Member
Oct 19, 2013
13
1
plus.google.com
Are you sure the step before that works? there's already a signature.bin in the archive, but it will not be for your phone. Can you make sure a new one is generated in the signature generation step?

thanks,
yes the file was generated, confirmed in command line and file date updated

my ID token
43303131343634304f44323036323130
 
Last edited:
Nov 7, 2022
17
2
Hello
I have a problem with every change I make in the system
Not saved after reboot

I tried using the old patched bot and the new one
And nothing helps
I even tried to edit the soper externally and download things
And yet the system remains the same
I just can't figure out where it gets the files from every reboot
 

santosst

Senior Member
Oct 7, 2020
117
54
Sao Paulo
Moto G
Xiaomi Mi A1
Hello
I have a problem with every change I make in the system
Not saved after reboot

I tried using the old patched bot and the new one
And nothing helps
I even tried to edit the soper externally and download things
And yet the system remains the same
I just can't figure out where it gets the files from every reboot

I'm not sure, but I think the system partition is read-only because of shared blocks. Try to make a magisk module to automate the mod every reboot.
 

wepecko

Member
Oct 19, 2013
13
1
plus.google.com
Hello, i confirm the process for getting the Lineage20 OS

install fresh full stock ROM (optional, pac)

unlock bootloader (ID token are both numbers combined together)

fastboot delete-logical-partition product_a (or b, according to fastboot getvar all)

-flash android GSI (santosst post)
fastboot flash system system.img

factory reset, boot

-flash Lineage20
fastboot erase system
fastboot flash system lineage-20.0-20230815-UNOFFICIAL-arm64_bvS.img

factory reset, boot, system works


So far so good.
no Im struggling with flashing Gapps using sideload recovery, as described few posts earlier

->recovery
adb sideload MindTheGapps-13.0.0-arm64-20230808_213316.zip
serving: 'MindTheGapps-13.0.0-arm64-20230808_213316.zip' (~47%) adb: failed to read command: No error
E: signature verification failed
E: error 21
Installation aborted.


Is there any other way how to put playstore and basic Google apps into this Lineage img?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Hello, i confirm the process for getting the Lineage20 OS

    install fresh full stock ROM (optional, pac)

    unlock bootloader (ID token are both numbers combined together)

    fastboot delete-logical-partition product_a (or b, according to fastboot getvar all)

    -flash android GSI (santosst post)
    fastboot flash system system.img

    factory reset, boot

    -flash Lineage20
    fastboot erase system
    fastboot flash system lineage-20.0-20230815-UNOFFICIAL-arm64_bvS.img

    factory reset, boot, system works


    So far so good.
    no Im struggling with flashing Gapps using sideload recovery, as described few posts earlier

    ->recovery
    adb sideload MindTheGapps-13.0.0-arm64-20230808_213316.zip
    serving: 'MindTheGapps-13.0.0-arm64-20230808_213316.zip' (~47%) adb: failed to read command: No error
    E: signature verification failed
    E: error 21
    Installation aborted.


    Is there any other way how to put playstore and basic Google apps into this Lineage img?
    For now, issue mitigated by flashing
    system-squeak-arm64-ab-gapps.img.xz instead of Lineage20
    AOSP12.1 https://github.com/phhusson/treble_experimentations/releases

    Gapps works fine, no other issue discovered so far.
    GPay/credit card not possible, but authenticators work fine
  • 6
    Ok, I just booted Google's Android 13 GSI from here, version ARM64, no GMS. Steps on fastbootd (after unlocking bootloader):

    fastboot --disable-verity --disable-verification flash vbmeta_system vbmeta_system.img
    fastboot --disable-verity --disable-verification flash vbmeta_product vbmeta_product.img
    fastboot resize-logical-partition product_a 38000
    fastboot flash system system.img

    (on phone, go to recovery -> factory reset -> factory reset -> reboot)

    I used both vbmeta-system and vbmeta-product from stock ROM.

    I'll try to boot any phh-treble-based GSI now

    EDIT 0: To enter fastbootd, run fastboot reboot fastboot before all the commands above.

    EDIT 1: LOS 19.1 vndklite leads to bootloop
    EDIT 2: Sooti's Android 13 booted 🥳 so I suppose LOS isn't able to boot because it is not a "secure" version i.e. it has su binary. Probably any A11, A12, or A13 GSI without inbuilt su will boot following this tutorial
    EDIT 3: 4g calling isn't working, maybe we need to install the IMS apk from stock ROM in GSI. For now, I'll use only 3g
    EDIT 4: Sooti's GSI doesn't pass SafetyNet test, so it's impossible to use GPay. Now I've installed PixelExperience and SafetyNet (and GPay) works well.
    5
    I finally got my cubot pocket. I like my devices without GAPPS so I unlocked the bootloader and finally managed to flash a GSI.

    This post contains: observations and general hints for this level of development, a guide to unlock the bootloader and what I did so far to flash a GSI.

    Unlocking the bootloader​

    This works similar to other Spreadtrum/Unisoc-based devices.
    The crucial thing is to issue get_identifier_token from fastboot -> reboot to bootloader. If you issue it in adb reboot fastboot, it will say OKAY and may also print a four character string, but this is not the token you're looking for.
    Also, when you flash the unlock_bootloader signature.bin, it will prompt you on the phone, but you have to react differently than described on the phone - see below.
    • enable Android developer mode (Settings -> About Phone -> tap "build number" >= 7x)
    • enable OEM unlocking (Settings -> System -> Developer Options -> OEM unlocking)
    • enable ADB (Settings -> System -> Developer Options -> USB debugging)
    • adb reboot fastboot
    • choose "reboot to bootloader"
    • Code:
      $ fastboot oem get_identifier_token
    • proceed as described here
    • finally:
      Code:
      $ fastboot flashing unlock_bootloader signature.bin
      this prompts you to press volume up to cancel, volume down to confirm.
      But volume down and power don't have any effect, instead volume up starts wiping user.
      wiping takes a bit longer than I'd expect, for me 433 s.
    Congratulations, you now own your phone a bit more than before!

    Flashing GSIs (probably applies to ROMs in general)​

    It's a Treble-enabled arm64 A/B device. Flashing GSIs should be possible.
    It looks to me like the A/B is crippled as all the _b partitions are 0-sized, probably to save space.
    • get and unpack necessary files as necessary: boot.img, vbmeta-sign.img, a ROM that you want, p.ex. AndyYan's Lineage GSI
    • fastboot resize-logical-partition product_a 38000
    • fastboot flash system [unpacked ROM file]
    • I also factory reset it afterwards

    General/random notes​

    • there are two different things reachable as "bootloader":
      • in fastboot switch to bootloader. The device displays the Cubot splash and from the display it looks stuck, but it exposes a fastboot interface -> useful
      • $ adb|fastboot reboot bootloader
        shows the droid with open service door, saying "no command". It also exposes adb, but I don't see a way how to authorise it. Maybe via the debug UART? I didn't yet read the UART when I stumbled upon this. Currently it seems useless to me.
    • there are test points for the debug UART easily reachable once you disassemble it.
      I didn't see anything with a 3.3V USB UART adapter, but a logic analyser with 1.4 V threshold works -> it probably uses 1.8 V logic level. UART-wise it's 115200 8n1.
      I think I don't have anything to hook up to the TX currently.
    • UART log of boot
    • it's easy to softbrick this device, and I haven't found a nice way out of softbricked yet. Two not-so-nice-ways
      - drain the battery, which obviously requires lots of patience
      - disassemble the device and disconnect the battery

      then flash the original ROM from the cubot site following the instructions there.
      • Once it bootloops, I didn't manage to power it off or get into fastboot / recovery using the device's keys.
    • the device reconfigures it's USB during boot and there's a limited time for the SPDFlashTool's mode that flashes complete firmwares. That means that it's not really feasible to run SPDFlashTool inside a VM.
    • the phone actually does something with the battery detached but USB power attached. For example, it's possible to flash it with the SPDFlashTool. However, it doesn't boot the linux kernel / Android, this seems to be inhibited.
      This is in contrast to many other devices that are not laptops for which the PMIC does not provide power to the system when the battery is disconnected.

    Old notes / how not to do it: Flashing GSIs (probably applies to ROMs in general)​

    • it's a Treble-enabled arm64 A/B device. Flashing GSIs should be possible.
    • It looks to me like the A/B is crippled as all the _b partitions are 0-sized, probably to save space.
    • system_a is a bit below 1 GB ( 0x3CF5D000 B) which is likely smaller than any interesting GSI.
      attempting to flash yields
      Code:
      Resizing 'system' FAILED (remote: 'Not enough space to resize partition')
    • There's the general hint to delete the product partition by running
      fastboot delete-logical-partition product
      then it's actually possible to flash a GSI, however:
    • the device bootloops :poop: -> log
      From the log I realised I need to modify vbmeta, so:
    • it does android verified boot / AVB which from my understanding the easiest way forward is to disable it by:
      • creating a vbmeta.img with
        Code:
        $ avbtool make_vbmeta_image --flags 2 --padding_size 4096 --output vbmeta_disabled.img
        • the padding necessary might be 16384 instead, according to the hovatek thread below.
      • it might be necessary to pad it additionally. There's a tutorial and a script here
      • when I flash both the hovatek-unpadded avbtool-4096-padded and hovatek-padded avbtool-16384-padded vbmeta, the device bootloops :poop: -> log
    • I guess the next step would be to unpack the vendor PAC ROM and check how the vbmeta image looks there.
      • Since with the original vbmeta it looks like it's restarting when it's already running linux / android, another way to go at this might be to change the kernel cmdline: instruct it to not do verity - Does anyone know how this is possible?
    3
    I also succeeded with the signed file from PDA4 as soon as there is boot & vbmeta with the same signature it is very simple like normal rooting
    I'm attaching the files here, it is necessary to burn this rooted BOOT that is signed with a signature compatible with vb
    2
    Ok, I just booted Google's Android 13 GSI from here, version ARM64, no GMS. Steps on fastbootd (after unlocking bootloader):

    fastboot --disable-verity --disable-verification flash vbmeta_system vbmeta_system.img
    fastboot --disable-verity --disable-verification flash vbmeta_product vbmeta_product.img
    fastboot resize-logical-partition product_a 38000
    fastboot flash system system.img

    (on phone, go to recovery -> factory reset -> factory reset -> reboot)

    I used both vbmeta-system and vbmeta-product from stock ROM.

    I'll try to boot any phh-treble-based GSI now

    EDIT 0: To enter fastbootd, run fastboot reboot fastboot before all the commands above.

    EDIT 1: LOS 19.1 vndklite leads to bootloop
    EDIT 2: Sooti's Android 13 booted 🥳 so I suppose LOS isn't able to boot because it is not a "secure" version i.e. it has su binary. Probably any A11, A12, or A13 GSI without inbuilt su will boot following this tutorial
    EDIT 3: 4g calling isn't working, maybe we need to install the IMS apk from stock ROM in GSI. For now, I'll use only 3g
    EDIT 4: Sooti's GSI doesn't pass SafetyNet test, so it's impossible to use GPay. Now I've installed PixelExperience and SafetyNet (and GPay) works well.
    Thank you! This worked for me and I was able to get a prerooted Lineages 13 GSI to boot! It's AndyYan's lineage-20.0-20221111-UNOFFICIAL-arm64_bvS.img.xz. lineage-20.0-20221111-UNOFFICIAL-arm64_bvS.img.xz
    2
    Some screenshots