General TWRP and Magisk prepatched boot for A22 5g Blind Build EXPERIMENTAL

Search This thread

lebigmac

Senior Member
Jan 31, 2017
1,072
706
Recovering from a brick is all part of the samsung learning experience
I don't want to compare apples with oranges but:
Recovering from Xiaomi brick: 2 minutes (Xiaomi devices are literally unbrickable. You can fastboot flash any of your partitions thousands of times within minutes on any operating system that has fastboot. You can throw the Xiaomi device against a brick wall and it will still work just fine! The latter is not recommended though ; )
Recovering from the same kind of brick on a Samsung device: 48 - 72 hours.
Xiaomi device have fully working fastboot straight out of the box
Samsung device have empty crippled fake fastboot out of the box
Now you decide which manufacturer is more open source and developer friendly ;)(y)
 
Last edited:

physwizz

Senior Member
Sep 16, 2013
3,479
754
Sydney
I don't want to compare apples with oranges but:
Recovering from Xiaomi brick: 2 minutes (Xiaomi devices are literally unbrickable. You can throw it against a brick wall and it will still work just fine! Not recommended though ; )
Recovering from Samsung brick: 48 - 72 hours.
Xiaomi device have fully working fastboot straight out of the box
Samsung device have empty crippled fake fastboot out of the box
Now you decide which manufacturer is more open source and developer friendly ;)(y)
Lol.
Greetings from Sydney Australia
 
  • Haha
Reactions: lebigmac

Platypus Enthusiast

