Basic requirements
- Make sure your computer has working
adb
. Setup instructions can be found here. - Enable USB debugging on your device.
Preparing for installation
Samsung devices come with a unique boot mode called “Download mode”, which is very similar to “Fastboot mode” on some devices with unlocked bootloaders. Heimdall is a cross-platform, open-source tool for interfacing with Download mode on Samsung devices. The preferred method of installing a custom recovery is through this boot mode – rooting the stock firmware is neither necessary nor required.
- Download and install the Heimdall suite:
- Windows: Extract the Heimdall suite and take note of the directory containing
heimdall.exe
. You can verify Heimdall is working by opening a command prompt in that directory and typingheimdall version
. If you receive an error, make sure you have the Microsoft Visual C++ 2012 Redistributable Package (x86) installed on your computer. - Linux: Pick the appropriate package to install for your distribution. The
-frontend
packages aren’t needed for this guide. After installation, verify Heimdall is installed by runningheimdall version
in the terminal. - macOS: Install the
dmg
package. After installation, Heimdall should be available from the terminal - typeheimdall version
to double-check.
- Windows: Extract the Heimdall suite and take note of the directory containing
- Power off the device and connect the USB adapter to the computer (but not to the device, yet).
-
Boot into download mode:
- With the device powered off, hold Volume Down + Home + Power. In order to exit download mode and reboot, hold Volume Down + Power for about 7 seconds.
Accept the disclaimer, then insert the USB cable into the device.
- Windows only: install the drivers. A more complete set of instructions can be found in the ZAdiag user guide.
- Run
zadiag.exe
from the Drivers folder of the Heimdall suite. - Choose Options » List all devices from the menu.
- Select Samsung USB Composite Device or MSM8x60 or Gadget Serial or Device Name from the drop down menu. (If nothing relevant appears, try uninstalling any Samsung related Windows software, like Samsung Windows drivers and/or Kies).
- Click Replace Driver (having to select Install Driver from the drop down list built into the button).
- If you are prompted with a warning that the installer is unable to verify the publisher of the driver, select Install this driver anyway. You may receive two more prompts about security. Select the options that allow you to carry on.
- Run
- On the computer, open a command prompt (on Windows) or terminal (on Linux or macOS) window, and type:
heimdall print-pit
- If the device reboots, Heimdall is installed and working properly.
Installing a custom recovery using heimdall
-
Download a custom recovery - you can download TWRP. Simply download the latest recovery file, named something like
twrp-x.x.x-x-lentislte.img
. - Power off the your device and connect the USB adapter to the computer (but not to the device, yet).
-
Boot into download mode:
- With the device powered off, hold Volume Down + Home + Power. In order to exit download mode and reboot, hold Volume Down + Power for about 7 seconds.
Accept the disclaimer, then insert the USB cable into the device.
- On the computer, open a command prompt (on Windows) or terminal (on Linux or macOS) window in the directory the recovery image is located, and type:
heimdall flash --RECOVERY twrp-x.x.x-x-lentislte.img --no-reboot
Tip: The file may not be named identically to what stands in this command, so adjust accordingly. If the file is wrapped in a zip or tar file, extract the file first, because Heimdall is not going to do it for you. - A blue transfer bar will appear on the device showing the recovery being transferred.
- Unplug the USB cable from your device.
- Manually reboot into recovery:
- With the device powered off, hold Volume Up + Home + Power. When the blue text appears, release the buttons.
Note: Be sure to reboot into recovery immediately after having installed the custom recovery. Otherwise the custom recovery will be overwritten and the device will reboot (appearing as though your custom recovery failed to install).
Installing LineageOS from recovery
-
Download the LineageOS install package that you’d like to install or build the package yourself.
- Optionally, download 3rd party application packages such as Google Apps (use the
arm
architecture)
- Optionally, download 3rd party application packages such as Google Apps (use the
- If you aren’t already in recovery, reboot into recovery:
- With the device powered off, hold Volume Up + Home + Power. When the blue text appears, release the buttons.
- (Optional, but recommended): Select the Backup button to create a backup. Make sure to create the backup in the external sdcard or copy it into your computer, since the internal storage will be formatted.
- Select Wipe, then Format Data and continue with the formatting process. This will remove encryption and also delete all files stored in the internal storage.
-
Select Wipe and then Advanced Wipe.
-
Select Cache and System partitions to be wiped and then Swipe to Wipe.
- Place the LineageOS
.zip
package, as well as any other .zip packages on the root of/sdcard
:- Using adb:
adb push filename.zip /sdcard/
- You can use any method you are comfortable with.
adb
is universal across all devices, and works both in Android and recovery mode, providing USB debugging is enabled.
- Using adb:
- Go back to return to main menu, then select Install.
- Navigate to
/sdcard
, and select the LineageOS.zip
package. -
Follow the on-screen prompts to install the package.
-
(Optional): Install any additional packages using the same method.
Note: If you want any Google Apps on your device, you must follow this step before the first boot into Android! - (Optional): Root the device by installing the LineageOS su add-on (use the
arm
package) or using any other method you prefer. - Once installation has finished, return to the main menu, select Reboot, and then System.
Get assistance
If you have any questions or get stuck on any of the steps, feel free to ask on our subreddit or in #LineageOS on freenode.