[Xperia Z General] theprince1991:
PLEASE SUGGEST IMPROVEMENTS TO INCREASE READABILITY AND CLARITY TO THIS TUTORIAL

Hi guys how are we all doing? This is my first guide so don't bite. I was seriously impressed with the level of support for Linux, I was able to completely sort my phone out in a few hours using Linux. Just a few things before we start this tutorial:

1.) This is a guide for rooting your phone, flashing a recovery and flashing EXISTENZ ROM. All in Linux. It does not include unlocking your bootloader although I'm sure you could achieve this very easily

2.) This is involve using the terminal to install FlashTool, DoomLords Root, and flashing recovery.

3.) If you can use Terminal and are familiar with file structures you're in a very good place.

4.) I use Linux Mint with the Cinnamon desktop. It is a Ubuntu variant. You should be able to do 99% with the commands I give you... otherwise you might have to tweak it very slightly.

STEP ONE: INSTALL FLASHTOOL

To install FlashTool we will do the following:

We will download FlashTool

We will move the files to a more sensible directory (where all the other programs are)

We will create a menu shortcut that requests root access.

We will install libusb via synaptic package manager which FlashTool requires.

Step 1.) Ok, so, download FlashTool from here: http://www.flashtool.net/download.php

Step 2.) Choose the Linux download and just place it on your desktop for simplicity. Have a clean Desktop for simplicity (i.e.) Have only the folders you need for this tutorial.

Step 3.) Unzip the folder and you should get another folder called "FlashTool" on your desktop. Delete the zip file

Step 4.) It might be worthwhile just checking if FlashTool works. So fire up the good old Terminal and type in:

Step 4.1)

cd Desktop/FlashTool

This puts us in the FlashTool folder in Terminal. Here's a hint, you don't need to fill out every letter in the commands. If you type in "cd Des" and then hit [TAB] then terminal will fill out the rest of the name for you ("Desktop"). Similarly if you type in "cd Desktop/Flas" and then hit [TAB] then terminal will fill out the rest of the name for you ("FlashTool").

Step 4.2) You can check the contents of a directory if you type in

ls -l

.

This will list every file and folder in the directory you are currently in. So it should produce a list that includes FlashTool, FlashToolConsole, firmwares etc etc. If it doesn't you are in the wrong directory. In addition to listing the files and folders it should give extra information. Look for the line that has "FlashTool" on it. On the left hand side of that line it should have something similar to -rw-r--r--. These are the permissions. We need to change this so do this:

Step 4.3) Type into the terminal

chmod ugo+x FlashTool

This will change the permissions of the file. "chmod" means "change mode", "u" means user, "g" means "group" and "o" means other. "+x" means add executable file permissions to this file.

Step 4.4) Type in

ls -l

once again. You should see that now the permissions for the file "FlashTool" has changed. Now we need to run flash tool:

Step 4.5) Type this into terminal:

su
**ENTER YOUR OWN PASSWORD**
./FlashTool

You should see the FlashTool GUI up and running.

At this point it would be a good idea to put the things you need to Flash via FlashTool in the "firmwares" folder.

So download these:

C6603_10.3.1.A.2.67_Generic UK.ftf from here: http://xdaforums.com/xperia-z/general/stock-rom-xperia-z-c6603-10-3-1-2-67-t2512422

XperiaZ_C660X_KernelOnly_10.3.A.0.423_Generic_NL.ftf from here: https://docs.google.com/file/d/0B5TbYyrM0V0POTE3bk9RS29pV1E/edit

XperiaZ_C660X_KernelOnly_10.3.1.A.2.67.ftf from here: http://d-h.st/LVH

C6603_10.4.1.B.0.101_Stripped.ftf from here: http://nut.xperia-files.com/

Put them in the "firmwares" folder within "FlashTool"

Make sure they all end in .ftf, if they do not you probably need to unzip them

Ok so we should have everything we need for FlashTool. Now we need to move it into a more sensible folder.

Step 5.) Close the terminal down by typing in "exit" twice. Open up a new terminal. Move to the directory Desktop by typing into the terminal:

cd Desktop/

Now we need to move the folder to a part of the file system that needs root permissions:

su
**YOUR PASSWORD**
mv FlashTool /usr/lib/

This will mv (MOVE) the FlashTool folder into the /usr/lib/ directory.

If you want to check if it moved just open up your explorer and navigate to /usr/lib/ and you can see that the FlashTool folder will be there.

Now we should create a start menu icon.

Step 6.) I have the Cinnamon desktop. These steps should be ROUGHLY similar. Be creative. Try different things.

For Cinnamon to create a start menu icon I need to "RIGHT-CLICK" on the Start Menu, then go to "CONFIGURE" and then "OPEN THE MENU EDITOR" and then click "PROGRAMMING" in the LEFT COLUMN. After this click "NEW ITEM"

In "Name:" type in "FlashTool" (It doesn't actually matter what you put it)

In "Command:" type in "/usr/bin/gksudo /usr/lib/FlashTool/FlashTool"

Make sure it works. Close the menu editor and launch FlashTool from the menu to see if the GUI boots up.

I'm guessing many people don't have Linux Mint, you'll need to adapt your approach if you want a start menu entry (if you're using a different desktop environment).

Step 7.) Open up Synaptic Package Manager from your Start Menu and type into "Quick Filter": "libusb-1.0" and ensure there's a green box beside "libusb-1.0-0:i386" and "libusb-1.0-0". If they aren't just click the little box next to them, click on "Mark for installation" and hit "Apply" and away you go!

