[GUIDE] Setup Android Development Environment on Ubuntu 13.04+ - Android Studio

{
"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"
}
Hi guys and future devs here you will find a very helpful guide on how to setup the android development so that you can basically do anything you want!
I'll suggest you many useful programs that are needed in this field
In this guide I'll be using Ubuntu 13.04 but probably this will also work on 12.04-12.10 and future releases!
Ok now let's begin with the real stuff :good:
INSTALL UBUNTU
The first thing you'll need to do is obviously the ubuntu installation, unfortunately i won't cover this part of the guide cause I think that everyone who is looking at this guide knows how to install an OS on a Desktop (hope so)
Download
SETUP ANDROID DEVELOPMENT ENVIRONMENT
WHAT WE NEED
1- JDK 6(Java Development Kit) NOTE: you will need to sign in the oracle site for this version of java unfortunately )
2- GNU Make (Optional)
3- Python 2.7
4- Git 1.7
5- Android SDK
6- Some more packages
INSTALLATION
JDK
Installing the JDK is pretty tricky and stressful every time
First, download the JDK 6, which you can download here. Download the .bin file! (in this case my JDK has been downloaded in the ~/Download folder and my file is named jdk-6u45-linux-x64.bin)
Open up your terminal and type
Code:
$ sudo mkdir /usr/lib/jvm
$ cd ~/Downloads/
$ chmod +x jdk-6u45-linux-x64.bin
$ ./jdk-6u45-linux-x64.bin
$ sudo mv jdk1.6.0_45 /usr/lib/jvm/
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_45/bin/javac 1
$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_45/bin/java 1
$ sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.6.0_45/bin/jar 1
$ sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_45/bin/javaws 1
$ java -version
Ok, if you did everything fine you should now have the JDK installed correctly ​
GIT
This is the easiest one
Code:
$ sudo apt-get install git
$ y
PYTHON
Download the 2.7.5 version or newer here
Code:
$ cd ~/Downloads/
$ tar -xzvf Python-2.7.5.tgz
$ cd Python-2.7.5/
$ ./configure
$ make
$ sudo make altinstall
GNU
You don't need this step, do this just if you want the latest version of GNU Make
Download the latest version here
Code:
$ cd ~/Downloads/
$ tar -zxvf make-3.82.tar.gz
$ cd make-3.82
$ ./configure
$ make
$ sudo make install
OTHER PACKAGES
These packages are needed to run many many android commands such as ADB and FASTBOOT (only 64-bit needs this)
Code:
$ sudo apt-get install ia32-libs
$ y
This will take about 20 mins especially if you have a slow processor or internet connection so relax and have a coffee :good:
If you're using Ubuntu 14.04 this won't work because that package isn't available anymore, so you just want to do these steps here
Code:
$ sudo dpkg --add-architecture i386
$ sudo apt-get update
$ sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386
ANDROID SDK
This will be your best friend from now on
Download it here > download for other platforms > download the sdk tools only
Ok now i always create a Development folder where i put all the android development stuff (you can do whatever you think here)
Code:
$ mkdir ~/development
$ cd ~/Downloads
$ tar -zxvf android-sdk_r22.0.1-linux.tgz
$ mv ~/Downloads/android-sdk-linux ~/development/
Now you're ready to run the Android SDK ​
SETUP ADB/FASTBOOT
Open up the Android SDK by running this command
Code:
$ cd ~/development/android-sdk-linux/tools
$ ./android
At this point the SDK should come up and you will need to download at least all the tools and all the extras files, so select them and install'em.
When it finishes downloading everything you have to run this commands in another terminal
Code:
$ sudo gedit .bashrc
And you need to add at the end of it your SDK paths
Code:
#Android PATHS
export PATH=$PATH:~/development/android-sdk-linux/tools
export PATH=$PATH:~/development/android-sdk-linux/platform-tools
If you followed everything now adb and fastboot should work!
to check this you need to close all the terminals opened, reopen one and simply type
Code:
$ adb
$ fastboot
You should get a long list of possible commands if so you're done!​
FIXING NO PERMISSIONS ERROR
Probably, if you run
Code:
$ adb devices
or
$ fastboot devices
right now you'll get a strange output, something like this
Code:
???????? No permissions
In order to avoid this message we have to create a simple file
Code:
$ cd /tmp/
$ touch android.rules
$ nano android.rules
Now you have to paste this lines in that file and save it
Code:
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0e79", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0502", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0b05", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="413c", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0489", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="091e", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="24e3", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="2116", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0482", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="17ef", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="22b8", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0409", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="2080", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0955", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="2257", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="10a9", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1d4d", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0471", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04da", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="05c6", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1f53", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04dd", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fce", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0930", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="19d2", MODE="0666"
Now you have to set the right permissions to this file, just type
Code:
$ sudo cp /tmp/android.rules /etc/udev/rules.d/51-android.rules
$ sudo chmod 644 /etc/udev/rules.d/51-android.rules
$ sudo chown root. /etc/udev/rules.d/51-android.rules
$ sudo service udev restart
$ sudo killall adb
​
SUGGESTED PROGRAMS
ECLIPSE
In the Android world you don't want to miss the Eclipse IDE which is the most used! This tool will help you develop android apps
You can download it here (download the classic one)
Code:
$ cd ~/Downloads
$ tar -zxvf eclipse-SDK-4.2.2-linux-gtk-x86_64.tar.gz
$ mv ~/Downloads/eclipse ~/development/
SETUP INFO
NOTE: If you download the entire ADT bundle provided by google you will get the SDK and Eclipse IDE together ​
ANDROID STUDIO (Recommended)
This is the new development IDE made in Google, personally i love it! We are now on version 8.6 BETA and I have to say that it's a really really good looking and powerful IDE. I would recommend to use this IDE because, over time, it will be the main Android IDE (rumors say that Google will stop developing ADT bundles so Eclipse won't be supported anymore and this will force you to switch to Android Studio).
You can download it from here
It has a lot of new features that Eclipse doesn't have and it could be useful in some cases
Code:
$ cd ~/Downloads
$ tar -zxvf android-studio-bundle-130.687321-linux.tgz
$ mv ~/Downloads/android-studio ~/development/
To run it you just need to navigate to its bin folder and type
Code:
$ ./studio.sh
If you don't want to type this everytime you can just create a shortcut for it by opening Android Studio and going into Configure > Create desktop entry That's it!​

hey nice guide !
I personally am a ubuntu 13.04 user
just one suggestion , you can add in your thread alternate way of downloading the whole ADT bundle and setting it up; so that separate installation of sdk eclipse adt plugin etc is not required
Sent from my GT-S5670 using xda premium

soham jambhekar said:
hey nice guide !
I personally am a ubuntu 13.04 user
just one suggestion , you can add in your thread alternate way of downloading the whole ADT bundle and setting it up; so that separate installation of sdk eclipse adt plugin etc is not required
Sent from my GT-S5670 using xda premium
Click to expand...
Click to collapse
that's right i'll add this later!

Was looking for something like this, good work:thumbup:
Sent from my C6603 using xda app-developers app

shoey63 said:
Was looking for something like this, good work:thumbup:
Sent from my C6603 using xda app-developers app
Click to expand...
Click to collapse
glad it helped let me know if everything works correctly

matt95 said:
glad it helped let me know if everything works correctly
Click to expand...
Click to collapse
Hi matt, thanks a ton for this great tutorial. I have followed all the steps mentioned here and i think adb and fastbook has been installed on my system Running the ./adb and ./fastboot commands bring up a list of command on the terminal.
Nw i have been trying to connect my phone to flash a boot.img, after i run "./adb devices" to check if the phone is connected it shows me this :
List of devices attached
???????????? no permissions
not sure if the device is connected do u knw what is causing this error ?

Being you have a path setup (per this guide) try typing either just
adb devices
or
fastboot devices
skip the ./ and see if it will work

I have got my device now connected in fastboot mode. Thanks again for this great tutorial. I am not a rom builder but a crazy flasher I skipped a few steps from the above tutorial to get fastboot and adb working on Ubuntu 13.04.
To install JDK:
Start by removing the openJDK if it exists already
Code:
sudo apt-get purge openjdk*
To install Java 8, do this
Add the PPA:
Code:
sudo add-apt-repository ppa:webupd8team/java
Update the repo index:
Code:
sudo apt-get update
Install Java 8:
Code:
sudo apt-get install oracle-java8-installer
Install GIT from the OP tutorial
Skip Python install
Skip GNU install
Skip ia32-libs install if you are using 32bit OS
Download the Android SDK from OP and install it as mentioned there.
Setup ADB/Fastboot as mentioned in the OP
Skip Suggested programs :cyclops:
Now connect your device in fastboot mode and type in terminal fastboot to check if your device is recognised, if you get
"fastboot not installed error"
Try
Code:
sudo apt-get install android-tools-adb android-tools-fastboot
connect device in fastboot and try :
Code:
sudo fastboot devices
Done

