[GUIDE][DEV] How to install Sun Java Oracle 1.6.0 - 1.7.0 jdk on Ubuntu 12.04+ - Android Software Development

First off this guide is only for developers. If you are not a developer or using this to develop something that has to do with android development please don't clutter up the thread with useless post and/or questions not related to this guide.
This guide will cover the basics on how to install Sun Java Oracle jdk (aka Java Development Kit) on Ubuntu 12.04+. Ubuntu has removed this from their apt repositories since 12.04, so this has made it a little difficult for android developers to install and use when building source ROMs. You can use open jdk, but I and other developers prefer to use Sun Java Oracle jdk. Note that android platforms 2.3 gingerbread and above all require Java 1.6. Froyo requires java 1.5 so this guide will not be useful for that. Some ROM sources such as Linaro and SaberMod can build with java 1.7
If you want to install java 1.7.0 jdk skip straight to THIS Guide
Prerequisites
Ubuntu 12.04 or later
Some basic knowledge of Ubuntu/Linux
Knowledge on how to develop for android (this guide will not cover that)
Instructions
1) Download Java
Download the latest 1.6 version of java for Linux from Sun Java Oracle's website. Make sure you have the correct version for your system. 64-bit users download the x64 ones.
http://www.oracle.com/technetwork/java/javase/downloads/index.html
Select the latest "Java SE 6 Update" download (currently 38)
2) Install Java
Open a command terminal and enter these commands, pressing enter after each line.
Note the versions will change when a new version is updated, change command lines accordingly.
Code:
cd ~/Downloads
chmod +x ~/Downloads/jdk-6u38-linux-x64.bin
~/Downloads/./jdk-6u38-linux-x64.bin
sudo mkdir -p /usr/lib/jvm/jdk1.6.0
sudo mv ~/Downloads/jdk1.6.0_38/* -f /usr/lib/jvm/jdk1.6.0/
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.0/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.6.0/bin/javaws" 1
3) Config java to be default
This next part will allow you to make sun java default after installing it.
Code:
sudo update-alternatives --config java
This will bring up a GUI in terminal to select which java you want to make default with numbers listed for each one. 0 being default, 1 is normally the same java version as 0. Select the sun java one usually 2. Type the number and press enter. Next do the same for javac and javaws.
Code:
sudo update-alternatives --config javac
Code:
sudo update-alternatives --config javaws
Add java to your .bashrc
Code:
gedit ~/.bashrc
Add this to the very bottom of the file
Code:
# Java
export PATH=$PATH:/usr/lib/jvm/jdk1.6.0/bin
You must open a new terminal window/tab each time you edit your .bashrc file
Updating newer java versions. Just repeat steps 1, 2 and 3 but exclude this command and .bashrc edits.
Code:
sudo mkdir -p /usr/lib/jvm/jdk1.6.0
Make sure to run this commands first before anything else
Code:
sudo rm -rf /usr/lib/jvm/jdk1.6.0/*

Thanks for the tip
When building CM10, we get a warning if version is not exactly the java 1.6 expected. Any issue with that when building CM10?

No no warnings. I had some warnings before with open jdk tho building cm10.
Sent from my Nexus 7 using Tapatalk 2

I see
What is the version of JDK officially recommended by CM team ? Sun Java Oracle jdk or the open jdk?

Phil3759 said:
I see
What is the version of JDK officially recommended by CM team ? Sun Java Oracle jdk or the open jdk?
Click to expand...
Click to collapse
It's all about your own preference. I'm not sure what the cm team uses for their build machines or each individual member uses... I prefer Oracle just because it's updated more with bug and security fixes :thumbup:
Sent from my Nexus 7 using Tapatalk 2

Just a small question. I've has Sun Java installed for a while now. I've been building CyanogenMod, and plain AOSP just fine the whole time too. I've noticed that a couple guides, including yours, suggest adding lines to the bash.rc for this. I never did that for Java, and everything has been great. Why is this; and is it going to come back and bite me eventually?
Thanks.

I couldn't build without errors on 12.10 without the .bashrc edits. I did an fresh install of 12.10 instead of upgrading maybe that's why but idk for sure. It just makes sure that that version of java always gets used no matter what. You can always gedit .bashrc again to edit it and remove or add things so no it won't be problematic. You can also verify your using sun java and not open java by typing java -version on terminal. It should read Java(TM) SE Runtime Environment.
Sent from my Nexus 7 using Tapatalk 2

Phil3759 said:
Thanks for the tip
When building CM10, we get a warning if version is not exactly the java 1.6 expected. Any issue with that when building CM10?
Click to expand...
Click to collapse
For what it's worth, Sun Java has always given warnings such about things being deprecated in future releases, and every build has always been fine. I'm not saying there aren't any potential problems, however, from everything I've seen, there have been no problems yet.

Great Step By Step Guide For All New User...........:good::good:

Updated OP with instructions on how to make sun java default.
Code:
sudo update-alternatives --config java
Sent from my Nexus 7 using Tapatalk 2

Ive got this error:
sudo mv ~/Descargas/jdk1.6.0_37/* -f /usr/lib/jvm/jdk1.6.0/
mv: no se puede efectuar `stat' sobre «/home/adrian/Descargas/jdk1.6.0_37/*»: No existe el archivo o el directorio

adri_360 said:
Ive got this error:
sudo mv ~/Descargas/jdk1.6.0_37/* -f /usr/lib/jvm/jdk1.6.0/
mv: no se puede efectuar `stat' sobre «/home/adrian/Descargas/jdk1.6.0_37/*»: No existe el archivo o el directorio
Click to expand...
Click to collapse
I can't read Spanish but it looks like you didn't create the directory yet.
Sent from my Nexus 7 using Tapatalk 2

The error he got is that the jdk1.6.0_37 folder gets created in the home folder, but the command looks for it in the Downloads folder. Just move the folder manually to the Downloads folder.
@Sparksco wasn't there a couple of lines we needed to add to the .bashrc file in the beginning to finish this change? I had to set up my build enviroment again, but after doing this I keep getting the error about using the wrong java version.
---------- Post added at 07:03 AM ---------- Previous post was at 06:37 AM ----------
sparksco said:
I couldn't build without errors on 12.10 without the .bashrc edits. I did an fresh install of 12.10 instead of upgrading maybe that's why but idk for sure. It just makes sure that that version of java always gets used no matter what. You can always gedit .bashrc again to edit it and remove or add things so no it won't be problematic. You can also verify your using sun java and not open java by typing java -version on terminal. It should read Java(TM) SE Runtime Environment.
Sent from my Nexus 7 using Tapatalk 2
Click to expand...
Click to collapse
Could you share with me the edits? This is what I was reffering to on my last comment.

apascual89 said:
The error he got is that the jdk1.6.0_37 folder gets created in the home folder, but the command looks for it in the Downloads folder. Just move the folder manually to the Downloads folder.
@Sparksco wasn't there a couple of lines we needed to add to the .bashrc file in the beginning to finish this change? I had to set up my build enviroment again, but after doing this I keep getting the error about using the wrong java version.
---------- Post added at 07:03 AM ---------- Previous post was at 06:37 AM ----------
Could you share with me the edits? This is what I was reffering to on my last comment.
Click to expand...
Click to collapse
Did you run sudo update-alternatives --config java ?
I don't think you need to add .bashrc edits if you configure java, javac and javaws to be with sun java oracle. Let me know how it goes I can add the .bashrc edits back if needed.

Code:
sudo update-alternatives --config javac
Code:
sudo update-alternatives --config javaws
Where these two there this morning? Am I losing my mind? I'll check and let you know.

apascual89 said:
Code:
sudo update-alternatives --config javac
Code:
sudo update-alternatives --config javaws
Where these two there this morning? Am I losing my mind? I'll check and let you know.
Click to expand...
Click to collapse
Those two I added just in case... The java one was already there lol.
Sent from my Nexus 7 using Tapatalk 2

sparksco said:
Those two I added just in case... The java one was already there lol.
Sent from my Nexus 7 using Tapatalk 2
Click to expand...
Click to collapse
Yep that did it! It's building. Thanks Again

Java update
Oracle released u38 version which has security and bug fixes in it. More info here on bug fixes: http://www.oracle.com/technetwork/java/javase/2col/6u38-bugfixes-1880999.html As you can see there are quite a few
Also I updated the OP for version 38 and instructions on how to update to a newer version.
If your building ROMs you'll want to do a completely new clean build. For example remove your entire out directory before building.

[GUIDE][DEV] How to install Sun Java Oracle 1.7.0 jdk on Ubuntu 12.04+
In this guide you will be installing java 1.7
Prerequisites
Ubuntu 12.04 or later
Some basic knowledge of Ubuntu/Linux
Knowledge on how to develop for android (this guide will not cover that)
Instructions
1) Download Java 1.7
Download the latest 1.7 version of java for Linux from Sun Java Oracle's website. Make sure you have the correct version for your system. 64-bit users download the x64 ones.
http://www.oracle.com/technetwork/java/javase/downloads/index.html
Select the latest "Java SE 7 Update" download (current 10)
2) Install Java
Open a command terminal and enter these commands, pressing enter after each line.
Note the versions will change when a new version is updated, change command lines accordingly.
First check for previous installations of openjdk for java 6 and 7
Code:
sudo apt-get remove openjdk-6-jdk
sudo apt-get remove openjdk-7-jdk
# For this next part remove anything that is openjdk with sudo rm -rf
Code:
ls /usr/lib/jvm
sudo rm -rf /usr/lib/jvm/###VersionYouWantToRemove###
Note: If you see
Code:
/usr/lib/jvm/default-java
You need to remove it. If you don't see it ignore this next command.
Code:
sudo rm /usr/lib/jvm/default-java
Continue.
Code:
cd ~/Downloads
gunzip ~/Downloads/jdk-7u10-linux-x64.tar.gz
tar -xvf ~/Downloads/jdk-7u10-linux-x64.tar
sudo mkdir -p /usr/lib/jvm/jdk1.7.0
sudo mv ~/Downloads/jdk1.7.0_10/* -f /usr/lib/jvm/jdk1.7.0/
For this part do not skip any steps
Code:
sudo ln -s /usr/lib/jvm/jdk1.7.0 /usr/lib/jvm/default-java
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1
3) Config java to be default
This next part will allow you to make sun java default after installing it. This will bring up a GUI in terminal to select which java you want to make default with numbers listed for each one. 0 being default, 1 is normally the same java version as 0. Select the sun java 1.7.0 one. Type the number and press enter.
Code:
sudo update-alternatives --config java
Code:
sudo update-alternatives --config javac
Code:
sudo update-alternatives --config javaws
Add java to your .bashrc
Code:
gedit ~/.bashrc
Add this to the very bottom of the file
If you have java 1.6 in your PATH you'll need to remove it in order to use java 1.7
Code:
# Java
export PATH=$PATH:/usr/lib/jvm/jdk1.7.0/bin
You must open a new terminal window/tab each time you edit your .bashrc file
Updating newer java versions. Just repeat steps 1, 2 and 3 but exclude these commands and .bashrc edits.
Code:
sudo mkdir -p /usr/lib/jvm/jdk1.7.0
sudo ln -s /usr/lib/jvm/jdk1.7.0 /usr/lib/jvm/default-java
Make sure to run these commands first before anything else
Code:
sudo rm -rf /usr/lib/jvm/jdk1.7.0/*

OP Update with new Guide instructions for java 1.7

Related

[GUIDE] Setting up a build environment for CDMA Hero

this is a guide for setting up a build environment on ubuntu 10.10. there has been similar guides but i did not have any luck with them. i'll just post step by step what i did to get a good build environment set up and compile jaybob's source.
install ubuntu 10.10
install ubuntu, install all the latest updates, DO NOT INSTALL UBUNTU 11.04 I MADE THIS FOR 10.10!!!
restart ubuntu
go to system, administration, update manager
go to settings
go to other software
check both canonical partners and click close
download python
sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
sudo apt-get install python2.5
download jdk 6
sudo add-apt-repository "deb http://archive.canonical.com/ maverick partner"
sudo add-apt-repository "deb http://archive.canonical.com/ubuntu maverick partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk
download sdk
download link: http://dl.google.com/android/android-sdk_r15-linux.tgz
take android-sdk-linux folder and move it inside your home folder
open terminal
cd android-sdk-linux
cd tools
./android
the sdk manager will open. download the platform tools and any sdk versions you wish to have
download git
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git-core
install required build packages
sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev sun-java6-jdk pngcrush schedtool
configure your usb
gksudo gedit /etc/udev/rules.d/51-android.rules
in the blank file that opens, paste this next line in the file:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
save and close the file.
then run in terminal:
sudo chmod a+r /etc/udev/rules.d/51-android.rules
cd
gedit .bashrc
in the file that opens, add these next lines to the top of the file:
#AndroidDev PATH
export PATH=${PATH}:${HOME}/android-sdk-linux/platform-tools/
save and close the file, then in terminal, type:
source ~/.bashrc
then in terminal type:
which adb
which adb will show you your adb path. if it says "/home/YOURLINUXNAME/android-sdk-linux/platform-tools//adb" your path is good.
connect your phone, do not mount usb, make sure debugging is checked, then in terminal type:
adb devices
my device showed up as "0123456789ABCDEF device", as long as it says device at the end its good.
create directories
mkdir -p ~/bin
mkdir -p ~/android/system
download repo and make executable
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo
initialize the repository
cd ~/android/system/
repo init -u git://github.com/TeamHeroC/manifest_aosp_heroc.git
(the repo above is jaybob's repo, there are a couple different repos you can choose from, you can download the AOSP repo, or cyanogenmod's repo aswell from the wiki)
repo sync
copy proprietary files
(must have jaybob's or a cm based rom already flashed to phone)
cd ~/android/system/device/htc/heroc/
./extract-files.sh
build the source
. build/envsetup.sh
lunch aosp_heroc-eng
mka bacon
if all goes well, your rom zip will be in ~/android/system/out/target/product/heroc/
*** when youre initializing the repository, if youre are compiling cyanogenmod's, follow the instructions in the wiki when you get to that section. if you are compiling aosp, follow the instructions on the aosp website. everything before that step should give you a good build environment to decide which source you want to build.***
Thank you:
dastin1015 - i used some of his guide and he is a great developer.
jaybob413 - for being a great developer and for his repo.
cyanogenmod - for the source and some of their guide.
sykopompos - i used some of his guide.
mTeryk - for helping me figure out my adb issue.
youdug - for finding some of the sources and helping me figure everything out.
*reserved*
*second reserved*
glenny buster said:
copy proprietary files
(must have jaybob's or a cm based rom already flashed to phone)
cd ~/android/system/device/htc/heroc/
./extract-files.sh
Click to expand...
Click to collapse
This step should no longer be needed when building from the TeamHeroC repos. I added the proprietary files some time ago to set up one-stop shopping and eliminate the need to do anything other than init, sync, lunch, and build (yes, I am just that lazy). The vendor device makefiles and proprietary files should already be pulled from the vendor_htc_heroc repo into vendor/htc/heroc. If something got trashed, the proprietary files can also be copied from the device/htc/heroc/prebuilt/proprietary folder, and the vendor device makefiles can be regenerated by running setup-makefiles.sh in the device/htc/heroc folder.
It is true that if building from CM7 or other repos, you will probably need to populate the proprietary files into the vendor/htc/heroc/... directories by running extract-files.sh or pulling them from koush's proprietary_vendor_htc repo (where vendor files for all CM7 supported htc devices are stored). You can clone his repo by running (in some other folder/location):
Code:
git clone git://github.com/koush/proprietary_vendor_htc.git
Then copying the heroc folder to vendor/htc/heroc.
This can come in handy if your mobile doesn't have a TeamHeroC or CM7 based ROM loaded, you can't connect to the machine you are building on, or your device is experiencing technical difficulties.
After an initial successful build you should be able to generate an update by another repo sync, lunch, mka bacon.
I would generally recommend doing a make clobber to wipe out the previous build artifacts and ensure a clean build when you generate the update. This does mean that you will recompile everything, so if you are working with a machine that takes a long time to build you may only want to do this if you are having problems or seeing unexpected results. My current build system can do a complete build from scratch in about 15 minutes, so I am now in the habit of doing this every time I build. The machine I originally used to build took over 90 minutes, so I was less likely to invoke clobbering time unless I had issues or was ready to post a release.
awesome guide!!! you the man!

[TUTORIAL ] Beginning development-the easy way

Ok so this is a guide that me and my friend made for compiling ROMs for our LG-P350 Now, this is pretty much universal and can be used for general development
This is the stuff you will need :
Ubuntu-can be found on the Ubuntu website http://www.ubuntu.com/start-download?distro=desktop&bits=64&release=lts (this is a direct link to the Ubuntu 12.04 64-bit version)
Python (included)
GNU Make
Java Development Kit (JDK) 6
Git
Before you can do anything you need to install Ubuntu. You can go with newer versions but i still think that 10.10 is best and this guide is adapted to it. You can install it like dual boot or use Wubi (Windows Ubuntu Installer). However if you choose Wubi there is a good chance that you won't have enough storage, so that's not recommended.Those who want to dual-boot check out this post http://forum.xda-developers.com/showpost.php?p=34669858&postcount=26
NOTE: You can do this in a virtual machine (for example VM Ware and Virtual box) but it will be a lot slower unless you have a VERY strong CPU and a LOT of RAM.
Generally Python is not needed since it's already in Ubuntu. However if you want to install it separately here's how:
First of all open the terminal. Now copy/paste these codes (one by one) and execute them:
Code:
sudo apt-get install build-essential gcc
cd Downloads
wget http://www.python.org/ftp/python/2.5.6/Python-2.5.6.tgz
tar -xvzf Python-2.5.6.tgz
cd Python-2.5.6
./configure --prefix=/usr/local/python2.5
make
make test
sudo make install ([B]NOTE[/B]: [I]You will be asked for your password, enter it and press enter[/I])
sudo ln -s /usr/local/python2.5/bin/python /usr/bin/python2.5
Now you need Sun JDK 6. Same procedure as with Python:
Code:
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk
For those who get package error try these:
Code:
sudo add-apt-repository ppa:sun-java-community-team/sun-java6
sudo apt-get update
sudo apt-get install sun-java6-jdk
sudo update-java-alternatives -s java6-jdk
Now that JDK is installed it's time for GNU Make:
First of all download GNU Make from link given. Download version 3.82
Now extract the downloaded file to your Home directory.
Go to Home directory and change the name of GNU Make To make
Now open the Terminal and type the following codes
Link: http://ftp.gnu.org/gnu/make/
Code:
cd make
./configure
sudo make install
Now make is installed.
Next, we are going to install the dependencies:
FOR UBUNTU 10.10
Codes to type in terminal :
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
export USE_CCACHE=1
If that method didn't work then try this:
You use the same commands BUT the first one is:
sudo apt-get install git-core gnupg flex bison gperf build-essential
Now it should download some stuff. When its done you need to do the same for the rest in the right order.
NOTE: Since I don't remember the right order i will just put the commands how they should be written if you get error read what's missing and put that in first.
Here are the rest of the lines:
Code:
sudo apt-get install zip curl
sudo apt-get install zlib1g-dev
sudo apt-get install libc6-dev
sudo apt-get install lib32ncurses5-dev
sudo apt-get install ia32-libs
sudo apt-get install x11proto-core-dev
sudo apt-get install libx11-dev
sudo apt-get install lib32readline5-dev
sudo apt-get install lib32z-dev
sudo apt-get install libgl1-mesa-dev g++-multilib
sudo apt-get install mingw32
sudo apt-get install tofrodos python-markdown
sudo apt-get install libxml2-utils
sudo apt-get install xsltproc
FOR UBUNTU 12.04
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
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Now for the Android SDK, ADB and ADB path:
1. SDK (Software-Development-Kit) :
Go to this link and download the Android SDK for Linux:
http://developer.android.com/sdk/index.html
After downloading it, extract it to the Home folder. You can probably extract where you want and change all the steps below to to fit your set up, but I like putting it in Home folder.
When you have extracted it in the Home folder change the name of the folder of android-sdk-linux to sdk.
Then open the Terminal and run these codes:
Code:
cd ~/sdk/tools/
./android sdk
When you run this, a window will pop up. For this you only need "Android SDK Tools" and "Android SDK Platform-tools". Just check these two and install them.
2. ADB (Android-Debug-Bridge):
Run this command to see if your ADB works. You have to have your android device connected in debugging mode.
Run these codes in the Terminal :
Code:
cd ~/sdk/platform-tools ./adb devices
When you entered the codes above, you should see something similar to this:
List of devices attached 0123456789ABCDEF device
NOTE: If you see output like given bellow we need to give the device permissions. Don't worry I had this too when I set my computer up for the first time.
List of devices attached ???????????? no permissions
Here is how we fix it:
Open the Terminal and type this:
Code:
gksudo gedit /etc/udev/rules.d/51-android.rules
After you've entered it, a window will pop up that will be blank. Now add the following commands and save it.
Code:
SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", MODE="0666"
Now save this File And follow the given codes
After you've entered those codes type these codes in too.
Code:
sudo service udev restart
sudo adb kill-server
sudo adb start-server
After you've entered those codes, restart Ubuntu.
Now to see if the problem is solved type these codes in:
Code:
cd ~/sdk/platform-tools ./adb devices
If everything is ok a output similar to this will be shown:
List of devices attached 0123456789ABCDEF device
Now to add the ADB path to system, so you don't have to cd to the SDK folder every time you want to use ADB:
So, first open up .bashrc with these codes:
Code:
sudo gedit ~/.bashrc
A window will pop up and there will be some text there. Scroll down to the bottom and add these lines:
Code:
export PATH=${PATH}:~/sdk/tools
export PATH=${PATH}:~/sdk/platform-tools
After you've done that, save it and reboot Ubuntu.
If everything is ok, you will get some output when you type the following codes in the terminal.
Code:
./adb devices
OR
Code:
adb shell
If you see:
Code:
adb not found[CODE]
Then it means you've done something wrong and ADB is not configured.
Next is GIT:
Open the browser and download git from given link
[URL]http://git-core.googlecode.com/files/git-1.7.9.6.tar.gz[/URL]
Extract GIT-1.7.9.6.tar.gz to your home directory
Rename the folder you extracted to from GIT-1.7.9.6.tar.gz to git
After you've done that, enter the following codes in the Terminal
[CODE]sudo aptitude build-dep git-core
sudo apt-get install zlib1g-dev
cd git
./configure
make
sudo make install
NOTE: If it doesn't work then install from this link:
http://kibyegon.wordpress.com/2010/0...u-lucid-10-04/
If the commands from above are not working then try this:
Code:
sudo apt-get install git-core
sudo apt-get install git
git
If it worked it should show this:
Code:
usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path]
[-p|--paginate|--no-pager] [--no-replace-objects]
[--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]
[--help] COMMAND [ARGS]
The most commonly used git commands are:
add Add file contents to the index
bisect Find by binary search the change that introduced a bug
branch List, create, or delete branches
checkout Checkout a branch or paths to the working tree
clone Clone a repository into a new directory
commit Record changes to the repository
diff Show changes between commits, commit and working tree, etc
fetch Download objects and refs from another repository
grep Print lines matching a pattern
init Create an empty git repository or reinitialize an existing one
log Show commit logs
merge Join two or more development histories together
mv Move or rename a file, a directory, or a symlink
pull Fetch from and merge with another repository or a local branch
push Update remote refs along with associated objects
rebase Forward-port local commits to the updated upstream head
reset Reset current HEAD to the specified state
rm Remove files from the working tree and from the index
show Show various types of objects
status Show the working tree status
tag Create, list, delete or verify a tag object signed with GPG
See 'git help COMMAND' for more information on a specific command.
Now we will download the Repo and get the source code:
Codes to type in the Terminal :
Code:
mkdir ~/bin
PATH=~/bin:$PATH
sudo apt-get install curl
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo
mkdir source
cd source
Ok so up to this part its mostly universal. However after this you need to sync up sources for your device. This will probably take a long time depending on your internet speed since the source is very big (also it will take up a lot of drive space: 14-30GB). After that you should build.
How to build
First you will need to get proprietary drivers from your device.
Connect your device via USB and enter the following commands (from the root of your source repository):
Code:
cd device/xxx/xxx where x is the path to your device
./extract-files.sh
cd ../../..
NOTE: Some developers can include these files in the source itself or can make them available for download from their Github page. Check that out with your developer for more info.
And start the build:
Code:
. build/envsetup.sh xxx
NOTE:Here x also varies since its unique for every device model
Now Android is building. You may need to wait a long time (depending on your hardware-mainly CPU and RAM for example I have a quad core 2.92Ghz CPU and 6GB of HyperX DDR3 ram and it took me about 10min for CM7 and about 20-30 min for CM9).Once it's done you should get this message:
Code:
Package complete:xxx.zip
That is your flashable .zip file you install from recovery.
Credits: Many thanks go to Keyur Maru who helped me learn how to develop and for making the base of this guide.
Reference: http://source.android.com/source/downloading.html
Very good tutorial for beginner
sangosnip69 said:
Very good tutorial for beginner
Click to expand...
Click to collapse
Thanks we tried our best since this is supposed to boost our dev base for our LG
Definitely one to try at home!
Sent from my GT-I9100 using xda premium
Wow 10min is real fast!! I recently tried CM9 directly from one of the Dev's forked repo and after about 4hours of build I got some build error! I need to get a better computer soon if I plan to get my hands real dirty! And if I may I have few suggestions - please mention that it will take a while to download the full repo from google sources else beginners may end up thinking something is wrong(which I did since it took me one full day to sync everything) and that it needs atleast 20-30GB disk space too..(Coz not everyone has Ubuntu as the only OS, I have three in my lapi!!)
A very good guide on the whole for a beginner!!!
pranks1989 said:
Wow 10min is real fast!! I recently tried CM9 directly from one of the Dev's forked repo and after about 4hours of build I got some build error! I need to get a better computer soon if I plan to get my hands real dirty! And if I may I have few suggestions - please mention that it will take a while to download the full repo from google sources else beginners may end up thinking something is wrong(which I did since it took me one full day to sync everything) and that it needs atleast 20-30GB disk space too..(Coz not everyone has Ubuntu as the only OS, I have three in my lapi!!)
A very good guide on the whole for a beginner!!!
Click to expand...
Click to collapse
Very true a great in depth and very informative tutorial for noobs like i was this would have helped me a lot.... Great work
btw pranks1989 i can help you with compiling for defy.... I used to compile roms from eppy's and quarx2k github and never got a error once it else onece eppy pinted out the mistake i was doing.... just send me a pm of your errors and i will try help
Great start for me!
You have been thanked!
Great start for me!
What would the procedure be if you want to create a rom that you can flash via Odin or Heimdall on a Mac client?
The guide I've been looking for ever since I had my first Android device (actually, my Optimus Me is my first Android device)...
Thanks for this great guide. I will try it today.
I already compiled a Rom, it took me 40 min. AMD 8 Core 3,1 MHz and 16 GB DDR3
But when i try a different device i always get errors, i hope your Guide will get me in to it.
serendipityguy said:
You have been thanked!
Great start for me!
What would the procedure be if you want to create a rom that you can flash via Odin or Heimdall on a Mac client?
Click to expand...
Click to collapse
I don't know but it's surely different for odin(I'm not sure that you can).And I don't know on mac either since I use ubuntu and windows. You can look up info on this on the official Android dev website.
Sent from my Optimus Me using xda premium
nerot said:
I don't know but it's surely different for odin(I'm not sure that you can).And I don't know on mac either since I use ubuntu and windows. You can look up info on this on the official Android dev website.
Sent from my Optimus Me using xda premium
Click to expand...
Click to collapse
Odlicno objasnjeno za pocetnike. Svaka cast
Good Beginners Guide. Thank you.
But 90% of it can also be found here:
http://source.android.com/source/initializing.html
This is what i used to build android for the pandaboard a few weeks ago.
And then I have a few questions.
1.
Why do you compile git when you can also download it from apt-sources? Imho this is just confusing for beginners.
2.
Where do you use git in your tutorial?
3.
Didn't you forget lunch and make at the very end of your tutorial?
". build/envsetup.sh" only sets up the environment, imho
(see also here: http://source.android.com/source/building.html)
nerot said:
First you will need to get proprietary drivers from your device.
Connect your device via USB and enter the following commands (from the root of your source repository):
Code:
cd device/xxx/xxx where x is the path to your device
./extract-files.sh
cd ../../..
Click to expand...
Click to collapse
How do I find out what the path is from my device?
I would add the option to install Ubuntu in a VM. Both VMWare player and VirtualBox are free and well supported. This way one can actually create some pre-packaged images with which one can start development right away. In fact I've already made two of them a year ago (one for Froyo and one for Gingerbread):
http://forum.xda-developers.com/showthread.php?t=881845
http://forum.xda-developers.com/showthread.php?t=1022407
One might also make on for ICS (for that Ubuntu 12.04 is also good, and since VMWare Player is free one could use that instead of VirtualBox, as VMWP has more user-friendly features)
If I had a nickle for every time I've seen a thread like this, I would have... a nickle.
Thank you from the bottom of my /dev/hda1
sztupy said:
I would add the option to install Ubuntu in a VM. Both VMWare player and VirtualBox are free and well supported. This way one can actually create some pre-packaged images with which one can start development right away. In fact I've already made two of them a year ago (one for Froyo and one for Gingerbread):
http://forum.xda-developers.com/showthread.php?t=881845
http://forum.xda-developers.com/showthread.php?t=1022407
One might also make on for ICS (for that Ubuntu 12.04 is also good, and since VMWare Player is free one could use that instead of VirtualBox, as VMWP has more user-friendly features)
Click to expand...
Click to collapse
True however unless you have a LOT of ram and a hexa-core CPU compilation under a vm is significantly slower and that's why I didn't add it.But the procedure is the same anyway.
Sent from my Optimus Me using xda premium
Gigadroid said:
How do I find out what the path is from my device?
Click to expand...
Click to collapse
Google is your friend
Sent from my Optimus Me using xda premium
TheBadFish said:
Good Beginners Guide. Thank you.
But 90% of it can also be found here:
http://source.android.com/source/initializing.html
This is what i used to build android for the pandaboard a few weeks ago.
And then I have a few questions.
1.
Why do you compile git when you can also download it from apt-sources? Imho this is just confusing for beginners.
2.
Where do you use git in your tutorial?
3.
Didn't you forget lunch and make at the very end of your tutorial?
". build/envsetup.sh" only sets up the environment, imho
(see also here: http://source.android.com/source/building.html)
Click to expand...
Click to collapse
1.Idk I found this thing simple as well
2.I will review it later since I'm on my phone now and its 00:13 here
3.I don't think it's necessary since I use the same procedure for my rom compilation. I will add it tough just in case someone gets an error.Thanks for the tip.
Sent from my Optimus Me using xda premium
I'll try this on my six core seeing as it would make a perfect devving machine.
just following
Just posting here to follow. I will have to try this tonight. This looks awesome!

[GUIDE] How to build firefoxOS from source with Ubuntu 12.10/13.04 x64

I have yet to see a good, COMPLETE, step by step tutorial for building firefoxOS, so since I figured it out thought I would document the steps I took and get a good guide going for us.
**This guide is written with Samsung Nexus S 4G (crespo4G) specifically in mind, but it can easily be adapted to any officially supported device
what you will need:
a nexus s 4g (or other officially supported device)
a pc capable of compiling android from source (ie: minimum 2x core cpu, 4gb ram)
ubuntu 12.10 or 13.04 64-bit (google it, it's open source!)
broadband internet (trust me, you want a minimum of 10mbit/sec)
a basic understanding of terminal command, adb and fastboot
ok, let's get started!!
I'll assume you've already installed ubuntu and gotten the network set up. If not, do so now.
First, set up the build environment....
Install java:
Code:
$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
Code:
$ sudo apt-get update
Code:
$ sudo apt-get install sun-java6-jdk
If you have multiple java installations you need to change the version your system is using
Code:
$ wget http://webupd8.googlecode.com/files/update-java-0.5b
Code:
$ chmod +x update-java-0.5b
Code:
$ sudo ./update-java-0.5b
(it says java 0.5, but it's java 6 don't worry)
choose any java 6 installation and save.
Install android sdk:
download the sdk from android dev site
http://developer.android.com/sdk/index.html
extract it to ~/android/sdk/.....
Code:
$ cd ~/android/sdk/tools
Code:
$ ./android update sdk
update all packages
Install adb & fastboot:
Code:
$ sudo add-apt-repository ppa:nilarimogard/webupd8
Code:
$ sudo apt-get update
Code:
$ sudo apt-get install android-tools-adb android-tools-fastboot
test it!!!
Code:
$ adb devices
Install dependancies:
ubuntu 12.10+ dependancies
Code:
$ sudo apt-get install autoconf2.13 bison bzip2 ccache curl flex gawk gcc g++ g++-multilib gcc-4.6 g++-4.6 g++-4.6-multilib git ia32-libs lib32ncurses5-dev lib32z1-dev libgl1-mesa-dev libx11-dev make
64 bit dependancies
Code:
$ sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so
Code:
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Clone the repo:
Code:
$ git clone git://github.com/mozilla-b2g/B2G.git
Code:
$ cd ~/B2G
Download the source:
Plug in your device, ensure ICS or newer is installed, then enable usb debugging
Code:
$ ./config.sh nexus-s-4g
This is where you can change the guide to work with any supported device. The proper syntax is as follows
Code:
$ ./config.sh (device name)
where (device name) is one of the following:
- galaxy-s2
- galaxy-nexus
- nexus-s
- nexus-s-4g
- otoro
- unagi
- pandaboard
- emulator
- emulator-x86
This takes about an hour
When the source is done downloading, create a file called .userconfig with gedit containing the following two lines of code then save and drop it in ~/B2G
export CC=gcc-4.6
export CXX=g++-4.6
Building from source:
if you're not already there
Code:
$ cd ~/B2G
Code:
$ ./build.sh
*if you get build errors, use a -j option. -j1 option tells your pc to use only one cpu core. -j2 tells it to use 2, and so on...
Using less cpu cores can lead to a more stable build environment and reduce errors
If you use a -j1 option, the syntax is as follows:
Code:
$ ./build.sh -j1
This takes HOURS (probably 4-5)
Flashing b2g:
when it's done, find the .img files in ~/B2G/out/product/target/crespo4g
Code:
$ cd ~/B2G/out/product/target/crespo4g
Boot your device to the bootloader
Code:
$ sudo fastboot flash boot boot.img
Code:
$ sudo fastboot flash system system.img
Code:
$ sudo fastboot flash userdata userdata.img
To create a flashable zip:
plug in your device and enable usb debugging
Code:
$ sudo adb pull /system ~/Documents/crespo4g/b2g
Code:
$ sudo adb pull /data ~/Documents/crespo4g/b2g
add the meta-inf from another nexus s 4g flashable zip
create a .zip with the 3 directories (meta-inf, system and data) and the boot.img you just created
flash in recovery after a FULL wipe (system, boot, data, cache, dalvik)
reserved
Reserved again
Thanks ! Will try this !
Sent from my Nexus s using xda app-developers app
Big Thx Good Guide

Guide: How To Build Your Own Stock AOSP For Your Nexus 7 (2013) KVT49L

PHP:
Guide: How To Build AOSP From Source With Linux Mint 16 - Nexus 7 (2013) KVT49L
Important Note: Do NOT use Linux Mint 16 KDE to do this guide, it will seriously mess up your programs menu when you remove the old Java. This guide has been tested and is working on Linux Mint 16 Cinnamon and Linux Mint 16 MATE
Got the KVT49L repos working and guide is updated to reflect this. This build includes several bug fixes from the KOT49H build but it is NOT 4.4.3, just an updated version of 4.4.2.
I started this guide as I could not find a step by step detailed guide to build a stock AOSP from source with Linux Mint 16.
All the steps should work in Ubuntu but I haven't tried so not 100% sure of that.
All this assumes your tablet is already unlocked.
Here goes:
Important note: Anything that is bolded text other then section titles are command line entries that are done in Terminal in Linux Mint. I thought it would be simpler to do it this way then say 'in Terminal' for every entry.
First we need to remove Icedtea Java or OpenJDK.
In Terminal: sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
Then in Terminal: sudo add-apt-repository ppa:webupd8team/java
Next: sudo apt-get update && sudo apt-get install oracle-java6-installer
Be sure to accept the licence agreement to install java when it prompts you.
Next: sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 lib32z-dev libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc readline-common libreadline6-dev libreadline6 lib32readline-gplv2-dev libncurses5-dev lib32readline5 lib32readline6 libreadline-dev libreadline6-dev:i386 libreadline6:i386 bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev lib32bz2-dev libsdl1.2-dev libesd0-dev squashfs-tools pngcrush schedtool libwxgtk2.8-dev python
Follow this with: sudo apt-get install -f
This should fix any dependency errors.
Now: sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Next download the SDK Tools For Linux x64 from this link. https://developer.android.com/sdk/index.html
Then: cd ~/Downloads
And: tar -xvf android-sdk_r22.6.2-linux.tgz
or tab the latest 'android-sdk_xxx.tgz file it they update it and it is a newer version then the one I downloaded to do this.
You can rename the android.sdk_xxx.tgz folder you extracted to SDK.
Then: cd ~/Downloads/SDK/tools
Next: ./android sdk
It will show you the tools that can be installed, just install the highest version API of 'Platform Tools' and 'Tools' for the latest android version '4.4.x' it shows.
Make sure you install the repo tool, in Terminal:
With: mkdir ~/bin
Then: curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
And: curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
Now: sudo chmod a+x ~/bin/repo
Now sudo nano ~/.bashrc
Add this to the bottom of the text: export PATH=~/bin:$PATH
Then hit Ctrl-O and enter, it should say it saved the file followed by Ctrl-X to exit.
Then restart bash: source ~/.bashrc
Now lets Initialize the Repository for GIT configuration
First : git config --global user.name {Your Name}
Then: git config --global user.email {[email protected]}
If you have not registered with the GitHub website just doing these two steps works fine.
If you have registered with the GitHub website create a file called .netrc in your home directory, add your GitHub password to it with no spaces on the first line and change the permissions to '600' or you will have to continually authenticate when building the source.
In Terminal:nano ~/.netrc
Then add just your GitHub password (like I said you only need to do this if you have registered with GitHub).
Then 'Ctrl-O' and enter and it'll say it saved it, then 'Ctrl-X' to exit nano.
And then: chmod 0600 ~/.netrc
Now: mkdir ~/AOSP
Then: cd ~/AOSP
Now you get the source code etc: repo init -u https://android.googlesource.com/platform/manifest -b android-4.4.2_r2
Then do in Terminal : repo sync -j12
Use repo sync -j12 for a quad core CPU or Intel I5 or if you have say an quad core I7 with 8 threads you can use repo sync -j24 to speed things up etc.
I have a I7 3930k with 12 threads so I used repo sync -j36. This gives you three threads per logical CPU and speeds things along quite well.
It may take several hours for the sync to finish.
After the sync finishes go to https://developers.google.com/android/nexus/drivers#razorkot49h and download the drivers (binaries) for the Nexus 7 (Wi-fi). You do need to use the KOT49H binaries and they work fine with the KVT49L build.
In Terminal: cp ~/Downloads/asus-flo-kot49h-a9532596.tgz ~/AOSP
Then: cp ~/Downloads/broadcom-flo-kot49h-c33beb3d.tgz ~/AOSP
And: cp ~/Downloads/qcom-flo-kot49h-f92d75b1.tgz ~/AOSP
In Terminal: tar -xvf asus-flo-kot49h-a9532596.tgz
And: tar -xvf broadcom-flo-kot49h-c33beb3d.tgz
Then: tar -xvf qcom-flo-kot49h-f92d75b1.tgz
If you have closed the Terminal after the sync remember to do: cd ~/AOSP
when you open Terminal again before doing the tar commands.
They should be the file names of the binaries for KOT49H that you are extracting but if for any reason the file names are different use the Tab key and tab the correct names in after 'tar -xvf'.
If the names ARE different I'd really check to make sure you downloaded the correct flo binaries.
Then: ./extract-asus-flo.sh
Now also in Terminal: ./extract-broadcom-flo.sh
And: ./extract-qcom-flo.sh
Hint: It will show you a really long licence agreement for each binary that you scroll by hitting the Enter key that takes forever to scroll one line at a time, it has 8 sections and several subsections. Hold the Enter key until you just get past Part 8, section D of the licence and stop there. Now hit enter a few more time one key stroke at a time until you finish Part 8 section E and see the 'Type 'I ACCEPT' to agree to the licence.' and type I ACCEPT If you just scroll by holding the Enter key all the way to the bottom of the licence you'll get an error you never accepted the licence. Then close Terminal.
Building the Sources
Now open Terminal: cd ~/AOSP
Then: . ./build/envsetup.sh
Now to select the type of device we give the following command: lunch
Choose: 11. aosp_flo-userdebug
by entering '11' or whatever number aosp_flo is after your enter the 'lunch' command (it was number 11 on mine).
Now: make -j12 for a quad core cpu or I5 or make -j24 for an I7 etc.
With your tablet connected to your USB cable and the PC: adb root
Then: adb reboot bootloader
And: cd out/target/product/flo
Lastly: fastboot -w flashall
If you get an error on the 'adb' and 'fastboot' commands do these first:
sudo apt-get install android-tools-adb
and: sudo apt-get install android-tools-fastboot
If you get an error when you fastboot -w flashall to do with a '-p' flag needed or 'android-info.txt' is missing it means you forgot to to the 'lunch' command before building the source. Go back to the 'Building The Sources' section.
If you already have a custom recovery installed like TWRP and would rather build a zip file to install with the recovery rather then flash it in adb instead of make -j12 do: make -j12 otapackage
In the /home/"yourusername"/AOSP/out/target/product/flo you have an aosp_flo-ota-eng.___.zip file to flash in your custom recovery.
You will need to wipe/reset data your in recovery before flashing it and re-install all your apps etc.
Installing Custom Recovery, Rooting and Google Apps
If you want to install a custom recovery download TWRP http://techerrata.com/browse/twrp2/flo
Rename the file in Downloads to recovery.img
Then in Terminal with your tablet connected by USB to your PC: adb root
And: adb reboot bootloader
Then: cd ~/Downloads
And: fastboot flash recovery recovery.img
Use the volume buttons on your phone to scroll onto "Restart Bootloader" and hit the powerbutton to select it. After the bootloader reloads, use the volume buttons to scroll to "Recovery Mode" and hit power button again to select it. You should then be in your custom recovery.
If for any reason you get a red android and no recovery just boot into fastboot mode again and reinstall the recovery.img.
And finally, to root your tablet download SuperSu http://download.chainfire.eu/supersu and install the supersu.zip in recovery mode.
Download PA GAPPS from here http://forum.xda-developers.com/showthread.php?t=2397942 if you want the zip to install Google Apps in recovery.
You now have your own rooted vanilla AOSP you compiled yourself, congrats!
P.S. Very likely a good idea wipe/reset data in recovery and start with a clean install, you'll need to install all your programs and stuff anyways I'm sure.
P.P.S.I did download and install the XPOSED Framework apk http://forum.xda-developers.com/showthread.php?t=1574401 after I put AOSP on my tablet so I could install Advanced Power Menu and some other add-ons like Boot Manager and Greenify. As well I installed a custom kernel with Faux Sound and Faux Kernel enhancements.
I think for the download repo tool section you only need the second (commondatastorage) one. The first one no longer works.
Other than that, it looks pretty good.
Awesome thanks!!!
Sent from my Nexus 7 using Tapatalk
meekrawb said:
I think for the download repo tool section you only need the second (commondatastorage) one. The first one no longer works.
Other than that, it looks pretty good.
Click to expand...
Click to collapse
Yeah, you're right, I checked into it.
Thanks!!
I updated the guide and removed that.
meekrawb said:
I think for the download repo tool section you only need the second (commondatastorage) one. The first one no longer works.
Other than that, it looks pretty good.
Click to expand...
Click to collapse
Edit: I see the problem with the second curl command, when I save the post it shortens the url in the command with dots and when you copy and paste it it is incorrect and does not download, I'm trying to figure out how to fix it, every time I save the post no matter if I take the url code out or not it shortens it.
Second edit: I figured out a work-around and added it to the guide. It's half baked how I had to do it but at least it's working now.
hey all, sorry if this is off topic, but ive been looking for help everywhere and im about ready to give up, im trying to build evervolv for flo, i've got the source downloaded and im ready to build, the only thing im having trouble with is getting all the propratairy blobs and device spacific files from the n7. is there a way i can just sync up with cyanogenmods device repo or over right the repo that is build into evervolvs source? thanks for any help.
Andromendous said:
hey all, sorry if this is off topic, but ive been looking for help everywhere and im about ready to give up, im trying to build evervolv for flo, i've got the source downloaded and im ready to build, the only thing im having trouble with is getting all the propratairy blobs and device spacific files from the n7. is there a way i can just sync up with cyanogenmods device repo or over right the repo that is build into evervolvs source? thanks for any help.
Click to expand...
Click to collapse
download the binaries and extract them as was shown in the OP.
Then do
make clobber
. build/envsetup.sh
lunch
make (whatever option you decide, otapackage etc)
Make clobber is important because it ensures you start clean and that the binaries will be properly implemented in your rom.
oldsoldier2003 said:
download the binaries and extract them as was shown in the OP.
Then do
make clobber
. build/envsetup.sh
lunch
make (whatever option you decide, otapackage etc)
Make clobber is important because it ensures you start clean and that the binaries will be properly implemented in your rom.
Click to expand...
Click to collapse
ok, i did all that and still get the same error like below. dunno if i mentioned it, but i am trying to build evervolv
EDIT: the option (5) was "aosp_flo-userdebug
KedarWolf said:
Edit: I see the problem with the second curl command, when I save the post it shortens the url in the command with dots and when you copy and paste it it is incorrect and does not download, I'm trying to figure out how to fix it, every time I save the post no matter if I take the url code out or not it shortens it.
Second edit: I figured out a work-around and added it to the guide. It's half baked how I had to do it but at least it's working now.
Click to expand...
Click to collapse
I think you had the "commondatastorage" one right before. It is the "curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo" that doesn't work anymore.
So instead of those two steps, it should be just this one:
Download the Repo tool and ensure that it is executable:
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
I hope that makes more sense.
Great post! Thanks for this!
meekrawb said:
I think you had the "commondatastorage" one right before. It is the "curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo" that doesn't work anymore.
So instead of those two steps, it should be just this one:
Download the Repo tool and ensure that it is executable:
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
I hope that makes more sense.
Click to expand...
Click to collapse
I fixed the second curl command so it works. Not 100% sure you need the first curl command but it does work in Linux Mint 16 and doesn't mess anything up so I left it in.

[GUIDE] How to compile/build Paranoid Android from source for the Xperia Z1

This guide will help you you to compile your "own" Paranoid Android ROM!
V1.0 - 2014-06-09
{
"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"
}
Picture loaned from SuperHanss Paranoid Android thread.
CREDITS AND THANKS TO:
Raum1807 for his awesome cm11 guide, I used that as a template.
SuperHanss
gokussjx
Pirateghost
SferaDev
MasterAwesome
Paranoid Android TEAM
CM TEAM
Please pm me if i forgot someone or if have to take this down!
Overview
1: Preparation
2: Install the required packages to build
3. Install & setup Java
4. Initialize repo and sources
5. Building the ROM
6. Renew sources and build again
I recommend you to read the whole guide one time without doing anything. Then you can start over and mimic the steps.
1. Preparation
Things you need for building:
A computer
An internet connection
An open mind and common knowledge
Time
Patience
First of all, you need a running up-to-date Ubuntu/Linux system. I am using Ubuntu 14.04 LTS 64-bit. I am running this in a Virtual-box over Windows and it is working fine for me. You can find simple guides on how to setup your Virtual-box on Google. I recommend using at least 100 GBs of hard drive space.
Use the built in terminal to make the steps. A terminal window can be opened by pressing Ctrl+Alt+T. Every single command for the terminal is marked with a $ sign. Just paste every command (without the $ sign) to your terminal window and there shouldn't be any problem.
IMPORTANT: INSTALL EVERYTHING AS A NORMAL USER. DON'T INSTALL AS ROOT!
2. Install the required packages to build (Ubuntu 14.04 LTS 64-bit)
Install packages:
Code:
$ sudo apt-get install bison build-essential curl flex \
g++-multilib gcc-multilib git-core gnupg gperf \
lib32ncurses5-dev lib32readline-gplv2-dev lib32z1-dev \
libesd0-dev libncurses5-dev libsdl1.2-dev \
libwxgtk2.8-dev libxml2 libxml2-utils lzop \
openjdk-6-jdk openjdk-6-jre pngcrush schedtool \
squashfs-tools xsltproc zip zlib1g-dev
3. Install & setup java
You need a version 6 Java Development Kit for building Paranoid Android. Usually, the SUN JDK 6 is recommended. But there is another way: you can use the OpenJDK 6. When you installed the required packages as described above, you will just need to configure your Java installation. I use OpenJDK6 and it is working just fine!
Check your Java version:
Code:
$ java -version
Verify the symlinks. Javac, Java, Javaws, Javadoc, Javah, Javap and Jar should all point to the right Java location and version:
Code:
$ ls -la /etc/alternatives/java* && ls -la /etc/alternatives/jar
If they are pointing to the wrong versions you have to change that to OpenJDK6.
Select the default Java version for your system:
Code:
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javaws
$ sudo update-alternatives --config javadoc
$ sudo update-alternatives --config javah
$ sudo update-alternatives --config javap
$ sudo update-alternatives --config jar
That's it.
4. Repo and sources
Install repo:
Repo is a tool that makes it quite easy to download and maintain the sources of Paranoid Android.
Code:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ cd ~/bin
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
Create the working directory:
Code:
$ mkdir ~/paranoid
$ cd ~/paranoid
Initialize Repo:
Code:
$ repo init -u git://github.com/AOSPA-legacy/manifest.git -b kitkat
Here you will probably get an error. You have to enter your credentials
Run these two commands to setup your crendentials.
Code:
$ git config --global user.name "Your Name"
$ git config --global user.email [email protected]
Setup sources:
Now you will download the source code.
Code:
$ repo sync
You can make some customizations to these commands, for example you can download more items parallel. Of course this will take more bandwidth so it’s up to you.
Code:
$ repo sync -h
Usage: repo sync [...]
Options:
-h, --help show this help message and exit
-f, --force-broken continue sync even if a project fails to sync
-l, --local-only only update working tree, don't fetch
-n, --network-only fetch only, don't update working tree
-d, --detach detach projects back to manifest revision
-q, --quiet be more quiet
-jJOBS, --jobs=JOBS number of projects to fetch simultaneously
-s, --smart-sync smart sync using manifest from a known good build
repo Version options:
--no-repo-verify do not verify repo source code
So for example if you want to fetch 10 jobs at the same time use this command.
Code:
$ repo sync -j10
Wait until it's finished - takes some time to download the hefty 12 GB of source code!
Take a break, have a KitKat!
If the process hangs use Ctrl+C to break out of it and resume the download with another
Code:
$ repo sync
If you are running into a lot of syncing errors the reason might be that the 'repo sync' command is establishing four threads automatically. This might be too much. So try to change the command to run with one thread only by using
Code:
$ repo sync -j1
5. Building the ROM
Turn on caching to speed up your build.
You can speed up subsequent builds by adding
Code:
export USE_CCACHE=1
to your ~/.bashrc file.
To access this file run the following
Code:
$ gedit ~/.bashrc
Then, specify the amount of disk space to dedicate to ccache by typing this from the top of your Android tree:
Code:
prebuilts/misc/linux-x86/ccache/ccache -M 50G
where 50G corresponds to 50GB of cache. This only needs to be run once and the setting will be remembered. Anywhere in the range of 25GB to 100GB will result in very noticeably increased build speeds (for instance, a typical 1hr build time can be reduced to 20min). If you're only building for one device, 25GB-50GB is fine. If you plan to build for several devices that do not share the same kernel source, aim for 75GB-100GB. This space will be permanently occupied on your drive, so take this into consideration.
You have all the standard sources ready but some specific sources for your device are still missing. Luckily they will be downloaded when you start to build your rom. Again be sure to be in your top directory.
Now build it:
Code:
$ ./rom-build.sh honami
And the building process starts. First it creates a new manifest called roomservice.xml then it downloads the device specific kernels and such.
If it gives you an error, try to CTRL+C and run repo sync. Then re-do the previous step.
Now it’s time to practice your patience again, the first build will take a long time. A couple of hours depending on your machine setup.
When everything worked as it should you will find your new ROM-image in ~/paranoid/out/target/product/honami
It is called pa_honami-4.4-BETA x-DATE .zip You can flash it via CWM/TWRP as usual.
6. Renew sources and build again
Whenever you like to update your sources and build a new version you have to run these four simple commands:
Code:
$ cd ~/paranoid
$ repo sync
$ ./rom-build.sh honami
Compiling takes less time than it took for creating the ROM the first time because it's only building new parts while reusing old parts that haven't changed.
Good luck and have fun while building!
CREDITS AND THANKS TO:
Raum1807 for his awesome cm11 guide, I used that as a template.
SuperHanss
gokussjx
Pirateghost
SferaDev
MasterAwesome
Paranoid Android TEAM
CM TEAM
Please pm me if i forgot someone or if have to take this down!
reserved
I'm trying to port the latest PA to nexus 10. I did the repo sync, it sync-ed for hours, now I'd like to fire ./rom-build.sh, the only problem is that there is no bom-build.sh to be found in my working dir.... How can that be?
Thank you!
How do I compile for x86_64? Really want to put it on a Surface Pro 6 (2018) and install the linux-surface kernel patches.

Categories

Resources