You now have FlashTool installed. Congratulations.

Now we need to flash "C6603_10.3.1.A.2.67_Generic UK" ROM so we can then root it and install a recovery.

Step 8.) Fire up FlashTool. Enter your password. If it doesn't ask for password, the program will boot but flashing will fail

Press the lightning icon. Choose Fashmode. Choose 10.3.1.A.2.67 Generic UK. It will ask you to put the device into flashmode (Turn your device off, hold down volume DOWN and insert USB) and then it'll flash that ROM and do it's thing.

At the end of all that you should have C6603_10.3.1.A.2.67_Generic UK ROM on your phone.

The next step is to ROOT this. For the rooting process your phone needs to be ON. Enable developer options (Settings->about phone-> hit "Build Number" until it says "You are now a developer" press back and then go to Developer Options and check "USB debugging". Go back one more time and go into "Security" and check "Unknown Sources" **Have these are your "default settings" i.e. make sure you have these on all the time**

Download DoomLords root method from here: http://xdaforums.com/xperia-z/development/root-how-to-rooting-firmware-10-3-1-0-t2386405

We need to flash a different kernel temporarily. So open FlashTool again and flash XperiaZ_C660X_KernelOnly_10.3.A.0.423_Generic_NL the exact same way you flashed the Generic UK ROM. Enable Unknown sources and USB debugging if you need to.

Just place the file on your desktop and unzip it. Delete the zip file. Keep the unzipped folder. You should get a folder with:

files

runme_linux.sh

runme_mac.sh

runme_win.bat

etc, etc.

Just remove the mac and windows files. We don't need them. Keep the "files" folder.

Remember you can use [TAB] complete. If you type "DooM" and then [tab] it should fill out the rest of the folder name for you.

Open up a new Terminal and put in these commands:

cd Desktop/DooMLoRD_Easy-Rooting-Toolkit_v18_perf-event-exploit
chmod ugo+x runme_linux.sh
./runme_linux.sh

and it'll do it's thing and root your phone!

Check this by seeing if "SU" app exists on your phone.

Turn your phone off. Flash "XperiaZ_C660X_KernelOnly_10.3.1.A.2.67.ftf" via FlashTool.

Now we have a rooted firmware!

Step 9.) Install recovery

Download NUT's dual recovery from here: http://www.fun-industries.nl/xda/do...kZHVhbHJlY292ZXJ5Mi41LjEtUkVMRUFTRS53aW5kb3dz

Put it on your Desktop and unzip it. You should get a folder called "lockeddualrecovery"

Open a new terminal and cd to the directory:

cd Desktop/lockeddualrecovery/
chmod ugo+x supersu.sh
./supersu.sh

It will do it's thing and install the recovery into your phone. Once it's done make sure it exists by turning it off and repeatedly tapping VOLUME UP. It should boot into CWM.

FINAL STEP: INSTALLING EXISTENZ

DO NOT UNZIP THESE FILES

Download the black version here: http://xdaforums.com/xperia-z/development/rom-existenz-v5-black-edition-10-4-b-0-t2251512

Download the white version here: http://xdaforums.com/xperia-z/development/rom-existenz-v5-0-0-ultra-edition-10-4-t2349656

Make sure you download SuperSU fix also.

Make sure all the terminal windows are gone. All you need to do is connect your phone to your computer and copy the above files to the phone. After they have copied:

Boot into CWM (Turn the phone off, turn it back on and press VOLUME UP repeatedly)

Go to Install ZIP (or something to that effect)

Select the ROM ZIP file and flash it.

After it's finished flash SuperSU fix.zip

Almost done. The ROM won't boot until you've 10.4.1.B.0.101 kernel. So make sure the phone is off. Open FlashTool and flash C6603_10.4.1.B.0.101_Stripped.ftf the same way as before.

Once it's finished turn your phone on and YOU HAVE EXISTENZ ROM!!!

One small addendum. For me my SuperSU was broken. If this is the case for you all you need to do is boot into recovery and select SuperSU fix, CWM will do it's thing and once it's done just turn your phone on and download SuperSU from the market place.

_______________________________________________________________________________________________________________________

Considerations:

1.) It's not necessary to flash "C6603_10.3.1.A.2.67_Generic UK.ftf" the aim here is to root the phone. You can use an older firmware version and root that using this method: http://xdaforums.com/showthread.php?t=2327472

This avoids the need to flash a different kernel and then re-flashing the "C6603_10.3.1.A.2.67_Generic UK.ftf" kernel potentially saving YOU a lot of time.

2.) When using chmod it should be enough for you to type in "chmod u+x <filename>" the reason why I have changed the permissions of "group" and "other" is just to ensure that it works.

3.) There is a way to copy folder into the restricted /usr/lib folder. In terminal if you type in "gksudo nautilus" it will bring up a file manager GUI with root permissions that will allow you do drag and drop these folders.

4.) It's not necessary to move FlashTool into this folder. The reason why I have done it was to keep an organised filesystem. You can leave it on desktop and change the file paths appropriately.

5.) After you have rooted your phone. It may not be necessary to reflash the "XperiaZ_C660X_KernelOnly_10.3.1.A.2.67.ftf" kernel since you are going to flash an entire ROM anyway.

**Please suggest ways to make this tutorial easier to understand**