Senior Member
Apr 6, 2021
77
18
Thanks for the quick reply. (y)
I finally got the phone back up and running by flashing the full firmware with Odin.
Thank god this nightmare is now finally over. What's the best way to root this thing without bricking your device? Thanks (y)
Assuming you already unlocked your bootloader, flash the modified VBMeta @Cheese-ass provided here to disable Verified Boot (It's for a different phone but it works for the A22 5G, I tested). Reboot and your phone will ask you to factory reset, then set up your phone as you usually would, and install the Magisk app.

Back on your PC, use 7zip to open the AP.md5 file, and copy the boot.img.lz4, then download lz4 (Find out whether your PC is 32 bit or 64 bit then download the appropriate one) and extract the archive. Open the extract folder until you find lz4.exe, then click the Directory path (see attachment) and type in cmd to open a Command Prompt. Run lz4 boot.img.lz4 boot.img to extract the boot.img. The reason why you use lz4 and not a normal archiver like WinRar or 7zip is because you can't extract it using those, try it yourself.

Now transfer your boot.img to your phone using MTP, FTP or something, patching it using Magisk, then transfer the Magisk patched one to your PC. Rename it boot.img (IMPORTANT, or else Odin won't know what to flash it to). Right click on the Magisk patched boot image > 7zip > Add to archive... > and choose tar as the archive format. Reboot your phone to Odin mode, open Odin (or Heimdall), and select the boot image .tar and flash. Magisk should now be installed.

Updating One UI is another can of worms.
 

Attachments

  • 1653193736682.png
    1653193736682.png
    4.1 KB · Views: 17
  • Like
Reactions: lebigmac

lebigmac

Senior Member
Jan 31, 2017
1,072
706
@Platypus Enthusiast thanks for your easily understandable step by step guide! (y)

Turns out my bootloop problem was caused by Heimdall or by my lack of knowledge in using it properly. Is it still maintained or is it EOL ?
The Heimdall tutorials want me to write --VBMETA in capital letters when flashing but Heimdall says that partition VBMETA doesn't exist in my device's PIT file :unsure:
heimdall flash --VBMETA vbmeta.img --no-reboot
I can flash successfully if I type --vbmeta in small letters but then something gets corrupted somewhere along the process.
heimdall flash --vbmeta vbmeta.img --no-reboot

Wait a second maybe I must flash the .tar file in Heimdall just like in Odin? So far I've only been flashing the raw .img files directly. Maybe that's where my bootloops come from? :unsure:

I would definitely recommend flashing Samsung devices the official way with Odin (y)
Rename the file to vbmeta.img and compress it as a tar and just flash in AP slot with Odin. Works great every time and it's a very straight forward process. Thanks to the guy who suggested this method to me (y)

By the way can we use Odin in Linux through Wine? :unsure:



To anyone out there who ended up in a tricky and very dark Samsung bootloop. Samsung made it especially difficult to get into Download mode when stuck in such a bootloop. Here's a quick tutorial:

Phone must be off for this to work!
The trick is to press both Volume Up & Volume Down & Power buttons & plug in USB cable (which is connected to pc) . YES! ALL AT THE SAME TIME! I KNOW IT'S CRAZY!
As soon as you feel the phone vibrate, let go of power button but keep vol+ and vol- buttons still pressed! Then when Download mode screen appears let go of both volume buttons and press vol up to get into flashing mode.
Out of all phone manufacturers out there this has got to be the most difficult und developer unfriendly way to get into flashing mode for flashing an android device.

This is how I turn device off if I'm stuck in a very nasty Samsung bootloop:
Plug in usb cable & at the same time press vol+ & vol- & power buttons for about 12 seconds!
If I don't feel the vibration I know phone is not off but I keep the button combination pressed anyways for about 12 seconds until the charger symbol appears (due to usb cable charging the device). In this very moment I let go of all buttons and immediately disconnect usb cable from device. Congratulations! Now your device is off! I know this sounds stupid but that's all the steps I must do to turn off device when stuck in such an annoying Samsung bootloop! I hope this helps someone out there to save some precious time!

Now you can proceed to get into Download mode the usual way by pressing all those aforementioned buttons together & plugging in usb cable simultaneously! Good luck!(y)
 
Last edited:

physwizz

Senior Member
Sep 16, 2013
3,479
754
Sydney
@Platypus Enthusiast thanks for your easily understandable step by step guide! (y)

Turns out my bootloop problem was caused by Heimdall or by my lack of knowledge in using it properly. Is it still maintained or is it EOL ?
The Heimdall tutorials say to write in capital letters --VBMETA when flashing but my device says that partition VBMETA doesn't exist in my PIT file :unsure:
heimdall flash --VBMETA vbmeta.img --no-reboot
I can flash successfully if I type in small letters --vbmeta but then something gets corrupted somewhere along the process.
heimdall flash --vbmeta vbmeta.img --no-reboot

Wait a second maybe I must flash the .tar file in Heimdall just like in Odin? So far I've only been flashing the raw .img files directly. Maybe that's where my bootloops come from? :unsure:

I would definitely recommend flashing Samsung devices the official way with Odin (y)
Rename the file to vbmeta.img and compress it as a tar and just flash in AP slot with Odin. Works great every time and it's a very straight forward process. (y) Can we use Odin in Linux through Wine? :unsure:

To anyone out there who ended up in a tricky and very dark Samsung bootloop. Samsung made it especially difficult to get into Download mode when stuck in such a bootloop. Here's a quick tutorial:

Phone must be off for this to work!
The trick is to press both Volume Up & Volume Down & Power buttons & plug in USB cable (which is connected to pc) . YES! ALL AT THE SAME TIME! I KNOW IT'S CRAZY!
As soon as you feel the phone vibrate, let go of power button but keep vol+ and vol- buttons still pressed! Then when Download mode screen appears let go of both volume buttons and press vol up to get into flashing mode.
Out of all phone manufacturers out there this has got to be the most difficult und developer unfriendly way to get into flashing mode for flashing an android device.

This is how I turn device off if I'm stuck in a very nasty Samsung bootloop:
Plug in usb cable & at the same time press vol+ & vol- & power for about 12 seconds!
If I don't feel the vibration I know phone is not off but I keep the button combination pressed anyways for about 12 seconds until the charger symbol appears (due to usb cable charging the device). In this very moment I let go of all buttons and immediately disconnect usb cable from device. Congratulations! Now your device is off! I know this sounds stupid but that's all the steps I must do to turn off device when stuck in such an annoying Samsung bootloop! I hope this helps someone out there to save some precious time!

Now you can proceed to get into Download mode the usual way by pressing all those aforementioned buttons together & plugging in usb cable simultaneously! Good luck!(y)
It's all a learning experience
I always use odin
 
  • Like
Reactions: lebigmac

Platypus Enthusiast

Senior Member
Apr 6, 2021
77
18
Turns out my bootloop problem was caused by Heimdall or by my lack of knowledge in using it properly. Is it still maintained or is it EOL ?
Doesn't seem to be, latest commit on the repository was March 2021 which isn't too long ago, there are new issues and pull requests.
Can we use Odin in Linux through Wine? :unsure:
Not sure, I only use Linux VMs on my Windows Host machine, so there isn't a need for me to use WINE, but it should hypothetically work.
 
  • Like
Reactions: lebigmac

Top Liked Posts

  • There are no posts matching your filters.
  • 2
    First of All i dont own this device !!!! so i cant test by myself
    Twrp is based on A22 4g and modified for A22 5g


    if someone is brave enough to test it please pm me
    for flash instructions - Look Here

    Boot.img/Recovery.img is from A226BXXU1AUEH Firmware

    To Root your device try magisk prepatched boot.img (magiskboot.tar)

    TWRP didnt work so i deleted it
    1
    This isn't working for my SM-A226B. It works through step #9 (flash vbmeta & twrpa22, then restart)--ie, flash indicates 'pass' for both. But at step #10, vol+ and power, my phone never goes into TWRP. I've tried several versions of the twrp file, various combinations of having the USB plugged in while I do it, holding for different lengths of time, etc. It just gets stuck in the Samsung logo boot loop. I can't even turn it off with vol- and power. The only response I can get is moving it to download mode with vol+,vol-,usb. The phone is fully charged.
    1
    Root works for me, just attached the magiskboot to odin AP, not im rooted!, not bothered about twrp but thanks.
    1
    Screenshot_20211204-141508_Root Checker Basic.jpg


    rooted thru magisk method, not this one posted. also call recording by default activated and screen record enabled.
    1
    Hi. I tried flashing the twrp.img from first post of this thread to the recovery partition but unfortunately my phone ended up in a very slow, very tricky, annoying and very dark bootloop. Almost as dark as the black hole in the milky way galaxy. The sort of bootloop you don't want to find your device in. Xiaomi bootloops are so much easier to get out of let me tell you! Especially since they ship with a fully working , non-crippled fastboot! Ain't that right @samsung? :ROFLMAO:

    Here's the log:
    heimdall flash --recovery ./recovery.img --no-reboot
    Heimdall v1.4.1

    Copyright (c) 2010-2014 Benjamin Dobell, Glass Echidna

    This software is provided free of charge. Copying and redistribution is
    encouraged.

    If you appreciate this software and you would like to support future
    development please consider donating:

    Initialising connection...
    Detecting device...
    Claiming interface...
    Setting up interface...

    Initialising protocol...
    Protocol initialisation successful.

    Beginning session...

    Some devices may take up to 2 minutes to respond.
    Please be patient!

    Session begun.

    Downloading device's PIT file...
    PIT file download successful.

    Uploading recovery
    100%
    recovery upload successful

    Ending session...
    Releasing device interface...

    After hours upon hours of trying in vain I somehow managed to get the Galaxy device to boot into Download mode :D(y) (don't ask me how - it just happened)

    Then I tried to flash the stock recovery.img from first post of this thread and it gave me this result:
    Thank god phone is still in Odin mode :D

    heimdall flash --recovery ./recovery.img
    Heimdall v1.4.1

    Copyright (c) 2010-2014 Benjamin Dobell, Glass Echidna

    This software is provided free of charge. Copying and redistribution is
    encouraged.

    If you appreciate this software and you would like to support future
    development please consider donating:

    Initialising connection...
    Detecting device...
    Claiming interface...
    Setting up interface...

    Initialising protocol...
    Protocol initialisation successful.

    Beginning session...

    Some devices may take up to 2 minutes to respond.
    Please be patient!

    Session begun.

    Downloading device's PIT file...
    PIT file download successful.

    Uploading recovery
    100%
    recovery upload successful

    Ending session...
    ERROR: Failed to receive session end confirmation!
    Releasing device interface...

    And on phone itself it give this error:


    All these different Samsung firmware websites only offer slow download speed 300 KB/s max. and I don't got premium account!
    And whole firmware is 5GB that means I must wait 6 hours +
    Should I keep the phone in download mode until then? Then I must leave it plugged in because screen will drain battery fast. I guarantee you that I will never ever be able to get it back into download mode again if I turn it off now. Can I even turn it off?! Nope. I can force reboot with vol down + power (hold for 10 seconds) but there is no key combo for force power off or shutdown 😒

    Can someone reading this please upload only the stock recovery of their Samsung Galaxy A22 5G (SM-A226B)? Or upload only the official file that the stock recovery is contained in such as one of those AP, CP or CSC files.
    Thank you very much!
    I think the firmware my device was running was Android 11 and February 2022 security patch or something. That shouldn't really matter as long as it's stock Android 11.
    Maybe it's somehow possible to fix this annoying bootloop without having to download the full 5 GB of the firmware. I only overwrote the recovery partition.

    I think next time I will flash using Odin like everyone else and I'll leave Heimdall to the real pro's :D
    Does anyone know how to flash only recovery with Odin? Do I flash the AP, CP or CSC file? I guess not the BL that sounds like BOOTLOADER!
    Thanks (y)

    Now I am very confident that soon I will finally be able to get this phone out of this mess and back up and running! :D(y)
    Sorry you didn't get help immediately, I don't check my emails often unless I want a verification code from some website.

    I also screwed up my A226B (different cause), I deleted an old copy of firmware files because they were outdated, so I went to Sammobile for a different one, spent 4 hours downloading an archive that turned out to be corrupted. It was already 1 AM at that point so I went to bed. The next day, I tried downloading it again, thinking my slow internet at the time corrupted the download, waited another 4 hours, but same result. I decided to take a risk and try out those sketchy websites. I tried out samfw.com and it worked good, so you might want to try that.

    About which files to flash, flash BL, AP, CSC, and CP to do a restore. HOME_CSC is if you want to keep your files, CSC if you want to start out fresh.

    Edit: BL is bootloader, CP is the modem, CSC is the region specific features, and AP is the main file. Usually flashing AP will make your phone work again, but you won't be able to get software updates unless you flash the others. Also samfw downloads pretty fast.