[HOW-TO] Setup ADB on Ubuntu Linux 64Bit - Vibrant Android Development

As you all may know (or may not know or may not even care), Google's current implementation of ADB for Linux only works on 32Bit Linux systems (boooh!) which leaves the rest of us x64 users with the dilemma of either installing an extra redundant 32bit version of Ubuntu that will hord 15Gb of space so that we may type a few ADB commands in the bash prompt or install ADB on Windows for those of us that have it. Ever since I bought my phone and was forced to reboot my beloved free OS to type those few commands, I'd wave my fists in the air and curse Google for not having had enough sense to make a 64Bit implementation.
Fortunately, my fists will need tire themselves no more. Using a guide compiled by a Geeksphone.com forum user called Talpa, I was able to successfully compile and run ADB on a Linux 64Bit system in short order. Little things make me happy and having seen that this technique is not very wide spread on the forums, I've decided to spread the happiness myself...
CREDITS:
Big, big thanks to the users of the geeksphone forums for having pooled their time, skills and efforts together to figure out this hack and a another big thank you to talpa for having sifted through all the of posts and having made a coherent and unified guide out of it. The guide can be originally found at:
http://wiki.geeksphone.com/en/index.php?title=CompileADB64bitLinux
the discussion that lead to the guide is at:
http://forum.geeksphone.com/index.php?topic=850.0
ADB Linux 64Bit (yeeehhhaaaah!!!)
For the sake of added clarity, I've completely rewrote the geeksphone guide. go to your terminal
#> sudo su
#> mkdir /tmp/my-adb
#> cd /tmp/my-adb
if you don't already have it, install git-core:
#>apt-get install git-core
once that's done, type out the following commands:
#> git clone git://android.git.kernel.org/platform/system/core.git system/core
#> git clone git://android.git.kernel.org/platform/build.git build
#> git clone git://android.git.kernel.org/platform/external/zlib.git external/zlib
#> git clone git://android.git.kernel.org/platform/bionic.git bionic
Before you run compile, you need to the following alterations to the compile scripts to make the output bianaries 64bit compatible. As time progress and this post ages in the ageless internet, some additional modifications may be necessary (or they may change the place of the offending code or may add new bits that need to be deleted or changed). You can go back to the GeeksPhone wiki link (up above) to see if the forum members there have updated it. Hopefully by then, Google would have compiled a 64Bit Linux version of ADB and all of this would be unnecessary. If for any reason you're unable or unwilling to modify the source code yourself, go to this link where I have posted the source code that I have modified:
http://www.mediafire.com/file/q42gektqr32nr31/adb-Linux64bit-source-code-jan-2011.zip
Editing the Source Code Yourself
first, edit the file /tmp/my-adb/build/target/product/sdk.mk and delete the last six lines:
==============================
# include available languages for TTS in the system image
include external/svox/pico/lang/PicoLangDeDeInSystem.mk
include external/svox/pico/lang/PicoLangEnGBInSystem.mk
include external/svox/pico/lang/PicoLangEnUsInSystem.mk
include external/svox/pico/lang/PicoLangEsEsInSystem.mk
include external/svox/pico/lang/PicoLangFrFrInSystem.mk
include external/svox/pico/lang/PicoLangItItInSystem.mk
==============================
then, edit the file /tmp/my-adb/build/core/main.mk at line 116 (again the position may change, just keep an eye out for the offending code) and erase the following lines:
==============================
# Check for the correct version of java
java_version := $(shell java -version 2>&1 | head -n 1 | grep '[ "]1\.6[\. "$$]')
ifeq ($(strip $(java_version)),)
$(info ************************************************** **********)
$(info You are attempting to build with the incorrect version)
$(info of java.)
$(info $(space))
$(info Your version is: $(shell java -version 2>&1 | head -n 1).)
$(info The correct version is: 1.6.)
$(info $(space))
$(info Please follow the machine setup instructions at)
$(info $(space)$(space)$(space)$(space)http://source.android.com/source/download.html)
$(info ************************************************** **********)
$(error stop)
endif
# Check for the correct version of javac
javac_version := $(shell javac -version 2>&1 | head -n 1 | grep '[ "]1\.6[\. "$$]')
ifeq ($(strip $(javac_version)),)
$(info ************************************************** **********)
$(info You are attempting to build with the incorrect version)
$(info of javac.)
$(info $(space))
$(info Your version is: $(shell javac -version 2>&1 | head -n 1).)
$(info The correct version is: 1.6.)
$(info $(space))
$(info Please follow the machine setup instructions at)
$(info $(space)$(space)$(space)$(space)http://source.android.com/source/download.html)
$(info ************************************************** **********)
$(error stop)
endif
==============================
Edit /tmp/my-adb/build/core/combo/HOST_linux-x86.mk and change every "-m32 string" to "m64"
Now that that's done, you should be able to get the compiling going with the following command:
#> make -f build/core/main.mk out/host/linux-x86/bin/adb
Once that's done, you go to /tmp/my-adb/out/host/linux-x86/bin/ and you get your adb and acp binaries and move them to wherever your OS keeps all the system binaries.
In ubuntu 10.04, that would be
/bin/adb
/bin/acp
That's it, adb should work from your 64 bit linux shell.
==========================

Holy hell that looks overly complicated. I've installed adb about a dozen times on x64 Ubuntu. I'll post a link to the guide i was using in a minute...
Sent from my SGH-T959 using Tapatalk

http://forum.xda-developers.com/showthread.php?t=537508
(skip the last part about setting up fastboot)
except on this step:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
Click to expand...
Click to collapse
You need to do lsusb in console (with your phone plugged in) and find the Samsung vendor id, it's like 0ed4 or something, I don't remember.
Much easier, I think.

birgertime said:
Holy hell that looks overly complicated. I've installed adb about a dozen times on x64 Ubuntu. I'll post a link to the guide i was using in a minute...
Sent from my SGH-T959 using Tapatalk
Click to expand...
Click to collapse
Um, yeah, I don't know why the OP is doing all this. All you need to do is download the android SDK for your platform:
http://developer.android.com/sdk/index.html
An adb binary is included in the tarball in the tools directory. Just add that to your path somewhere.
Yes, the binary included in the SDK is 32bit. No, it doesn't matter at all. A clean install of 64-bit Ubuntu includes multilib support for the (very few) 32-bit shared libraries it requires.
If you really, really need a 64-bit binary... well, go for it. But unless you're building your own Linux distribution or are doing something really exotic, it's highly likely that the 32-bit version will work just fine.

Yikes! This is overkill. Dude, just install the lib32 library files. You should really read the Android developers page on how to setup the sdk on 64-bit linux, its all there. ;-) Good luck with this though. Really...
Sent from my SGH-T959 using XDA App

I thought some people might appreciate the instructions to get adb working over WiFi too and this seems like a good place to put it:
Type this in your terminal emulator on your Android device:
Code:
setprop service.adb.tcp.port 5555
stop adbd
start adbd
Then check it with this:
Code:
getprop service.adb.tcp.port
If it doesn't return "5555" and you're rooted, then do a "su" command and try again. You shouldn't need to be rooted for adb over wifi to work, but I haven't tried every device:
Code:
su
setprop service.adb.tcp.port 5555
stop adbd
start adbd
Then check it:
Code:
getprop service.adb.tcp.port
When it returns "5555" then run this command in the terminal (or command prompt) on your computer:
Code:
adb connect 192.168.0.151
(Obviously enter your device's IP address. You must be on the same network as the computer that has the Android SDK installed.)
And you should be connected!
To tell the Android device to listen for adb on the USB port instead of TCP again, enter this into the terminal emulator:
Code:
setprop service.adb.tcp.port -1
stop adbd
start adbd
(again, might need "su" on your device)
Or just reboot the Android device.
And to tell your computer to use USB for adb instead of TCP:
Code:
adb usb
Now, keep in mind, when your Android device is listening for adb via WiFi, it's wide open... anybody that that the Android SDK installed and knows your device's IP address can access it without a password.
HTH,
Billy
PS - Your
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
are appreciated!

Yes, I just installed a clean Ubuntu 64 bit and the lib32 binaries were included. I only needed to create a /etc/udev/rules.d/70-android.rules and enter my device ID - SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666". I can connect via ADB 32 bit just fine.
Of course using 64 bit drivers falls under the I did it because I could category as well. Kudos!

JeremyNT said:
Um, yeah, I don't know why the OP is doing all this. All you need to do is download the android SDK for your platform:
http://developer.android.com/sdk/index.html
An adb binary is included in the tarball in the tools directory. Just add that to your path somewhere.
Yes, the binary included in the SDK is 32bit. No, it doesn't matter at all. A clean install of 64-bit Ubuntu includes multilib support for the (very few) 32-bit shared libraries it requires.
If you really, really need a 64-bit binary... well, go for it. But unless you're building your own Linux distribution or are doing something really exotic, it's highly likely that the 32-bit version will work just fine.
Click to expand...
Click to collapse
Exactly my thoughts as well. It is simple enough to get it working using the standard package that Android provides!

Like others have said adb packaged with the android sdk works fine on ubuntu 10.10 with no additional configuration. The only problem that I know of is you have to run the adb server as root.
Sent from my SGH-T959 using XDA App

I'm pretty sure that you only have to give it root on the first time.
Sent from my SGH-T959 using Tapatalk

phattchumpy said:
Like others have said adb packaged with the android sdk works fine on ubuntu 10.10 with no additional configuration. The only problem that I know of is you have to run the adb server as root.
Sent from my SGH-T959 using XDA App
Click to expand...
Click to collapse
I am able to run the adb server with a user login with guest permissions. Did not have to use root. But I run Ubuntu 10.04. I guess that it would probably be the same for 10.10 as well, but can't confirm.

This is what I do (very simple and fast)
1) Open the terminal and type: wget dl.google.com/android/android-sdk_r07-linux_x86.tgz (Downloads The SDK with ADB)
2) Then type: tar xvfz android-sdk_r07-linux_x86.tgz && cd android-sdk-linux_x86 (Extracts the archive)
3) After that type: sudo mv tools /usr/local/share/android-tools (Moves the sdk tools to your local system folder)
4) Now type: sudo ln -s /usr/local/share/android-tools/adb /usr/local/bin/ (Makes a symbolic link to the adb executable)
5) Then type: sudo adb devices (This will start the adb server and search for connected devices)
You should now see this in your terminal:
List of devices attached
T959730f48f7 device