8yt3c0d3 said:
Hi matt, thanks a ton for this great tutorial. I have followed all the steps mentioned here and i think adb and fastbook has been installed on my system Running the ./adb and ./fastboot commands bring up a list of command on the terminal.
Nw i have been trying to connect my phone to flash a boot.img, after i run "./adb devices" to check if the phone is connected it shows me this :
List of devices attached
???????????? no permissions
not sure if the device is connected do u knw what is causing this error ?
Click to expand...
Click to collapse
actually i should write more to avoid that message :/ stay tuned! tonight i'll write how to solve that... sorry for making you wait

8yt3c0d3 said:
I have got my device now connected in fastboot mode. Thanks again for this great tutorial. I am not a rom builder but a crazy flasher I skipped a few steps from the above tutorial to get fastboot and adb working on Ubuntu 13.04.
To install JDK:
Start by removing the openJDK if it exists already
Code:
sudo apt-get purge openjdk*
To install Java 8, do this
Add the PPA:
Code:
sudo add-apt-repository ppa:webupd8team/java
Update the repo index:
Code:
sudo apt-get update
Install Java 8:
Code:
sudo apt-get install oracle-java8-installer
Install GIT from the OP tutorial
Skip Python install
Skip GNU install
Skip ia32-libs install if you are using 32bit OS
Download the Android SDK from OP and install it as mentioned there.
Setup ADB/Fastboot as mentioned in the OP
Skip Suggested programs :cyclops:
Now connect your device in fastboot mode and type in terminal fastboot to check if your device is recognised, if you get
"fastboot not installed error"
Try
Code:
sudo apt-get install android-tools-adb android-tools-fastboot
connect device in fastboot and try :
Code:
sudo fastboot devices
Done
Click to expand...
Click to collapse
yeah that works too but sometimes you may have some problem with that command and probably it won't work on every distro, while the manual installation always works

8yt3c0d3 said:
Hi matt, thanks a ton for this great tutorial. I have followed all the steps mentioned here and i think adb and fastbook has been installed on my system Running the ./adb and ./fastboot commands bring up a list of command on the terminal.
Nw i have been trying to connect my phone to flash a boot.img, after i run "./adb devices" to check if the phone is connected it shows me this :
List of devices attached
???????????? no permissions
not sure if the device is connected do u knw what is causing this error ?
Click to expand...
Click to collapse
you should run adb with root user
Code:
sudo adb devices
that should do the trick

Thanks!
Just registered on xda, starting with android development, this guide helped me a lot!! I am using Ubuntu 12.04.2 LTS though.
Thanks a lot!

vaibhav_vc said:
Just registered on xda, starting with android development, this guide helped me a lot!! I am using Ubuntu 12.04.2 LTS though.
Thanks a lot!
Click to expand...
Click to collapse
glad it helped if you get any issue ask here :good:

Hello and greetings to Verona. I love your region, very nice there!
Very good guide, sir! Used this to set up my first Linux/Ubuntu/Android environment! :good:
Some points/questions i have (as a long time windows user ):
matt95 said:
OTHER PACKAGES
These packages are needed to run many many android commands such as ADB and FASTBOOT
Code:
$ sudo apt-get install ia32-libs
$ y
Click to expand...
Click to collapse
These packages are only for 64bit i think?
Code:
$ cd ~/Downloads
$ tar -zxvf eclipse-SDK-4.2.2-linux-gtk-x86_64.tar.gz
[B][COLOR="Red"]$ mv ~/Downloads/ ~/development/[/COLOR][/B]
Click to expand...
Click to collapse
Is the red line correct, cause it moves the complete download folder to development?
And the most important thing for me as windows user:
I have now all importent things for development in ~/development/ folder.
Every time i have to go with terminal to the specific folder and execute the program:
Code:
cd ~/development/kitchen
./menu
cd ~/development/eclipse
./eclipse
cd ~/development/android-studio/bin
./studio.sh
cd ~/development/android-sdk-linux/tools
./android
Is it possible to make these programs executable like adb and fastboot?
What i mean is, open terminal, write ./menu and kitchen starts, without moving to the kitchen folder (like adb).
If yes, a step-by-step guide would be very appreciated!
Or any other way to start those programs on a easy way, like linked into Cairo Dock?
Thanks in advance and keep on rockin'!

old.splatterhand said:
Hello and greetings to Verona. I love your region, very nice there!
Very good guide, sir! Used this to set up my first Linux/Ubuntu/Android environment! :good:
Some points/questions i have (as a long time windows user ):
These packages are only for 64bit i think?
Is the red line correct, cause it moves the complete download folder to development?
And the most important thing for me as windows user:
I have now all importent things for development in ~/development/ folder.
Every time i have to go with terminal to the specific folder and execute the program:
Code:
cd ~/development/kitchen
./menu
cd ~/development/eclipse
./eclipse
cd ~/development/android-studio/bin
./studio.sh
cd ~/development/android-sdk-linux/tools
./android
Is it possible to make these programs executable like adb and fastboot?
What i mean is, open terminal, write ./menu and kitchen starts, without moving to the kitchen folder (like adb).
If yes, a step-by-step guide would be very appreciated!
Or any other way to start those programs on a easy way, like linked into Cairo Dock?
Thanks in advance and keep on rockin'!
Click to expand...
Click to collapse
Yes those packages are for the x64 desktops, i should have said that! :good:
The red highlighted command was wrong, now i've corrected it! thanks for reporting that
And last thing, if you want to run that commands as adb and fastboot you only have to add those commands' directories to the .bashrc
so open up the terminal and type
Code:
$ gedit .bashrc
and then you have to write down the directories
example (the menu command is in the ~/development/kitchen directory) you should write
Code:
#Personal PATHS(you can write what you want after the #)
export PATH=$PATH:~/development/kitchen
then hit save and that's all close all the terminals that are open and now you can launch the kitchen just by typing menu (you don't have to type ./ before it).
if you need help again just ask

Excellent guide
awesome :good: very good guide thanks a lot

bliizzz said:
awesome :good: very good guide thanks a lot
Click to expand...
Click to collapse
glad to help :highfive:

matt95 said:
And last thing, if you want to run that commands as adb and fastboot you only have to add those commands' directories to the .bashrc
so open up the terminal and type
Code:
$ gedit .bashrc
and then you have to write down the directories
example (the menu command is in the ~/development/kitchen directory) you should write
Code:
#Personal PATHS(you can write what you want after the #)
export PATH=$PATH:~/development/kitchen
then hit save and that's all close all the terminals that are open and now you can launch the kitchen just by typing menu (you don't have to type ./ before it).
Click to expand...
Click to collapse
First, thank you for your super-quick reply! :good:
Yes, i thought about that, adding those lines to ".bashrc". :laugh:
I did it already yesterday, but maybe i did something wrong, cause i tried to open kitchen in terminal with ./menu and it did not work. But maybe its because of ./
The .bashrc file don't need to be "updated" after saving (like for example grub, when editing the OS that starts first on dual boot)?
Anyway, i will have a look and post the result.

old.splatterhand said:
First, thank you for your super-quick reply! :good:
Yes, i thought about that, adding those lines to ".bashrc". :laugh:
I did it already yesterday, but maybe i did something wrong, cause i tried to open kitchen in terminal with ./menu and it did not work. But maybe its because of ./
The .bashrc file don't need to be "updated" after saving (like for example grub, when editing the OS that starts first on dual boot)?
Anyway, i will have a look and post the result.
Click to expand...
Click to collapse
when you add something to the .bashrc you do not have to type the ./ before the command and yes, it doesn't need to be updated, just save it and that's it

Ok, will take a look, when i booted it again.

Related

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

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 # < $

[Tutorial] How to compile a kernel

