Re: [LINUX GUIDE for NOOBS] Rooting, Unlocking, Locking and Flash
1) Installing the Android SDK/ADB/Fastboot on Linux with 64-bit support!
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
EDIT: You could follow this guide if you like or you could use a script will take care of it for you. You can find more information HERE. I used it with 64-bit Lubuntu 12.04 and it worked great.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I found that working with the Galaxy Nexus with Linux was actually really easy once I figured out how to get the Android SDK working with my 64-bit Linux system. I used 64-bit Lubuntu 11.10 which is just a light weight version of Ubuntu so this guide should work for Ubuntu users.
(If you are using something other than Ubuntu, then you probably don't need this guide. If you feel your distro of choice needs it, please add a post or a dedicated thread for it and I will add a link or simply add the information to this guide.)
This part of the guide should get your computer to the point where you can unlock, root and restore your phone. This will probably be the hardest part of the entire process and it isn't even that hard. I know this looks like a lot of work, but it shouldn't take more than 30 minutes or so. Once you get this done you will be rewarded because everything after this will be easy peasy!
WARNING: If the thought of typing commands in a terminal scares you to death, then using Linux to Unlock and Root you phone might not be for you. There are some great "one click" methods for Windows out there if that's more your style.
INSTALLING the SDK
1) Install Java
You need to get a Java SDK on your machine.
To see if you have a Java JDK, open your terminal and type in the following command:
(If you have never used the terminal in Ubuntu, you should find it in your accessories menu or by pressing Ctrl+Alt+T. You can copy and past the command and press enter. Also, if you are typing in commands or directories, you can type the first few letters and double press Tab for auto-complete options.)
If you have Java JDK, you will see something like this:
Command:
Aspire-3820:~$ java -version
java version "1.6.0_23"
OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre11-0ubuntu1.11.10)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)
I'm using OpenJDK6.0 but any Java JDK should do. In Lubuntu you can use Synaptic Package Manager to install the OpenJDK. If you are using Ubuntu (without Synaptic) you may want to check out the first reference at the bottom of this post.
You could also use Google to find a guide like this one:
how to install jdk on Ubuntu 11.10 Which simply says to type the following command in your terminal to get OpenJDK:
Command:
sudo apt-get install openjdk-7-jdk
Or this for the Sun JDK:
Command:
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jdk sun-java6-plugin
2) Install Android SDK/ADB?Fastboot
Now you need to download the Android JDK for Linux from here:
Android SDK | Android Developers
Once it's done downloading, open your file manager and go to Downloads. Find the zip you just downloaded, right click the file and choose "Extract Here" to unpack it. You will then have a folder named android-sdk-linux. Copy the file and paste it in your home directory. (You can delete the zip file you pasted if you want to clean things up a bit.) The end result is that you have a android-sdk-linux folder to your home directory.
The command lines to accomplish this same task would look like this:
Command:
cd Downloads
tar xfvz android-sdk_r16-linux.tgz
mv android-sdk-linux/ ~
Now we need to cd (change directory) to the android-sdk-linux folder and run the update script:
Command:
cd ~/android-sdk-linux/tools/
./android update sdk
Click install and wait for it to do its thing. This will take a little while. When finished you should find a folder called "platform-tools" inside your android-sdk-linux directory. Inside "platform-tools" you should see "adb" and "fastboot". (If for some reason you don't see fastboot, you can download it
HERE. Extract the contents, place it in the "platform-tools" folder and rename it to fastboot.)
While you wait for the update to finish, lets get the Galaxy Nexus ready for work. You need to make sure USB debugging is enabled. You do this on your phone with settings/applications/development menu options and checking the USB debugging box. Now wait until the SDK is finished updating and we will test your phone.
If you are on 64-bit Linux, you will need run the following command before moving on to the next step:
64-bit only Command:
sudo apt-get install ia32-libs
When the updated is complete, plug you phone (power should be on) into the USB port on your computer. DO NOT choose USB storage. You should see the usb debugging connected message in your notifications screen.
Now lets see if ADB sees your phone:
Command:
cd platform-tools/
./adb devices
If you are lucky, you will see something like this:
Command:
List of devices attached
H100004t0000
This means ADB is working! You can continue to step 4. The rest of us will need to set up uDev rules before ADB sees or phone.
3) Setting up uDev rules (if needed)
This shouldn't be too difficult. First make sure you don't already have android.rules set up.
Command:
ls /etc/udev/rules.d/
If you find something with "android.rules" you should probably rename it with the mv command. For example I'll just add .bak to mine:
Command:
mv /etc/udev/rules.d/91-android.rules /etc/udev/rules.d/91-android.rules.bak
This next command will create a new android.rules file. If your Linux distro doesn't have gedit, you can try leafpad (in Lubuntu) or use nano, vim, etc:
Command:
sudo gedit ~/etc/udev/rules.d/99-android.rules
Now paste the following into the file:
Copy and paste:
#Acer
SUBSYSTEM=="usb", SYSFS{idVendor}=="0502", MODE="0666"
#Dell
SUBSYSTEM=="usb", SYSFS{idVendor}=="413c", MODE="0666"
#Foxconn
SUBSYSTEM=="usb", SYSFS{idVendor}=="0489", MODE="0666"
#Garmin-Asus
SUBSYSTEM=="usb", SYSFS{idVendor}=="091E", MODE="0666"
#Google
SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"
#HTC
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
#Huawei
SUBSYSTEM=="usb", SYSFS{idVendor}=="12d1", MODE="0666"
#Kyocera
SUBSYSTEM=="usb", SYSFS{idVendor}=="0482", MODE="0666"
#LG
SUBSYSTEM=="usb", SYSFS{idVendor}=="1004", MODE="0666"
#Motorola
SUBSYSTEM=="usb", SYSFS{idVendor}=="22b8", MODE="0666"
#Nvidia
SUBSYSTEM=="usb", SYSFS{idVendor}=="0955", MODE="0666"
#Pantech
SUBSYSTEM=="usb", SYSFS{idVendor}=="10A9", MODE="0666"
#Samsung
SUBSYSTEM=="usb", SYSFS{idVendor}=="04e8", MODE="0666"
#Sharp
SUBSYSTEM=="usb", SYSFS{idVendor}=="04dd", MODE="0666"
#Sony Ericsson
SUBSYSTEM=="usb", SYSFS{idVendor}=="0fce", MODE="0666"
#ZTE
SUBSYSTEM=="usb", SYSFS{idVendor}=="19D2", MODE="0666"
Save the file and close your editor. Now lets change permissions for android.rules:
Command:
ls /etc/udev/rules.d/sudo chmod a+r /etc/udev/rules.d/99-android.rules
Now
make sure your phone is not plugged into your computer and restart uDev and ADB:
Command:
sudo service uDev restart
./adb kill-server
./adb start-server
Now ADB should work. Try the devices command again:
Command:
cd platform-tools/
./adb devices
If ADB still doesn't see your phone please make sure you ran all of the commands successfully. You may need to change the uDev rules. There are a couple of different examples used in the links I referenced. Please read those before posting here. If you need to change the uDev rules, simply open the file as you did above and add the new rules to your file and save it.
4) Make ADB and Fastboot work from any directory
Doing this step will allow you to run ADB from anywhere meaning that you won't have to be in "~/android-sdk-linux$ cd platform-tools/" directory to run it and you won't need the "./" in front of the command either.
Type (or paste) the following command in the terminal (any directory will work)
Command:
sudo gedit ~/.bashrc
AND paste these lines at the bottom of the file:
Copy and Paste:
# Android tools
export PATH=${PATH}:~/android-sdk-linux/tools
export PATH=${PATH}:~/android-sdk-linux/platform-tools
Now
make sure your phone is not plugged into your computer and restart ADB:
Command:
source ~/.bashrc
./adb kill-server
./adb start-server
Now plug your phone in, cd to your home directory and test ADB:
NOTE: If this doesn't work after restarting adb, try rebooting your system. It should work after that.
If that works, congratulations! You are now set up to easily work with your phone in Linux.
If you are still having trouble, please read the referenced links. If you need to ask a question, please post here. If the question turns into it's own topic, consider taking it to another thread and post it here so I can create a link below. That will make it easier to get help and more useful for others who may experience the same problem later on.
References:
Ubuntu 11.10 and ADB and fastboot
Step by Step OEM Unlock and Root
Download the Android SDK
Installing the SDK
uDev Rules for Any Device! (No more starting adb with sudo)
More complete uDev rules in case you need it.
[GUIDE] ADB Workshop and Guide for everyone