Install Android SDK / JDK / ADB on Linux 11.04 - Android Software/Hacking General [Developers Only]

1.Get root permission.
2.Install x32 libs if you are running on a x64
Code:
apt-get install ia32-libs
3.Install sun JDK - Aprox 25 mins in 56k line
Code:
apt-get install sun-java6-jdk
4.Install eclipse -Aprox 1hr in 56k line
Code:
sudo apt-get install eclipse
5.Now open up Eclipse, and go to:
Help Menu -> Install New Software
* Add:
Code:
https://dl-ssl.google.com/android/eclipse/
http://download.eclipse.org/datatools/updates
http://download.eclipse.org/webtools/updates/
http://download.eclipse.org/modeling/emf/updates/releases/
http://download.eclipse.org/tools/gef/updates/releases/
http://dl.google.com/eclipse/plugin/3.5
Install these packages, and then you can install adt plugin as well.
6.Download Android SDK from
http://developer.android.com/sdk/index.html
7.Now open a terminal again and go to the directory where you've saved the Android SDK
Code:
cd /home/*username*/Desktop
8.Uncompress it.
Code:
tar xvfz android-sdk_r12-linux_x86.tgz
9.Delete the archive file to save some space
Code:
rm android-sdk_r12-linux_x86.tgz
10.Move extracxted file to your home directory.
Code:
mv android-sdk-linux_86 /home/*username*
11.Make and edit /etc/udev/rules.d/##-android.rules
Code:
sudo gedit /etc/udev/rules.d/##-android.rules
## = 50 if you are running Gusty/Hardy/Dapper (50-android.rules) or with the number 70 if you are running Karmic Koala/Lucid Lynx/Maverick Meerkat(70-android.rules)
12.in ##-android.rules Add line as follow
For Gusty/Hardy:
Code:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
For Dapper:
Code:
SUBSYSTEM=="usb_device", SYSFS{idVendor}=="0bb4", MODE="0666"
For Karmic Koala:
Code:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
For Lucid Lynx:
Code:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
For Maverick Meerkat:
Code:
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666"
**NOTE: In the above lines the code ”0bb4″ refers to a HTC device. If your phone is from a different manufacturer, replace the code with the appropriate
Code:
Acer - 0502
Dell - 413c
Foxconn - 0489
Garmin-Asus - 091E
HTC (Older Phones) - 0bb4
HTC (Newer phones) - 18d1
Huawei - 12d1
Kyocera - 0482
LG - 1004
Motorola - 22b8
Nexus One/S - 18d1
Nvidia - 0955
Pantech - 10A9
Samsung - 04e8
Sharp - 04dd
Sony Ericsson - 0fce
ZTE - 19D2
**NOTE: If you copy one of the lines mentioned above, make sure you replace the quotation marks with the ones in your keyboard, as these have different display code and it might give you a “no permissions” error.
13.Execute ##-android.rules:
Code:
sudo chmod a+rx /etc/udev/rules.d/70-android.rules
14.Reboot
**To run ADB you need to add an environment variable to your bashrc file.
15.Open a terminal window and type:
Code:
sudo gedit .bashrc
16.Add the following line at the end of the page:
Code:
export PATH=$PATH:/home/grainier/android-sdk-linux_x86/Platform-tools
17.Save and close
18.To make sure everything works perfect, type adb devices in a terminal window with your phone plugged in.
If you see a serial number pop up that means you are done. Should look something like this:
List of devices attached
HT99PHF***** device
**If for some reasons when running adb devices gives you a “no permissions” error, try typing the following in terminal
adb kill-server
adb start-server
18.Finally open up Eclipse and Go to Window > Preferences. Select Android, and add the SDK Location: /home/*username*/android-sdk-linux_86
19.Click the Apply and then OK.
**Everything is ready to go.. rest is up to you**

I hope you realize that Debian and Debian-derivatives aren't the only Linux based operating systems in the entire universe.