If you see mistakes please contact me. If you think something can be shorter, easier, feel free to suggest.
I have spent a lot of time figuring this out. Not to mention making this guide.
If this guide helped you feel free to donate.
There is more to come, using different toolchains, important files, adding overclocking etc.
Coming soon
- Links to useful mods: deep idle, live oc, BLN, ...
- How to compile a custom kernel: eg air kernel
- A list of useful files and folders in the downloaded kernel source
Setting up the environment & building the kernel for the first time
Ubuntu 10.04 64-Bit (recommended)
Ubuntu 12.04 64-Bit
Note that you cannot compile AOSP ROMs with Ubuntu 12.04. Ubuntu 12.04 is fine for kernels.
If you want to use virtualization software, do not use Virtualbox. You can run into networking issues and so on. I suggest using VMWare Player instead, which is available for free on http://www.vmware.com
Installing latest updates & reboot.
$ sudo apt-get update
$ sudo apt-get dist-upgrade
$ sudo reboot
Click to expand...
Click to collapse
Now we will download and install the latest Java 6 JDK from here. Look for Java 6 SE Update 33 or a later update version. Don't download Java 7 JDK. I am downloading the file below for this guide.
Linux x64 68.69 MB jdk-6u33-linux-x64.bin
Click to expand...
Click to collapse
This guide assumes you have downloaded the file in the folder
~/Downloads
Click to expand...
Click to collapse
$ cd ~/Downloads
$ sudo chmod +x jdk-6u33-linux-x64.bin
$ ./jdk-6u33-linux-x64.bin
$ sudo mv jdk1.6.0_33 /usr/lib/jvm/jdk1.6.0_33
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_33/bin/javac 1
$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_33/bin/java 1
$ sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_33/bin/javaws 1
$ sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.6.0_33/bin/jar 1
$ sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk1.6.0_33/bin/javadoc 1
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javaws
$ sudo update-alternatives --config jar
$ sudo update-alternatives --config javadoc
$ java --version
$ ls -la /etc/alternatives/java*
Click to expand...
Click to collapse
Now reboot is optional but welcome. Let's play safe.
$ sudo reboot
Click to expand...
Click to collapse
Install all required packages to play with Android.
Ubuntu 10.04
$ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc
Click to expand...
Click to collapse
Ubuntu 12.04
$ sudo apt-get update
$ sudo apt-get install git-core gnupg flex bison gperf build-essential 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 openjdk-6-jdk tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 git
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
$ sudo reboot
Click to expand...
Click to collapse
Configure USB ports.
$ sudo gedit /etc/udev/rules.d/51-android.rules
Click to expand...
Click to collapse
This file should get the contents:
# adb protocol on passion (Nexus One)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e12", MODE="0600", OWNER="<username>"
# fastboot protocol on passion (Nexus One)
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0fff", MODE="0600", OWNER="<username>"
# adb protocol on crespo/crespo4g (Nexus S)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e22", MODE="0600", OWNER="<username>"
# fastboot protocol on crespo/crespo4g (Nexus S)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e20", MODE="0600", OWNER="<username>"
# adb protocol on stingray/wingray (Xoom)
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", ATTR{idProduct}=="70a9", MODE="0600", OWNER="<username>"
# fastboot protocol on stingray/wingray (Xoom)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="708c", MODE="0600", OWNER="<username>"
# adb protocol on maguro/toro (Galaxy Nexus)
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0600", OWNER="<username>"
# fastboot protocol on maguro/toro (Galaxy Nexus)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e30", MODE="0600", OWNER="<username>"
# adb protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d101", MODE="0600", OWNER="<username>"
# fastboot protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d022", MODE="0600", OWNER="<username>"
# usbboot protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d00f", MODE="0600", OWNER="<username>"
# usbboot protocol on panda (PandaBoard ES)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d010", MODE="0600", OWNER="<username>"
Click to expand...
Click to collapse
Don't forget to replace the red marked text with your username from Ubuntu.
When building a kernel, you only need to start from here. Pick the appropriate branch from the git manually. I used the one below as an example. What I did was visiting the git repository each time and picked the appropriate branch.
https://android.googlesource.com/device/samsung/crespo
$ mkdir ~/Documents/kernel
$ cd ~/Documents/kernel
$ git clone https://android.googlesource.com/device/samsung/crespo -b ics-plus-aosp
Click to expand...
Click to collapse
Again pick the right branch from https://android.googlesource.com/kernel/samsung.git
$ cd crespo
$ git clone https://android.googlesource.com/kernel/samsung.git -b android-samsung-3.0-ics-mr1
Click to expand...
Click to collapse
Ensure the toolchain is in your path.
Default, Easy solution
$ git clone https://android.googlesource.com/platform/prebuilt -b ics-plus-aosp
$ export PATH=$(pwd)/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin:$PATH
Click to expand...
Click to collapse
$(pwd) is a variable holding the current working directory.
Bandwidth-friendly solution
You can also download the toolchain to another directory. Bit first write down the directory you are working at.
mkdir ~/Documents/toolchain
cd ~/Documents/toolchain
$ git clone https://android.googlesource.com/platform/prebuilt -b ics-plus-aosp
export PATH=~/Documents/toolchain/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin:$PATH
Click to expand...
Click to collapse
Instead of specifying the location of the toolchain with a relative path, we must specify the absolute path here.
Now we go back to where we were working.
cd ~/Documents/kernel/crespo
Click to expand...
Click to collapse
I hope you understand why I mentioned the bandwidth-friendly solution. With little insight you could have come up with it yourself.
Now let's build the kernel
$ export ARCH=arm
$ export SUBARCH=arm
$ export CROSS_COMPILE=arm-eabi-
$ cd samsung
$ make ARCH=arm herring_defconfig (maybe ARCH=arm is unneeded here but added it to be sure)
$ make
Click to expand...
Click to collapse
[*]Now you need to put it in a flashable zip.
Possible issues, things to avoid, FAQ
- Avoid downloading the kernel sources to directories which might require root/superuser access. This is one of the reasons I downloaded all sources to '~/Documents'. This will save a lot of time messing with chmod or chown commands.
- What is 'herring', shouldn't this be crespo? No, actually not. Herring is the board name, while crespo is the codename of the Nexus S. Something you might want to remember when building kernels.
Interesting files and locations
<kernel_directory>/samsung/arch/arm/mach-s5pv210/cpu-freq.c
Overclocking
Voltages
Links to mods, source code, ...
I am making the patch files currently
Ezekeel's work https://github.com/Ezekeel/GLaDOS-nexus-s-ics
BLN
BLX
Custom Voltage
Deep Idle
Live OC
Touchwake
USB OTG
Voodoo
Samsung IDLE2 port for S5PV210 (Improved Deep Idle patch)
djjonastybe said:
$ export ARCH=arm
$ export SUBARCH=arm
$ export CROSS_COMPILE=arm-eabi-
$ cd omap
$ git checkout <commit_from_first_step> What to put here???
$ make panda_defconfig
$ make
Click to expand...
Click to collapse
You should have everything now ready to compile the aosp kernel
My method is:
$cd /path/to/kernel/source
$export ARCH=arm
$export CROSS_COMPILE=arm-eabi-
$export PATH=$PATH:~/path/to/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin
$make herring_defconfig
$make
Just change the '/path/to' to match yours You can also make it a script.
The checkout command I don't use (but I do have all of the aosp source and 'set the environment' first '. build/envsetup.sh && lunch full_crespo-userdebug'). You can clone from git and it will all be in the folder you cloned in. To pull the latest, just use 'git pull'.
Hope that helps.
How do you use linaro toolchain?
snandlal said:
How do you use linaro toolchain?
Click to expand...
Click to collapse
I haven't used it, but theoretically you could export the path to the linaro tool chain instead of Google's gcc.
I have heard (have not confirmed) that there could be issues that may be introduced by using a different tool chain.
Sent from my Nexus S using xda app-developers app
Now I need this:
$ make ARCH=arm CROSS_COMPILE=arm-eabi- -j4
scripts/kconfig/conf --silentoldconfig Kconfig
*** Error during update of the configuration.
make[2]: *** [silentoldconfig] Error 1
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target `include/config/auto.conf', needed by `include/config/kernel.release'. Stop.
Click to expand...
Click to collapse
boog said:
I haven't used it, but theoretically you could export the path to the linaro tool chain instead of Google's gcc.
I have heard (have not confirmed) that there could be issues that may be introduced by using a different tool chain.
Sent from my Nexus S using xda app-developers app
Click to expand...
Click to collapse
Cool, thanx
djjonastybe said:
Now I need this:
Click to expand...
Click to collapse
Interesting....Sounds like it is maybe missing the files. I went back and reread your original instructions and instead of
sudo git clone https://android.googlesource.com/device/samsung/crespo
Click to expand...
Click to collapse
try
git clone https://android.googlesource.com/kernel/samsung.git -b android-samsung-3.0-ics-mr1
Click to expand...
Click to collapse
Leave off the sudo, you don't need it for doing things in your own home directory, you'll end up with a bunch of files that belong to root.
boog said:
Interesting....Sounds like it is maybe missing the files. I went back and reread your original instructions and instead of
try
Leave off the sudo, you don't need it for doing things in your own home directory, you'll end up with a bunch of files that belong to root.
Click to expand...
Click to collapse
I think you are giving me wrong instructions? You mixed things up I think
I also noticed that gcc was not found because it had the wrong permissions. 'chmod 755 *' fixed it.
I am now trying again. I made a mistake.
guide complete. thank you boog for helping. I hope I can help some people with this. It took some time to sort out.
djjonastybe said:
I think you are giving me wrong instructions? You mixed things up I think
I also noticed that gcc was not found because it had the wrong permissions. 'chmod 755 *' fixed it.
I am now trying again. I made a mistake.
Click to expand...
Click to collapse
Ahh, ok, then it was probably due to checking out as sudo. Not trying to give wrong instructions. Just trying to help.
If you had to chmod them, it was possibly because the files might have belonged to root instead of your user, I didn't think of that.
I think the guide should help people get started tinkering with kernels
boog said:
Ahh, ok, then it was probably due to checking out as sudo. Not trying to give wrong instructions. Just trying to help.
If you had to chmod them, it was possibly because the files might have belonged to root instead of your user, I didn't think of that.
I think the guide should help people get started tinkering with kernels
Click to expand...
Click to collapse
I really hope this too. I have been willing to do this since October 2011, but never got to it because I always thought it would be too difficult. Now I spent 3-4 days figuring everything out, with your help.
I still have few things on my list like adding a tutorial here on how to rename the kernel, and links to specific mods like Ezekeel's mods.
I'm gonna try this . will trouble you a lot i guess . lol . this would be hard with my ****ty internet connection . ( i won't ever be able to compile AOSP , becuase of the large file size to be downloaded )
Now i'm @ the start of the guide .
apt-get update - done
Click to expand...
Click to collapse
apt-get dist-upgrade - returned some errors so ,
apt-get -f dist-upgrade - running ...
Click to expand...
Click to collapse
many thanks for the OP , to this tutorial . It's a must needed . & I think other experienced devs should also help out this thread .
Oodie said:
I'm gonna try this . will trouble you a lot i guess . lol . this would be hard with my ****ty internet connection . ( i won't ever be able to compile AOSP , becuase of the large file size to be downloaded )
Now i'm @ the start of the guide .
apt-get dist-upgrade - returned some errors so ,
many thanks for the OP , to this tutorial . It's a must needed . & I think other experienced devs should also help out this thread .
Click to expand...
Click to collapse
Being updated isn't a bad thing, but if your already on 12.04, it could be possible to just:
sudo apt-get update
sudo apt-get upgrade
Click to expand...
Click to collapse
That should have you updated to the latest updates for 12.04.
Doing a dist-upgrade can upgrade you to the next version of ubuntu (not released yet). But could on the next release.
boog said:
Being updated isn't a bad thing, but if your already on 12.04, it could be possible to just:
That should have you updated to the latest updates for 12.04.
Doing a dist-upgrade can upgrade you to the next version of ubuntu (not released yet). But could on the next release.
Click to expand...
Click to collapse
oops . will it do any harm if i dist-upgrade ?
Oodie said:
oops . will it do any harm if i dist-upgrade ?
Click to expand...
Click to collapse
http://techhamlet.com/2012/02/ubuntu-whats-the-difference-between-upgrade-and-dist-upgrade/
Google it: upgrade vs dist-upgrade
upgrade only updates the packages already installed.
I believe apt-get upgrade is equal to the update manager of ubuntu. If you use the GUI to update. Correct me if I am wrong
I believe dist-upgrade also handles the dependencies.
http://en.wikipedia.org/wiki/Advanced_Packaging_Tool
I have always preferred dist-upgrade.
Oodie if you get errors during dist-upgrade try reinstalling your ubuntu. Maybe you want to start fresh. I started a clean Virtual Box virtual machine.
dist-upgrade has never given me errors.
How old is your installation ?
djjonastybe said:
http://techhamlet.com/2012/02/ubuntu-whats-the-difference-between-upgrade-and-dist-upgrade/
Google it: upgrade vs dist-upgrade
upgrade only updates the packages already installed.
I believe apt-get upgrade is equal to the update manager of ubuntu. If you use the GUI to update. Correct me if I am wrong
I believe dist-upgrade also handles the dependencies.
http://en.wikipedia.org/wiki/Advanced_Packaging_Tool
I have always preferred dist-upgrade.
Oodie if you get errors during dist-upgrade try reinstalling your ubuntu. Maybe you want to start fresh. I started a clean Virtual Box virtual machine.
dist-upgrade has never given me errors.
How old is your installation ?
Click to expand...
Click to collapse
You are correct. For some reason I had it in my head as an update to the next release.
Sent from my Nexus S using xda app-developers app
I'm stuck on kernel source downloading ( user / kernel folder ) .
Download interrupted 3 times now
Can't we share a completed kernel folder or something?
I hate my internet connection.
°°° This comment is Sent from my Nexus S °°°
Oodie said:
I'm stuck on kernel source downloading ( user / kernel folder ) .
Download interrupted 3 times now
Can't we share a completed kernel folder or something?
I hate my internet connection.
°°° This comment is Sent from my Nexus S °°°
Click to expand...
Click to collapse
Have you tried connecting it with a ethernet cable to the modem? I have a good connection but cable seems to be always 100% safe.
sudo sysctl -w net.ipv4.tcp_window_scaling=0
Click to expand...
Click to collapse
Maybe this tweak helps you. But I suggest shutting down as much programs as you can. And other computers. And if you can connect it directly to the modem/router with a ethernet cable.
Or keep trying. In the end it should be complete.
Also try a retail installation of Ubuntu instead of using a virtual machine this has helped me here.
EDIT: Updated first post with more kernel fun.
ok . the first branch finished successfully :angel: ( finally )
( Now there is files in the kernel / crespo folder )
Now running the second branch .
$ cd crespo
$ git clone https://android.googlesource.com/kernel/samsung.git -b android-samsung-3.0-ics-mr1
Click to expand...
Click to collapse
Oodie said:
ok . the first branch finished successfully :angel: ( finally )
( Now there is files in the kernel / crespo folder )
Now running the second branch .
Click to expand...
Click to collapse
Told you
Oodie I changed something in my guide.
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javaws
Click to expand...
Click to collapse
Make sure you run these to see if you are using the right JDK. By default the OpenJDK is still used. Just discovered it.

