[Android] Jake007g:
[Linux] How to install ROOT, Custom Recovery &amp; Custom Roms (via ADB Sideload) on Andr

Hi everybody, thought I'd make my first post a useful one.

The other day I set about upgrading my Samsung Galaxy S6 Edge to Marshmallow from Lollipop with a custom rom. I spent hours trawling through many pages on the internet to find the information I needed which was a pain - especially as there are so many how-to guides for Windows users. So I thought I'd share what I've learnt with the community to give a bit back!

As with anything of this nature, there is a chance you could brick your device (I will not be held responsible so

PLEASE

ensure you know what you're doing!).

Please also ensure that any important data on your device (such as photos/contacts/app data) is backed up before going any further.

Now there are a few files you're going to need before we get started - and these files will be individual for your device. In this guide I will be using a Samsung Galaxy S6 Edge (SM-G925F UK Variant) on Stock Marshmallow 6.0.1 for reference. The process for most devices/android versions is the same - all though the files you'll need to flash will vary depending on your device's Model and Android Version.

Please head to settings>about device(>software info) on Android to find out anything you need to know. Whilst you're in your 'About Device' settings - tap on the 'Build Number' quickly about 10 times to enable Developer options, and head into them on the main settings page & enable 'USB Debugging'.

ROOT

Firstly, download ROOT files for your device. You can find these by searching google - for example in my case: "G925F 6.0.1 Root". If you get a zip file please extract it and look for a .TAR file (if it's a .TAR.MD5 extension simply delete the .MD5 as the checksum isn't needed here). For reference's sake I'll refer to this file as root.tar throughout the guide.

Please create a new folder within your home directory and name it "android".

Place root.tar in /home/android

Open terminal (CTRL ALT + T) and navigate to /home/android with cd android

Via terminal we're going to extract root.tar with tar -xvf root.tar

Once extracted you should be presented with boot.img (if not please try downloading another root kernel in Odin format

.tar

.md5)

Back in terminal, please install Heimdall flash (linux alternative to Odin) sudo apt-get install heimdall-flash

Once installed, run lsusb command to list USB devices

Power off your phone then hold down Volume Down, Center Home, and Power buttons together for about 5 seconds until you enter download mode and plug into your computer (may be different key combo for different phones to my G925F).

Run lsusb again and check there's an extra entry (for your phone in download mode).

Now, in terminal, run: heimdall flash --BOOT boot.img

All being successful your phone should reboot with its' new root kernel (Download SuperSU off play store to check root status and to individually grant SU privileges to apps).

Custom Recovery

Firstly, download CUSTOM RECOVERY files for your device. You can find these by searching google - for example in my case: "G925F 6.0.1 TWRP". If you get a zip file please extract it and look for a .TAR file (if it's a .TAR.MD5 extension simply delete the .MD5 as the checksum isn't needed here). For reference's sake I'll refer to this file as twrp.tar throughout the guide.

Place twrp.tar in /home/android (the folder we made in the rooting process)

Open terminal (CTRL ALT + T) and navigate to /home/android with cd android

Via terminal we're going to extract twrp.tar with tar -xvf twrp.tar

Once extracted you should be presented with recovery.img (if not please try downloading another custom recovery in Odin format

.tar

.md5)

Power off your phone then hold down Volume Down, Center Home, and Power buttons together for about 5 seconds until you enter download mode and plug into your computer (may be different key combo for different phones to my G925F).

Run lsusb and ensure your phone in download mode is recognised by Linux as you did in the rooting process.

Now, in terminal, run: heimdall flash --RECOVERY recovery.img

If everything went to plan, your phone should reboot as normal.

Power off your phone then hold down Volume Up, Center Home, and Power buttons together for about 5 seconds until you enter your custom recovery (TWRP in this case).

Custom Roms via ADB

Now with custom roms, you could always install them the simple way (add rom zip file to device internal storage, boot TWRP recovery and install from there).

In this guide I'll show you how to install them via ADB Sideload on Linux. This is very useful if you mess something up and cannot access your device's internal storage!

Firstly download your Custom Rom zip file. You can find these by searching google - for example in my case: "G925F 6.0.1 Custom Rom". If you get a zip file then this is the correct format to flash and it doesn't need extracting. I chose the Tyrannus Rom on XDA forums By frenkowski (Brilliant rom - recommend trying it if you can). For reference's sake I'll refer to this file as customrom.zip throughout the guide.

Place your customrom.zip in the /home/android folder which we've used previously and navigate to it in terminal with cd android

Staying in terminal, please install the adb tools needed with sudo apt-get install adb

To be on the safe side, we will declare some generic rules for main Android phones manufacturers. These rules will be declared /etc/udev/rules.d/51-android.rules. To declare these rules simply run the following two commands in terminal one after the other: sudo wget -O /etc/udev/rules.d/51-android.rules https://raw.githubusercontent.com/NicolasBernaerts/ubuntu-scripts/master/android/51-android.rules followed by sudo chmod a+r /etc/udev/rules.d/51-android.rules (full credit given to NicolasBernaerts for hosting the file)

We can now restart udev for the new rules to become operational. Run sudo service udev restart in terminal.

Now run lsusb to display connected USB devices.

Power off your phone then hold down Volume Up, Center Home, and Power buttons together for about 5 seconds until you enter your custom recovery (TWRP in this case).

Once TWRP custom recovery has loaded, head to Advanced, plug your micro USB into your computer and click ADB Sideload. I'd also recommend wiping the Dalvik Cache and Cache before sideloading.

Now in terminal, run lsusb again to ensure your computer is recognising the device in ADB Sideload mode.

If all has gone well up to here - you are ready to install your custom rom. To do this, simply sideload it with adb sideload customrom.zip in terminal. Most custom roms include an on-screen installer which you need to go through on your device.

I hope you've found this guide useful. I give full credit to everybody referenced in the guide.