[Samsung Galaxy A21s Guides, News, & Discussion] Ryosuke_420:
Rooting And Installing An Android 13/12 GSI To Samsung Galaxy A21s

View attachment 5969629

**Disclaimer : I am not responsible for bricked devices, dead SD cards, * thermonuclear war, or you getting fired because the alarm app failed. * and by unlocking your device your are voiding your warranty and tripping Knox Forever . Make sure to backup your data.

I made this guide as simple as possible for newbies who want to modify/customize their devices so please pay attention to every step I mention below .And if your English is not that good .Please translate the page to your local language . It may seem long because its detailed . ​

A./Enable OEM Unlocking :

Open the Settings app on your Galaxy .

Navigate to About phone > Software information.

Now tap on Build number section seven times to enable the developer options.

Go back to the main page of the Settings app.

Locate the new Developer options section and open it.

Enable the toggle next to OEM unlocking.

View attachment 5969589​

B./Unlocking the Bootloader :

Turn off the phone, press and hold both volume up and volume down buttons simultaneously, and connect the device to your PC/Mac using the USB cable.

Release the buttons when you see the warning about custom OS appear.

Press the volume up key once to boot into Download Mode. At this stage, you should see an option to unlock the bootloader.

Now, press and hold the volume up button for a few seconds, and the bootloader unlocking wizard will begin.

Use the volume up button to confirm the unlocking process.

To reiterate, this step will wipe all the data on your phone, so make sure you back up your data before proceeding.

Once completed, your device will automatically boot up to the OS.

View attachment 5969627​

C./Rooting your phone :

Download the latest firmware for your device variant directly from Samsung servers. (Samfw /...)

Extract the firmware archive and copy the AP tar file to your device. The naming scheme should be AP_[build number and other identifiers].tar.md5.

Download the latest build of Magisk and install the APK on your phone.

It is possible to perform the patching part on a different Android device as well.

Tap the Install button in the Magisk card.

Choose Select and Patch a File in method and choose the AP tar package.

After successfully patching the file, copy the patched file (named as magisk_patched_xxx.tar) from the Download folder of the phone to your PC.

Reboot your Galaxy to the download mode.

Now install Odin to your Windows machine Then the Samsung USB drivers . Next, flash the magisk_patched_xxx.tar as AP, together with BL, CP, and CSC from the original firmware package.

Turn off the Auto Reboot option

Don't choose the HOME_CSC module because a data wipe is necessary.

After the flashing is done and you see a GREEN BOX in Odin press Volume down key + Power key for more than 7 seconds then immediately hold the volume up key + the power key . if you see a blue screen telling you "Erasing" Then congrats . if your see another menu head to data erase then yes then reboot to system .

After booting . install the Magisk app on the phone , launch it once you reach the home screen. It should show a dialog asking for additional setup.

Allow the app to execute the additional routines and automatically reboot the device.

If everything goes right, your device should be rooted.

View attachment 5969593View attachment 5969597View attachment 5969599​

D./Installing a custom recovery :

Go to this GitHub repository and download the recovery.img or the recovery.tar depending on the method you want .

Method 1: recovery.img

If you are on Linux then flash recovery.img with heimdall

heimdall flash --RECOVERY recovery.img

OR​

You can the TWRP app to flash the recovery.img

OR​

You can use the dd command to flash recovery.img by placing the recovery.img in /sdcard and running these commands

su
dd if=/sdcard/recovery.img of=/dev/block/by-name/recovery

Method 2: recovery.tar

Place the tar file in AP in Odin then flash

Booting to TWRP​

Once TWRP is flashed, boot to it with volume up + power combo

Go to Advanced -> Terminal, then you will enter the 'multidisabler' command

Reboot to recovery again

Format data as you will get bootloops if you don't

E./Installing The Custom rom (GSI):

Head to the GSI table and chose from the variety of roms. I suggest you install Pixel Experience For almost no bug experience

After installing the GSI extract its content on your phone (Make Sure its less then 3.6GB in size)

Go to Magisk then Reboot to recovery

Go to Install

Install image

Select install as System image

After the instalation is done reboot to system

Then congrats you now have a rooted A21s With a custom rom installed

Credits :

XDA Developers post for unlocking a Samsung Phone .

topjognwu for the Magisk app

DozNaka for the TWRP Port

phhusson for the treble_experimentations

ponces for the Pixel Experience

And lastly Me for writing this XDA psot