[GUIDE] Kernel Compiling Guide For Desire C

COMPILE YOUR OWN CUSTOM KERNELS - FOR HTC DESIRE C
{
"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"
}
Hey guys .
I have been thinking of making a kernel compiling guide for some time now. So, here I present to you a newb friendly ( See how I wrote newb friendly and not noob friendly ) way of compiling kernels for Htc Desire C ( a.k.a Golfu). Before we start out , I would like to mention that , I am not ..what you would call a "Pro" in this field. But I do enjoy building them as a hobby
Pre-Requisites
However , you do need to have some minimum requirements before being able to use this guide and compile your own kernels.
1. A Unix based OS. I personally use ubuntu 11.10 (64-bit) . But this guide should work on later versions as well
2. A little experience with navigating through the linux os and a few basic terminal commands
3. You will need to install all the required packages mentioned in this guide to be able to start compiling your kernel
4. The device kernel source code which can be found over here : htc-Dev.com - Search for Desire C in kernels source . Use golfu source for GSM variant and golfc source for CDMA
Click to expand...
Click to collapse
This guide will be split into three parts :
I. The first part deals with setting up your build environment or preparing your OS to be able to compile kernels by installing the required packages.
II . We start compiling the kernel in this part. I will deal with the basic steps to be followed and packing your compiled zImage.
III . I will deal with some basic additions you can make into your kernels to make it truly "Custom"
Click to expand...
Click to collapse
Ok.. So lets start this !
STEP-I.a SETTING UP YOUR OS TO BE ABLE TO START COMPILING KERNELS
1. Install your preferred unix based OS. The commands used in this guide have been tested out on ubuntu. This should work on others aswell , but you might have to modify some of the commands.
2. Now we start installing the packages. Open up the terminal and enter the following commands :
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential 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 openjdk-6-jdk tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 git
3. You have include one more step if you are on ubuntu 12.04 . Its a good idea to reboot after this step.
Code:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
4. Now we have to install Java 6. This guide assumes that you are on a fresh ubuntu install. If you have previous versions of java installed on your OS , you might have to remove it before proceeding to this step.
Open the terminal and type :
Code:
sudo add-apt-repository ppa:webupd8team/java
Code:
sudo apt-get update
Code:
sudo apt-get install oracle-java6-installer
Code:
apt-get install oracle-java6-set-default
5. Configure your USB :
Open up the terminal and type
Code:
gksudo gedit /etc/udev/rules.d/51-android.rules
Add the contents shown below to the opened file and save it.
Code:
#Acer
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666"
#ASUS
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666"
#Dell
SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0666"
#Foxconn
SUBSYSTEM=="usb", ATTR{idVendor}=="0489", MODE="0666"
#Garmin-Asus
SUBSYSTEM=="usb", ATTR{idVendor}=="091E", MODE="0666"
#Google
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666"
#HTC
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666"
#Huawei
SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0666"
#K-Touch
SUBSYSTEM=="usb", ATTR{idVendor}=="24e3", MODE="0666"
#KT Tech
SUBSYSTEM=="usb", ATTR{idVendor}=="2116", MODE="0666"
#Kyocera
SUBSYSTEM=="usb", ATTR{idVendor}=="0482", MODE="0666"
#Lenevo
SUBSYSTEM=="usb", ATTR{idVendor}=="17EF", MODE="0666"
#LG
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666"
#Motorola
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666"
#NEC
SUBSYSTEM=="usb", ATTR{idVendor}=="0409", MODE="0666"
#Nook
SUBSYSTEM=="usb", ATTR{idVendor}=="2080", MODE="0666"
#Nvidia
SUBSYSTEM=="usb", ATTR{idVendor}=="0955", MODE="0666"
#OTGV
SUBSYSTEM=="usb", ATTR{idVendor}=="2257", MODE="0666"
#Pantech
SUBSYSTEM=="usb", ATTR{idVendor}=="10A9", MODE="0666"
#Philips
SUBSYSTEM=="usb", ATTR{idVendor}=="0471", MODE="0666"
#PMC-Sierra
SUBSYSTEM=="usb", ATTR{idVendor}=="04da", MODE="0666"
#Qualcomm
SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666"
#SK Telesys
SUBSYSTEM=="usb", ATTR{idVendor}=="1f53", MODE="0666"
#Samsung
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666"
#Sharp
SUBSYSTEM=="usb", ATTR{idVendor}=="04dd", MODE="0666"
#Sony Ericsson
SUBSYSTEM=="usb", ATTR{idVendor}=="0fce", MODE="0666"
#Toshiba
SUBSYSTEM=="usb", ATTR{idVendor}=="0930", MODE="0666"
#ZTE
SUBSYSTEM=="usb", ATTR{idVendor}=="19D2", MODE="0666"
Click to expand...
Click to collapse
STEP-1.b GETTING THE DEVICE KERNEL SOURCE CODE AND TOOLCHAIN FOR COMPILING
1.Open Up the terminal. Enter the following :
Code:
mkdir golfu
cd golfu
mkdir kernel
2.Download the required kernel source from htc-Dev.com - Search for Desire C in kernel sources and extract them to the newly made kernel folder.
3. Open the terminal again and type :
Code:
cd golfu
mkdir toolchain
git clone git://github.com/sakindia123/Android_Toolchains.git
4. You may also need these tools inorder to repack the zImage with ramdisk or you can also using android kitchen to serve this purpose.
Open the terminal and type
Code:
cd golfu
mkdir tools
git clone git://github.com/sakindia123/Boot-Image-tools.git
So , now you have success full setup you OS to start compiling your own custom kernels
Click to expand...
Click to collapse
STEP 2 START COMPILING THE KERNEL
Click to expand...
Click to collapse
Now that we have setup the build environment , we can start compiling our custom kernel.
STEP 2.a
1. The first step is to get a working config file from your device. So connect your device with adb debugging enabled , change to your root kernel directory and type the following
Code:
adb pull /proc/config.gz
Code:
gunzip config.gz
^^ This step extracts the kernel config from the compressed file ie config.gz
Code:
mv config arch/arm/configs/golfu_defconfig
2. Now open up the terminal in the root of your kernel source directory and type
Code:
export ARCH=arm
Code:
export CROSS_COMPILE=~/golfu/toolchains/arm-eabi-4.4.3/bin/arm-eabi-
=> Specfies the toolchain you want to use for compiling . Here I have used arm-eabi-4.4.3.
3. Since we havent yet determined a way to make the wifi module along with the kernel , you have to use this workaround :
Navigate to arch/arm/configs folder and open up golfu_defconfig with a text editor and you have to add this
Code:
CONFIG_LOCALVERSION="$(KERNEL_LOCAL_VERSION)-g51cada9"
You can also disable the version check as described by cute_prince in CM9 thread.
After this you can proceed to the next step :
Code:
make golfu_defconfig
4. If you wish to do some modifications to your current config , you can type
Code:
make menuconfig
This will bring a graphical user interface from which you can add / remove features from your kenrel.
5. After this you can proceed to compiling
Code:
make -jX
=>Where X specifies the number of processor cores you want to use for compiling.
6. The kernel should compile and if there where no errors in compiling , you will get a finished zImage in /arch/arm/boot folder.
Click to expand...
Click to collapse
STEP 2.b
Now that you have obtained your compiled zImage , we can proceed to packing it with the ramdisk.
1. Take a stock boot.img from any sense4 based rom for the device. Place it in the /golfu/tools folder , open terminal and type :
Code:
unpackbootimg -i boot.img
Now you will obtain the stock zImage and boot.img-ramdisk.gz.
2. Now take the zImage you got from compiling and place it in the golfu/tools folder and type the following in terminal :
Code:
mkbootimg --kernel zImage --ramdisk boot.img-ramdisk.gz --cmdline no_console_suspend=1-console=null --base 13000000 --output boot.img
3. After this you will have obtained your compiled boot.img. Flash it on your device and enjoy your own custom kernel
Click to expand...
Click to collapse
Reserved for credits and some additions you can make to your kernel . Will add the later..
Thank you, man!
We need moar devs, this might get us some ;-P
Sent from my HTC Desire C
Phenziox said:
Thank you, man!
We need moar devs, this might get us some ;-P
Sent from my HTC Desire C
Click to expand...
Click to collapse
Np mate
Hope you guys find it useful.
Thanks Nikhil, great New stuff has came while I was gone. :thumbup:
There will be a kernel from me, once I have time great guide Nikhil, is there a revo kernel on the horizon?
Hmmm
Sent from my HTC Desire C using xda premium
i am having some problem....
First I need to install java first before downloading my packages
Secondly and the main one
-> When I install Ubuntu(which has no packages installed) it works totally fine .I shut it down switch it on. It is fine.
->when I install packages as long as I work it works fine but as soon as I shut it down/restart it won't boot .
->A purple screen would apperar and will turn black screen appears ....at times automatically reading something like big box or at time when I press many buttons..and reads the representation of up down and right left buttons in terminial when and apt-get is there ...like ]A...}D
->If I don't press any button and then press any buton the screen goes to sleep .
->Then I press the power on button on my cpu.
->the system will turn on from sleep go purple and dots will appear .3 dots turn red and my cpu gets off.
Please need help
Okay please can you explain to me what you mean by "CPU"?
I have a CPU, but it doesn't appear to have a power switch, so to help you with your issue can you please clarify?
russell664 said:
Okay please can you explain to me what you mean by "CPU"?
I have a CPU, but it doesn't appear to have a power switch, so to help you with your issue can you please clarify?
Click to expand...
Click to collapse
Probably means power button
Sent from my HTC Desire C using xda premium
Shad0wPanda said:
Probably means power button
Sent from my HTC Desire C using xda premium
Click to expand...
Click to collapse
yes the power button which we press to switch the cpu on.
Thanks for ur concern :angel:
one thing to add.
Guys when i download the intial pakacges it says
Code:
The following packages have unmet dependencies:
libgl1-mesa-glx:i386 : Depends: libglapi-mesa:i386 (= 8.0.4-0ubuntu0.6)
Recommends: libgl1-mesa-dri:i386 (>= 7.2)
so i install dri one for(>=7.2)
is it creating the problem
when give the command make -jX
for Zimage get this
Code:
[email protected]:~/golfu/kernel/stock-golfu-kenrel-master$ make -jX
make: the `-j' option requires a positive integral argument
Usage: make [options] [target] ...
Options:
-b, -m Ignored for compatibility.
-B, --always-make Unconditionally make all targets.
-C DIRECTORY, --directory=DIRECTORY
Change to DIRECTORY before doing anything.
-d Print lots of debugging information.
--debug[=FLAGS] Print various types of debugging information.
-e, --environment-overrides
Environment variables override makefiles.
-f FILE, --file=FILE, --makefile=FILE
Read FILE as a makefile.
-h, --help Print this message and exit.
-i, --ignore-errors Ignore errors from commands.
-I DIRECTORY, --include-dir=DIRECTORY
Search DIRECTORY for included makefiles.
-j [N], --jobs[=N] Allow N jobs at once; infinite jobs with no arg.
-k, --keep-going Keep going when some targets can't be made.
-l [N], --load-average[=N], --max-load[=N]
Don't start multiple jobs unless load is below N.
-L, --check-symlink-times Use the latest mtime between symlinks and target.
-n, --just-print, --dry-run, --recon
Don't actually run any commands; just print them.
-o FILE, --old-file=FILE, --assume-old=FILE
Consider FILE to be very old and don't remake it.
-p, --print-data-base Print make's internal database.
-q, --question Run no commands; exit status says if up to date.
-r, --no-builtin-rules Disable the built-in implicit rules.
-R, --no-builtin-variables Disable the built-in variable settings.
-s, --silent, --quiet Don't echo commands.
-S, --no-keep-going, --stop
Turns off -k.
-t, --touch Touch targets instead of remaking them.
-v, --version Print the version number of make and exit.
-w, --print-directory Print the current directory.
--no-print-directory Turn off -w, even if it was turned on implicitly.
-W FILE, --what-if=FILE, --new-file=FILE, --assume-new=FILE
Consider FILE to be infinitely new.
--warn-undefined-variables Warn when an undefined variable is referenced.
This program built for i686-pc-linux-gnu
Report bugs to <[email protected]>
[email protected]:~/golfu/kernel/stock-golfu-kenrel-master$ make -jX
make: the `-j' option requires a positive integral argument
Usage: make [options] [target] ...
Options:
-b, -m Ignored for compatibility.
-B, --always-make Unconditionally make all targets.
-C DIRECTORY, --directory=DIRECTORY
Change to DIRECTORY before doing anything.
-d Print lots of debugging information.
--debug[=FLAGS] Print various types of debugging information.
-e, --environment-overrides
Environment variables override makefiles.
-f FILE, --file=FILE, --makefile=FILE
Read FILE as a makefile.
-h, --help Print this message and exit.
-i, --ignore-errors Ignore errors from commands.
-I DIRECTORY, --include-dir=DIRECTORY
Search DIRECTORY for included makefiles.
-j [N], --jobs[=N] Allow N jobs at once; infinite jobs with no arg.
-k, --keep-going Keep going when some targets can't be made.
-l [N], --load-average[=N], --max-load[=N]
Don't start multiple jobs unless load is below N.
-L, --check-symlink-times Use the latest mtime between symlinks and target.
-n, --just-print, --dry-run, --recon
Don't actually run any commands; just print them.
-o FILE, --old-file=FILE, --assume-old=FILE
Consider FILE to be very old and don't remake it.
-p, --print-data-base Print make's internal database.
-q, --question Run no commands; exit status says if up to date.
-r, --no-builtin-rules Disable the built-in implicit rules.
-R, --no-builtin-variables Disable the built-in variable settings.
-s, --silent, --quiet Don't echo commands.
-S, --no-keep-going, --stop
Turns off -k.
-t, --touch Touch targets instead of remaking them.
-v, --version Print the version number of make and exit.
-w, --print-directory Print the current directory.
--no-print-directory Turn off -w, even if it was turned on implicitly.
-W FILE, --what-if=FILE, --new-file=FILE, --assume-new=FILE
Consider FILE to be infinitely new.
--warn-undefined-variables Warn when an undefined variable is referenced.
This program built for i686-pc-linux-gnu
Report bugs to <[email protected]>
and if i type make-j1 or make j2
get the folowing
Code:
[email protected]:~/golfu/kernel/stock-golfu-kenrel-master$ make -j1
scripts/kconfig/conf --silentoldconfig Kconfig
include/config/auto.conf: line 498: KERNEL_LOCAL_VERSION: command not found
CHK include/linux/version.h
CHK include/generated/utsrelease.h
UPD include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
CC kernel/bounds.s
arm-eabi-gcc: No such file or directory
Is your PATH set correctly?
make[1]: *** [kernel/bounds.s] Error 2
make: *** [prepare0] Error 2
[email protected]:~/golfu/kernel/stock-golfu-kenrel-master$ make -j2
include/config/auto.conf: line 498: KERNEL_LOCAL_VERSION: command not found
CHK include/linux/version.h
/home/aman/golfu/kernel/stock-golfu-kenrel-master/scripts/gcc-version.sh: line 25: arm-eabi-gcc: command not found
/home/aman/golfu/kernel/stock-golfu-kenrel-master/scripts/gcc-version.sh: line 26: arm-eabi-gcc: command not found
/home/aman/golfu/kernel/stock-golfu-kenrel-master/scripts/gcc-version.sh: line 25: arm-eabi-gcc: command not found
/home/aman/golfu/kernel/stock-golfu-kenrel-master/scripts/gcc-version.sh: line 26: arm-eabi-gcc: command not found
CHK include/generated/utsrelease.h
CC scripts/mod/empty.o
arm-eabi-gcc: No such file or directory
Is your PATH set correctly?
make[2]: *** [scripts/mod/empty.o] Error 2
make[1]: *** [scripts/mod] Error 2
make: *** [scripts] Error 2
make: *** Waiting for unfinished jobs....
[email protected]:~/golfu/kernel/stock-golfu-kenrel-master$
Looks like you missed or mistyped a command from the instructions...
export CROSS_COMPILE=~/golfu/toolchains/arm-eabi-4.4.3/bin/arm-eabi-
You need to make sure the compiler you a using has that exact path to the gcc binary, or edit the path accordingly.
soupmagnet said:
Looks like you missed or mistyped a command from the instructions...
export CROSS_COMPILE=~/golfu/toolchains/arm-eabi-4.4.3/bin/arm-eabi-
You need to make sure the compiler you a using has that exact path to the gcc binary, or edit the path accordingly.
Click to expand...
Click to collapse
still geting same error
aman23091998 said:
still geting same error
Click to expand...
Click to collapse
What do you get when enter the following command?
Code:
ls ~/golfu/toolchains/arm-eabi-4.4.3/bin/arm-eabi-gc*
one thing to say
->let the name of the downloaded zip be stock-kernel.
->Root kernel directory will be /golfu/kernel or /golfu/kernel/stock-kernel
->if the second one /golfu/kernel/stock-kernel .Y=then what is the root kernel-source directory
aman23091998 said:
one thing to say
->let the name of the downloaded zip be stock-kernel.
->Root kernel directory will be /golfu/kernel or /golfu/kernel/stock-kernel
->if the second one /golfu/kernel/stock-kernel .Y=then what is the root kernel-source directory
Click to expand...
Click to collapse
I'm not sure if I understand what you're asking (or even if that's a question at all), but let me explain my experience with it and hopefully shed some light on the subject...
There are some slight inconsistencies with the instructions posted, likely due to naming conventions being changed after the tutorial was written. When you download the source code, it should come in a package that is similarly named 'golfu-ics-3.0.16-3d39477.zip'. Within that, is another package of the same name, but with a 'tar.gz' file extension. When you right-click on that file and select "Extract Here", the resulting folder simply needs to be renamed to "kernel", rather than creating another separate kernel directory in the Terminal.
The other problem is, when you 'git clone' the tools and toolchains directories, they will be named "Android_Toolchains" and "Boot-Image-Tools", which is inconsistent with the instructions to make directories named "toolchain" and "tools".
So...if you were to follow the instructions in step-1.b explicitly, you would probably end up with a directory structure similar to this:
Code:
golfu
Android_Toolchains
arm-2009q3
arm-2010.09
arm-2011.03
...
...
...
Boot-Image-Tools
tools
from565
mkbootfs
mkbootfs-cfroot
...
...
...
README
kernel
golfu-ics-3.0.16-3d39477
arch
block
crypto
...
...
...
toolchain
tools
Instead, for step-2.a to work as it is written, the directory structure should be more like this:
Code:
golfu
kernel
arch
block
crypto
...
...
...
toolchains
arm-2009q3
arm-2010.09
arm-2011.03
...
...
...
tools
from565
mkbootfs
mkbootfs-cfroot
...
...
...
Ensuring this, will prevent the types of errors you were receiving before.
I'm not sure if this answers your question, but it should hopefully help someone in a similar situation.
aman23091998 said:
one thing to say
->let the name of the downloaded zip be stock-kernel.
->Root kernel directory will be /golfu/kernel or /golfu/kernel/stock-kernel
->if the second one /golfu/kernel/stock-kernel .Y=then what is the root kernel-source directory
Click to expand...
Click to collapse
Ok here is an example. You download Stock-golfu.zip<=(Example).
You unrar it in ~/golfu/kernel.
Now the tree is ~/golfu/kernel/Stock-golfu.
The Root directory of the kernel source code is ~/golfu/kernel/Stock-golfu/
Inside the Root directory you should have folders such as arch, block, scripts etc.
I hope that clears it up for you.
me4488 said:
Ok here is an example. You download Stock-golfu.zip<=(Example).
You unrar it in ~/golfu/kernel.
Now the tree is ~/golfu/kernel/Stock-golfu.
The Root directory of the kernel source code is ~/golfu/kernel/Stock-golfu/
Inside the Root directory you should have folders such as arch, block, scripts etc.
I hope that clears it up for you.
Click to expand...
Click to collapse
Question:
How necessary is it to have the "Stock-golfx" directory located inside the kernel directory (as with your example), as opposed to just having the arch, block, etc. folders directly in the ~/golfx/kernel/ directory? Both examples compile in the same manner (as far as I can tell), that is, assuming you are in the correct directory when executing "make".
Is it out of necessity that you did it this way, or is it just personal preference?
Running Ubuntu 12.04 and screen went black after reboot (after second set set of commands) has been like that for ~ten minutes now, anyone got any ideas how I can get it to boot as usual again?
Thanks in advance
--FIXED--
(ran "sudo apt-get install ubuntu-desktop" after I managed to boot terminal)

[Guide][7/5/13]Learn Linux Terminal/Setup A Build Environment/HTC Kernel Building

To start I will be adding a lot to this over time so dont be upset if I dont have everything.
To open a terminal without finding it in your programs all you need to do is ctrl+alt+t
Heavily used Commands
cd: this command is used to navigate through your directory's. For example if you have a folder named apps on desktop you would type... cd Desktop...then cd apps.
mkdir: this means make directory or folder. For example cd to your directory then do mkdir whatever. Then you can cd right into that directory ever.
pwd: print working directory. This shows you where you are on the filesystem. This helps if your deep in a directory or folders.
ls: this means list. This tells you all the files in your present working directory.
man: this means manual. This prints like a help page in the terminal to guide you on whatever you need. This can be used for many things.
cp: means copy a file or directory
rm and rmdir: remove a file or like rmdir remove a directory.
mv: move a file or directory
The next command is to issue a command. There are a couple of popular ways of doing so.
First
"./": this is to issue or run a command or file that is in your current directory.
Second
"../": this runs the file that is directly above your current directory.
cat: prints a list of provided text files to the screen.
grep or global regular expression print: searches for patterns or a pattern in a list of files. This is great for small editing if thats what your into and so is.....
diff: compares two text files and displays the differences found between the files on the screen.
history: this is very useful. This shows you a list of your recent commands if you forgot the exact command. To select a command on the list use "!". For example if the label for the command is 00 then type "!00". However most linus OS's allow you to use the up arrow and enter key instead.
Also if you guys dont want a full help list using the "man" command you can use this command: --help
Popular Terminal Commands for Android:
adb: also called android debug bridge is used to issue commands to your phone and debug.
Most people use the following:
adb devices: shows what devices are connected to the computer
adb push and pull: can transfer file from computer to phone and vice versa.
if you want to push an apk to your system make sure that apk is in your adb folder and type: "adb push target.apk system/apps"
adb reboot
adb reboot bootloader
adb logcat: if you are either porting, making roms, or just debugging for a dev you need to know how to logcat. Also if you want to just take the log and make it into a txt file to share just issue the following; "adb logcat -d> logcat.txt"
The logcat will go to your adb folder and save as logcat.txt.
fastboot: is a tool used to update the flash filesystem
I use fastboot for a few things including flashing splashes and flashing recoveries. For example:
Take twrp. To flash to htc one you do...
"fastboot flash recovery twrp.img" presuming you are in your fastboot directory in terminal and the recovery.img is in that folder.
Now as you may know htc uses fastboot to unlock and lock the bootloader using the following commands:
"fastboot oem unlock"
"fastboot oem lock"
Of course you should know this by now you need to be in bootloader under fastboot usb mode.
Now to be able to use fastboot and adb u need sdk and java. Lets start.
"sudo apt-get install openjdk-6-jre openjdk-6-jdk icedtea6-plugin"
This will get u java jdk. Sudo means root and apt-get install means terminal is pulling the file from servers and then installing it.
Next you want sdk. So instead of going all around and downloading it just do this.
" wget http://dl.google.com/android/android-sdk_r20-linux.tgz"
Wget means you are "getting the package".And then you want to extract the file.
"tar -xvzf android-sdk_r20-linux.tgz"
Seeing how the file is a tar "tar -xvzf" extracts that tar. Then cd to the sdk folder and you are good to go.
Speaking of compressing and uncompressing files......
tar -zxvf filename.tar.gz
Untar a tarred and compressed tarball (*.tar.gz or *.tgz).
tar -xvf filename.tar
Untar a tarred but uncompressed tarball (*.tar).
gunzip filename.gz
Decompress a zipped file (*.gz" or *.z).
bunzip2 filename.bz2
Decompress a file (*.bz2) zipped with bzip2 compression.
unzip filename.zip
Decompress a file (*.zip).
Next. Processes.
You know hiw windows has task manager with ctrl+alt+delete. Well here is that for terminal.
ps
(=print status) Display the list of currently running processes with their process IDs (PID) numbers.
kill PID
Force a process shutdown. First determine the PID. Use the command "ps".
bg PID
Send the process to the background.The same can be accomplished with z.
any_command&
Run any command in the background the symbol "&" means run the proceeding command in the background.
killall program_name
Kill program or multiple programs by name. This is useful
lpq
Shows your printing queue.
lprm job_number
Remove a printing job "job_number" from the queue. Alot like windows printing task manager.
lpc
Check and control the printer(s). Type "?" to see the list of available commands.
renice -1 PID
(as root) Change the priority of a running process to -1. Make sure you are Root.
*
Ill add more later. My fingers are tired.
Here are some useful admin commands
printtool
Configuration tool for your printer(s).
linuxconfig
(as root, either in text or graphical mode). You can access and change hundreds of setting from it. Be careful.
adduser user_name
Create a new account (you must be root).
userdel user_name
Remove an account (you must be a root).
passwd
Change the password on your current account. If you are root, you can change the password for any user using: "passwd user_name"
chmod perm filename
Change the file access permission for the files you own. You can make a file accessible in three modes: read (r), write (w), or execute (x) to three classes of users: owner (u), group (g), or others (o).
ls -l filename
Checks the files current permissions.
If the file is accessible to all users in all modes it will show:
rwxrwxrwx
The first triplet shows the file permission for the owner of the file, the second for that group, the third for others. A no permission is shown as "-".
su
You will be asked for your password. Type "exit" to return you to your previous login. Don't work on your machine as root. Use it only when you need it.
fdisk
(as root) Linux hard drive partitioning utility. The program gparted I think is better. To install gparted just like many other programs us the command "sudo apt-get install gparted".
fsck -t ext2 /dev/hda2
Check and repair a filesystem.
Sent from my HTCONE using xda premium
Build Environment
Instructions For Setting up a Build Environment for Linux
Make sure you are 64-bit
Have a big hard drive
A good amount of ram
If you dont have java already. Get it.
sudo apt-get install openjdk-6-jdk
You will also need python
sudo apt-get install python
And git
sudo apt-get install git-core
Android SDK:
I showed you guys how to get it in the first post.
Now open your home folder and press Ctrl+H to show hidden files, and open up a file called .bashrc.
Add these lines to the bottom of .bashrc:
# Android tools
export PATH=${PATH}:~/SDK/tools
export PATH=${PATH}:~/SDK/platform-tools
export PATH=${PATH}:~/bin
Now you should also find .profile file in the same place you found .bashrc file. Add this to that file:
PATH="$HOME/SDK/tools:$HOME/SDK/platform-tools:$PATH"
After that you need to install these packages:
sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \
x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev \
libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \
libxml2-utils xsltproc
On Ubuntu 12.04:
sudo apt-get install git gnupg flex bison gperf build-essential \
zip curl libc6-dev libncurses5-dev x11proto-core-dev \
libx11-dev libreadline6-dev libgl1-mesa-glx \
libgl1-mesa-dev g++-multilib mingw32 tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev
Also this:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Now Configure your USB.
Type :
gksudo gedit /etc/udev/rules.d/51-android.rules
A blank text will open and now add this code and save:
#Acer
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666"
#ASUS
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666"
#Dell
SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0666"
#Foxconn
SUBSYSTEM=="usb", ATTR{idVendor}=="0489", MODE="0666"
#Garmin-Asus
SUBSYSTEM=="usb", ATTR{idVendor}=="091E", MODE="0666"
#Google
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666"
#HTC
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666"
#Huawei
SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0666"
#K-Touch
SUBSYSTEM=="usb", ATTR{idVendor}=="24e3", MODE="0666"
#KT Tech
SUBSYSTEM=="usb", ATTR{idVendor}=="2116", MODE="0666"
#Kyocera
SUBSYSTEM=="usb", ATTR{idVendor}=="0482", MODE="0666"
#Lenevo
SUBSYSTEM=="usb", ATTR{idVendor}=="17EF", MODE="0666"
#LG
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666"
#Motorola
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666"
#NEC
SUBSYSTEM=="usb", ATTR{idVendor}=="0409", MODE="0666"
#Nook
SUBSYSTEM=="usb", ATTR{idVendor}=="2080", MODE="0666"
#Nvidia
SUBSYSTEM=="usb", ATTR{idVendor}=="0955", MODE="0666"
#OTGV
SUBSYSTEM=="usb", ATTR{idVendor}=="2257", MODE="0666"
#Pantech
SUBSYSTEM=="usb", ATTR{idVendor}=="10A9", MODE="0666"
#Philips
SUBSYSTEM=="usb", ATTR{idVendor}=="0471", MODE="0666"
#PMC-Sierra
SUBSYSTEM=="usb", ATTR{idVendor}=="04da", MODE="0666"
#Qualcomm
SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666"
#SK Telesys
SUBSYSTEM=="usb", ATTR{idVendor}=="1f53", MODE="0666"
#Samsung
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666"
#Sharp
SUBSYSTEM=="usb", ATTR{idVendor}=="04dd", MODE="0666"
#Sony Ericsson
SUBSYSTEM=="usb", ATTR{idVendor}=="0fce", MODE="0666"
#Toshiba
SUBSYSTEM=="usb", ATTR{idVendor}=="0930", MODE="0666"
#ZTE
SUBSYSTEM=="usb", ATTR{idVendor}=="19D2", MODE="0666"
Once you have saved the file type this:
sudo chmod a+r /etc/udev/rules.d/51-android.rules
Now install your repository:
Type the following:
mkdir ~/bin
PATH=~/bin:$PATH
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo
Now all you have to do is initialize your repository and then make a working folder and sync:
mkdir WORKING_FOLDER
cd WORKING_FOLDER
So lets just say you want to sync and build cm10.1 you need the repo so once you cd into the directory type this:
repo init -u git://github.com/CyanogenMod/android.git -b cm-10.1
While that runs in the terminal it is going to ask you to put in your name and email address.
Once all thats done just type:
repo sync
And your good to go. Thats where I stop for now. Any questions just ask.
Sent from my HTCONE using xda premium
How to build a sense kernel from source
Judging that you are reading this and going to try and build a kernel make sure you have looked at the previous posts above as they may be needed to complete this task.
This is the readme from htc dev's website. But why do all this work. Lets use Linux and bash scripts to our advantage.
defconfig file: m7wls_defconfig (arm-eabi-4.6)
Download:
=========
If you are not already using an AOSP toolchain (included in an AOSP build tree), download the corresponding official android toolchain for the arm-eabi specified above for this device:
git clone https://android.googlesource.com/platform/prebuilt for 4.4.3
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6 for 4.6
(use darwin-x86 in place of linux-x86 for mac)
Build the kernel:
=================
set the following environment variables:
export TOP= [where you installed the toolchain or top of android AOSP code base]
export PATH=$TOP/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin:$PATH (use corresponding arm-eabi bin path)
export ARCH=arm
export SUBARCH=arm
export CROSS_COMPILE=arm-eabi-
make [the defconfig file for this device above]
make clean (for subsequent builds)
make -j4 (in this example 4 is the number of processors of your build machine)
Output Binary Files:
====================
After the build process is finished, there should be a file named "zImage" found in arch/arm/boot/
If you are building a rom with this kernel ZImage, copy it into your build's output folder and rename it to "kernel".
You will also need the following kernel modules. These will eventually be installed into /system/lib/modules on the device.
kernel modules:
./driver/*.ko
Click to expand...
Click to collapse
The only thing I will ask you to get are the following.
-Download the source from htcdev.
-Get your toolchain and put it in your desired folder. Do that with this command.
"git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6"
-for me I put the toolchain in my directory like this. It is different for each toolchain and device. It doesn't matter. /android/kernel/**toolchain**. That's where the extracted toolchain is.
-Next step open a file and add the following text. Make sure the file is executable so you can run it. Add this....
echo "~m7wls STOCK KERNEL COMPILER~"
cd Kernel-m7wls
export ARCH=arm CROSS_COMPILE=/android/kernel/toolchain/arm-eabi-4.6/bin/arm-eabi-4.6-
echo "Cleaning up source"
make clean && make mrproper
date +%Y%m%d%H%M > CURRENT_VERSION
echo "Making config"
make m7wls_defconfig
echo "Adding Current Version to Kernel"
cp CURRENT_VERSION .version
echo "Building Kernel"
make -j4
echo "Kernel ready"
cp -f arch/arm/boot/zImage /android/kernel/htcone/STOCK-m7wls/zImage
echo "Copying modules"
rm -f /android/kernel/htcone/STOCK-m7wls/boot.img-ramdisk/lib/modules/*
find . -name "*.ko" -exec cp {} /android/kernel/htcone/STOCK-m7wls/boot.img-ramdisk/lib/modules/ \;
cd /android/kernel/htcone/STOCK-m7wls/boot.img-ramdisk/lib/modules/
for i in $(find . | grep .ko | grep './')
do
echo $i
/android/kernel/toolchain/arm-eabi-4.6/bin/arm-eabi-4.6-strip --strip-unneeded $i
done
echo "Stripped Modules"
echo "All done,Press Enter to Quit"
read ANS
Click to expand...
Click to collapse
-This is a quick script that does all the work for me. No need to add paths, etc. As long as your folders and filed match the paths of the script all will be ok. Now this script will have to be edited to suite your computer and the destinations of your kernel folders.
-Now once the script is fully correct and everything is setup just cd to the directory your script is in and type the following assuming your file name is m7wls type:
./m7wls
Once the script has fully run. It should take a while in the folders I made you should see zImage and kernel modules. From there you will need to know how to pack the kernel.
Notice if you downloaded sprints htc one kernel source the source is named m7wls-jb-crc-3.4.10-eb45596. I changed this to just m7wls to make it easier for the script.
Finally, remember you will have to make directories to suit the script for example this line "rm -f /android/kernel/htcone/STOCK-m7wls/boot.img-ramdisk/lib/modules/*" this is where the modules go "*" but I had to make these folders first boot.img-ramdisk/lib/modules/.
If you followed my instructions and did your own fooling around you should have a sense kernel built from source. This is not for beginners. If you have any questions just ask. Message me if you really need some more help.
Happy Building!
I'll add this to the faq guide when I get home from work thanks for the write up
Sent from my HTCONE using xda app-developers app
Cool thanks. Gotta add alot of stuff tho. Need to fix computer first. Doin this on phone is a pain.
Sent from my HTCONE using xda premium
HTC_M7 said:
Cool thanks. Gotta add alot of stuff tho. Need to fix computer first. Doin this on phone is a pain.
Sent from my HTCONE using xda premium
Click to expand...
Click to collapse
Updated Q18
What else would you guys like to know? Let me know. How to build a kernel from htc source? How to use apktool? How to read a logcat?
Sent from my HTCONE using xda premium
HTC_M7 said:
What else would you guys like to know? Let me know. How to build a kernel from htc source? How to use apktool? How to read a logcat?
Sent from my HTCONE using xda premium
Click to expand...
Click to collapse
Yes
Yes and
Yes
Sent from my HTCONE using xda app-developers app
Ok just added my fourth post on how to build a htc sense kernel from source
Im really trying to get this moved to general software section but no mod has contacted me back yet.
Sent from my HTCONE using xda premium

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

Categories

Resources