This is a writeup about Installing a custom operating system on the Samsung Galaxy A51.
This usually requires installing a custom recovery system.
The most commonly used recovery system is TWRP.
Use this information at your own risk and read the documentation of the mentioned tools.
Original OS: Android 10-13
Kernel: Linux 4.14.113 Petit Gorille with patches
Android Codename: a51
Other Codename: SM-A515F sometimes different letters as suffix
Wikipedia
samsung-a51 on the postmarketOS wiki
This device was never officially supported by LineageOS.
However there are regular and up to date unofficial builds on Github: Exynos9611Development
These builds are on Android 15 and feature a very recent Android security patches.
Just download the zip file and install it with TWRP and ADB Sideload.
- Download Mode: Press and hold volume up and down simultaneously then connect a USB Cable. The other end must already be connected to a PC.
- Recovery Mode: Press and hold volume up and power
- This will later be used to enter TWRP
- PC with Windows or Linux
- USB Cable to connect the phone with the PC
- Copy all data from device because it must be wiped in in the next step.
Warning: All data on the device will be wiped!
This is a security measure by Android to prevent attackers from installing malicious software to extract personal data from the device.
- Go to into Developer Settings (see Enable Developer options).
- Look for an option called OEM Unlock or Unlock Bootloader and enable it.
- Shutdown the device.
- Enter Download Mode
- Release the keys after the the screen turns blue. This should happen within 5 seconds.
- Navigate the menu using volume buttons for up and down. Use the power button to select.
- Select Device unlock mode and confirm with yes.
- After restarting, follow the Android setup procedure and connect the device to WiFi.
- Go to into Developer Settings like in step 1 and confirm that the option is grayed out.
Note: if you skip step 8 and do not connect the device to the internet, the following error will later appear during flashing:
Only official released binary are allowed to be flashed
See also Odin (firmware flashing software) on Wikipedia
A software is needed on the PC to install the recovery system. Unlike most Android phones where this is done with Fastboot, Samsung phones require Odin and are not compatible with Fastboot.
Odin is a program for Windows. There is a open source replacement for Odin called Heimdall for Linux & Mac.
Unfortunately there is no public download for Odin offered by Samsung. Trustworthy Odin downloads are offered in forums like XDA-Developers. Make sure to scan the program for malware (for example using Virustotal) before executing it.
I happened to find a leaked Linux version of odin4 version 1.2.1-dc05e3ea that I used for this procedure. It only featured a CLI.
The Sha256 hash of the executable is: 6754aa54f2abe6e99ece32414cd34c8b23b28dbddde537a33203036813637c3b
Virustotal scan.
Use at you own risk.
See Heimdall on Github
- Download the
*.img.tarfile from dl.twrp.me- The version I used is 3.7.1
- Verify the file with it's sha256 hash
- Consider verifying the pgp signature using the
.ascfile - The fingerprint of the key should be
95707D42307C9D41D09BF7091D8597D7891A43DF
- Enter Download Mode
- Open Odin / Heimdall
- Select the TWRP tar file in the AP slot and flash it
- Ideally disable auto reboot
- After the flashing, reboot the phone when ready in case it didn't already
- As soon as the screen turns black, press and hold volume up and power to enter Recovery Mode
- Wait for TWRP to boot
- Go to Advanced > Terminal, type: multidisabler
- Now go back and click Wipe > Format Data > type yes.
- Now again go back and click Advanced > Terminal, type: multidisabler again. will see " - Finished." when done.
- Now again go back to Wipe > Format Data, and type yes to confirm.
This is the command I happened to use with the odin tool on Linux:
./odin4 -a twrp-3.7.1_12-0-a51.img.tarNone of the described steps is optional.
The device can be forced to reboot at any time in any state by pressing volume down and power for atleast 7 seconds.
If TWRP does not start by entering Recovery Mode, it was probably overwritten. This is a known issue.
As a quick fix, just repeat the installation.
Although there is a risk of bricking the device, it is unlikely. If any step fails, check if the previous steps were executed correctly. There is generally no harm in repeating the steps if something failed.