With Ubuntu's recent decision to no longer include Sun Java SDK in their repositories, this post needs an update. I've just completed an install of the Android Dev Environment following this guide, but as the Sun Java SDK has been removed from the Ubuntu Respositories, is installed the Open Java JKDK. It seems to work OK, although only time will tell as I do more Android development.
To download and install the Open Java SKD on a variety of Linux distros follow the instructions appropriate to your Linux Distro on the following link (add dots to replace the spaces in the following address. Sorry as a new poster, I can't post external links.)
openjdk java net

Related

[Resolved] [Q] Setting Up ADB/USB Drivers for Android Devices in Ubuntu maverick 10.10?

OK so I tried these instruciton for Lucid on Maverick. I would post the link but I can't cuz I'm a newbie.
Download the latest Android SDK from Google: Android SDK
Extract the TGZ file to your home/user directory
NOTE: User would be your username
On your phone, click Settings > Applications > Development and make sure USB Debugging is on.
Login as root and create this file: /etc/udev/rules.d/##-android.rules
NOTE: In the above file replace ## with the number 50 if you are running Gusty/Hardy/Dapper (50-android.rules) or with the number 70 if you are running Karmic Koala/Lucid Lynx(70-android.rules)
Or simply type in terminal sudo gedit /etc/udev/rules.d/##-android.rules then enter your password
The file should read:
For Gusty/Hardy: SUBSYSTEM==”usb”, SYSFS{idVendor}==”0bb4″, MODE=”0666″
For Dapper: SUBSYSTEM==”usb_device”, SYSFS{idVendor}==”0bb4″, MODE=”0666″
For Karmic Koala: SUBSYSTEM==”usb”, SYSFS{idVendor}==”0bb4″, MODE=”0666″
For Lucid: SUBSYSTEM==”usb”, SYSFS{idVendor}==”0bb4″, MODE=”0666″
NOTE: In the above lines the code ”0bb4″ refers to a HTC device. If your phone is from a different manufacturer, replace the code with the appropriate from the table below.
Execute: sudo chmod a+rx /etc/udev/rules.d/70-android.rules
Reboot
To run ADB you need to add an environment variable to your bashrc file:
Open a terminal window and type: sudo gedit .bashrc
Add the following line at the end: export PATH=${PATH}:~/home/user/android-sdk-linux_86/tools
Save and close
You should be ready to go, type adb devices in a terminal window with your phone plugged in.
If you see a serial number pop up that means you are done. Should look something like this:
List of devices attached
HT99PHF02521 device
If for some reasons when running adb devices gives you a “no permissions” error, try typing the following in terminal
adb kill-server
adb start-server
USB Vendor IDs
MANUFACTURER USB VENDOR ID
Acer 0502
Dell 413c
Foxconn 0489
Garmin-Asus 091E
HTC 0bb4
Huawei 12d1
Kyocera 0482
LG 1004
Motorola 22b8
Nvidia 0955
Pantech 10A9
Samsung 04e8
Sharp 04dd
Sony Ericsson 0fce
ZTE 19D2
Common ADB Commands
- Lists which devices are currently attached to your computer
adb devices
- Drops you into a basic linux command shell on your phone with no parameters, or lets you run commands directly
adb shell
- Lets you install an Android application on your phone
adb install
- Remounts your system in write mode – this lets you alter system files on your phone using ADB
adb remount
- Rets you upload files to your phones filesystem
adb push
- Lets you download files off your phones filesystem
adb pull
- Starts dumping debugging information from your handset to the console – useful for debugging your apps
adb logcat
Now, as for the credits, I took TheUnlockr “How To” for Windows as a base for this guide.
Click to expand...
Click to collapse
But it doesn't work in maverick. Please help. Because I really want to overlock my phone.
Also keep in mind I'm fairly new to Linux so be easy on the newbie.
Thanks guys.
49 views and no responds? Please help I'm desperate here.
So did post this in the wrong section? This silent treatment is killing me. lol
in terminal type:
$ sudo -i
$ gedit .bashrc
insert the same line at the end: export PATH=${PATH}:~/home/user/android-sdk-linux_86/tools
$ exit
$ sudo -i
$ adb kill-server
$ adb start-server
$ adb devices
benholiio said:
in terminal type:
$ sudo -i
$ gedit .bashrc
insert the same line at the end: export PATH=${PATH}:~/home/user/android-sdk-linux_86/tools
$ exit
$ sudo -i
$ adb kill-server
$ adb start-server
$ adb devices
Click to expand...
Click to collapse
Dude this is for adb, not for recognizing the USB...
My phone is HTC Desire and I am still figuring out why it doesnt work on 10.10 with all the rules...
hungrysquid said:
Dude this is for adb, not for recognizing the USB...
My phone is HTC Desire and I am still figuring out why it doesnt work on 10.10 with all the rules...
Click to expand...
Click to collapse
I'm assuming thisisspeedy got to the same stage i did: USB connects, i can access files through maverick, however adb won't detect the device to allow push/pull/shell.
simply elevating to root & editing the bash script on maverick solves the problem.
I have my Galaxy S connected to Maverick via USB, and i can run all ADB functions.
It should work for HTC using the correct code. If you have a problem with Ubuntu detecting your device on USB when you've set USB to mount on Android, PM me and I'll see if i can help.
Could someone post a link for the Lucid dirs? Thanks.
Sent from my T-Mobile G2 using XDA App
Thanks for everyone responses.
I figured it out thanks to this.
[QUOTEThe Android Debug Bridge (adb) is a tool lets you manage the state of an emulator instance or Android-powered device.
I was trying to run it for the first time on my ubuntu 9.10 box and I kept getting this error:
desktop:~/dev/Android/android-sdk-linux/tools$ adb
No command 'adb' found, did you mean:
Command 'cdb' from package 'tinycdb' (main)
Command 'gdb' from package 'gdb' (main)
Command 'aub' from package 'aub' (universe)
Command 'dab' from package 'bsdgames' (universe)
Command 'mdb' from package 'mono-debugger' (universe)
Command 'arb' from package 'arb' (multiverse)
Command 'tdb' from package 'tads2-dev' (multiverse)
Command 'pdb' from package 'python' (main)
Command 'jdb' from package 'openjdk-6-jdk' (main)
Command 'jdb' from package 'sun-java6-jdk' (multiverse)
Command 'ab' from package 'apache2-utils' (main)
adb: command not found
What was I doing wrong?
A quick google search shows me the error of my ways.. I haven't added my Android SDK tools directory to my system path!
It should go something like this...
open a terminal window and type:
$ echo $PATH
---(should return the directories associated with $PATH)
$ export PATH=$PATH:/home/YOUR-USERNAME/sdk/tools
---(replace with path to your tools directory, you may need to add 'sudo' to the beginning of this cmd)
$ echo $PATH
---(you should now see your tools directory added to the end of the $PATH variable)
$ adb devices
---(now adb should do something, if nothing else at least error, no devices)
And now I get:
List of devices attached
emulator-5554 device
Sweet Success!
p.s. Adding to the system path in Windows is along the lines of :
right-click '(My) Computer'
Select 'Properties'
Go to 'Advanced' or whatever tab you find 'Environment Variables'
Select 'Path' then 'Edit' and add your new path in.][/QUOTE]
adb trouble
Hi i am runing on Ubuntu Maverick with device Huawei U8110 on Celestial Teapot 4 ROM
java jdk ver6
installed Android SDK and tools in the home folder
i edit the rules file 99-android.rules to SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", SYMLINK+="android_adb", MODE="0666" GROUP="plugdev"
saved and added the file permisions
restart the udev
Connected the Phone put the debug mode on
kill the adb then started
And Then Run The comand
[email protected]:/home/android-sdk-linux_x86/platform-tools# ./adb devices
List of devices attached
There is nothing in the list....?
HELP!? Please......
I use it for Marveric.
vim /etc/udev/rules.d/70-android.rules
# IS01
SUBSYSTEM=="usb",ATTRS{idVendor}=="04dd",ATTRS{idProduct}=="04dd",MODE="0666",OWNER="root"
# GalaxyS
SUBSYSTEM=="usb",ATTRS{idVendor}=="04e8",ATTRS{idProduct}=="681c",MODE="0666",OWNER="root"
# bravo
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"
add like a above. then
/etc/init.d/udev restart
Good luck!
thisisspeedy said:
I figured it out thanks to this.
[QUOTEThe Android Debug Bridge (adb) is a tool lets you manage the state of an emulator instance or Android-powered device.
I was trying to run it for the first time on my ubuntu 9.10 box and I kept getting this error:
desktop:~/dev/Android/android-sdk-linux/tools$ adb
No command 'adb' found, did you mean:
Command 'cdb' from package 'tinycdb' (main)
Command 'gdb' from package 'gdb' (main)
Command 'aub' from package 'aub' (universe)
Command 'dab' from package 'bsdgames' (universe)
Command 'mdb' from package 'mono-debugger' (universe)
Command 'arb' from package 'arb' (multiverse)
Command 'tdb' from package 'tads2-dev' (multiverse)
Command 'pdb' from package 'python' (main)
Command 'jdb' from package 'openjdk-6-jdk' (main)
Command 'jdb' from package 'sun-java6-jdk' (multiverse)
Command 'ab' from package 'apache2-utils' (main)
adb: command not found
What was I doing wrong?
A quick google search shows me the error of my ways.. I haven't added my Android SDK tools directory to my system path!
It should go something like this...
open a terminal window and type:
$ echo $PATH
---(should return the directories associated with $PATH)
$ export PATH=$PATH:/home/YOUR-USERNAME/sdk/tools
---(replace with path to your tools directory, you may need to add 'sudo' to the beginning of this cmd)
$ echo $PATH
---(you should now see your tools directory added to the end of the $PATH variable)
$ adb devices
---(now adb should do something, if nothing else at least error, no devices)
And now I get:
List of devices attached
emulator-5554 device
Sweet Success!
p.s. Adding to the system path in Windows is along the lines of :
right-click '(My) Computer'
Select 'Properties'
Go to 'Advanced' or whatever tab you find 'Environment Variables'
Select 'Path' then 'Edit' and add your new path in.]
Click to expand...
Click to collapse
============================================================
THANK YOU!! (I did hit 'THANKS' as well)...
You pointed me in the right direction with Ubuntu 10.04.
The only change was with SDK..the 'adb' has moved to $ ~/platform-tools/
By the way folks, when you install SDK, it would be wise to do all the updates, otherwise the platform-tools folder won't be an option....:cyclops:
"The order has been restored.."

[HOWTO] Straight to the point cross building from x86 GNU/Linux to Android

There doesn't seem to have a quick HOWTO about cross compiling a simple C code from a GNU/Linux machine to an Android device, so here's my first contribution here.
1. Fetch the official Android NDK from the official website
(google it, it's my first post I'm not allowed to post links
2. Uncompress the archive in a convenient place
Code:
$ cd ${HOME}
$ mkdir android
$ cd android
$ tar jxvf /path/to/android-ndk-r7b-linux-x86.tar.bz2
3. Create the toolchain for the tagetted platform, remember:
(from the official NDK documentation)
android-3 -> Official Android 1.5 system images
android-4 -> Official Android 1.6 system images
android-5 -> Official Android 2.0 system images
android-6 -> Official Android 2.0.1 system images
android-7 -> Official Android 2.1 system images
android-8 -> Official Android 2.2 system images
android-9 -> Official Android 2.3 system images
android-14 -> Official Android 4.0 system images
So, if we are to create Android 2.3 binaries:
Code:
$ android-ndk-r7b/build/tools/make-standalone-toolchain.sh --platform=android-9 --install-dir=/home/user/android/android-9-toolchain
4. Setup environment variables
From now on, you just have to set two variables to complete the process:
Code:
export PATH=/home/user/android/android-9-toolchain/bin:$PATH
export CC=arm-linux-androideabi-gcc
You may want to add these to your ~/.bashrc file to it's ready for every shell instance.
5. Try it!
Let's write a very simple C code:
Code:
cat > ohai.c
#include <stdio.h>
int
main()
{
printf("OHAI\n");
exit(0);
}
^D
And have it compile with our new toolchain:
Code:
$ $CC -o ohai ohai.c
Finally, push it to your android device and execute your creation:
Code:
$ adb push test /data/local/tmp
$ adb shell /data/local/tmp/ohai
OHAI
Enjoy !

[SOLVED][Q]Adb + Ubuntu 12.04

Hi all,
I'm new user of the One S.
I want can run adb in ubuntu 12.04, but isn't work, i'm not root, rom stock after power on at the first time
Code:
sudo gedit /etc/udev/rules.d/[COLOR="Red"]70[/COLOR]-android.rules or sudo gedit /etc/udev/rules.d/[COLOR="Red"]51[/COLOR]-android.rules
with this in
Code:
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"
i'm restart UDEV or Reboot computer
and the result is same at any time
Code:
adb devices
List of devices attached
???????????? no permissions
Any one can help me?
SOLUCE
Code:
sudo gedit /etc/udev/rules.d/99-android.rules
Code:
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0cec", MODE="0666"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bb4", ATTRS{idProduct}=="0cec"
TEST=="/var/run/ConsoleKit/database", \
RUN+="udev-acl --action=$env{ACTION} --device=$env{DEVNAME}"
Code:
sudo chmod a+rx /etc/udev/rules.d/99-android.rules
Code:
reboot
Code:
~$ adb devices
List of devices attached
SH24SW405437 device
s
If this not work add
Code:
sudo gedit /.android/adb_usb.ini
Code:
0bb4
Code:
reboot
this worked for me
This worked for me (Kubuntu 12.04):
Type the following commands:
Code:
cd /etc/udev/rules.d/
Code:
sudo vim 51-android.rules
Press
Code:
i
to edit, then paste the following text:
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4",ATTR{idProduct}=="0cba", MODE="0666"
Click to expand...
Click to collapse
press Esc key, then
Code:
wq
m!k3 said:
Hi all,
I'm new user of the One S.
I want can run adb in ubuntu 12.04, but isn't work, i'm not root, rom stock after power on at the first time
Code:
sudo gedit /etc/udev/rules.d/[COLOR="Red"]70[/COLOR]-android.rules or sudo gedit /etc/udev/rules.d/[COLOR="Red"]51[/COLOR]-android.rules
with this in
Code:
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"
i'm restart UDEV or Reboot computer
and the result is same at any time
Code:
adb devices
List of devices attached
???????????? no permissions
Any one can help me?
Click to expand...
Click to collapse
Have you tried Knives-and-Forks Tools for linux user try with sudo <command>
adb works on Ubuntu 12.04LTS
x1123 said:
Have you tried Knives-and-Forks Tools for linux user try with sudo <command>
Click to expand...
Click to collapse
On Ubuntu 12.04LTS
step 1:
use lsusb command to find out your devices's ID:
lsusb
Bus 003 Device 007: ID 18d1:d002 Google Inc.
step2:
add a line in the /etc/udev/rulers.d/xx-android.rules using the ID found in step 1.
http://source.android.com/source/initializing.html
Configuring USB Access
Under GNU/linux systems (and specifically under Ubuntu systems), regular users can't directly access USB devices by default. The system needs to be configured to allow such access.
The recommended approach is to create a file /etc/udev/rules.d/51-android.rules (as the root user) and to copy the following lines in it. <username> must be replaced by the actual username of the user who is authorized to access the phones over USB.
# adb protocol on passion (Nexus One)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e12", MODE="0600", OWNER="<username>"

[GUIDE] Build Android From Source

Today, we will be learning how to build android from source! Lets start.​The Android build is routinely tested in-house on recent versions of Ubuntu LTS (10.04), but most distributions should have the required build tools available.​Please note that building on mac osx wont be discussed here.​
Requirements
A Linux or Mac computer. It is also possible to build Android in a virtual machine on unsupported systems such as Windows. If you are running Linux in a virtual machine, you need at least 16GB of RAM/swap and 30GB or more of disk space in order to build the Android tree.
A 64-bit environment is required for Gingerbread (2.3.x) and newer versions, including the master branch. You can compile older versions on 32-bit systems.
30GB of free disk space to complete a single build and up to 100GB or more for a full set of builds. The source download is approximately 8.5GB in size.
Python 2.6 -- 2.7, which you can download from python.org.
GNU Make 3.81 -- 3.82, which you can download from gnu.org,
JDK 6 if you wish to build Gingerbread or newer; JDK 5 for Froyo or older. You can download both from java.sun.com.
Git 1.7 or newer. You can find it at git-scm.com.
Setting up the linux build Environment
Installing the JDK
The Sun JDK is no longer in Ubuntu's main package repository. In order to download it, you need to add the appropriate repository and indicate to the system which JDK should be used.
Please note : Java 6: for Gingerbread and newer.
Code:
$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
$ sudo apt-get update
$ sudo apt-get install sun-java6-jdk
Installing required packages (Ubuntu 10.04 - 11.10)
You will need a 64-bit version of Ubuntu. Ubuntu 10.04 is recommended. Building using a newer version of Ubuntu is currently only experimentally supported and is not guaranteed to work on branches other than master.
Code:
$ 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 10.10
Code:
$ sudo ln -s /usr/lib32/mesa/libGL.so.1 /usr/lib32/mesa/libGL.so
On Ubuntu 11.10
Code:
$ sudo apt-get install libx11-dev:i386
Configuring USB Access
Under GNU/linux systems (and specifically under Ubuntu systems), regular users can't directly access USB devices by default. The system needs to be configured to allow such access.
The recommended approach is to create a file /etc/udev/rules.d/51-android.rules (as the root user) and to copy the following lines in it. <username> must be replaced by the actual username of the user who is authorized to access the phones over USB.
Code:
# 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>"
# adb protocol on grouper/tilapia (Nexus 7)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e42", MODE="0600", OWNER="<username>"
# fastboot protocol on grouper/tilapia (Nexus 7)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e40", MODE="0600", OWNER="<username>"
# adb protocol on manta (Nexus 10)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee2", MODE="0600", OWNER="<username>"
# fastboot protocol on manta (Nexus 10)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee0", MODE="0600", OWNER="<username>"
NOTE : Those new rules take effect the next time a device is plugged in. It might therefore be necessary to unplug the device and plug it back into the computer.​
Setting up ccache
Put the following in your .bashrc or equivalent.:
Code:
export USE_CCACHE=1
By default the cache will be stored in ~/.ccache. If your home directory is on NFS or some other non-local filesystem, you will want to specify the directory in your .bashrc as well.
Code:
export CCACHE_DIR=<path-to-your-cache-directory>
The suggested cache size is 50-100GB. You will need to run the following command once you have downloaded the source code:
Code:
prebuilts/misc/linux-x86/ccache/ccache -M 50G
When building Ice Cream Sandwich (4.0.x) or older, ccache is in a different location:
Code:
prebuilt/linux-x86/ccache/ccache -M 50G
This setting is stored in the CCACHE_DIR and is persistent.
--- > Please note : By default, the output of each build is stored in the out/ subdirectory of the matching source tree.​
Downloading the Source
The Android source tree is located in a Git repository hosted by Google. This document describes how to download the source tree for a specific Android code-line.
Installing Repo
Repo is a tool that makes it easier to work with Git in the context of Android.
TO install repo:
1. Make sure you have a bin/ directory in your home directory and that it is included in your path:
Code:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
2. Download the Repo tool and ensure that it is executable:
Code:
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
Initializing a Repo client
After installing Repo, set up your client to access the Android source repository:
1. Create an empty directory to hold your working files.
Code:
$ mkdir WORKING_DIRECTORY
$ cd WORKING_DIRECTORY
2. Run repo init to bring down the latest version of Repo with all its most recent bug fixes. You must specify a URL for the manifest, which specifies where the various repositories included in the Android source will be placed within your working directory.
Code:
$ repo init -u https://android.googlesource.com/platform/manifest
3. When prompted, configure Repo with your real name and email address. To use the Gerrit code-review tool, you will need an email address that is connected with a registered Google account. Make sure this is a live address at which you can receive messages. The name that you provide here will show up in attributions for your code submissions.​
Downloading the Android Source Tree
To pull down the Android source tree to your working directory from the repositories as specified in the default manifest, run
Code:
$ repo sync
The Android source files will be located in your working directory under their project names.​
Building the System
Choosing a Branch
Some of the requirements for your build environment are determined by which version of the source code you plan to compile.
See Codenames, Tags, and Build Numbers for a full listing of branches you may choose from. You may also choose to download and build the latest source code (called "master"), in which case you will simply omit the branch specification when you initialize the repository.​
Initialize
Initialize the environment with the envsetup.sh script. Note that replacing "source" with a single dot saves a few characters, and the short form is more commonly used in documentation.
Code:
$ source build/envsetup.sh
Choose a Target
Choose which target to build with lunch. The exact configuration can be passed as an argument, e.g.
Code:
$ lunch full-eng
The example above refers to a complete build for the emulator, with all debugging enabled.
All build targets take the form BUILD-BUILDTYPE, where the BUILD is a codename referring to the particular feature combination. Here's a partial list:
{
"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"
}
and the BUILDTYPE is one of the following:
​
Build the Code
Build everything with make. GNU make can handle parallel tasks with a -jN argument, and it's common to use a number of tasks N that's between 1 and 2 times the number of hardware threads on the computer being used for the build
Code:
$ make -jN
You can either run your build on an emulator or flash it on a device. Please note that you have already selected your build target with lunch, and it is unlikely at best to run on a different target than it was built for.
Flash a Device
To flash a device, you will need to use fastboot, which should be included in your path after a successful build. Place the device in fastboot mode either manually by holding the appropriate key combination at boot, or from the shell with
Code:
$ adb reboot bootloader
Once the device is in fastboot mode, run
Code:
$ fastboot flashall -w
The -w option wipes the /data partition on the device; this is useful for your first time flashing a particular device, but is otherwise unnecessary.​
Emulate an Android Device
The emulator is added to your path automatically by the build process. To run the emulator, type
Code:
$ emulator
Using ccache
ccache is a compiler cache for C and C++ that can help make builds faster. In the root of the source tree, do the following:
Code:
$ export USE_CCACHE=1
$ export CCACHE_DIR=/<path_of_your_choice>/.ccache
$ prebuilts/misc/linux-x86/ccache/ccache -M 50G
Note : The suggested cache size is 50-100G.
Note 2 : You can watch ccache being used by doing the following:
Code:
$ watch -n1 -d prebuilts/misc/linux-x86/ccache/ccache -s[/B]
​
Reserved
Reserved for updates
Last one
I would like to keep this one
Bahalshsjshsijwghwowbbapbfnaoabbdms
(Deleted)

[HOW-TO] Quick Guide on How to Compile Heimdall from Source in MacOS - OSX Yosemite

So, I was able to compile and flash my Galaxy J5 from my Mac OSX Yosemite command line, and I'd like to share the experience. I'm a beginner at flashing and the Android world, so I struggled to understand I did not need Odin for taking control over my Galaxy J5.
The following should work for most versions of OSX / MacOS, as long as you have a compiler installed. But I've only tested it in my Yosemite machine.
All binary packages for Heimdall did not work for me. I was getting a persistent "libusb error -7 whilst sending packet". So I decided to build everything from source and forget about Odin, JOdin3 and the like.
I already had a development environment setup in my Mac, with the stock Xcode cc compiler. So I can only relate the additional dependencies I had to install (+ GIT). But it could be that I had additional software that is required from my brew installed packages. At the end of the post I list all my brew installed packages just in case.
1) Make sure you have a compiler (Xcode dev tools) installed. This is standard Apple stuff. Just google "install xcode mac" for your Mac version.
2) Install Homebrew (url is brew.sh), and the following packages:
Code:
brew install git
brew install cmake
3) Build libusb from source
Code:
cd /tmp
git clone https://github.com/libusb/libusb
cd libusb
./autogen.sh
make
cd /tmp
4) Build Heimdall
Code:
cd /tmp
git clone https://github.com/Benjamin-Dobell/Heimdall
cd Heimdall/
cmake -DLIBUSB_LIBRARY=/tmp/libusb/libusb -DLIBUSB_INCLUDE_DIR=/tmp/libusb/libusb -DDISABLE_FRONTEND=1 .
make
5) If you had no errors in the previous make steps, run Heimdall. You ca print your PIT, flash, etc, from the command line and never use Odin AFAIK. Take your phone into "Download Mode" (Vol Down + Home + Power button from a powered down state). Then try the print-pit Heimdall command (which takes a few minutes to complete).
Code:
cd /tmp/Heimdall/bin
sudo ./heimdall print-pit --no-reboot
sudo ./heimdall flash --17 recovery.img
etc....
BTW, move both Heimdall and libusb directories out of /tmp/ if you intend to preserve them after your Mac reboots. Create something like /Users/[your_user]/build/ to keep it safe and replave all "/tmp/" dirs in the lines above with your destination directory.
Have fun!
=====================
The following is a list of all my brew-installed packages, just in case you're missing a dependency and not sure which package I had that could make this work in my machine.
Code:
~/dev/build/Heimdall$ brew list
android-sdk gifsicle id3lib meld redis
atk git imagemagick net-snmp ruby
autoconf glew jbig2dec netcat scala
automake glib jpeg nettle sdl2
boost glm lame nexus sdl2_image
brew-cask gmp libepoxy nmap sqlite
cairo gnome-icon-theme libev node texi2html
cmake gnu-sed libffi openssl tig
cscope gnupg libogg p7zip tree
d-bus gnutls libpng pango unrar
ffmpeg go libtasn1 pcre v8
fontconfig gobject-introspection libtiff phantomjs watch
freetype gource libtool pixman webp
gawk gsettings-desktop-schemas libvo-aacenc pkg-config wget
gd gtk+3 libvorbis py2cairo x264
gdbm gtksourceview3 libvpx pygobject3 xvid
gdk-pixbuf harfbuzz libyaml python xz
geoip hicolor-icon-theme little-cms2 qemu yasm
gettext httrack macvim qt5
ghostscript icu4c maven readline

Categories

Resources