PLEASE NOTE: Flashing software on a device is an “at your own risk” activity. Even if you follow our guide to-the-letter, we can’t accept any responsibility if your device breaks. Our guide is meant for educational purposes, and we offer no guarantees on success.
One of the wonderful things about most Android devices is how much choice you have about which version of the operating system to use. If you buy a smartphone with terrific hardware, but the software doesn’t meet your needs, you can usually install something different (eat it, iOS!).
Depending on the device, there are potentially dozens of versions of Android you can install. Some are created and maintained by a team of developers, while others have just a single developer overseeing all aspects. Best of all, they are all free.
The biggest and most popular custom Android experience is LineageOS. Formerly known as CyanogenMod (and later just Cyanogen), LineageOS is a close-to-stock version of Android with additional features that make your device more powerful and customizable.
One of the best things about LineageOS is that it lets you update many devices to the latest version of Android — even if stock updates for that device ended long ago. This breathes new life into otherwise-forgotten smartphones and tablets.
Installing a new operating system on your Android device might seem daunting, but if you break it down into steps, it’s fairly easy. There’s also a wide margin for error so beginners don’t have to worry about breaking their devices.
Here’s how to do it!
First, a primer
Before you get all crazy messing with the software of your device, you should know some basics. There are some terms and protocols that many sites and walkthroughs will assume you already know, which could make things confusing if you don’t.
Here’s a quick glossary of terms for you to refer to later on if you’re confused:
- ROM – Stands for “read-only memory.” This is where the core software of Android lives. LineageOS will often be referred to as a “custom ROM,” as it is a customized version of pure Android.
- Flashing – When you overwrite one piece of software with another piece of software, that’s called “flashing.” This guide you’re reading goes over how to “flash” LineageOS.
- Bootloader – When you power on a device, the first thing that turns on is the bootloader, which is responsible for starting up other processes. Most Android devices come with locked bootloaders – i.e., you can’t alter what it does. Luckily, most bootloaders can be unlocked, which allows you to then flash new software.
- Recovery – After the bootloader loads, the recovery software system will launch the operating system (Android). In almost all cases, to launch a custom ROM you will also need a custom recovery that differs from the one your device comes with.
- Wipe – Various parts of the flashing process will result in a “wipe” – the erasure of data from your device. A full wipe would eliminate all operating system files from your device, causing your device to boot into the recovery and then stop.
- Packages – LineageOS, Google apps, custom recoveries, etc., will usually download to your device in a “package” of some kind, usually in .ZIP format. In most cases, you can simply assume “package” is equivalent to “ZIP file.”
- ADB – Stands for “Android Debug Bridge.” This is a tool that allows communication between a personal computer and an Android smartphone. In most cases, you will need ADB on your computer to complete a flash.
- Fastboot – This diagnostic tool comes with most Android installs and allows you to flash a new ROM. You usually access fastboot through ADB. Some device manufacturers (including Samsung, HTC, and a few others) use the term “Download mode” instead, but the functions are relatively the same.
- Brick – If something goes wrong with a flash, in rare cases it could cause your device to cease functioning. If your phone doesn’t even turn on, it’s as useful as a brick, hence the name. Some people will say things like “soft brick” to clarify that the device is unusable but has the potential to be fixed. It is very difficult to brick a device, and usually only happens when people don’t follow instructions carefully (hint hint).
Flashing LineageOS: The Basics
When you flash LineageOS (or any custom ROM), there are a set of steps you almost always must follow. How you complete those steps – and the tools needed to do the job – differs from device to device. But overall, the basic steps are the same.
Here’s what you’ll need to flash a ROM:
- Compatible Android smartphone or tablet
- USB cable for that device
- Laptop or desktop running Windows, macOS, or Linux
- An internet connection
- Time (this could take an hour or two, depending on how comfortable you are with the technologies involved)
Here are the steps one usually performs to flash a ROM:
- Install necessary computer software (usually ADB)
- Download packages (ROM, recovery, apps, etc.)
- Backup and prepare device
- Unlock bootloader
- Flash custom recovery
- Flash custom ROM
- Flash apps
- Reboot and personalize
Each step begets the next. You install the software first because it accesses the device’s bootloader. You then unlock the bootloader, because it accesses the recovery, and then you change the recovery to a custom one because it flashes the ROM. You then flash the ROM, and on and on. It’s a very linear process.
One incredibly important fact to keep in mind is that this process will almost always involve a wipe of your personal data. Unlocking the bootloader always results in a format of data.
With that in mind, it is imperative you follow step three and make a backup before performing any changes to your device. If something goes wrong after you unlock the bootloader, there will be no way to get your phone back to the way it used to be. Instead, your phone will be set back to factory default like it was when you first turned it on.
One other thing to keep in mind: unlocking the bootloader usually voids your device’s warranty. Devices usually permanently record an unlocked bootloader so even if you unlock it and then lock it again the company will know. If something goes wrong and you give it to the OEM, there’s a good chance it will refuse to help if it sees you unlocked the bootloader.
Step 1: Install the necessary software
Some rare devices out there allow you to flash new ROMs without needing to hook up to a computer first. However, the vast majority of devices will require access to a PC running Windows, macOS, Linux, or even Chrome OS. This can be a ten-year-old laptop or high-performance desktop — it doesn’t take a lot of computational power to flash a ROM.
Usually, the software you need is ADB. Google hosts and maintains ADB, so there are no concerns about viruses or malware when downloading and installing the program.
You can visit this page to follow explicit instructions on how to download and install ADB for your computer platform. It doesn’t take long and the instructions are very straightforward.
Once you’ve installed ADB, you’ll access it through a command prompt on Windows or a terminal window on Linux and macOS. This might seem daunting, but don’t worry: the commands are extremely simple and easy to just copy and paste.
Pro Tip: Eventually you’ll hook your Android device to your computer to connect to ADB. When you do this, make sure you are using the USB cable that came with the device. If you don’t have access to that, use a high-quality, short-and-thick cable. Cheap cables you get for $1 each could cause problems with flashing, so don’t use them.
Step 2: Download packages
To get LineageOS for your device, you’ll need to first check to make sure your device is compatible with the ROM. Go to the LineageOS wiki and do a search for the device you’d like to flash.
LineageOS supports most popular devices from almost all major manufacturers. Unless you have a very unpopular or low-priced budget device, chances are good you can install at least one version of LineageOS.
When you get to the list of files associated with your device, you might wonder which one to download. Just download whichever file has the most recent upload date.
Once you have the file downloaded to your computer, you can leave the LineageOS site. However, you don’t just need the LineageOS package; you also need the custom recovery package as well as the Google apps package.
It is imperative you locate the exact model of your device before downloading TWRP or LineageOS. There are many variants of the Samsung Galaxy S5 and thus many versions of TWRP and LineageOS with the Galaxy S5 label. Be sure to match it up exactly.
You will also need a Google apps package. If you don’t install these at the end of the flashing process, you will not have any Google products on your device when you boot, including the Google Play Store. You can’t install the apps later, you must install them during your original flash.
Once you have those three packages downloaded, move the files into the same location as the ADB files you installed in the previous step. Then rename them to simpler things; for example, the TWRP file name is very long and tricky (twrp-3.2.2-1-xxxx.img). Change it to just TWRP.img. This will make it easier to find the files later and also save you some command line typing.
Rename each file you downloaded as such:
- twrp-x.x.x-x-xxxx.img > TWRP.img
- lineage-xx.x-xxxxxxxx-nightly-xxxx-signed.zip > LINEAGE.zip
- open_gapps-xxxxx-x.x-xxxx-xxxxxxx.zip > GAPPS.zip
Don’t forget to move them to the ADB folder (for Windows, that’s %USERPROFILE%\adb-fastboot\platform-tools). Once the files are all organized, you’re ready for the next step!
Pro Tip: Your device has a code name that LineageOS, TWRP, and GApps will use to identify it. The code name is shown on the LineageOS compatible devices list — use this to search for compatible packages, that way you know you’re always downloading the right one!
Step 3: Backup and prepare device
There’s no one right way to backup your device. Figure out whichever method works best for you and make the backup.
A good method to backup your device is to use Helium. If you connect your phone to the Helium desktop client, you’ll be able to back up pretty much everything on your phone to your computer without needing to root your device first.
After you’ve backed everything up, you need to do two things on your device before you move on to the next step: enable USB debugging and OEM unlocking. These are two toggles in your device’s settings panel, hidden in a section called “Developer Options.”
Do a Google search for “access Android developer options [your device name here]” to find instructions on how to access these two toggles (it usually involves tapping a bunch of times on your Android build number in Settings). Once you have access to developer options, toggle on both USB debugging and OEM unlock. If OEM unlock isn’t there, don’t worry: just make sure USB debugging is turned on.
Once you’ve done all that, connect your device to your computer with a good USB cable. You might see a notification on your phone asking if you trust the computer. Confirm you trust the connection and exit out of settings. You might see drivers are installing on your computer, which is normal.
You’re ready for the next step!
Pro Tip: Do not skip anything in this step. This stuff is here for a reason. It could take you hours to reinstall all your apps, login to all your accounts, move over all your photos, and all that. You also don’t want to risk losing any important data. Be safe!
Step 4: Unlock the bootloader
The steps for unlocking the bootloader of your device will vary depending on the make and model of your smartphone or tablet. Some OEMs make the process incredibly easy, while others purposely make it difficult (or even impossible).
This step will thus vary wildly depending on your device, so it’s hard to give explicit instructions from which everyone will benefit. That said, here’s an overall primer!
To make your life easier, head over to XDA Developers and find the forum for your device. Skim through the threads and see if other users have successfully unlocked the bootloader. If everyone else seems to be having no trouble, you’ll be fine.
Here’s an easy method to bootloader unlock a Verizon Pixel or Pixel XL
If you find other users are having trouble with the bootloader, it could be for a few reasons. It might be because the device is too new, so no one has figured out the process yet. It might also be that the bootloader is protected and difficult or impossible to unlock; Samsung is notorious for this.
Once you are sure the bootloader is unlockable, head to the LineageOS installation guide for your particular device. There you’ll find step-by-step instructions on how to unlock your bootloader.
Remember: this will wipe your device’s data.
In most cases, to unlock the bootloader you hook your device up to your computer using a USB cable and then run a few ADB and fastboot commands to unlock the smartphone or tablet:
- An ADB command to make sure your device is properly connected
- An ADB command to reboot the device into fastboot mode (see glossary above)
- A fastboot command to check that the device is in fastboot mode and properly connected
- A fastboot command to unlock the bootloader
If you are on Windows, you might run into an error when you try the steps listed on your device’s bootloader page. The problem might be that your command prompt is not in the right location. With the command prompt open, type the following command (see above):
The first thing to do after hooking your device up to the computer is run an ADB command to ensure a proper connection (see above):
If you don’t see any devices listed after running that command, check your Android device — it might have this screen:
Click the “Always allow” box and hit OK. That should solve the problem, but run the “adb devices” command again just to be sure.
If after successfully connecting to ADB and rebooting into fastboot mode you face some problems, that likely means you need to update the drivers on your computer. Do a Google search for “[device name here] drivers” and download and install the latest version.
With all that done, you should be able to successfully unlock the bootloader. After your bootloader is unlocked, your device will reboot and enter Android setup, just like after a factory reset.
Before continuing on to the next step, make sure you turn on USB debugging again. Go through the process of setting up your device for the first time and then re-enable USB debugging. After the factory reset, this might have turned off, so make sure you follow the same steps as you did before (turn on, plug into computer, and so on).
With your bootloader unlocked, you’re ready for Step 5.
Pro Tip: YouTube is your friend! A quick YouTube search could net you a video walkthrough of how to unlock your device’s bootloader. Watch it and this whole process will likely be so much easier!
Step 5: Flash a custom recovery
Now that the bootloader is unlocked, it’s time to actually flash something onto your device. This is a big step! You will be flashing software onto your smartphone or tablet that will drastically change how your device functions.
You already downloaded the appropriate custom recovery from the TWRP website back in Step two. However, if you haven’t done this already, head here and find the TWRP file that exactly matches your device model.
As one final warning: flashing the wrong custom recovery onto a device could cause a brick. Be absolutely certain that the TWRP file you downloaded matches the model of your device. You’ve been warned.
Once you’re all set, fire up ADB via a command prompt and perform the following commands:
Just like before, the command above ensures your device is properly connected to your computer. After that, run this one:
adb reboot bootloader
Also as before, that command gets you into fastboot mode. Next, run this command:
That performs one final check before the flash that your device is connected and fastboot is ready to go. Finally, you run this command:
fastboot flash recovery TWRP.img
Check out the screenshot below to see how this should all look:
You should consult the LineageOS instructions for your specific device to make sure that these are the correct commands.
Once ADB and fastboot are done flashing, you reboot the device into recovery mode. This usually involves a set of hardware key presses. Booting the OnePlus 5 into recovery mode involves powering off, and then powering on while holding down the Volume Down key. Do a Google search for the steps involved with booting your device into recovery mode.
Since you just flashed TWRP over your original recovery, your device will boot into TWRP when you press the specific hardware keys you found using Google. You’ll be greeted first by the screen below:
This is just notifying you that, by using TWRP, you will be messing with the software on your phone. If you don’t swipe the “Swipe to Allow Modifications” button, you won’t ever be able to boot into TWRP — and thus never get to flash a ROM. That’s what we came here to do, so swipe that button to the right! You’ll see the following screen:
Once you’ve booted your device up into TWRP, you are ready for the next step: flashing LineageOS!
Pro Tip: There are numerous YouTube videos and online tutorials on how to flash a custom recovery. In fact, there’s probably a video specific to your device! Search Google for “flash TWRP on [device name here] video” and see if you can watch someone else go through this process first so you’ll have a better idea of what to do.
Step 6: Flash LineageOS
You downloaded the appropriate LineageOS file to your computer way back in Step two. However, the file doesn’t help us much on your computer — it must be on the device itself.
Usually, you would just boot up into Android and move the file from your computer to the device after connecting the USB cable, but you can’t boot into Android because you haven’t installed it yet!
Don’t worry, though — ADB can do all the file transfers you need. Before you do that make sure that no remnants of your former version of Android remain.
From the main menu of TWRP, tap Wipe, and then tap Format Data. TWRP will warn you this is serious business, but since you made a backup in Step three you have nothing to worry about (right?!). Follow TWRP’s instructions and complete the format process.
After you get a “Successful” message, hit the back button until you’re back at the Wipe page. Tap on Advanced Wipe and you’ll see a series of checkboxes. If an item is checked, that section of the hard drive will get wiped. You want to check the first three boxes: Dalvik / ART Cache, System, and Cache. Leave all the others unchecked.
Swipe from left to right on the slider marked Swipe to Wipe. The wiping process begins.
Once that’s done, you’re ready to flash LineageOS. With your device still in TWRP mode, connect it to your computer using the USB cable. Fire up a command prompt or terminal window in the ADB folder, perform a device check, and then use the “push” command to push your LineageOS file onto the internal memory of your device.
The command looks like this:
adb push LINEAGE.zip /sdcard/
After you type that in and press Enter, ADB will begin pushing the LineageOS file to your device. This could take some time, and sometimes there’s no progress bar to watch how fast it’s going. Give it a while (at least five minutes) before touching anything. Eventually, you’ll see a “1 file pushed” notification:
On your device, get back to the main menu of TWRP and tap Install. You’ll see a list of the available files on your device, and the LineageOS package should be one of them. Tap on the filename and you’ll come to a screen with three options: you want to Swipe to Confirm Flash.
TWRP will flash LineageOS on your device, and then tell you it’s successful. You’ll then have two options: Wipe cache/dalvik or Reboot System. Don’t hit either one! Instead, hit the onscreen Home button.
Now that you’ve flashed LineageOS, you’re ready for the second-to-last-step.
Pro Tip: If pushing your LineageOS file isn’t working, make sure the file is in the same computer directory as ADB. If the LineageOS package is on your desktop and ADB is in its own folder, ADB won’t know where the file is when you type in its name. All the files you are pushing and flashing should be in the same folder as the ADB program. Refer back to Step two if you’re confused!
Step 7: Flash necessary applications
You’ve come a long way so far! You are so close to being done. You have an unlocked bootloader, a custom recovery, and a fresh install of the latest version of LineageOS.
The only thing you’re missing are Google apps like the Google Play Store, Google Play Services, Gmail, and Google Maps. You’re going to flash the ZIP file of Google apps you downloaded in Step 2 in the same fashion as you flashed LineageOS.
With your device booted into TWRP and connected to your computer, open an ADB command prompt and — once again — do an ADB device check. Then type in this command:
adb push GAPPS.zip /sdcard/
Usually, your Google apps package is bigger than your LineageOS package, so this push might take even longer than the first push you did in the previous step. Just give it time!
Once the push is done, grab your device and follow the same steps you did before:
Tap Install > Locate Google package > Tap package > Swipe to Confirm Flash
After performing those steps, the flashing process begins.
Once it’s done, tap Wipe cache/dalvik, wait a moment, and then hit Reboot System. Guess what, your device will reboot into LineageOS!
Pro Tip: If you want to root your device, you can also flash a root file at this stage (before rebooting into System). There are multiple root methods and files available for different devices, so I’m not going to go over them here. If you want root access, this would be the perfect opportunity to flash that file too.
Step 8: Reboot and personalize
Your first boot into LineageOS will take a while — give it time. You just installed a new operating system and don’t want to rush it!
If your first boot takes longer than 15 minutes, something is wrong. Do a hard reboot by holding down the power button until the device restarts. Let it try to boot again. If it still doesn’t boot, something didn’t flash correctly, so head back to Step Six and start again.
The first thing you’ll notice upon a successful boot is a new boot animation, with the Lineage OS logo’s three circles on a curved line, like in the GIF above.
Once the boot is complete, you’ll be at the startup screen of Android, where you’ll pick your language, add your Google Account, connect to Wi-Fi, and so on. This is all very similar to what you previously performed when you first got your device, so there shouldn’t be any surprises.
Once you get to the home screen, you are officially done — you have LineageOS on your device! Now head to YouTube to learn about all the nifty features you can play with in this new version of Android.
Pro Tip: This is a great time to restore all the apps you backed up in Step Three. You can also manually re-download them all if you skipped that step. We’ll talk to you in a few hours.
Depending on your device, there are likely a lot of other custom ROMs out there besides LineageOS. Now that you know how to flash a ROM, you can get flash-happy and try out all sorts of new flavors. All you need to do is find ROMs that match your device’s model number, and then repeat Steps 6 through 8. You don’t need to unlock the bootloader or install a custom recovery again.
However, you’ll need to backup your device again. Don’t forget this vital step!
If you try out custom ROMs and decide you don’t like them anymore, it is incredibly easy to switch back to the stock ROM your device originally had. There’s a different set of instructions for flashing back to stock, but the essence is essentially the same. Do some Googling to figure out how to flash your particular device back to its factory defaults by searching for “flash [device name here] back to stock.”
I hope this guide has been helpful to you! If you get stuck, ask some questions in the comments and someone will surely help you out!
August 15, 2018 at 10:27AM