Firstly, Thanks a lot to the OP for posting this and the link to the geeksphone wiki. I really needed this and I would have removed my existing linux install, had I not come across this in the next few minutes.
Now back to the main reason why I am posting this comment.
I didn't see even one single reply that was grateful to the OP and the first many posts were just plain crap. If you people don't know what someone is talking about, then please don't show your ignorance and move on to troll other threads.
Of course you can install adb from the default google sdk package and it would work fine on 99% of your systems. It is the remaining 1% for whom this post is intended.
This method is for those who have a pure non-multilib 64-bit system. For such users, google has not packaged a 64-bit adb file in their release, and the default adb will not work. Such users have to build the adb file for a 64-bit machine from the sources. It is for such users that this is necessary and it was very much necessary for me, as well as for the OP, I presume.
So if you don't understand something, please don't waste others' time by spamming the post. The title is quite obvious to those who are looking for a solution.
Update: Just as I finished typing this, my adb has got compiled and I am able to run it. Thanks a million once again, OP.

geekoo said:
Firstly, Thanks a lot to the OP for posting this and the link to the geeksphone wiki. I really needed this and I would have removed my existing linux install, had I not come across this in the next few minutes.
Now back to the main reason why I am posting this comment.
I didn't see even one single reply that was grateful to the OP and the first many posts were just plain crap. If you people don't know what someone is talking about, then please don't show your ignorance and move on to troll other threads.
Of course you can install adb from the default google sdk package and it would work fine on 99% of your systems. It is the remaining 1% for whom this post is intended.
This method is for those who have a pure non-multilib 64-bit system. For such users, google has not packaged a 64-bit adb file in their release, and the default adb will not work. Such users have to build the adb file for a 64-bit machine from the sources. It is for such users that this is necessary and it was very much necessary for me, as well as for the OP, I presume.
So if you don't understand something, please don't waste others' time by spamming the post. The title is quite obvious to those who are looking for a solution.
Update: Just as I finished typing this, my adb has got compiled and I am able to run it. Thanks a million once again, OP.
Click to expand...
Click to collapse
damn!
The adb tool has moved to platform-tools/
If you don't see this directory in your SDK,
launch the SDK and AVD Manager (execute the android tool)
and install "Android SDK Platform-tools"
Please also update your PATH environment variable to
include the platform-tools/ directory, so you can
execute adb from any location.
ofcourse they meved it. so ... any new tutorial with android sdk ?
in windows is the same problem with missing adb.exe (but i have an older version installed). just that i use windows for starcraft2 so i want adb for linux (eventually x64).
later edit: found it ->scroll down to platform tools
and after:
extract in a folder, cd to that folder
$sudo apt-get install lib32ncurses5 lib32stdc++6
# echo SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666">/etc/udev/rules.d/51-android.rules
$./adb kill-server
$./adb start-server
(kill and start i don`t know if is necessary, but it can`t do nothing wrong)
connect the device, $./adb devices and shall see it.
$./adb shell and enjoy
$ => as regular user
# => as root
i`m on kubuntu 12.04 (x64) and using an android 2.3.7 (cm7 based) huawei u8180 / orange stockholm

even easier
even easier paste these commands in linux terminal
sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install android-tools-adb android-tools-fastboot
btw # < $

Related

[Q] help w jb root

all is good until the last step whats going on?
[email protected]:/tmp/share$ tar xvf motoshare.tgz
adb
busybox
pwn
su
Superuser.apk
[email protected]:/tmp/share$ sudo chown root:root pwn
[email protected]:/tmp/share$ sudo chmod 6755 pwn
[email protected]:/tmp/share$ /tmp/share/adb shell /storage/rfs0/pwn
bash: /tmp/share/adb: No such file or directory
[email protected]:/tmp/share$
Please give me the response for the terminal command:
ls -l /tmp/share/adb
re jb root
[email protected]:/tmp/share$ ls -l /tmp/share/adb
-rwsr-sr-x 1 jody jody 204436 Feb 11 11:49 /tmp/share/adb
jodybgoode said:
[email protected]:/tmp/share$ ls -l /tmp/share/adb
-rwsr-sr-x 1 jody jody 204436 Feb 11 11:49 /tmp/share/adb
Click to expand...
Click to collapse
I will get back to you after I talk with Dan. Unless another set of eyes knows the solution.
Sent from my MB886 using xda app-developers app
Try running the last command as simply "adb shell /storage/rfs0/pwn"
(i.e. without the prefix /tmp/share/)
Help confused
djrbliss said:
As promised, this post describes how to root the Atrix HD Jelly Bean build. This should also work on other Motorola 4.1.2 builds (Razr/Razr Maxx, Razr HD, Razr M, etc.).
The exploit requires setting up a special Samba share and mounting this share on your phone using the File Manager app. I apologize that this process may seem involved for some of you, and request that members of this community help each other out if some of you are having problems completing the procedure. I'm not able to provide individual tech support to every user who wants to root this phone.
The following instructions require a working Linux installation. The following instructions are for Ubuntu. If you don't want to install Ubuntu permanently on your machine, I suggest using a LiveCD installation. Instructions on setting this up are described here:
https://help.ubuntu.com/community/LiveCD#How-To_LiveCD_Ubuntu
Once you're booted into Ubuntu, open a terminal. Create a new directory for your Samba share:
Code:
mkdir /tmp/share
Next, install the samba package:
Code:
sudo apt-get install samba
Edit the configuration file for samba:
Code:
sudo gedit /etc/samba/smb.conf
Add the following lines to the end of the configuration file and save your changes:
Code:
[share]
path = /tmp/share
available = yes
valid users = guest
read only = yes
browsable = yes
public = yes
Close the text editor once you've saved your changes.
Next, create a user for the Samba share by typing in the terminal:
Code:
sudo useradd guest -m -G users
Set a password for the new user. Remember this password:
Code:
sudo passwd guest
Provide a password here and press enter. You won't see the characters you're typing, so be careful.
Next, set a password on the share. Use the same password you just provided:
Code:
sudo smbpasswd -a guest
Type the password you created before and press enter.
Next, restart the Samba server:
Code:
sudo restart smbd
Finally, download and prepare the required files to the Samba share:
Code:
cd /tmp/share
wget [url]http://vulnfactory.org/public/motoshare.tgz[/url]
tar xvf motoshare.tgz
sudo chown root:root pwn
sudo chmod 6755 pwn
At this point, you'll need to know the IP address of your Linux host, which you can get by running "ifconfig" from your terminal (it should be of the form "192.168.x.x").
Next, move over to your Android device. Ensure you have enabled USB Debugging Mode (under Settings -> Development Settings). Ensure your device is connected via Wifi.
Open the "File Manager" app, and select "Remote storage". Click "Add storage", and fill in fields as follows:
Code:
Host IP address: [your Linux machine's IP address]
Domain name: WORKGROUP
Shared folder name: share
User: guest
Password: [the password you created above]
At this point, the phone will mount your Linux share. To complete the process, plug in your phone via USB to your Linux machine, and type the following in your Linux terminal:
Code:
sudo /tmp/share/adb kill-server
sudo /tmp/share/adb shell /storage/rfs0/pwn
If it's successful, this should print "[+] Rooting complete!".
Finally, install Supersu by typing the following in the terminal:
Code:
sudo /tmp/share/adb install /tmp/share/eu.chainfire.supersu.apk
Congratulations, enjoy your rooted device.
I can't stress this enough: I can't provide individualized tech support for everyone on this forum. Please help each other.
TTLayland has been successfully rooted using this technique and has volunteered to help. If you get stuck and can't find support on these forums, feel free to email him at ttlayland (at) gmail (dot) com.
Paypal:
http://goo.gl/zBGb0
Click to expand...
Click to collapse
Got this error:
[email protected]:/tmp/share$ sudo /tmp/share/adb shell /storage/rfs0/pwn
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
mount: Operation not permitted
sh: can't create /system/xbin/busybox: Read-only file system
Unable to chmod /system/xbin/busybox: No such file or directory
sh: busybox: not found
cp: /system/bin/su: Read-only file system
Unable to chown /system/bin/su: No such file or directory
Unable to chmod /system/bin/su: No such file or directory
link failed Read-only file system
[+] Rooting complete!
[email protected]:/tmp/share$
Then it says: "There is no SU binary installed, and SuperSU cannot install it. This is a problem!" when opening SuperSU
PLEASE HELP HERE OR MY EMAIL! : [email protected]
Thanks in advanced
progrockguy said:
Try running the last command as simply "adb shell /storage/rfs0/pwn"
(i.e. without the prefix /tmp/share/)
Click to expand...
Click to collapse
progrockguy said:
Try running the last command as simply "adb shell /storage/rfs0/pwn"
(i.e. without the prefix /tmp/share/)
Click to expand...
Click to collapse
that worked kinda. well it says rooting complete but when i update superuser or root checker says root fail
Please Help: error: device offline
I am getting the following error
[email protected]:/tmp/share$ sudo /tmp/share/adb kill-server
[email protected]:/tmp/share$ sudo /tmp/share/adb shell /storage/rfs0/pwn
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
error: device offline
[email protected]:/tmp/share$
I am running the LiveCD in VMware Workstation
Sorry for the duplicate posts
worked perfectly after i used a 32 bit live disk
jodybgoode said:
worked perfectly after i used a 32 bit live disk[/QUOTE
Did you use Ubuntu and which version?
do you have a link to the CD?
Did you boot a machine or you used VMware or Virtualbox?
Click to expand...
Click to collapse
Why would anyone even attempt to use a VM for this simple root method? You could've been rooted already if you had just followed the instructions.
Same problem here. I couldn't get past the adb kill-server command. It would tell me there is no such directory. If any one can get past this can someone please tell me what they did to get past it.
Black_halo said:
Same problem here. I couldn't get past the adb kill-server command. It would tell me there is no such directory. If any one can get past this can someone please tell me what they did to get past it.
Click to expand...
Click to collapse
I am stuck, I have tried so many machine to no luck
Please someone help
Start over and just copy and paste each single line and hit enter do not copy multiple code lines .
ATRIX HD running BATAKANG 1.10
sickkside13 said:
Start over and just copy and paste each single line and hit enter do not copy multiple code lines .
ATRIX HD running BATAKANG 1.10
Click to expand...
Click to collapse
I did, no luck
Dammz man idk what else to tell you yesterday i spend all day trying to root too but just when i was about to give up i got everything g working
ATRIX HD running BATAKANG 1.10
sickkside13 said:
Dammz man idk what else to tell you yesterday i spend all day trying to root too but just when i was about to give up i got everything g working
ATRIX HD running BATAKANG 1.10
Click to expand...
Click to collapse
hehehehe
Does the root method have anything to do with having android sdk and ndk on your system? Im thinking thats what it is now. Would i have to have linux sdk to run with terminal root or windows sdk?
Black_halo said:
Does the root method have anything to do with having android sdk and ndk on your system? Im thinking thats what it is now. Would i have to have linux sdk to run with terminal root or windows sdk?
Click to expand...
Click to collapse
No, you don't need the Android SDK/NDK, since I included a copy of ADB in the tarball file that you extracted to /tmp/share.
What's the output of "ls -l /tmp/share/adb" on your Linux machine?
I had to re-flash official JB firmware in RSD Lite before the exploit would work. Before that, the Exploit would return "Root Complete", but there was no root access (though I could su to # in adb). I run Ubuntu 12.04 x64 at work already with Windows in VirtualBox.
RSD Lite doesn't seem to want to complete a flash in the Windows VMs I run in VirtualBox at work, so I waited until I got home and used my Windows 8 Pro machine to RSD the phone with the official JB firmware. I run Ubuntu 12.04 in a VirtualBox on that machine already, so after the RSD flash, I ran the exploit from that VM - BINGO - worked on the first try.
Failing other options, you might want to try re-flashing JB in RSD Lite and running the exploit on a fresh device.
I used the firmware in this thread (To fix the issue the thread is about):
http://forum.xda-developers.com/showthread.php?t=2057078
If you decide to try that, Be SURE to get the firmware zip AND THE XML and replace the XML before flashing!!

Install ADB on Windows & ubuntu 12.04 or 12.10

If you need to flash ROM even using fastboot for Smartphone or Tablet in which they use Android OS! Then Ubuntu OS is needed!
This is a guide I made for ubuntu users and included a guide for windows users to setup Android SDK which contains ADB.
Android Debug Bridge (ADB) provides a terminal interface on your PC to interact with your device's file system. This can be useful for many things like installing & uninstalling apps, logcat, backup & restore, and hacking your device just to name a few.
ubuntu 12.04 & 12.10 Guide
1. Go here and download android-sdk (not the adt-bundle)....
https://hotfile.com/dl/241406263/5e6a306/android-sdk_r22.0.5-linux.tgz.html
2. Place the downloaded file in your home folder and then extract it and you should get a folder named android-sdk-linux (do not rename it).
3. If you’re on a 64bit machine run these commands in terminal to make sdk compatible with 64bit (if you’re on 32bit machine then skip this step)....
sudo apt-get update
sudo apt-get install ia32-libs-multiarch
4. Run this command in terminal to install jdk if you don’t have it already....
sudo apt-get install openjdk-6-jdk
5. Navigate to the home folder where you extracted android-sdk-linux and open the folder then open the folder named tools
6. Inside the tools folder there will be a file named android... double click it and select run then android sdk manager will open.
7. In the center pane deselect everything... Now only select the following....
Android SDK Tools
Android SDK Platform-tools
Android Support Library
8. Once selections have been made click on install packages and wait till finished.
9. Upon completion of step 8 in terminal run this command....
sudo gedit ~/.bashrc
When the file opens, go to the very bottom and copy/paste the following 3 lines (make sure they’re each on separate lines)....
# Android tools
export PATH=${PATH}:~/android-sdk-linux/tools
export PATH=${PATH}:~/android-sdk-linux/platform-tools
10. Now reboot your computer.
11. Set your phone to usb debugging then plug it to your pc after pc is done booting
12. Open a terminal on your pc and enter....
adb devices
If all went well, you should see your phone’s serial number and you’ll be ready to go.
~~~~~Important~~~~~
You can use steps 5 & 6 to open Android SDK Manager & update your ADB/SDK installation. Only select your installed packages then update.
Also if you only need the fastboot/adbtools:
sudo add-apt-repository -y ppa: phablet-team/tools
Note: delete the space after"-y ppa:" -xda creates smileys like ppa
sudo apt-get update
sudo apt-get install -y phablet-tools
Sent from my Nexus 4 using xda app-developers app
Thank...
gazhead said:
Also if you only need the fastboot/adbtools:
sudo add-apt-repository -y ppa: phablet-team/tools
Note: delete the space after"-y ppa:" -xda creates smileys like ppa
sudo apt-get update
sudo apt-get install -y phablet-tools
Sent from my Nexus 4 using xda app-developers app
Click to expand...
Click to collapse
Thanks man! It's also good way!
Followed this guide (thank you for posting) but couldn't connect. Scratched around and found I needed to create a new file in /etc/udev/rules.d with:
Code:
SUBSYSTEM=="usb", ATTR{idVendor}=="<4-char_verndorID>", ATTR{idProduct}=="4-char_productID", MODE="0666", OWNER="username"
Followed by:
Code:
sudo restart udev
Then plugged device in and it worked!
qtoon said:
Followed this guide (thank you for posting) but couldn't connect. Scratched around and found I needed to create a new file in /etc/udev/rules.d with:
Code:
SUBSYSTEM=="usb", ATTR{idVendor}=="<4-char_verndorID>", ATTR{idProduct}=="4-char_productID", MODE="0666", OWNER="username"
Followed by:
Code:
sudo restart udev
Then plugged device in and it worked!
Click to expand...
Click to collapse
What did you name the new file you created? Or did you add this string to another existing file from the rules.d directory? I'm not sure what I've done wrong, but I get
Code:
[email protected]:~$ adb devices
No command 'adb' found, did you mean:
Command 'cdb' from package 'tinycdb' (main)
Command 'gdb' from package 'gdb' (main)
Command 'dab' from package 'bsdgames' (universe)
Command 'zdb' from package 'zfs-fuse' (universe)
Command 'kdb' from package 'elektra-bin' (universe)
Command 'tdb' from package 'tads2-dev' (multiverse)
Command 'pdb' from package 'python' (main)
Command 'jdb' from package 'openjdk-6-jdk' (main)
Command 'jdb' from package 'openjdk-7-jdk' (universe)
Command 'ab' from package 'apache2-utils' (main)
Command 'ad' from package 'netatalk' (universe)
adb: command not found
[email protected]:~$
This is after following each step, adding the three lines to the end of .bashrc and rebooting.
atmu5fear said:
What did you name the new file you created? Or did you add this string to another existing file from the rules.d directory? I'm not sure what I've done wrong, but I get
Code:
[email protected]:~$ adb devices
No command 'adb' found, did you mean:
Command 'cdb' from package 'tinycdb' (main)
Command 'gdb' from package 'gdb' (main)
Command 'dab' from package 'bsdgames' (universe)
Command 'zdb' from package 'zfs-fuse' (universe)
Command 'kdb' from package 'elektra-bin' (universe)
Command 'tdb' from package 'tads2-dev' (multiverse)
Command 'pdb' from package 'python' (main)
Command 'jdb' from package 'openjdk-6-jdk' (main)
Command 'jdb' from package 'openjdk-7-jdk' (universe)
Command 'ab' from package 'apache2-utils' (main)
Command 'ad' from package 'netatalk' (universe)
adb: command not found
[email protected]:~$
This is after following each step, adding the three lines to the end of .bashrc and rebooting.
Click to expand...
Click to collapse
@atmu5fear, inferring that you're new to Linux (a common background for all), some notes:
Unlike wlth Win-d'oh-s, there is a worldwide development community that's always working toward improvement of every aspect of the system, including echoed messages and documentation. You may have to shake off the tendency to ignore Windudz messages, which are frequently unhelpful. Linux command echoes are much more on-target. Also, look for files such as README in rules.d and read it!
Now before creating a new config file (which may not be necessary on your system), see the top feedback line: "No command 'adb' found." First, see that the adb binary is present and that it has exec permission. (Since it's a small file and functions alone, I prefer to copy it to the folder I'm working from.)
If it then runs but won't connect, read on...
Directory (or "folder") names with a trailing '.d' are special: They configure, control, or provide executables for daemons (programs which run continuously, providing a service).
Within service-config.d folders, if the service steps through the files sequentially (as in this case), then it does so based on each filename. (True except for the special case of rc.d, iIRC, in which order is set by the special program rcorder).
So in this case, for example, since the existing files are named 70-whatever, your newly-created file could be 80-atmu5fears-phone to load after the others.
Should connect.
qtoon said:
@atmu5fear, inferring that you're new to Linux (a common background for all), some notes:
Unlike wlth Win-d'oh-s, there is a worldwide development community that's always working toward improvement of every aspect of the system, including echoed messages and documentation. You may have to shake off the tendency to ignore Windudz messages, which are frequently unhelpful. Linux command echoes are much more on-target. Also, look for files such as README in rules.d and read it!
Now before creating a new config file (which may not be necessary on your system), see the top feedback line: "No command 'adb' found." First, see that the adb binary is present and that it has exec permission. (Since it's a small file and functions alone, I prefer to copy it to the folder I'm working from.)
If it then runs but won't connect, read on...
Directory (or "folder") names with a trailing '.d' are special: They configure, control, or provide executables for daemons (programs which run continuously, providing a service).
Within service-config.d folders, if the service steps through the files sequentially (as in this case), then it does so based on each filename. (True except for the special case of rc.d, iIRC, in which order is set by the special program rcorder).
So in this case, for example, since the existing files are named 70-whatever, your newly-created file could be 80-atmu5fears-phone to load after the others.
Should connect.
Click to expand...
Click to collapse
Thanks @qtoon for the reply. I'm not really new to Ubuntu, albeit, it's been a while. First started using it just prior to the realease of Hardy Heron 8.04 LTS. That being said I am certainly no expert, but am somewhat familiar and comfortable with the command line. I did read the README file before posting, but since I'm not all that familiar with configuration files and the like, I figured maybe I should ask.
As per your suggestion i moved the ADB binary to my home folder, not necessarily my working folder, but to test to see if the adb command would be recognized in terminal.
Code:
mv ~/ADB/android-sdk-linux/platform-tools/adb ~/
Still got same result so I moved it back, then went on to make a new file and add the suggested string
Code:
sudo > /etc/udev/rules.d/80-atmu5fear-adb
sudo gedit /etc/udev/rules.d/80-atmu5fear-adb
After saving and restarting udev I still get the same "adb command not found" error.
I then changed the string to read OWNER"atmu5fear" instead of "username", still nothing
Any more suggestions?
Thanks
atmu5fear
Sorted it out
instead of:
adb devices
i needed to input:
./adb devices
It's listed, and in order to use the adb shell:
./adb shell
once in the shell all adb commands work
I get this error...
[email protected]:~$ sudo > /etc/udev/rules.d/80-sjy-phone
bash: /etc/udev/rules.d/80-sjy-phone: Permission denied
ok....... didn't need to add a file, changed phone usb mode to media device and all is ok.
thanks
atmu5fear said:
Sorted it out
instead of:
adb devices
i needed to input:
./adb devices
It's listed, and in order to use the adb shell:
./adb shell
once in the shell all adb commands work
Click to expand...
Click to collapse
Didn't think to mention that, apologies.
Quick 'why' on the ./ here.
Glad you got it running.
Just tried on 14.4 and worked like a charm.
Note: No need to reboot the computer, just reload the bash config with
Code:
source ~/.bashrc
Thanks
A good step by step guide
i will try it and see if it works
Thanks again
Hello, can someone help me ? - I m having problems connecting my device with adb (I ve connected several other devices before with no problems).
I ve got an Allwinner A20 tv box, it worked fine for a few months then one day, after being on (but idle) for a few hours, I noticed the screen was blank but the light on the front was blue (indicating it was on, red is standby). It would not respond to the remote control or to anything, so I unplugged it and since then it will not boot and the screen is blank, the red light will light up but that is it. I ve eliminated the remote controller not working, but I cant boot the device.
So I ve tried connecting via ADB (with Ubuntu) but I cant get the device to show up after typing "adb devices".
Using this guide:
http://androidonlinux.wordpress.com/2013/05/12/setting-up-adb-on-linux/
I can get the vendor id and device id and I ve added it and the manufacturer to udev/modeswitch devices, but when I type "sudo usb_modeswitch -v 0x1f3a -p 0xefe8 -S -R -W"
I get the following error:
~/Android/sdk/platform-tools$ sudo usb_modeswitch -v 0x1f3a -p 0xefe8 -S -R -W
Take all parameters from the command line
* usb_modeswitch: handle USB devices with multiple modes
* Version 2.1.1 (C) Josua Dietze 2014
* Based on libusb1/libusbx
! PLEASE REPORT NEW CONFIGURATIONS !
DefaultVendor= 0x1f3a
DefaultProduct= 0xefe8
SierraMode=1
NeedResponse=0
Look for default devices ...
found USB ID 048d:1336
found USB ID 1d6b:0002
found USB ID 19a8:2036
found USB ID 1f3a:efe8
vendor ID matched
product ID matched
found USB ID 1d6b:0001
found USB ID 062a:0102
found USB ID 1d6b:0001
Found devices in default mode (1)
Access device 004 on bus 003
Current configuration number is 1
Use interface number 0
USB description data (for identification)
-------------------------
Manufacturer: not provided
Product: not provided
Serial No.: not provided
-------------------------
Send Sierra control message
Error: Sierra control message failed (error -7). Abort
I ve searched Google for the error code but I cannot find anything.
The device was rooted and USB debugging was on.
Any help would really be appreciated.
Thanks

[GUIDE][A First For Xda] How to Build a rom + more using only the Linux terminal!

How to build a CyanogenMod/Omni/Android Based Rom from source using only a Linux Terminal
A First for XDA I believe? So why this tutorial?
Originally when I was searching about for tutorials on how to build from source, they were all specific to those who use a GUI and this included downloading .zips with a browser and editing files through text editors, extracting files to certain locations and executing files through the file explorer such as "get-prebuilts.sh". There were some that used the linux terminal more then they needed too, this was helpful but not specific, this isn't going to be a tutorial like you see everywhere else, this will be made more specific to those who use either a remote machine, or people who want to use just the Linux terminal like a badass! This will have the commands I use, they may not be the most universally used or the simplest they can be but it's not broke so I shan't fix it! All these tutorials, for me, meant a lot of personal work google-ing and searching my way through commands, this was great as it has helped me learn a lot about Linux Terminal commands, but it has also caused me countless issues, such as uploading my final product and navigating around is a real pain in the ass. This meant it took me quite a while to get my first ever build using just the Linux terminal, and uploading it.​
ForewordRead first
For this tutorial I will try not to make it too device/situation/rom specific because, then that means people have to make changes, which, we will have experienced never ends well, but I will have two variations of the command, the first command will be the generalised command using a HTML style coding for where you should make your changes, an example of this would be for the code <DeviceName>, you would replace it with your device name minus the <>signs (obviously). To then check if you had done it right, I will add in my device name which for this tutorial will be the LG Optimus 4xHD (codename p880). As this may become confusing with many <*> codes popping up, and there are many codenames and device names to keep up with, I will be adding a legend/key with some of the syntax I will be using and what it means, but also include some of the more popular codename and manufacturer names for those who do not know what they are. This tutorial will not tell you how to set up a remote machine, only use a Linux terminal and nothing else much. It may also include a hidden "GUI Cheat" for those with GUI to check if you have done a step correctly. This will be aimed at Ubuntu 13.10 64bit, as you need 64bit to compile (to my knowledge anyway)​
Setting Up Your Build Environment
Okay so the easy-ish bit, this is mainly for people who either the administrator of their "Build Server" or Remote Machine as most "user-based" ones will almost always have theirs set-up for you. This will also be required by users who have set up Ubuntu/other Linux distribution on a host/local machine. You probably will not be able to do this on a user based Remote Machine anyway due to an absence of root access, if this is an issue and one is not setup and you do not have elevated privileges, email the corresponding admin for help! I can't help you here! So now down to business!​Installing the required packages should be as follows, although, if they do not work just google it, I'm sure there are many tutorials with many ways to set up a build environment:
Code:
sudo apt-get install bison build-essential curl flex \
g++-multilib gcc-multilib git-core gnupg gperf \
lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev \
libesd0-dev libncurses5-dev libsdl1.2-dev \
libwxgtk2.8-dev libxml2 libxml2-utils lzop \
openjdk-6-jdk openjdk-6-jre pngcrush schedtool \
squashfs-tools xsltproc zip zlib1g-dev
NOTEIf any GUI comes up for any installation (not sure, been a while since I did it) It should be pretty self-explanatory, for example arrow keys to navigate, enter to select an option etc.
Setting Up Repo's
Okay, so repo is a blanket term here. It can be split up in order to simplify things for the purpose of this tutorial. Repo is a package type thing of commands for handling your repo's. You will need this for Initialising repo's (Repo init) and for syncing sources (Repo sync). I will not be going into different flag meanings, only those which I use in this tutorial.​
Installing the Repo package should be as follows, again google and let me know if I am wrong or it doesn't work!:
Code:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ cd ~/bin
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
NOTEEach $ sign represents a line of command, so you should press enter between commands. For example "mkdir ~/bin <ENTER>" <ENTER> being the action by the user. GUI Users on a local machine may need to reboot at this time or redo it a couple of times until it works, remote users should just disconnect and reconnect again.
Setting up working folders and understanding Directories
Many tutorials will have this step differing from one another, this is because it's all down to personal preference. I prefer to have just the RomName because it's less work, but some prefer to have "Android/<ROMNAME>" or "Android/system/<ROMNAME>". This is because of Git, if a package is called Android_frameworks_Base, it represents the directory <ROMNAME>/frameworks/base/.​
Setting up your working directories is dependent on which Rom you are building.
Generalised Code
Code:
$ mkdir ~/<ROMNAME>
$ cd ~/<ROMNAME>
Example Code
Code:
$ mkdir ~/carbon
$ cd ~/carbon
NOTEThis is creating a directory (mkdir) and navigating to it (cd) to go back when navigating use the "~" sign, it means "Home/<USERNAME>/" it skips some typing is all!
Initialising and Downloading the Repo
Okay so the repo part is perhaps the second longest of all processes you will have when building, it downloads the sources you need to compile with, this is approximately ~18gb maybe? Possibly? So you may need a fair partition or free space on your HDD/SDD for the building process as well.​
Generalised Code:
Code:
repo init -u <GITHUB_LINK_IN_ROM_MANIFEST/ANDROID> -b <CORRESPONDING_BRANCH>
Specific Code:
Code:
repo init -u https://github.com/CarbonDev/android.git -b kk
NOTEAt this point you will see some code and some download stuff, it's just the repo fetching some stuff, at this point, you will be prompted to enter a name and an email, you will either be prompted to enter it, or you will be given the commands needed to do it, this needs to be done, once completed, re-initialize the repo. This will only happen on your first time.
Downloading the code:
Code:
repo sync -j#
NOTE This is going to start the downloading of the sources, the -f is a force flag, this will stop you from receiving any errors in your repo and will re rep sync the source. Other flags can be -j which specifies how many objects to download at once, I choose not to use it but the syntax is -j<NUMBER_OF_JOBS> for example -j10, this should be used in conjunction with the speed and bandwidth of the internet connection supplied, -j4 is default and using a higher flag for a better connection will speed things up considerably, be sure not to over do it thou. See this post for more details!
Setting Up For Your Device
Okay so one of the more important parts, and the parts people usually use the GUI and browsers etc. for, this will be how to do it without those aids. Well on the remote machine anyway, a host machine with GUI is probably needed for changes and links. This will set up vendor, kernel, and device tree.​
General Code in order Kernel, Vendor, Device Tree:
Code:
$ mkdir -p kernel/<MANAFACTURER>/
$ cd kernel/<MANAFACTURER>/
$ git clone <KERNEL_GIT_LINK> <DEVICE_CODENAME/KENREL_NAME>
$ ls
$ cd ~/<ROMNAME>/vendor/
$ git clone <VENDOR_GIT_LINK> <MANAFACTURER>
$ ls
$ cd ~/<ROMNAME>/device
$ mkdir <MANAFACTURER>
$ cd <MANAFACTURER>
$ git clone <DEVICE_TREE_GIT_LINK> <DEVICE_CODENAME>
$ ls
$ cd ~/<ROMNAME>
Specific Code in order Kernel, Vendor, Device Tree:
Code:
$ mkdir -p kernel/lge
$ cd kernel/lge
$ git clone https://github.com/P880-dev/android_kernel_lge_x3.git x3
$ ls
$ cd ~/carbon/vendor
$ git clone https://github.com/P880-dev/proprietary_vendor_lge.git lge
$ cd ~/carbon/device
$ mkdir lge
$ cd lge
$ git clone https://github.com/P880-dev/android_device_lge_p880.git p880
$ ls
$ cd ~/carbon
NOTE There are shorter ways I'm sure, but this works. "ls" checks files in the directory just to double check you did it right. To find the git link it will be on the github of the tree on the left in a box. This only clones the default branch, if it's different you must fork the tree and click settings>default branch and change to the needed one, and use the git clone box from there. Device tree's can be edited per rom on github, or in terminal, for the purpose of using terminal, I'll add to this tutorial.
Making Changes to files
If you are building whichever rom was on your default branch then I guess this step isn't too important for you unless you want to check the files over or you want to edit other files like envsetup.sh to change the build tools versions. This will use the cd, ls, and pico function for editing files. To change configs and stuff in .mk files in device tree. Most people would use gui for file editing and that's why I am showing you the method to do so with ease from the Linux terminal.​
General Code:
Code:
$ cd /device/<MANAFACTURER>/<DEVICE_CODENAME>/
$ ls
$ pico <FILENAME>
Specific Code:
Code:
$ cd device/lge/p880
$ pico cm.mk
NOTE This will open a text editor, the key at bottom represents ctrl + <LETTER> to do different functions. The main ones you use will be "ctrl x" because that is exit. After that you can either edit the name after the changes you made, for example changing CM to Carbon if you were building carbon. You can navigate to any directory, and pico <FILENAME> to edit it! It is easier to make these edits using github after forking a repo, usual changes need to be done to cm.mk and vendorsetup.sh, to know what needs changing, swap cm with the name of the rom, and check the vendor_rom of the rom for the config directories, for nfc and carbon, place a # at the start of the line, this is called hashing out. Change cm.mk when saving or by using mv <FILENAME> <NEW_FILENAME>.
Building the Rom
Okay so now that wasn't too bad was it? Setting up? Some devices that are officially supported do not need the above steps, but then again, if you was officially supported, why would you need to build? Anyways, this will show you how to get the pre-builts (if needed) and how to start the build of the rom. Cheated and used the GUI yet? If not, Good on ye! I will be adding the commands for adding legacy drivers and some other miscellaneous codes and commands in the next post! Including ccache for those who are on host/local machines rather than remote machines.​
Generalised Code:
Code:
$ cd ~/<ROMNAME>/vendor/cm
$ . get-prebuilts.sh
$ cd ~/<ROMNAME>
Option #1: $ . build/envsetup.sh
Option #2: $ source build/envsetup.sh
[I]This last step varies between rom, so I will give the most generalised, check the manifest or building tutorial for the Rom to find out the way to build[/I]
$ brunch <DEVICE_CODENAME> -j<NUMBER_OF_CPU_CORES_+1>
Specific Code:
Code:
$ cd ~/carbon/vendor/cm
$ . get-prebuilts.sh
$ cd ~/carbon
$ . build/envsetup.sh
$ lunch
$ corresponding number
$ make carbon -j18
NOTE This will then start the build, this can take from 1-10hours to build depending on performance and other variables, it takes me ~1hour 15mins for a build of a KitKat Rom. Each ROM has a different build script, this means it can be a different chosen command each time, brunch is the most commonly used, check their manifest or look for a ROM specific building tutorial. -j# is the amount of jobs it will compile at one time, putting an insane number will not make it build faster. Put the amount of cores +1 to be safe. My server has 16cpu threads, and can handle -j18. A -j flag is not needed. Some build scripts support a time brunch <DEVICE_CODENAME> flag to time how long the build has taken. You may be prompted to enable colour display, enable, it looks pretty.
Completed Build, Now What?
So on this journey you have set up a build environment, set up your repo's, and device specific changes needed to buid and you have built a rom. So how do you access the build you just worked your ass off for? For the average user like me who does not have access to ftp, you can either use a program called plowshare as a non root user, or use a command line tool made by xda user GermainZ to upload to devhost using a python script. This is what we will set up next. Or you can use the GUI and extract the Rom and move to your phone straight, for us using remote machines we cannot do this, so we must upload.​
Devhost Set-Up code (supports Anon Uploads):
Code:
$ cd ~/
$ git clone git://github.com/GermainZ/dev-host-cl.git dev-host-cl
$ cp dev-host-cl/devhost-py2.py ~/bin/devhost
$ chmod +x ~/bin/devhost
Uploading your ROM:
Code:
$ cd out/target/product/<DEVICE_CODENAME>/
$ ls
$ devhost upload -u <USERNAME> -p <PASSWORD> <ROM_ZIP_FILE_NAME>
Example:
Code:
$ cd out/target/product/p880
$ ls
For anon upload: $ devhost upload CARBON-KK-UNOFFICIAL.zip
For user upload: $ devhost upload -u username -p password CARBON-KK-UNOFFICIAL.zip
$ cd ~/carbon
Before building again make sure you either:
Code:
A: $ make clean
B: $ make clobber
To remove the directory fully:
Code:
$ cd ~/
$ rm -rf <ROM_FOLDER_NAME>
NOTEThis is installing the script for python 2, if you use python change "python-py2.py" to just "python.py". Do this if it doesn't work first time for you also. Plowshare will be in the miscellaneous post below this one for other codes for users who do not wish to use devhost. The link to the Rom will be on the bottom of the terminal after it is finished uploading. Some errors are server based, make sure you check the error if you are given one.
Did you make it?
Did you manage to complete it without using GUI and cheating? I bet you did! Post in the thread (Don't quote anything) saying you successfully completed the challenge of using no GUI and link to the finished product and I wall add your name to the "Hall of Fame" that will be placed either at the bottom of this thread or on the bottom of the next post! This should now help give you more experience in building from source with a Linux terminal for uses who have no previous experience, or are new to having access to a remote machine.​
Foot Note
So here is my tutorial on how to build a rom from source using no gui and only the Linux terminal, it is a longer process but is the only process when using a remote machine. I hope I made it easy to understand and I hope you will stay to read the other miscellaneous codes and commands that are still to come on the next post. This tutorial was written up by scratch by me, I thank GermainZ for the devhost script, but I had no help in writing up this tutorial, I believe it may also be a first for xda as when I was searching, I didn't find one to follow. Commands in this are done the long way I know. I will explain why and add how to shorten them and some other shortcuts in the miscellaneous section at the bottom of this thread.
Fluoxetine.​
Miscellaneous
Okay so as promised throughout the thread this section is going to contain other codes that may be useful to you (after gaining experience) including some shortcuts for coding that are really simple, it will also include other scripts such as plowshare for those who hate devhost (can't see why you would thou). I plan to continuously add to this part of thread with extra goodies, so keep posted here. For this purpose I will be using HIDE markers for each code as they are optional, and not for everyone. The key for the HTML style syntax I used for this thread (as self-explanatory as it is) will come at the bottom of my opening posts for this thread, kinda like to round it off you could say haha. Logically they should go at the top, however I am neither Spok nor Sheldon Cooper!​
Legacy Folders (Display and Audio)
Code:
$ cd ~/<ROMNAME>/hardware/qcom/
$ git clone https://github.com/Evervolv/android_hardware_qcom_display-legacy.git display-legacy
$ cd ~/<ROMNAME/hardware/qcom/
$ git clone https://github.com/Evervolv/android_hardware_qcom_audio-legacy.git audio-legacy
$ cd ~/<ROMNAME>
Plowshare
Code:
$ wget http://plowshare.googlecode.com/files/plowshare4-snapshot-git20YYMMDD.GITHASH.tar.gz
$ tar xvzf plowshare4-snapshot-git20YYMMDD.GITHASH.tar.gz
$ cd plowshare4-snapshot-git20YYMMDD.GITHASH
$ make install PREFIX=/home/$USER
See this for more information on using plowhshare: https://code.google.com/p/plowshare/wiki/Readme4 [/CODE]
Shortcuts and other codes (WIP)
#Grouping Commands
Code:
$ mkdir cm && cd cm
&& is a grouping command, it literally means "And then"
#Making Paths
Code:
$ mkdir -p kernel/lge
$ cd kernel/lge
-p flag with mkdir creates a path instead of mkdir * cd * mkdir * cd
#Moving and Copying Files
Code:
$ cd ~/home && mv file.txt ~/home/documents
This will move the "file.txt" to your documents.
$ cd ~/home && scp file.txt ~/home/documents
This will copy the "file.txt" to your documents.
#Removing files and Directories
Code:
$ rm -rf ~/home/documents
This will remove the folder "documents"
$ cd ~/home/documents && rm file.txt
This will delete the file.txt
#Downloading Files/Patches
Code:
$ wget file.link
$ wget github.com/commit.patch
$ git apply commit.patch
Add .patch to the end of the commit to make a patch, navigate to the corresponding directory where it needs to be applied, wget it, and apply the name of it.
#SpeedTest
Code:
$ git clone https://github.com/sivel/speedtest-cli.git
$ cd speedtest-cli
$ ./speedtest_cli.py
This will test download and upload speeds.
[/HIDE]
[B]Device Codenames (Should always be lowercase) (WIP)[/B]
[HIDE] [CODE]
LG Optimus 4xHD p880
Nexus 4 Mako
Nexus 5 Hammerhead
Nexus 7 WiFi Flo
Nexus 7 LTE Deb
Manufacturer Names (Should always be lowercase) (WIP)
Code:
Sony
Lge
Samsung
Asus
Htc
Well, here we are, the Key
Code:
<ROMNAME> Name of the Rom, Carbon, Cm, AOKP, AOSP, Beanstalk, DU, There's plenty to choose from!
<DEVICE_CODENAME> Find the codename for your device from it's github as it is most likely going to be used there!
<GIT_LINK> The link to the corresponding package/manifest on github, google to find the roms github and then search it's repo's
<MANAFACTURER> Well, who made your phone? Check devices github for this one too!
<CORRESPONDING_BRANCH> The branch the manifest is on github, it will most likely include this with the repo link for your convenience
If I missed something, a friendly PM will do! Don't want any confuffled users here!
Hall of Fame for users who managed to follow this confusingly long guide!
Code:
Just Me for now, to get your name put here (will be tagged) just post in thread with an [B]"Hey Fluoxetine! I completed the building with Linux Terminal Challenge, Here is my finished product (Link to product) and I didn't cheat by using the GUI! You're the best!"[/B]
Closing Statement
Well guys, I thank you for taking the time to read and follow my tutorial on building from source using only the Linux terminal, this is a great way to build some experience, maybe gain some confidence in building from source and help you get some original work under your belt! To my knowledge, I believe this is the first tutorial which is specifying on how to build using just the Linux terminal and with some extra goodies! I will keep this updated as both Linux, and android evolve in order to keep it up to date, in mainstream with xda and to just make users life that little bit easier. I think this also proves, even noobs can turn things around by studying up, I managed to learn and write all of this within 3weeks of having an android phone! (16, had an iPhone before, big mistake) Would be great to have this featured on xda *Hint Hint* Vote for it! *Hint Hint*. Wonder if this could qualify for xda university material? Haha, anyways, hope this helped!​
Fluoxetine.
Other Stuff No One Will Read
Thanks go out to Rom Dev Teams, xda for giving a place to post this, GermainZ for his devhost script, and Danny19901 for testing and proof reading basically anything and everything I shove infront of him! Haha!​
Donations
I don't like Electronic Payments, the middle man always takes his cut and it's not fair, I don't want donations, cut out the relay and the time, PM with the amount you want to Donate, and I'll send you the link to an amazon item with my details for you to buy for me and have sent straight to me! Would be much appreciated! Will probably be food, I love food :'3
Requests for Rom builds or additions to this post
PM, PM, PM, I do not care about getting messages (In fact it makes me feel loved) So do not be scared to request a Rom build, or request I add something I have missed out from this tutorial! All requests welcome, however this is not going to be a Q&A Thread with compilation issues, it is purely for the knowledge of how to compile, if you have problems with setting up/changing files/navigating, by all means post, all "Error" posts that are not specific to me will be cleaned because I probably won't know how to fix ^.^
Some Hardware Issues
Okay so some of users out there will be thinking "Hmm, is my hardware good enough to build a whole rom with, I can't even run battlefield or -otherGameHere-. The short answer to this is that you probably can, it may just take a little while longer for you, I think you need to have a 64bit machine full stop. However you also need RAM, a fair bit of it, at least 4gb if you plan to compile and nothing else. If not, you can compile on 1ghz, just will take a while and may freeze so keep checking and make the terminal as small as you can. SWAP May be your best friend for those with GUI, this doesn't apply for Remote Machine Users. You can format a partition on your HDD/SSD, or on a USB Stick (preferred) as a Linux Swap partition of 4gb+ to use as extra Rom, just format and swap-on using Gparted which should be installed on Ubuntu standard.​
GPL, Disclaimer, And Goodbye
So here we go, if you do build a Rom following this tutorial, be sure to release/add the kernel source on github to your thread in order to be compliant with the GPL, otherwise you may be in a spot of trouble, that being said I am not responsible for anything that happens to you/your machine/your phone/tab/anything really, unless this wins you the lottery or a similar payload, in which case I love you and we should get married (No Homo) haha.​
Additions, Edits, Other stuff that doesn't fit anywhere else really haha
Okay so what about the other types of cool things you can do to make this maybe a little bit easier? Well even like you guys probably are i am also still learning how to properly use git, and linux etc. so here i will be adding any of the cool things i learn. This will be great as a reference for me to look back at resources and recollect any information that may filter out of my brain, but may also be useful for you to learn at the same rate as i do! So check it out ​
Okay so today (18.02.14) i found a cool little trick using .sh files to help with the whole setting up malarcky and can make it easier if you plan to build the same rom on a weekly/nightly basis.
Okay, so what you can do whilst in the terminal is to add a file on a text basis, you can do this by running
Code:
$ pico setup.sh
This will open up the text editor on a blank document in which you can edit yourself, this is what you need, to begin with you should probably aim to write something for on screen guide/a type of ui just to let you know whats happening, this will work like a build script does, infact the same method can be applied there. Okay so whatneeds to go into it? First you want the print, this is displayed using a command known as echo.
Code:
echo 'Whatever you want to write'
This will displayed when you execute the script. So what next? Well you can choose to have it run a ui print after each action or just once at the start and then leave it to default ui to guide you. So how do you set the actions you want to do? Simply just start writing the commands!
Code:
echo 'setting up'
mkdir -p kernel/<MANUFACTURER> && git clone <KERNEL_CLONE_LINK> <CODENAME> && cd ~/<ROMNAME>/vendor && git clone <VENDOR_CLONE_LINK>
<MANUFACTURER> && cd ~/<ROMNAME> && mkdir <MANUFACTURER> && cd <MANUFACTURER> && git clone <DEVICE_CLONE_LINK> <CODENAME> && cd
~/<ROMNAME>/vendor/cm && sh get-prebuilts && cd ~/<ROMNAME> && . build/envsetup.sh && breakfast <CODENAME> && brunch <CODENAME> -j7 && cd
~/<ROMNAME>/out/target/product/<CODENAME>/
This will set up the kernel, vendor, and device and start building the rom, you may want to remove/add steps but that is how you can do it if you want to build multiple times, this can take a while to ammend for each different rom you use but it works like a dependencies file. To add UI after each one just add it after each step (short version example to follow)
Code:
echo 'setting up'
Mkdir -p kernel/<MANUFACTURER>
echo 'Cloning Kernel now'
Save this file with ctrl +w and save as a .sh file. Once this is done and in your root, working directory you can simply do:
Code:
. setup.sh
Or whichever you set it as!
NOTE
This may not always work, but it is a good way to set up quickly and efficiently, if a step goes wrong it is best to continue manually rather then re-executing the file, for those with GUI, you can just double click the sh file, this does include the prebuilts from CM, you cann a step by using the && command or create multiple scripts to run one after the other to do a separate job. This does require default branches on github to be the ones you are going to be using. The one i use as an example for carbon is as follows
Code:
echo "Setting up Kernel, Vendor, and Device ready to build Carbon Rom"
mkdir -p kernel/lge && cd kernel/lge && git clone https://github.com/P880-dev/android_kernel_lge_x3.git x3 && cd ~/carbon/vendor && git clone https://github.com/P880-dev/proprietary_vendor_lge.git lge && cd ~/carbon/device && mkdir lge && cd lge && git clone https://github.com/Fluoxetine/android_device_lge_p880.git p880 && cd ~/carbon && . build/envsetup.sh && lunch p880 && make carbon -j30 && cd out/target/product/p880/
Great job mate very useful thread
Sent from my LG-P880 using Tapatalk
Nice work mate! I'm a noob but very interested in these type of things and this looks very useful.I'll see if I can do a 'Lil something with this and let you know if it works out!kudos my man!
Sent from my HTC One using xda app-developers app
nice very good thread for our p880 maybe there will not be more q's about bugs and other stuffXD
i will try this challange later i am tired a bit of building roms by myself, because i have lot of work..
btw i didnt know there are some gui tools for building romsXD
If I may add a suggestion repo sync -f is not the best idea (at least for the first sync), as if a repo can't be downloaded, it just gets skipped, but the repo script still does on syncing, which means you may be missing some source code in case something goes wrong.
So repo sync should be better, at least for the initial sync. Also, the -j flag can speed up things extremely, on systems with a good internet connection, the default is -j4 (if you don't specify another value), but if you run this on a speedy connection, it will slow the DL extremely down.
I, for one, am running -j20 on my home connection (~1.2MB/s DL), but -j80 on a server, I have access to (dunno the exact max speed, but it's fast enough to sync CM in under 7 minutes ). -j4 would take an eternity, as it cannot use the entire bandwidth of the server
BTW, the codenames and manufacturers usually are all lowercase
laufersteppenwolf said:
If I may add a suggestion repo sync -f is not the best idea (at least for the first sync), as if a repo can't be downloaded, it just gets skipped, but the repo script still does on syncing, which means you may be missing some source code in case something goes wrong.
So repo sync should be better, at least for the initial sync. Also, the -j flag can speed up things extremely, on systems with a good internet connection, the default is -j4 (if you don't specify another value), but if you run this on a speedy connection, it will slow the DL extremely down.
I, for one, am running -j20 on my home connection (~1.2MB/s DL), but -j80 on a server, I have access to (dunno the exact max speed, but it's fast enough to sync CM in under 7 minutes ). -j4 would take an eternity, as it cannot use the entire bandwidth of the server
BTW, the codenames and manufacturers usually are all lowercase
Click to expand...
Click to collapse
Added your changes, and some suggested by @me4488 so thanks for that guys, in addition to this and to kinda bump the thread i did add another
Additions, Edits, Other stuff that doesn't fit anywhere else really haha
Click to expand...
Click to collapse
Section with a build script type creating thing in it for users to muck about with
Hope this is of a help to you all!
Damn this is a big thread
it look really great but... i would like to use the offical tree and blobs...... i got a lot of it done oke but i seems to get lost in finding the "offical" vendor in step setting up for your device.
could any body help me out? just trying to compile offical cyanogenmod just to try. and to understand how it all works.
ok i got something starting
but i get this message
You are attempting to build with an unsupported JDK. will find and try to install the right JDK
moneyvirus said:
[..]
but i get this message
You are attempting to build with an unsupported JDK. will find and try to install the right JDK
Click to expand...
Click to collapse
what's the output of?
Code:
java -version
laufersteppenwolf said:
what's the output of?
Code:
java -version
Click to expand...
Click to collapse
It seems he is using java1.7 .. He must change all things to work under 1.6 but i dont remember how XD it is explained somewhere at xda university
Sent from my LG-P880 using xda app-developers app
gerciolisz said:
It seems he is using java1.7 .. He must change all things to work under 1.6 but i dont remember how XD it is explained somewhere at xda university
Sent from my LG-P880 using xda app-developers app
Click to expand...
Click to collapse
well apperently i'm not using java 1.7.
java version "1.6.0_27"
OpenJDK Runtime Environment (IcedTea6 1.12.6) (6b27-1.12.6-1ubuntu0.12.04.4)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
this is what i got @laufersteppenwolf
moneyvirus said:
well apperently i'm not using java 1.7.
java version "1.6.0_27"
OpenJDK Runtime Environment (IcedTea6 1.12.6) (6b27-1.12.6-1ubuntu0.12.04.4)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
this is what i got @laufersteppenwolf
Click to expand...
Click to collapse
I mean there was a command which shows every detail about wchich things are using which java.. Sometimes you can have java 1.6 installed but some parts of system are using 1.7.. Ill try to find it
Edit. I remember it was in compiling cm11 thread somewhere on xda.
There was something about setting up java alternatives AS far AS i remember
Sent from my LG-P880 using xda app-developers app
Nice tutorial If i was a developer of roms o would definetely use your way, i like the old school linux throught terminal exploring
Sent from my LT22i using xda app-developers app
moneyvirus said:
well apperently i'm not using java 1.7.
java version "1.6.0_27"
OpenJDK Runtime Environment (IcedTea6 1.12.6) (6b27-1.12.6-1ubuntu0.12.04.4)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
this is what i got @laufersteppenwolf
Click to expand...
Click to collapse
Alright, then just ignore the error It's saying it'd be the wrong java version, because you're using openJDK, and not oracle, but openJDK is just as fine as oracle
gerciolisz said:
I mean there was a command which shows every detail about wchich things are using which java.. Sometimes you can have java 1.6 installed but some parts of system are using 1.7.. Ill try to find it
Edit. I remember it was in compiling cm11 thread somewhere on xda.
There was something about setting up java alternatives AS far AS i remember
Sent from my LG-P880 using xda app-developers app
Click to expand...
Click to collapse
Java 7 (1.7) is also compatible. It isn't officially supported, and you might run into problems compiling pure AOSP, but other custom ROMs should compile just fine
Thanks for the feedback i'm still having 1 question the Vendor, the unoffical tree is completly clear but i can't find it in the offical source so i mean something like
$ git clone https://github.com/P880-dev/proprietary_vendor_lge.git lge but than on the offical cyanogenmod github.
moneyvirus said:
Thanks for the feedback i'm still having 1 question the Vendor, the unoffical tree is completly clear but i can't find it in the offical source so i mean something like
$ git clone https://github.com/P880-dev/proprietary_vendor_lge.git lge but than on the offical cyanogenmod github.
Click to expand...
Click to collapse
here you go:
Code:
cd vendor
git clone [email protected]:TheMuppets/proprietary_vendor_lge.git -b cm-11.0 lge
croot
ok i found it..
source: http://forum.xda-developers.com/nexus-4/general/guide-cm11-how-to-build-cyanogenmod-11-t2515305
Verify the symlinks. Javac, Java, Javaws, Javadoc, Javah, Javap and Jar should all point to the right Java location and version:
Code:
Code:
$ ls -la /etc/alternatives/java* && ls -la /etc/alternatives/jar
If they are pointing to the wrong versions you have to change that to OpenJDK6.
Select the default Java version for your system:
Code:
Code:
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javaws
$ sudo update-alternatives --config javadoc
$ sudo update-alternatives --config javah
$ sudo update-alternatives --config javap
$ sudo update-alternatives --config jar
That's it.
Click to expand...
Click to collapse
when i had problems with compiling and got some famous errors i changed to this OpenJDK6 with this method and it solved it so if is not solution for your problem maybe its helpful for others
when i was compiling some time ago i must read few compiling threads to make it work and understand it
ok probbably this is a really stupid from my side but this is what i did.
and probbably i'm too noob for this, but i tried this:
i downloaded by example rastakat.
downloaded all the steps... without any error.
But in the last step when i type lunch and i have to choose wich version i would like to compile i can't find P880......
i have the feeling i have to edit some stuff but to be honest i don't know that yet....
will try later on.
maybe you need custom local manifest to p880-dev sources or official p880 sources..
moneyvirus said:
ok probbably this is a really stupid from my side but this is what i did.
and probbably i'm too noob for this, but i tried this:
i downloaded by example rastakat.
downloaded all the steps... without any error.
But in the last step when i type lunch and i have to choose wich version i would like to compile i can't find P880......
i have the feeling i have to edit some stuff but to be honest i don't know that yet....
will try later on.
Click to expand...
Click to collapse
You've set yourself a pretty hard task, first of all, compiling a yet unsupported ROM, but mostly a (more-less) AOSP ROM...
this means you can't use lunch, but you need to do the following:
Download the p880-dev device tree, kernel and vendor blobs
Edit the "inherit" paths inside the .mk files of the device tree
Without (except for the above mentioned) changes, you can run "lunch cm_p880-eng"
Then you can make -j<your_value> bacon

How to set up Android SDK in Linux

*If you find this Guide Thread helpful, feel free to hit the "thanks" button below!
I'm doing this guide because when I switched to arch linux ,I found no guides to setup sdk in it.Arch is a beautiful OS, but for newcomers like me ,I took some time to get used to it.So,In this guide, we’ll take a look at how to set up a development environment for Android in Arch linux(or Arch based Linux Distros) so you can start working on your Projects.Most of the Arch Linux are pro linux users so there is really no need of this guide, but this guide is meant for those who are switching from ubuntu/mint/fedora/any other disto which are not based on Arch, to say it in short its meant for new users of Arch Linux. Anyway Let's set up.
First let's set see how to install Platform tools.
Setting up platform-tools in UBUNTU(or Ubuntu based distros/Linux Mint)
In ubuntu platform tools can be setup very easily.
1.Open terminal(Default shortcut is ctrl+alt+T)
2. Type "sudo apt-get install android-tools-adb" (this will install the adb)
3. Type "sudo apt-get install android-tools-fastboot"(this will install the fastboot)
Step 4: Check whether the above tools are working by typing an adb command. For e.g. "adb devices"
Now its time to install SDK in Ubuntu and set it up but before that let me tell you there is already a great thread by matt95.You can see the guide and thank him herehttp://forum.xda-developers.com/showthread.php?t=2302780
Fedora/CentOS/RedHat
First lets install Eclipse[You can also use Android Studio if you want]
Code:
sudo yum install eclipse-jdt
Now lets download the sdk from here. http://developer.android.com/sdk/index.html. Its about 500mb , Just wait and let it downlaod. Once the download is done extract it wherever you want.
For newcomers I recommend to extract it to 'home'.So the file is now extracted inside /home/user/AndroidSDK .
Now lets setup .bash_profile file so that we can access adb anywhere or else you have to type the whole location again use the adb command which is lot of work . So let's shorten it up.
Type "sudo vim .bash_profile"in terminal.
Code:
PATH=$PATH:$HOME/AndroidSDK:$HOME/AndroidSDK/tools
export PATH
# For SDK version r_08 and higher, also add this for adb:
PATH=$PATH:$HOME/AndroidSDK/platform-tools
export PATH
Now lets install android plugin for eclipse.
Open Eclipse and click on Help.Select Install New Software. Then click Add, at the top right of that window. Type in Android Plugin for the name and https://dl-ssl.google.com/android/eclipse/ for the address.
Once this is done, click on the Available Software Sites hyperlink below the Add button, then highlight the Android Plugin source and click on Reload. Now exit this window, and choose Android Plugin from the “Work with” dropdown menu. Choose the developer tools option that you see here and Proceed with the installation.
After the installation configure your Android virtual devices.
ARCH LINUX(or Arch based Distros)
Lets install android sdk
Open terminal and type
Code:
wget https://aur.archlinux.org/packages/an/android-sdk/android-sdk.tar.gz
Note:- If terminal shows wget is not found. Type this in the terminal
Code:
pacman -Suy && pacman -S wget
Once it fetches the tarball, lets extract it by typing
Code:
tar -xvzf android-sdk.tar.gz
wait for it to finish. Change the directory to android-sdk by using the command
Code:
cd android-sdk
.
Now lets make the package by using the command
Code:
makepkg -s
now lets install it by typing
Code:
sudo pacman -U *.pkg.tar.xz
Platform tools for Arch
Let's install platform-tools now.Just like above steps ,well get a package and install it.
1. Type
Code:
wget https://aur.archlinux.org/packages/an/android-sdk-platform-tools/android-sdk-platform-tools.tar.gz
2.Type
Code:
tar -xvzf android-sdk-platform-tools.tar.gz
3.Change directory.
Code:
cd android-sdk-platform-tools
4.
Code:
makepkg -s
5.Install it
Code:
sudo pacman -U *.pkg.tar.xz
All the files are installed in /opt/android-sdk/ . Just like we had .bash_profile in FEDORA, we use symbolic links in Arch linux to use commands from anywhere .
Code:
sudo ln -s /opt/android-sdk/platform-tools/adb /usr/bin/adb //this one's for adb
sudo ln -s /opt/android-sdk/platform-tools/fastboot /usr/bin/fastboot //This one's for Fastboot
sudo ln -s /opt/android-sdk/tools/ddms /usr/bin/ddms //This is for DDMS
sudo ln -s /opt/android-sdk/tools/android /usr/bin/android //This is for Android
Now run android by typing "android" in terminal. :good:
Simple as that. If you are yet to switch to Arch linux then I recommened you to use "BBQLinux " its an Arch linux for Android developers. It comes with most of the things needed for android development. You can download it from Here.
Thanks for reading this. Help me by giving me e-books.:angel:
PM me or post here if you have any doubts. :victory:
Install an aur wrapper like pacaur .
pacaur -S android-sdk android-studio android-udev android-platform-tools
Done
Sent from my Nexus 5
Pirateghost said:
Install an aur wrapper like pacaur .
pacaur -S android-sdk android-studio android-udev android-platform-tools
Done
Sent from my Nexus 5
Click to expand...
Click to collapse
Thanks for the reply, I havent tried pacaur repository though. Will give it a try soon.:good:
sorry, I made an error:
Code:
pacaur -S android-sdk android-sdk-platform-tools android-udev android-studio android-sdk-build-tools
you dont need both platform and build tools, it looks like build-tools is more recent. if you want eclipse instead of android studio, just use 'eclipse-android' instead of android-studio

[TUTORIAL] Build CyanogenMod 11 on a VPS or Dedicated Server

Introduction
CyanogenMod 11 is a custom firmware used on android phones and tablets. But, you already know that, chances are you've used it. Building ROMs may seem scary and confusing at first because of the code and terminals, but in reality, it's not that difficult. In this thread, we're going to be discussing how to build CyanogenMod on a VPS or dedicated server. I say a server and not a desktop machine because this is going to be geared towards keeping things simple. When you have only one shell to work with, it's usually easier.
Vocabulary
A couple words you may be unfamiliar with will be described here.
- shell: where you type in the commands on your VPS/dedicated server
- VPS: Virtual Private Server, a type of server that is virtualized from physical hardware
- Dedicated Server/dedi: a dedi is a physical server, it can be an old computer, or (recommended) a server from a server host/data center like Incero or Colocrossing
- Linux: the operating system in which we will build android
- SSH: Secure SHell, the world-standard protocol used to control Linux servers
- bash: the shell we're going to use
Linux Commands
In order to control our server, we won't be using a GUI (Graphical User Interface) where you can click things to make things happen, we will be using SSH. SSH sessions are just a prompt where you type in commands. This is where people get scared but calm the f*ck down. It's not as scary as movies make it seem. Here's a rundown of some basic commands we'll be using.
- cd: change directory, change the folder we are working in, equivalent of changing folders in windows explorer
- mkdir: make directory, makes folders
- cp: copy, it copies files
- mv: move, it moves files
- rm: remove, it deletes files
- ls: list files, it's like dir for windows
- curl: downloads files from URLs
- adduser: adds users, linux has users just like windows
- apt-get: package manager, it's used to install things. In Windows, you usually install things from .exe or .msi files. In Linux, you generally use a package manager. This will be explained more later.
- nano: our text editor of choice for this tutorial. I chose nano because it's very simple and easy to use for a beginner.
Basic Intro to Linux
A few things that I'm going to discuss about Linux are directory structure as well as file structure. In Windows, we have our C: drive, which is where pretty much everything stays. In Linux, we have /, it's the same thing, except it's represented as a slash. If I wanted to edit C:\cookies\morecookies.txt in Linux, the same file path would be /cookies/morecookies.txt. A couple other things about Linux are that the file system is case sensitive, meaning I can have two files named Android and android in the same directory and they won't conflict, whereas in Windows it would. Linux also uses / (forward-slash) instead of \ (backslash) in the directory structures.
Now, our shell is interactive, meaning it's not just a box we type things into, we can use it in different ways. One of the things you should know about bash is ~ (the tilda). ~ in Linux refers to our home directory. Every user has their own home directory (by default at least). Standard users' homes are stored in /home. If my username is tanmay, my home directory would be /home/tanmay/. If I'm logged in as tanmay, ~/android refers to a file at /home/tanmay/android. If I'm logged in as bob, ~/android refers to /home/bob/android. If you don't understand all this completely, I don't expect you to, don't worry. This was just to give you a brief introduction to Linux.
Buying a VPS
I'm guessing most of you already know how to do this, so I'll put it in a spoiler for those who don't need it loading loads of images.
For this tutorial, we're going to use a DigitalOcean VPS, you can sign up here: https://www.digitalocean.com/?refcode=2050223a4edc
After you sign up for DigitalOcean, head to the billing tab and enter in credit card info or put some money in through PayPal to get yourself some credits. Once done, click the big green Create button. The hostname can be anything you want, I usually just make it "android" or "build". Now, you have a choice here, you can spend less and wait longer for builds, or spend more and wait less. I recommend one of these:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Any lower and the build will likely just fail, and any higher is just unnecessary. 16GB is plenty, and 8GB will work just fine. You can go with 4GB if you really can't afford it, but I don't recommend it.
In Select Image, choose Ubuntu 12.04.4 x64 and click Create Droplet. Wait for it to spin up, and check your email. You'll have an email like this:
We'll use these details later.
Getting into our server with SSH
In order to SSH into our server, we need a client. The most common client for Windows is PuTTY. PuTTY is free and open source, it can be downloaded here: http://the.earth.li/~sgtatham/putty/latest/x86/putty.exe (direct link). Open it and you should see this:
Under IP, type in your server's IP. If you used DigitalOcean, it should be in your email. Click Open and when it says login as:, enter "root" without quotes, and then when it asks for password, use the one supplied in the email.
If you're on Mac or Linux, you can open a terminal and type in:
Code:
ssh [email protected] # replace server.ip with the IP of your server, if you used DigitalOcean, it's in the email
Use the password supplied in the email.
Installing The Necessary Packages
Once we're in, we need to update the server's current packages to the latest ones, we can do so with the following commands.
Code:
apt-get update # update the package sources list
apt-get -y upgrade # upgrade all the current packages
Now that that's done, we can install the libraries and packages we need.
Code:
apt-get -y install git gnupg flex bison gperf \
zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
libgl1-mesa-dev g++-multilib mingw32 tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev:i386
apt-get -y install build-essential schedtool screen python-software-properties
Android relies on many libraries and compilers, so we can't build it without them.
Oracle Java is closed source, so we have to do some other things to install it.
Code:
add-apt-repository -y ppa:webupd8team/java # add third party source to the package manager's list
apt-get update # refreshes the sources list to include the one we just added
apt-get -y install oracle-java6-installer
While installing oracle-java6-installer, you will be prompted to accept the Oracle Sun Java license agreement whatever, use your arrow keys to select accept then click enter.
Adding Swap
Even with 8GB of RAM, you'll probably run out of memory, so we use swap. Swap is hard drive space that acts as if it's memory for things that aren't important to the host at the current time. We'll need this, because android takes a LOT of RAM to compile.
Code:
fallocate -l 8G /swapfile # create an empty file that's 8GB in size called /swapfile
mkswap /swapfile # format the file to be swap
swapon /swapfile # turn the swapfile on
Adding a User
Now that we have all the required packages to build, let's add a user to build under.
Code:
adduser tanmay # replace tanmay with your username of choice, must be lower case
Enter the password when it prompts for one, then do
Code:
login tanmay # replace tanmay with the username above and enter the password
You should see something like this:
Note: Disregard the system restart message, it's not necessary for our purposes.
You may have noticed that the prompt changed from "[email protected]:~#" to "[email protected]:~$". This shows we're in our new account.
Setting up repo and Downloading the CyanogenMod 11 Source
repo is the tool supplied by Google used to manage the android source code. Since it's used by AOSP, pretty much every ROM uses repo to manage their source. To install repo, we need to make a folder called bin (binary), where we'll store it. This is mainly for organization purposes. After that, we'll download repo to that folder.
Code:
mkdir ~/bin # create a folder called bin in our home directory
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo # download repo and store it in ~/bin/repo
chmod +x ~/bin/repo # mark the file as executable, so we can run it
export PATH=$PATH:~/bin # explained below
The last line may seem scary, but all it does is take the current PATH variable and add ~/bin to it. If you do
Code:
echo $PATH
you get
Code:
[email protected]:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/tanmay/bin
You can see /home/tanmay/bin at the end of it. This allows us to use the repo command anywhere in the filesystem, not only in the ~/bin directory.
Now let's make a folder for our source code.
Code:
mkdir cm-11.0 # make a folder called cm-11.0
cd cm-11 # move into the directory we just made
You should see your shell prompt change like so:
Code:
[email protected]:~/cm-11.0$
This shows us what directory we are in for reference. Now, let's initialize repo in this folder with the CyanogenMod 11 repo.
Code:
git config --global user.name "Your Name" # Necessary for repo to init
git config --global user.email [email protected] # same as above
repo init -u https://github.com/CyanogenMod/android.git -b cm-11.0
When you get prompted if you want color or not, type "y" then press enter.
Now we need to actually download the source.
Code:
repo sync
This takes... a long time. Sit back and relax. If you're using a server, it'll probably take around 10-15 minutes, if you're on a home line, expect a few hours as the source is around 8GB large.
Getting Proprietary Blobs
Since every phone has different hardware, each one requires different drivers. The Nexus 4 (or mako) has it's own, along with every other phone. We need to download these so that CyanogenMod can compile properly. We can incorporate these into our local build using the local_manifests folder.
Code:
cd ~/cm-11.0/.repo # cd into our repo folder
mkdir local_manifests # make a folder called local_manifests
nano local_manifests/roomservice.xml
On the last line, you'll see an editor (nano) open up, this is editing ~/cm-11.0/.repo/local_manifests/roomservice.xml. The name roomservice.xml is just a formality, it can be anything you want. Anyways, inside the file, paste in the following:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<manifest>
<project name="TheMuppets/proprietary_vendor_lge" remote="github" revision="cm-11.0" />
</manifest>
Once you enter that in, press CTRL + X, Y, then enter. This will save and exit the file.
Next run
Code:
cd ~/cm-11.0/ # bring us back to the parent directory of the source
repo sync # sync again to download the new project we added
Don't worry, this sync won't take hours like the last one, this shouldn't take more than a minute or two.
Getting Prebuilts and Building!
We're getting to the actual build! What we have to do now is get the prebuilt apps that CyanogenMod comes with. We can do this with the following command.
Code:
~/cm-11.0/vendor/cm/get-prebuilts
Once those download, run the following.
Code:
export USE_CCACHE=1 # ccache is compiler cache, it makes future builds MUCH faster, this is not necessary if you're only going to build once
source build/envsetup.sh # load the commands supplied by CyanogenMod used to build
lunch cm_mako-userdebug # generate the Makefile, the instructions for the compiler on how to build the ROM
ARE YOU READY?! THIS IS IT.
Code:
mka bacon # yes, bacon
Aaaaaaaaaaaaand wait. Wait a lot. This is going to take a LONG time.
Downloading the ROM
To download your ROM, download WinSCP from here: http://winscp.net/eng/download.php
Once installed (or just downloaded), open it and enter in the same credentials that you used in PuTTY except use the username and password we added ("tanmay" in my case) instead of root. Click login, and click Okay for messages that you get prompted for. Once you're in, open the cm-11.0 folder, then out/product/target/mako/. Inside that folder, you should see a zip called cm-mako-something.zip. Drag this file onto your desktop or a folder of your choice and then flash it.
CONGRATULATIONS YOU BUILT CYANOGENMOD 11 FOR THE NEXUS 4
Wasn't so bad, was it?
I hope this guide has helped you, if it has, please press the Thanks button below.
Thanks for reading!
awesome guide bt can u help me regarding mtk ........how can i add device tree and vendor manually
Nice tutorial. Just want to add that if your going with DigitalOcean you have the choice of deploying an instance that has Docker preinstalled on Ubuntu. In that case following this tutorial is much simpler and easier.
http://forum.xda-developers.com/showthread.php?t=2650345
Thanks !
[email protected] said:
awesome guide bt can u help me regarding mtk ........how can i add device tree and vendor manually
Click to expand...
Click to collapse
Hi bro @[email protected]! Check it may be useful:
https://github.com/axet/android_device_mt6592
https://github.com/axet/android_vendor_mt6592
Regards.
hyperion70.

Categories

Resources