These are the steps I used to restore an old Samsung Galaxy Tab 2 10.1 GSM (P5100)1 purchased in 2012, which came with Android Ice Cream Sandwich (4.0.3) and was upgraded to Jelly Bean (4.1.2)1. There were issues installing and updating apps from the Google Play Store. I attempted to fix the issue and ended up installing a custom recovery image and ROM with a more recent Android version (i.e. replacing the stock Android operating system).
Tip
As always, step zero is to backup all important files!
Finding the right custom recovery and ROM
Following guides by Android-Andi and on XDA Developers forum threads, I decided to go with the following:
- Recovery: TWRP for Samsung Galaxy Tab 2 (GSM - unified)
- ROM: OmniROM 6.0 - unofficial unified build with Android 6 (Marshmallow)
The unified versions (codename: espresso3g) work on both P5100 and P3100. I’m using the unified version of TWRP as while a device-specific version for P5100 exists, it has been discontinued2. Although an OmniROM build with Android 7 exists, I went with the Android 6 build, as the former has unresolved bugs3 while the latter is more stable. Moreover, I went with the unofficial build of OmniROM, as the official builds have been discontinued4.
Since OmniROMs are free of Google Play services5, and my sister needs Google apps to work, I also downloaded Open GApps. I downloaded the pico variant (since I only want a minimal install of Google Play) for ARM platforms (since the tab has 32-bit architecture) and Android 6.0 (same as the ROM of my choice).
After downloading the ZIP files for OmniROM and Open GApps, I copied them to an external microSD card mounted on the tab6.
Setting up tools to flash a custom recovery
I had to unlock developer mode (by tapping the build version in the settings a number of times), and then enable USB debugging.
I also needed to install a programme on my computer in order to flash the custom recovery on the tab via a USB cable connection. For many devices, this is achieved by unlocking the bootloader of the Android device and running Fastboot, which is part of the Android SDK tools7 8. However, this is not supported on Samsung devices, so I needed to use either Heimdall or Odin9. I went with Heimdall; Heimdall’s homepage sums up nicely why Odin is not recommended:
For internal use, Samsung developed their own firmware flashing tool known as ‘Odin’ […]
Aside from being slow and generally unreliable, Odin only runs on Windows systems. Furthermore, Odin is ‘leaked software’ that is not officially supported by Samsung, freely available, or well understood by the community at large.
Heimdall is an open-source (MIT License), cross-platform tool; its source code is available on GitHub. The repository has operating-system-specific README files on how to build the programme from source. These are the steps I followed on my Windows 10 system10:
- Download and install MSYS2 (detailed installation instructions), which serves as the MinGW-w64 build environment.
-
In the command prompt that launches, run the following to install all requirements:
Pacman -S mingw-w64-x86_64 mingw-w64-x86_64-clang mingw-w64-x86_64-cmake mingw-w64-x86_64-libusb mingw-w64-x86_64-qt5-static make
-
Add MinGW-w64 to the PATH environment variable:
export PATH="/mingw64/bin:$PATH"
-
Set up MSYS2 to be used on Windows Terminal11, and launch a Windows Terminal window with the
MINGW / MSYS2
shell. -
Clone the Heimdall GitHub repository.
via HTTPS:
git clone https://github.com/Benjamin-Dobell/Heimdall.git
via SSH:
git clone git@github.com:Benjamin-Dobell/Heimdall.git
-
Run the following to build Heimdall:
cd Heimdall mkdir build cd build cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DQt5Widgets_DIR=/c/msys64/mingw64/qt5-static/lib/cmake/Qt5Widgets .. make
Flashing the custom recovery image
I turned off the tab and entered download mode. I did this by pressing the Volume Up and Power buttons for a few seconds until a yellow warning triangle appears on the screen. I then pressed the Volume Down button to proceed into ODIN mode.
I then connected the tab to my computer using a USB cable and followed these instructions10:
- Execute
zadig.exe
, located inHeimdall/Win32/Drivers
, to install (or replace) the Samsung USB driver12. - Open a
MINGW64 / MSYS2
terminal window in the path where Heimdall was built (Heimdall/build/bin
). - Run
./heimdall help
to list all of Heimdall’s functionality. - Run
./heimdall detect
to verify whether the tab is connected via USB. -
Run the following to flash the custom recovery, replacing
recovery.img
with the full path of the downloaded TWRP recovery image13:./heimdall flash --RECOVERY recovery.img --no-reboot
-
Once the flash is complete, disconnect the USB cable and reboot into recovery mode by pressing the Volume Down and Power buttons for a few seconds to access TWRP.
Warning
Do not boot into the Android system, as this can cause the stock recovery to replace the newly-flashed TWRP8 14.
Creating backups and flashing the custom ROM
Before flashing a custom ROM, I created a backup of the stock Android system of the tab, so that I can go back to it in case something goes wrong. I tapped “Backup” on TWRP and selected the System, Data, and Boot partitions, which I backed up to the external microSD card6 15 16.
Info
Read more about backing up and formatting Android devices on the TWRP FAQ.
I then followed these instructions6 16, which include formatting the internal storage and installing OmniROM and Open GApps:
- Go to TWRP’s home and tap “Wipe”, tap “Format Data”, type “yes”, and tap the tick mark to proceed.
- Go back to “Wipe” and tap “Advanced Wipe”, select “Dalvic / ART Cache”, “System”, and “Cache”, and swipe to proceed.
- Go back to TWRP’s home and tap “Reboot”, tap “Recovery”, and swipe to reboot.
- After rebooting, tap “Install”, navigate to the external microSD card directory, select the OmniROM ZIP file, and flash it.
- Go back to “Install” and flash Open GApps the same way.
- Go back to TWRP’s home and tap “Reboot” to reboot into the new Android system.
That’s it!
Footnotes
-
Recoveries for Samsung Galaxy Tab 2 - OpenSource Development by Android-Andi @ XDA ↩
-
OmniRoms for Samsung Galaxy Tab 2 - OpenSource Development by Android-Andi @ XDA ↩
-
Installing Omni on your device - Omni Docs ↩
-
FAQ - Frequently Asked Questions - OpenSource Development by Android-Andi @ XDA ↩ ↩2 ↩3
-
FASTBOOT commands don’t work at all on my Samsung phone - Android Enthusiasts Stack Exchange ↩ ↩2
-
Fastboot on Samsung devices - Android Enthusiasts Stack Exchange ↩
-
Heimdall errors, “ERROR: Partition “recovery” does not exist in the specified PIT.” - Android Enthusiasts Stack Exchange ↩
-
How to wipe in TWRP properly? - OpenSource Development by Android-Andi @ XDA ↩ ↩2
Comments
Kumaran Sandeep
This was very helpful and cleanly written (even a oaf like could do it)i can only say thank you its a simple word that says a lot thanks thanks and thanks again
Fausto
Purtroppo tante cose che hai spiegato non mi sono chiare. Potresti fare un video che spieghi passo passo ogni passaggio? Sul pc uso Windows 11. Grazie
Comments are closed