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

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

Related

How-to compile a fresh Android!

Hi all.
In this thread I'd like to collect all the information I've found scattered in various threads in order to compile Android system and kernel, directly from GIT repo.
Hoping this help who wants to try to compile Froyo from the GIT repo but really doesn't know where to start!!!
All credits for this infos, obviously, doesn't go to me but to all the great persons I've found in this forum, helping me with a lot of informations: Dzo, l1q1d, Kalt_Kaffe, Incubus and many others.
If something of the things written below is not correct... first of all forgive me! I'm only a newbie trying to do something useful for others like me!!! Then please... help me to correct the mistakes!!!
And then, please, forgive my really bad english! Any correction is appreciated!
DISCLAIMER: even if this steps have been personally tested by me everything u'll decide to do u'll do at ur own risk. The flashing procedure may brick your device.
I've implanted all the compiling environment in a virtual machine with the latest Ubuntu (10.04).
NOTE ABOUT VIRTUAL MACHINE: if you are using a virtual machine it's important that you setup it with at least 1,5GB or RAM. With less RAM than this your Android will not compile.
All you need to obtain a fresh Android System is only a lot of time (and patience) and at least 10GB of free disk space.
10GB is the very minimum disk space you need. If you decide to try in a virtual machine I suggest to create a virtual disk at least 20GB.
1) Install needed software
As in the latest Ubuntu version the repositories have the "sun-java6-jdk", with which you cannot compile Android, you have to install the previous Java version from the Jaunty repo. To do this edit, with your favourite text editor and using "sudo", the "etc/apt/sources.list" file adding the following two lines:
Code:
deb http://us.archive.ubuntu.com/ubuntu/ jaunty multiverse
deb http://us.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse
and then, from a terminal, run the following commands:
Code:
sudo apt-get update
sudo apt-get install sun-java5-jdk
After this you can delete/comment the two lines added above in the sources.list file.
Then, according to the instruction described here, install the needed software with the following command:
Code:
$ sudo apt-get install git-core gnupg flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev valgrind
2) Installing repo and configuring the environment
After the installation of the needed software follow this steps to create the right environment for ur compilation. I assume to work in my "/home/virtual" directory. If d'u like to work in another directory simply replace this path with yours in the commands.
Code:
$ mkdir bin
$ PATH=$PATH:/home/virtual/bin/
$ curl http://android.git.kernel.org/repo > /home/virtual/bin/repo
$ chmod a+x /home/virtual/bin/repo
$ mkdir mydroid
$ cd mydroid
3) Downloading, syncing and compiling the source
Now that you are in the destination directory (I've called it "mydroid" but obviously you can call it with every name you want) you've to init and syncing your repo with the one on the server.
The "init" step have to be executed only the first time. Then you can start directly from the "sync" command.
The following steps may need a looooooot of time (about 3 hours in my virtual machine) so you can have one (or two maybe!!!) coffee in the further coffee bar in your city!!!
Anyway let's go:
Code:
$ repo init -u git://androidhtc.git.sourceforge.net/gitroot/androidhtc/manifest -b froyo
$ repo sync
$ . build/envsetup.sh
$ lunch full_vogue-userdebug
$ make
With these commands you'll obtain a system with all languages in it.
You'll find the "system" folder under "out/target/product/vogue". Simply tar it and you're in!!!
4) Compiling the kernel
If you only want to compile the kernel you have to follow this steps (from your repo dir - "mydroid" in my case)
Code:
$ cd kernel
Open, with your favourite text editor, the file "Makefile" and change the CROSS_COMPILE line like the following:
Code:
CROSS_COMPILE=../prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi-
then run the following commands:
Code:
make vogue_defconfig
make
After the compilation you'll find the "zImage" file into "kernel/arch/arm/boot/" and use it like you want (I.E. I compile it with NBHCreator in order to flash it into my Polaris).
That's all, folks!!!
Enjoy!
Initializing project gps ...
fatal: The remote end hung up unexpectedly
error: Cannot fetch gps
way not?
did it finish or did it get stuck and there is more to fetch?

[GUIDE][DEV] Compile any source built rom for your device [ULTRA NOOB FRIENDLY]

I know there are many other guides avalable regarding this, But I tried to focus on the small points also that many guides overlook
that's why I have this for you. Do let know if I have missed something or more details have to be included in case still there is a difficulty in compiling
This thread on Madteam Forums: http://madteam.co/forum/development...lt-rom-for-your-device-(ultra-noob-friendly)/
So lets start with simple things
Basic FAQ:
Q: What is a Source built rom?
A: Source Built Roms are roms that are compiled from source on a Linux Platform! They are not themed manually.
Q: How do we build these type of roms?
A: Setup Linux and then follow this guide.
Click to expand...
Click to collapse
This post/guide is divided into 4 parts:
1. Setting up build environment
2. Machine specifications etc.
3. Device Tree and source basics
4. Syncing Source and Building
PART 1: Setting up build environment​
Type sudo su and then your password to get rid of Admin Permissions
#Installing Python
STEP 1: Open terminal (CTRL + ALT + T)
Then execute the following commands in terminal one by one
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
sudo make install
sudo ln -s /usr/local/python2.5/bin/python /usr/bin/python2.5
Now Python is configured
#Installing JDK
As far as I know PPA which was the earlier method of installing JDK etc. doesn't exist's anymore, So I used another way!
Step 1: Open Terminal (CTRL + ALT + T)
STEP 2: Now we need to download the JDK 6 Binary by executing this command in terminal
Code:
wget --no-check-certificate --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" "http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-x64.bin"
STEP 3: Then we need to run the binary and move it to a shared location:
Code:
chmod +x jdk-6u45-linux-x64.bin
sudo ./jdk-6u45-linux-x64.bin
sudo mv jdk1.6.0_45 /usr/lib/jvm/
STEP 4: Now you have to install all binaries and give them highest priority, This will also overwrite the previous version of Java Binaries in your computer
Code:
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_45/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_45/bin/javac 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_45/bin/javaws 1
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.6.0_45/bin/jar 1
sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk1.6.0_45/bin/javadoc 1
STEP 5: Now check if JDK 1.6 is selected on this:
Code:
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javaws
sudo update-alternatives --config jar
sudo update-alternatives --config javadoc
Now JDK is configured! To check if it is done
Execute this is Terminal
Code:
java -version
Output will be similar to this
Code:
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
#Installing GNU Make
Code:
cd Downloads
wget -o make.tar.gz http://ftp.gnu.org/gnu/make/make-3.81.tar.gz
tar -xvzf make-3.81.tar.gz
cd make-3.82
./configure
sudo make install
These commands are for Make 1.81 if you want to install Make 1.82 Execute these
Code:
cd
wget -o make.tar.gz http://ftp.gnu.org/gnu/make/make-3.82.tar.gz
tar -xvzf make-3.82.tar.gz
cd make-3.82
./configure
sudo make install
Now GNU make is configures
#Installing Android SDK
STEP ONE: Download the SDK from http://developer.android.com/sdk/index.html and extract it in a folder called "sdk" in the Downloads folder
STEP TWO: Now, Execute these commands in terminal
Code:
cd ~/Downloads/sdk/tools/
./android sdk
SDK is configured now :victory:
#Installing required packages:
STEP 1: Open Terminal
Now execute these commands:
Code:
apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev libncurses5-dev x11proto-core-dev \
libx11-dev libreadline6-dev libgl1-mesa-dev tofrodos python-markdown \
libxml2-utils xsltproc pngcrush gcc-multilib lib32z1 schedtool
Good, Now you have successfully setup linux build environment!​
PART 2: Machine specifications and other misc. stuff​
Basic Computer Specs:
2Ghz Dual Core Processor
2GB Minimum ram
50GB File Space (For only one rom source)
*PLEASE NOTE*: This is the basic specification, It really depends on the condition of your ram and cpu!
If you want to use other apps while compilation you should make a 5GB minimum swap partition!
If ram is more than 4GB ram then you don't swap partition!
PART 3: DEVICE TREE AND SOURCE BASICS​
Basic source folders:
/packages - Proprietary rom applications
/framework - Framework (Overall rom UI and stuff)
/device - Device config
/vendor - Vendor Tree and other vendor files
/hardware - Hardware drivers
Q: What is BoardConfig.mk?
A: It's the file where you setup path's to files like toolchain etc. and enable/disable stuff, its very easy to understand. You can find it in your device's tree
Q: Where is build.prop in source?
A. Build.prop is available in the source in the form of system.prop in the device tree!
Q: How to remove ringtones, video editor, CM wallpapers from bulid?
A: Go to device/releasetools/extras.txt and Delete anything you don't want in your build
PART 4: Syncing Source and Building​
# Installing Repo Package
Code:
mkdir ~/bin
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo
STEP 2: Now it is recommended to reboot your computer (No need of sudo su after reboot)
STEP 3: Now make directory:
Code:
mkdir -p ~/rom/android/system
STEP 4: Go into directory and set path for Repo Package
Code:
cd ~/rom/android/system
PATH=~/bin:$PATH
STEP 5: NOW ITS TIME FOR SYNCING:
Their are different sources for different roms:
Some are listed bellow:
MIUI - www.github.com/micode/
Rootbox - www.github.com/Root-Box/
rasbeanjelly - www.github.com/rascarlo/
Xylon AOSP - www.github.com/xyaosp/
PAC-Man - www.github.com/PAC-Man/
CyanogenMod - www.github.com/Cyanogenmod/
CarbonROM - www.github.com/carbondev/
SaberMOD - www.github.com/SaberMOD/
AOKP - www.github.com/AOKP/
From the above collection some are Gingerbread some are ICS and some are JB 4.1/4.2 you have to visit these links via browser and see which source is which and follow the commands given at android.git/platform_manifest.git
Click to expand...
Click to collapse
For CM10.1 source execute this:
Code:
repo init -u git://github.com/CyanogenMod/android.git -b cm10.1
For syncing CM10 source execute:
Code:
repo init -u git://github.com/CyanogenMod/android.git -b jellybean
You have to find for the rest!!
PS: You don't have to execute all the repo init commands written above
Now to sync execute this after the the repo init command
Code:
repo sync
Once it finishes without breaking all the folders will appear in rom/android/system folder
now execute this:
Code:
mkdir -p ~/rom/android/system/device/<ManufacturerName>/<DeviceCodeName>
and extract the device config/tree here
for me its samsung/totoro (galaxy Y, Don't mind )
then do the following:
Code:
mkdir -p ~/rom/android/system/vendor/<ManufacturerName>/<DeviceCodename>
Its the same as for the device folder
Now for compiling:
Code:
. build/envsetup.sh
lunch cm_<DeviceCodename>-eng
brunch cm_<DeviceCodename>-eng
Your build will be located at /rom/android/system/out as <RomName>-date/month/year-UNOFFICIAL-<DeviceCodeName>.zip
HAPPY COMPILING ​
Credits:
MadTeam (motafoca, whitexp etc.) for MADTeam Forums and many help
Team Broadcom CM (bieltv.3, SpaceCaker, Psychogame etc.) for giving my device a quite stable cm.. I learnt to compile because of them! Cheers
BeerGang
mithun46
abhisahara
galaxyfreak
cybojenix
Sniper Killer for supporting me a lot! Thanks dude
prototype-U for Supporting..
Others who supported me
IF YOU LIKE MY GUIDE, DO RATE THIS THREAD A FIVE STAR!
THOSE WHO ARE FACING ERRORS, DO POST YOUR PROBLEM at speed_bot's Source Building Help Thread ​
Good good !! Nicely compiled
abhisahara said:
Good good !! Nicely compiled
Click to expand...
Click to collapse
Thanks
I'll update this guide whenever I get time
Good work on this, I found it quite clear keep up the good work!
Sent from my GT-I9505 using Tapatalk 4 Beta
nicely copied
Aniruddh Chandratre said:
nicely copied
Click to expand...
Click to collapse
Just read what I said at the begging of the thread!
If you are too lazy then:
I know there are many other guides avalable regarding this, But I tried to focus on the small points also that many guides overlook
that's why I have this for you. Do let know if I have missed something or more details have to be included in case still there is a difficulty in compiling
Click to expand...
Click to collapse
And yes, I took reference from others guide... I do give credits!
Have you ever compiled it(successfully) yourself?
Sent from my HTC Desire X using xda app-developers app
prototype-U said:
Have you ever compiled it(successfully) yourself?
Sent from my HTC Desire X using xda app-developers app
Click to expand...
Click to collapse
Yes.. I did..
Thanks for your support
Arnav.G said:
Yes.. I did..
Thanks for your support
Click to expand...
Click to collapse
Where is it?
Sent from my HTC Desire X using xda app-developers app
prototype-U said:
Where is it?
Sent from my HTC Desire X using xda app-developers app
Click to expand...
Click to collapse
It will come...
Please don't spam the thread now! I know you are a RC and you know the rules but still.. Please
http://xda-university.com/as-a-developer/getting-started-building-android-from-source
Nice simplifications...
Noob friendly? Lol! Did you test it on yourself!
When I run the binaries on jdk
I get errors on the 2nd command-Syntax error
Why >
Fang Leone said:
When I run the binaries on jdk
I get errors on the 2nd command-Syntax error
Why >
Click to expand...
Click to collapse
Can you please explain your problem in a little more details?
"This Story Ends Where It Began" - Octavarium (Dream Theater)
Sent from my GT-I9505
Great Guide!!
This is very kind of you to make this helpful thread. It really helped me alot after setting up my new build environment. I ran into an error on you post that you may want to correct, other than that, great work! Here is the typo
"cd Downloads
wget -o make.tar.gz http://ftp.gnu.org/gnu/make/make-3.81.tar.gz
tar -xvzf make-3.81.tar.gz<--this is correct.
cd make-3.82<---it changes here.
./configure
sudo make install"
Hello guys!
I have an error at brunch:
Code:
host Java: guavalib (/home/richard/android/system/out/host/common/obj/JAVA_LIBRARIES/guavalib_intermediates/classes)
logtags: /home/richard/android/system/out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/content/EventLogTags.java <= frameworks/base/core/java/android/content/EventLogTags.logtags
logtags: /home/richard/android/system/out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/speech/tts/EventLogTags.java <= frameworks/base/core/java/android/speech/tts/EventLogTags.logtags
logtags: /home/richard/android/system/out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/webkit/EventLogTags.java <= frameworks/base/core/java/android/webkit/EventLogTags.logtags
[B]make: *** No rule to make target `/home/richard/android/system/out/host/linux-x86/bin/dx', needed by `/home/richard/android/system/out/target/common/obj/APPS/Apollo_intermediates/proguard.classes-with-local.dex'. Stop.[/B]
make: *** Waiting for unfinished jobs....
logtags: /home/richard/android/system/out/target/common/obj/JAVA_LIBRARIES/telephony-common_intermediates/src/src/java/com/android/internal/telephony/EventLogTags.java <= frameworks/opt/telephony/src/java/com/android/internal/telephony/EventLogTags.logtags
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Anyone knows what's causing it? It couldn't be the roomservice.xml in local_manifest as I used the one which another person successfully built CM with. I also repo sync'ed a few times already. I tried make clobber and built again, but nothing :crying:
I am building PACMAN ROM (4.3) now by the way.
All help is appreciated (with a thank!)
Greedings everyone
For some time now i am trying to download and compile CyanongenMod Sources for my Device. I Install VirtualBox + Linux Mint + all the needed stuff. Then i do the repo init and everything looks ok but when i do the repo sync it always throw me a error fetch stop because of sync errors. Ive done it a lot of time with no luck. Also i tried the repo sync -f which finaly finishes fetching things but stops at getting the project tree. Can anyone help me? :/ its really frustrating
vale amicis said:
I know there are many other guides avalable regarding this, But I tried to focus on the small points also that many guides overlook
that's why I have this for you. Do let know if I have missed something or more details have to be included in case still there is a difficulty in compiling
This thread on Madteam Forums: http://madteam.co/forum/development...lt-rom-for-your-device-(ultra-noob-friendly)/
So lets start with simple things
Basic FAQ:
This post/guide is divided into 4 parts:
1. Setting up build environment
2. Machine specifications etc.
3. Device Tree and source basics
4. Syncing Source and Building
PART 1: Setting up build environment​
Type sudo su and then your password to get rid of Admin Permissions
#Installing Python
STEP 1: Open terminal (CTRL + ALT + T)
Then execute the following commands in terminal one by one
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
sudo make install
sudo ln -s /usr/local/python2.5/bin/python /usr/bin/python2.5
Now Python is configured
#Installing JDK
As far as I know PPA which was the earlier method of installing JDK etc. doesn't exist's anymore, So I used another way!
Step 1: Open Terminal (CTRL + ALT + T)
STEP 2: Now we need to download the JDK 6 Binary by executing this command in terminal
Code:
wget --no-check-certificate --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com" "http://download.oracle.com/otn-pub/java/jdk/6u45-b06/jdk-6u45-linux-x64.bin"
STEP 3: Then we need to run the binary and move it to a shared location:
Code:
chmod +x jdk-6u45-linux-x64.bin
sudo ./jdk-6u45-linux-x64.bin
sudo mv jdk1.6.0_45 /usr/lib/jvm/
STEP 4: Now you have to install all binaries and give them highest priority, This will also overwrite the previous version of Java Binaries in your computer
Code:
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_45/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_45/bin/javac 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_45/bin/javaws 1
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.6.0_45/bin/jar 1
sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk1.6.0_45/bin/javadoc 1
STEP 5: Now check if JDK 1.6 is selected on this:
Code:
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javaws
sudo update-alternatives --config jar
sudo update-alternatives --config javadoc
Now JDK is configured! To check if it is done
Execute this is Terminal
Code:
java -version
Output will be similar to this
Code:
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
#Installing GNU Make
Code:
cd Downloads
wget -o make.tar.gz http://ftp.gnu.org/gnu/make/make-3.81.tar.gz
tar -xvzf make-3.81.tar.gz
cd make-3.82
./configure
sudo make install
These commands are for Make 1.81 if you want to install Make 1.82 Execute these
Code:
cd
wget -o make.tar.gz http://ftp.gnu.org/gnu/make/make-3.82.tar.gz
tar -xvzf make-3.82.tar.gz
cd make-3.82
./configure
sudo make install
Now GNU make is configures
#Installing Android SDK
STEP ONE: Download the SDK from http://developer.android.com/sdk/index.html and extract it in a folder called "sdk" in the Downloads folder
STEP TWO: Now, Execute these commands in terminal
Code:
cd ~/Downloads/sdk/tools/
./android sdk
SDK is configured now :victory:
#Installing required packages:
STEP 1: Open Terminal
Now execute these commands:
Code:
apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev libncurses5-dev x11proto-core-dev \
libx11-dev libreadline6-dev libgl1-mesa-dev tofrodos python-markdown \
libxml2-utils xsltproc pngcrush gcc-multilib lib32z1 schedtool
Good, Now you have successfully setup linux build environment!​
PART 2: Machine specifications and other misc. stuff​
Basic Computer Specs:
2Ghz Dual Core Processor
2GB Minimum ram
50GB File Space (For only one rom source)
*PLEASE NOTE*: This is the basic specification, It really depends on the condition of your ram and cpu!
If you want to use other apps while compilation you should make a 5GB minimum swap partition!
If ram is more than 4GB ram then you don't swap partition!
PART 3: DEVICE TREE AND SOURCE BASICS​
Basic source folders:
/packages - Proprietary rom applications
/framework - Framework (Overall rom UI and stuff)
/device - Device config
/vendor - Vendor Tree and other vendor files
/hardware - Hardware drivers
Q: What is BoardConfig.mk?
A: It's the file where you setup path's to files like toolchain etc. and enable/disable stuff, its very easy to understand. You can find it in your device's tree
Q: Where is build.prop in source?
A. Build.prop is available in the source in the form of system.prop in the device tree!
Q: How to remove ringtones, video editor, CM wallpapers from bulid?
A: Go to device/releasetools/extras.txt and Delete anything you don't want in your build
PART 4: Syncing Source and Building​
# Installing Repo Package
Code:
mkdir ~/bin
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
chmod a+x ~/bin/repo
STEP 2: Now it is recommended to reboot your computer (No need of sudo su after reboot)
STEP 3: Now make directory:
Code:
mkdir -p ~/rom/android/system
STEP 4: Go into directory and set path for Repo Package
Code:
cd ~/rom/android/system
PATH=~/bin:$PATH
STEP 5: NOW ITS TIME FOR SYNCING:
For CM10.1 source execute this:
Code:
repo init -u git://github.com/CyanogenMod/android.git -b cm10.1
For syncing CM10 source execute:
Code:
repo init -u git://github.com/CyanogenMod/android.git -b jellybean
You have to find for the rest!!
PS: You don't have to execute all the repo init commands written above
Now to sync execute this after the the repo init command
Code:
repo sync
Once it finishes without breaking all the folders will appear in rom/android/system folder
now execute this:
Code:
mkdir -p ~/rom/android/system/device/<ManufacturerName>/<DeviceCodeName>
and extract the device config/tree here
for me its samsung/totoro (galaxy Y, Don't mind )
then do the following:
Code:
mkdir -p ~/rom/android/system/vendor/<ManufacturerName>/<DeviceCodename>
Its the same as for the device folder
Now for compiling:
Code:
. build/envsetup.sh
lunch cm_<DeviceCodename>-eng
brunch cm_<DeviceCodename>-eng
Your build will be located at /rom/android/system/out as <RomName>-date/month/year-UNOFFICIAL-<DeviceCodeName>.zip
HAPPY COMPILING ​
Click to expand...
Click to collapse
I had two things to ask
1)Was installing android-sdk needed
2)If device not yet had a cm build or device tree how to get them

[GUIDE] How to compile kernel EASIEST WAY + add features + useful tools

Hi guys!
I wrote this guide because after a few month of kernel development i found useful tools and tricks than helped me a lot and speeded up my work and i want to share with you this knowledge.
Setup computer and download sources​
Code:
Minumum reqirement:
* C knowledge
* Ubuntu 12.04 (13.10 if you want use Kdevelop + linux kernel plugin)
* Internet connection, possibly fast and unlimited
* the boot.img of the ROM you want to support with your kernel (AOSP, SENSE etc etc...)
* [URL="http://forum.xda-developers.com/showthread.php?t=2519416"]zImage switcher[/URL]
Install required package:
Linux 12.04;
Code:
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2 bin86 libqt3-headers libqt3-mt-dev wget libncurses5 git-core nautilus-open-terminal
linux 13.10:
Code:
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2 bin86 qt4-dev-tools wget libncurses5 git-core nautilus-open-terminal
and restart your PC.
Download Source:
Go to /home/<username>, create a new folder called "kernel", and enter in that folder.
right click somewhere in "kernel" folder and select "open terminal here" (CooL AH?)
and run
Code:
git clone <kernel-source-code-for-your-device-repository>
for example for HTC One S will be
Code:
git clone https://github.com/CyanogenMod/android_kernel_htc_msm8960.git
Download the toolchain
There are a lot of toolchain, stock, linaro optimized, based on gcc 4.7, based on gcc 4.8 the choice is yours! in this tutorial we use google gcc 4.7 toolchain.
Go to /home/<username>, create a new folder called "toolchains", and enter in that folder.
right click -> open terminal here
Code:
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7
Build the kernel​
Build the kernel:
in this part we will work in "/home/<username>/kernels/<kernel-folder>" folder, i'll call it <root>
go to "<root>/arch/arm/configs" and copy "<you-device-name>_defconfig" to <root>
rename <you-device-name>_defconfig to ".config"
open a terminal window in <root>
type:
Code:
make ARCH=arm CROSS_COMPILE=/home/<username>/toolchains/arm-eabi-4.7/bin/arm-eabi- > compileLog
and the compilation will start.
Some explanation:
"ARCH=arm" tells to compiler what arch the kernel is made for
"CROSS_COMPILE=xxxxxx" tells to "make" the compiler to use
"> compileLog" saves all the messages in a file called compileLog, it's easier to read than terminal window
Click to expand...
Click to collapse
Pack the kernel to boot.img:
Unpack zImage switcher somewhere, i'll call that folder <ZimgSw>.
copy in the same folder of "repack.sh" file the stock boot.img and yout zImage, you can find it in <root>/arch/arm/boot.
run the script
Code:
./repack.sh
now in <ZimgSw> there's a new file called newBoot.img, that's your kernel!
to find the modules (*.ko files) open a teminal windows to <root> and type
Code:
find ./ -name "*.ko" -exec cp {} <absolute/path/destination/folder> \;
now you have the boot.img and the modules, download a custom kernel and use the flashable zip to make your flashable zip, just replace the modules and the boot.img!
Add features​Add features to kernel:
"Woah! i'd like to add intellimand governor to my kernel"
First you need to find a git repository that contains intellimand governor, than the commit that added the governor.
for example https://github.com/rmbq/android_kernel_htc_msm8960/commit/6c87d0e0b3c82ffff8c0704dfde7369872f5602f
Open a terminal window in <root>
type:
Code:
git remote add rmbq https://github.com/rmbq/android_kernel_htc_msm8960.git -b cm-10.2
git fetch rmbq
git cherry-pick 6c87d0e0b3c82ffff8c0704dfde7369872f5602f
Explanations:
Code:
git remote add rmbq https://github.com/rmbq/android_kernel_htc_msm8960.git -b cm-10.2
add a link to https://github.com/rmbq/android_kernel_htc_msm8960.git branch cm-10.2 and called it "rmbq"
Code:
git fetch rmbq
download all the commit history to your PC without modify your sources
Code:
git cherry-pick 6c87d0e0b3c82ffff8c0704dfde7369872f5602f
apply the commit 6c87d0e0b3c82ffff8c0704dfde7369872f5602f to your source
Click to expand...
Click to collapse
in termial window type:
Code:
make ARCH=arm xconfig
will open a new window where you can configure your kernel's features
press ctrl+f (find) and serach for "intellimand" and tick the checkbox. save clicking the floppy disk in upper left corner.
the modified configuration file will be saved in ".config"
now we can build the kernel again, but first type
Code:
make ARCH=arm clean CROSS_COMPILE=/home/<username>/toolchains/prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.8/bin/arm-linux-androideabi-
this will remove all the compiled files of previous build.
View git commits history​you can easly view all the commits in your repo:
open a terminal window in <root> and type
Code:
gitk
will open a GUI where you can see all the commits, what files were modified for each commit, the author of the commit.
you can also revert commits.
There are other GUI for git, i also like "gitg"
Hacking the kernel
suggested by @pirlano​for easy work on kernel sources, add features & co. you can use kdevelop + linux kernel plugin, here is a guide
http://www.gnurou.org/code/kdevelop-kernel
and a video guide:
http://video.linux.com/videos/kernel-browsing-and-hacking-using-kdevelop
NOTE: for linux kernel plugin ubuntu 13.10 is required
if something is not working or it's not clear or you have useful tips just tell me and i'll update the guide
Nice! I usually use kdevelop + linux kernel plugin, so i have a fast IDE and i can save compilation config, fix warning and errors on the fly, and use git from a gui, it's a good solution for me
pirlano said:
Nice! I usually use kdevelop + linux kernel plugin, so i have a fast IDE and i can save compilation config, fix warning and errors on the fly, and use git from a gui, it's a good solution for me
Click to expand...
Click to collapse
cool! if you want/have time write a small tutorial for your method and i'll add to OP
EDIT: meanwhile i added this guide http://www.gnurou.org/code/kdevelop-kernel
rmbq said:
cool! if you want/have time write a small tutorial for your method and i'll add to OP
EDIT: meanwhile i added this guide http://www.gnurou.org/code/kdevelop-kernel
Click to expand...
Click to collapse
And video guide from a nVidia tegra developer
http://video.linux.com/videos/kernel-browsing-and-hacking-using-kdevelop
Hi rmbq,
many thanks for your tutorial! I really appreciate it as I already made some first steps with compiling Roms. Now I'll try to make a kernel
Sent from my One S using XDA Premium 4 mobile app
UPDATE:
added git GUI section
Thanks for this tutorial. Maybe I will finally sit down to making my own kernel someday. If I can do it for linux why can't I for android.
@rmbq
I get an error when i run the command
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2 bin86 libqt3-headers libqt3-mt-dev wget libncurses5 git-core nautilus-open-terminal
Click to expand...
Click to collapse
Error
$ sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2 bin86 libqt3-headers libqt3-mt-dev wget libncurses5 git-core nautilus-open-terminal
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libqt3-headers
E: Unable to locate package libqt3-mt-dev
Click to expand...
Click to collapse
This is my first time trying to build a kernel, How do i fix it?
Edit:
Im running Ubuntu 13.10
phanitej said:
@rmbq
I get an error when i run the command
Error
This is my first time trying to build a kernel, How do i fix it?
Edit:
Im running Ubuntu 13.10
Click to expand...
Click to collapse
Hi!
instead
Code:
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2 bin86 libqt3-headers libqt3-mt-dev wget libncurses5 git-core nautilus-open-terminal
can you try to run
Code:
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2 bin86 qt4-dev-tools wget libncurses5 git-core nautilus-open-terminal
and see if "make xconfig" (qt is required only for this command) is working? i haven't got ubuntu 13.10 so i can't test
rmbq said:
Hi!
instead
Code:
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2 bin86 libqt3-headers libqt3-mt-dev wget libncurses5 git-core nautilus-open-terminal
can you try to run
Code:
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2 bin86 qt4-dev-tools wget libncurses5 git-core nautilus-open-terminal
and see if "make xconfig" (qt is required only for this command) is working? i haven't got ubuntu 13.10 so i can't test
Click to expand...
Click to collapse
Tried the command. Did not get any errors. But after downloading source i dont see the kernel folder insde the kernel. What am i doing wrong?
Im trying to build a hammerhead kernel so used the below link
git clone https://android.googlesource.com/kernel/msm.git
Click to expand...
Click to collapse
phanitej said:
Tried the command. Did not get any errors. But after downloading source i dont see the kernel folder insde the kernel. What am i doing wrong?
Im trying to build a hammerhead kernel so used the below link
Click to expand...
Click to collapse
because "master" branch (the default branch) is empty.
open a terminal in <root> and type
Code:
git checkout android-msm-hammerhead-3.4-kk-r1
and you will switch from master branch to android-msm-hammerhead-3.4-kk-r1 branch, i think it's the more updated branch for hammerhead. now you should see all the folders and files of your kernel
rmbq said:
because "master" branch (the default branch) is empty.
open a terminal in <root> and type
Code:
git checkout android-msm-hammerhead-3.4-kk-r1
and you will switch from master branch to android-msm-hammerhead-3.4-kk-r1 branch, i think it's the more updated branch for hammerhead. now you should see all the folders and files of your kernel
Click to expand...
Click to collapse
First of all, a big thanks to your patience for helping me out.
The above command did show up files. I then went to root and tried to use make
make ARCH=arm CROSS_COMPILE=/home/phanitej/toolchain/prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.8/bin/arm-linux-androideabi- > compileLog
Click to expand...
Click to collapse
It gives an error. I made sure the path is correct.
make[2]: *** [silentoldconfig] Error 1
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target `include/config/auto.conf', needed by `include/config/kernel.release'. Stop.
phanitej said:
First of all, a big thanks to your patience for helping me out.
The above command did show up files. I then went to root and tried to use make
It gives an error. I made sure the path is correct.
make[2]: *** [silentoldconfig] Error 1
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target `include/config/auto.conf', needed by `include/config/kernel.release'. Stop.
Click to expand...
Click to collapse
did you do these steps?
go to "<root>/arch/arm/configs" and copy "<you-device-name>_defconfig" to <root>
rename <you-device-name>_defconfig to ".config"
if yes try to (in <root>):
Code:
make ARCH=arm xconfig
save clickn' the floppy
Code:
make ARCH=arm CROSS_COMPILE=/home/<username>/toolchains/prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.8/bin/arm-linux-androideabi- > compileLog
P.S. to post code / script / terminal commands use CODE tag instead QUOTE
rmbq said:
did you do these steps?
go to "<root>/arch/arm/configs" and copy "<you-device-name>_defconfig" to <root>
rename <you-device-name>_defconfig to ".config"
if yes try to (in <root>):
Code:
make ARCH=arm xconfig
save clickn' the floppy
Code:
make ARCH=arm CROSS_COMPILE=/home/<username>/toolchains/prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.8/bin/arm-linux-androideabi- > compileLog
P.S. to post code / script / terminal commands use CODE tag instead QUOTE
Click to expand...
Click to collapse
Thanks for the tip Will use code tag from now on for codes.
After running
Code:
make ARCH=arm xconfig
I got the kernel config window. Saved it without modifying anything. THen ran the other command. Gives error. Checked the log and found few errors.
phanitej said:
Thanks for the tip Will use code tag from now on for codes.
After running
Code:
make ARCH=arm xconfig
I got the kernel config window. Saved it without modifying anything. THen ran the other command. Gives error. Checked the log and found few errors.
Click to expand...
Click to collapse
probably your new .config has got wrong configuration, try to delete .config in <root> (if you don't see it press ctrl+h)
and do again
go to "<root>/arch/arm/configs" and copy "<you-device-name>_defconfig" to <root>
rename <you-device-name>_defconfig to ".config"
this time run the make command without make xconfig
rmbq said:
probably your new .config has got wrong configuration, try to delete .config in <root> (if you don't see it press ctrl+h)
and do again
go to "<root>/arch/arm/configs" and copy "<you-device-name>_defconfig" to <root>
rename <you-device-name>_defconfig to ".config"
this time run the make command without make xconfig
Click to expand...
Click to collapse
Still got error
make[1]: *** [init/main.o] Error 1
make: *** [init] Error 2
Just to make sure im doing it right.
I copied hammerhead_defconfig to <root> and renamed it to .config
Then ran the make command without make xconfig i.e
Code:
make ARCH=arm CROSS_COMPILE=/home/phanitej/toolchain/prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.8/bin/arm-linux-androideabi- > compileLog
phanitej said:
Still got error
make[1]: *** [init/main.o] Error 1
make: *** [init] Error 2
Just to make sure im doing it right.
I copied hammerhead_defconfig to <root> and renamed it to .config
Then ran the make command without make xconfig i.e
Code:
make ARCH=arm CROSS_COMPILE=/home/phanitej/toolchain/prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.8/bin/arm-linux-androideabi- > compileLog
Click to expand...
Click to collapse
can you try to:
open <root>/Makefile
go to line 375 (it's "-fno-delete-null-pointer-checks") and replace this line with "-fno-delete-null-pointer-checks -march=armv7-a"
save and try to compile again
rmbq said:
can you try to:
open <root>/Makefile
go to line 375 (it's "-fno-delete-null-pointer-checks") and replace this line with "-fno-delete-null-pointer-checks -march=armv7-a"
save and try to compile again
Click to expand...
Click to collapse
Edited that, still no go
What am i doing wrong?
phanitej said:
Edited that, still no go
What am i doing wrong?
Click to expand...
Click to collapse
and if you change toolchain?
try to download this http://releases.linaro.org/13.11/co...ndroid-toolchain-eabi-4.8-2013.11-x86.tar.bz2
unpack it in toolchain folder and run make with new CROSS_COMPILE path
CROSS_COMPILE=/home/phanitej/toolchain/new folder/bin/new files name
to know the "new files name" go to
/home/phanitej/toolchain/prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.8/bin
you can see all files are starting with "arm-linux-androideabi-" that's why the command is
Code:
CROSS_COMPILE=/home/phanitej/toolchain/prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.8/bin/[COLOR="Red"]arm-linux-androideabi-[/COLOR]
make the same thing with the new toolchain
EDIT: shuold be
Code:
CROSS_COMPILE=/home/phanitej/toolchain/[COLOR="Red"]android-toolchain-eabi[/COLOR]/bin/[COLOR="Red"]arm-eabi-[/COLOR]
EDIT2: if still not working try to modify line 357 of <root>/Makefile from
CFLAGS_KERNEL =
to
CFLAGS_KERNEL = -mtune=cortex-a15 -mfpu=neon-vfpv4

[GUIDE][AOSP][WIP] Build android from source on windows 10

CURRENT STATUS: can compile android kernel successfully, right now cant compile complete rom.
Edition: Windows 10
Version: 1607
OS Build: 14393.222
===========================================
REQUIREMENTS
===========================================​
1) Windows 10 64-Bit with Anniversary Update
===========================================
Setting up ubuntu bash on windows 10
===========================================​
1) open the Settings --> Update & Security --> For Developers--> enable Developer Mode
2) search for “Turn Windows Features On or Off” in cortana & hit enter
3) Enable the “Windows Subsystem for Linux (Beta)” option in the list and click “OK.” & restart your system
4) search for “bash” in cortana & hit enter
5) type "y" & hit enter
6) download of ubuntu for windows 10 will start. It will take some time depending on your internet speed. You’ll be asked to create a user account and password for use in the Bash environment. restart your system
7) search for “Bash on Ubuntu on Windows” in cortana & hit enter
8) congratulations you have successfully installed bash on windows 10
9) OPTIONAL
add bash to context menu (developer is Manouchehri)
install this reg entry,... Accept the warnings and import it.
===========================================
Setting up a Linux build environment
===========================================​
1) open “Bash on Ubuntu on Windows”
Code:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install default-jdk
sudo apt-get install android-tools-adb android-tools-fastboot
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \
libgl1-mesa-dev libxml2-utils xsltproc unzip python-networkx
===========================================
How To's
===========================================​
warning 1: do not edit your linux files i.e. "C:\Users<username>\AppData\Local\lxss" in windows,... it will make the files useless in bash... never add files or edit files of linux subsystem from windows,....
Solution: copy the files out of linux sub system i.e. "lxss", edit them, then use bash to move the files back to "lxss"
---------------------------------------------------------------------
warning 2: Do not mnt and download android source,... download the source in linux subsystem (inside lxss) only...
---------------------------------------------------------------------
Problem: where are my ubuntu files
Solution: All your bash files are located in "C:\Users<username>\AppData\Local\lxss\rootfs". your home directory is located in "C:\Users<username>\AppData\Local\lxss\home"
---------------------------------------------------------------------
Problem: sudo: unable to resolve host
Solution: delete hosts file of ubuntu, it will auto generate the next time you open “Bash on Ubuntu on Windows" (C:\Users\<username>\AppData\Local\lxss\rootfs\etc\hosts)
---------------------------------------------------------------------
Problem: Java 8 doesn't install or work
Solution: know bug. use the following code. it will install java 7
Code:
sudo apt-get install default-jdk
---------------------------------------------------------------------
Problem: how to access windows files in bash
Solution: for example you want to navigate to downloads "C:\Users\<username>\Downloads"
Code:
cd /mnt/c/Users/<username>/Downloads
---------------------------------------------------------------------
Problem: repo not found or needs to be installed even after it was successful installed
Solution: use the following command
Code:
nano ~/.bashrc
add this at the end
Code:
PATH=~/bin:$PATH
press Ctrl+o & Ctrl+x
---------------------------------------------------------------------
Problem: can't mount my drive
Solution:: In order for a drive to show up under /mnt/ it must meet the following criteria:
1. The drive must be a fixed drive
2. The drive must be formatted to NTFS
---------------------------------------------------------------------
=======================================
*****still experimenting with bash, still have a few problems to successfully compile the rom,... will update if i find something
Move Home Ubuntu Directory
I can move ubuntu home directory from C to another drive?
@IacobIonut-DW
i am afraid you cant change it,.... there are duplicate files in ubuntu example lxss\text.txt & lxss Text.txt
if you try to copy the folder you will get a error message
It seems interesting I'm going to try it and will give you my feedback .
BTW , I've ubuntu installed along side with windows can I the files on ubuntu partition with the bash installed on windows ?
@LahKeda
No you can't read that drive
Nice to see that guide, great work!
But I am stuck at this point currently: stackoverflow | Bash on Ubuntu on Windows, Compile AOSP.
My strace file says about the same thing.
Did you find any solution to this?
@Spartaner25
did you try to edit files of linux or files of your build in windows???
Wow thanks!
But one question: Is it just another virtualization ? I mean is it faster than an Ubuntu installed inside a VM ?
For performance of bash on windows vs native Ubuntu read this
chiragkrishna said:
@Spartaner25
did you try to edit files of linux or files of your build in windows???
Click to expand...
Click to collapse
I did not touch any files of the linux base (lxss) in either the windows explorer or the bash and I did not modified anything inside the Windows Folder.
But I upgraded the system via apt update/upgrade which should not be destructive (I hope).
My target was a regular aosp build with the tag android-6.0.1_r58, I only changed a few linies in some files in frameworks/base via nano and added a device and kernel folder which was all done inside the bash.
Spartaner25 said:
I did not touch any files of the linux base (lxss) in either the windows explorer or the bash and I did not modified anything inside the Windows Folder.
But I upgraded the system via apt update/upgrade which should not be destructive (I hope).
My target was a regular aosp build with the tag android-6.0.1_r58, I only changed a few linies in some files in frameworks/base via nano and added a device and kernel folder which was all done inside the bash.
Click to expand...
Click to collapse
Try building only the kernel and see if it builds correctly!!
chiragkrishna said:
Try building only the kernel and see if it builds correctly!!
Click to expand...
Click to collapse
Thanks for the hint, the kernel builds fine.
By the way, building CyanogenMod gets stuck here for me.
Windows Insider Preview for those in Fast Ring
Ubuntu 16.04 Arrives With New Windows 10 Build 14936
change log
I'm currently on this version with ubuntu 16.04 and it's getting better.
Currently the build (aosp and cm) ist stuck on the bison binary which is a prebuilt 32-bit ELF, which can not be executed.
It might be possible to replace the prebuilts with their 64-bit variants.
@chiragkrishna upon using
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \
libgl1-mesa-dev libxml2-utils xsltproc unzip python-networkx
I get the following errors: Unable to locate package zip, lib32ncurses5-dev, libgl1-mesa-dev.
Edit: Fixed by removing the '\' from all lines.
does anyone know how to solve this error?
ionice: ioprio_set failed: Invalid argument
I have been able to successfully build cm-13.0 on Windows 10. I haven't been successful with cm-12.1, since it builds 32-bit binaries for the host executables for some reason.
The fixes I had to do:
Recompile flex and bison as 64-bit binaries according to the instructions in their source directory (github btongminh/android_prebuilts_misc)
Disable futexes in Art (github btongminh/android_art)
Disable v8 snapshots, since it is only possible to make snapshots for 32-bit targets on a 32-bit host (github btongminh/android_v8)
The build for Xiaomi Redmi 3 (ido) was successful, flashed it and it booted into Android Unfortunately after that the launcher kept on crashing, but is looks like I'm almost there.
Ayush1325 said:
does anyone know how to solve this error?
ionice: ioprio_set failed: Invalid argument
Click to expand...
Click to collapse
Build with "make bacon" instead of brunch or mka
btongminh said:
I have been able to successfully build cm-13.0 on Windows 10. I haven't been successful with cm-12.1, since it builds 32-bit binaries for the host executables for some reason.
Build with "make bacon" instead of brunch or mka
Click to expand...
Click to collapse
How do you make a user build signed with release keys instead of a userdebug build signed with testkeys??
EDIT: Well my normal make build failed
Please note I'm trying to compile Lineage OS 14.1
Code:
[ 1% 675/34224] Generating TOC: /root...core-all_intermediates/classes.jar.toc
FAILED: /bin/bash -c "(/root/out/host/linux-x86/bin/ijar /root/out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/classes.jar /root/out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/classes.jar.toc.tmp ) && (if cmp -s /root/out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/classes.jar.toc.tmp /root/out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/classes.jar.toc ; then rm /root/out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/classes.jar.toc.tmp ; else mv /root/out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/classes.jar.toc.tmp /root/out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/classes.jar.toc ; fi )"
ftruncate(fd_out, GetSize()): Invalid argument
/bin/bash: line 1: 7115 Aborted (core dumped) ( /root/out/host/linux-x86/bin/ijar /root/out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/classes.jar /root/out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/classes.jar.toc.tmp )
ninja: build stopped: subcommand failed.
build/core/ninja.mk:151: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1
#### make failed to build some targets (13:50 (mm:ss)) ####
It looks like I'm having the same error as this person. https://forum.xda-developers.com/lineage/help/building-lineageos-cancro-xiaomi-mi3w-t3530766
What Java version are you using (java -v). LineageOS 14.1 requires Java 1.8.
Link_of_Hyrule said:
Code:
[ 1% 675/34224] Generating TOC: /root...core-all_intermediates/classes.jar.toc
FAILED: /bin/bash -c "(/root/out/host/linux-x86/bin/ijar /root/out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/classes.jar /root/out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/classes.jar.toc.tmp ) && (if cmp -s /root/out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/classes.jar.toc.tmp /root/out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/classes.jar.toc ; then rm /root/out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/classes.jar.toc.tmp ; else mv /root/out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/classes.jar.toc.tmp /root/out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/classes.jar.toc ; fi )"
ftruncate(fd_out, GetSize()): Invalid argument
/bin/bash: line 1: 7115 Aborted (core dumped) ( /root/out/host/linux-x86/bin/ijar /root/out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/classes.jar /root/out/target/common/obj/JAVA_LIBRARIES/core-all_intermediates/classes.jar.toc.tmp )
ninja: build stopped: subcommand failed.
build/core/ninja.mk:151: recipe for target 'ninja_wrapper' failed
make: *** [ninja_wrapper] Error 1
#### make failed to build some targets (13:50 (mm:ss)) ####
Click to expand...
Click to collapse
I've committed a fix to fix this problem, you can find it here:
https://github.com/imReker/bazel/commit/d2f16b573e0a77653454e64f124e0c4bab3b0fd7

How To Compile Rom From Source full guide step by step by Jai Sharma

How To Compile Rom From Source
We need following things to compile ROM from source
A Computer( Linux or Mac)
Java JDK
Some required Package for building Rom
Rules for Accessing USB devices
Choosing a Branch
Installing Java on the Machine
Here i am using Ubuntu(14.04 LTS) as a Linux machine but it should work for other Linux variant
Open a terminal and type following
sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
This command will remove other existing openjdk installation
2. Once java is uninstalled use following command for installing correct version of java
sudo apt-get update
sudo apt-get install openjdk-s8-jdk
Check java version by typing following command
java -version
2. Installing some required packages
Type following in terminal to install some required packages
sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \
libgl1-mesa-dev libxml2-utils xsltproc unzip
3. Downloading Repo Tool and setting PATH
mkdir ~/bin
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Now open the bashrc file and so we can include the repo tool:
sudo nano ~/.bashrc
Add following in the end of the file
export PATH=~/bin:$PATH
Now we need to reload bash variables to include the new path:
source ~/.bashrc
4. Initializing a Repo client
Now we need to create a directory where our source code will be downloaded. I am creating a directory AOSP here
mkdir AOSP
cd AOSP
In the following command insert your name and email address
git config --global user.name "Your_Name"
git config --global user.email "Your_EMail"
Now care fully select your branch whether you are downloading aosp or Cyanogenmod
repo init -u https://android.googlesource.com/platform/manifest -b android-7.1.0_r7
type your desired branch name after the -b. This also applies to Cyanogenmod
5. Downloading source code
Now start downloading source code by typing following
repo sync
Note: this may take some time depending upon your internet speed and also please make sure you have enough storage
6. Configuring USB Access
type your username in following command and type enter
wget -S -O - http://source.android.com/source/51-android.rules | sed "s/<username>/$USER/" | sudo tee >/dev/null /etc/udev/rules.d/51-android.rules; sudo udevadm control --reload-rules
7. Now building Rom for your device
To build rom we need following
Device tree
Vendor tree
kernel
Finding device tree and Vendor Tree
To find your device tree search on Github or similar sources with your device code name. If you are lucky you will find it there and believe me it is the easiest way to build your rom rather than creating device tree and vendor tree from scratch
Your device tree will go on following location
device/device_manufacturer_name/device_codename
Same for vendor tree
vendor/device_manufacturer_name/device_codename
If you find device tree and vendor tree then how to download it
For device tree
git clone “Github url” -b (branch_tag) device/device_manufacturer_name/device_codename
2. For vendor tree
git clone “Github url” -b (branch_tag) vendor/device_manufacturer_name/device_codename
Note1: You may need to change some files if everything is not working or giving you some error in rom compiling. Look into output to find out error. You can use Google if you can't correct it
Note2: You may be not found your device tree and vendor tree then what to do?. You may need to create them. Please follow my guide
Creating Device tree and vendor tree from scratch
For creating device tree
http://azodik.com/how-to-create-device-tree-for-android-rom-building/
2. For creating Vendor tree
“Coming Soon”
Kernel
For kernel part if you are lucky than you can find your kernel source from Github or similar sources. If not you can use your prebuilt kernel Foolow this to extract your kernel http://azodik.com/how-to-create-device-tree-for-android-rom-building/
Kernel location
/kernel/device_manufacturer_name/device_codename
Downloading your kernel
Manually download it and extract to kernel location or use following command
git clone “Github url” kernel/device_manufacturer_name/device_codename
Note1: You can use your prebuilt kernel. To use your prebuilt kernel edit BoardConfig.mk file in your device tree.
Note2: If you created device tree from scratch following my guide. Use of prebuilt kernel set to default
How to build
Use following command for building your rom
Source build/envsetup.sh
lunch
Now select your device from menu
3. make or mka
I hope you found it usefull. Please follow my website for interesting guide. Please comment here if you face any error.
Thank You
Really a great guide bro!
Can you please post a rom porting guide? easy to understand and effective
sohamsen said:
Really a great guide bro!
Can you please post a rom porting guide? easy to understand and effective
Click to expand...
Click to collapse
Thank you very much. Sure i will post soon.
jai44 said:
Thank you very much. Sure i will post soon.
Click to expand...
Click to collapse
Nice tutor.. But it looks need an enormous data usage to do that. If i wanna porting rom for example slim rom nougat to my device (kenzo) can you give me some info how many data should i provide and how to do that? Thanks
thanks
elanglangit said:
Nice tutor.. But it looks need an enormous data usage to do that. If i wanna porting rom for example slim rom nougat to my device (kenzo) can you give me some info how many data should i provide and how to do that? Thanks
Click to expand...
Click to collapse
You can follow this guide. Read it again and again. I hope soon you will build your own Rom. You can comment here if you face any problem
While compiling pure nexus. I got this error. How to solve thishttp://cloud.tapatalk.com/s/589b479597bc0/tapatalk_1486571095280.jpeg?
@jai44 wow! you make it look so easy! :') I have subscribed to this thread. When I get free time, Ill build my own rom
Thank you so much!
not able to sync rr source...
After i type repo sync it doesnt do anything. I double checked my site direction and it appears to be fine. Any hints??
could you please spare some time and make a post about how to create vendor tree?
can anyone help with this error while porting dotos rom for lenovo a700
/home/ubuntu/android/dotos/out/build-dot_aio_row.ninja is missing, regenerating...
device/lenovo/aio_row/board/ril.mk:4: error: cannot assign to readonly variable: PRODUCT_PROPERTY_OVERRIDES
10:14:07 ckati failed with: exit status 1
and ril.mk script
# RIL
BOARD_PROVIDES_RILD := true
BOARD_RIL_CLASS := ../../../device/lenovo/aio_row/ril
PRODUCT_PROPERTY_OVERRIDES += ro.telephony.sim.count=2
Hy I'm building lineage os 14.1 for SM-J250F
Samsung Galaxy J2 Pro 2018 (SM-J250F) but im not going to giveup .. so I'm started to build roms my self .. fixed some build errors and successfully compiled but it stuck on Samsung logo(no bootanimation) also took pstore logs but it only store recovery logs .. sir can you please help to make it boot? Can u kindly tell me what changes i need to do in sources to make it boot? Or can u fix the issue in my tree? Please I'm hoping your feedback
Source android base : Android 7.1.1
Tried compilation : Lineage OS 14.1
I cant post my tree links due to new account please pm
jai44 said:
How To Compile Rom From Source
We need following things to compile ROM from source
A Computer( Linux or Mac)
Java JDK
Some required Package for building Rom
Rules for Accessing USB devices
Choosing a Branch
Installing Java on the Machine
Here i am using Ubuntu(14.04 LTS) as a Linux machine but it should work for other Linux variant
Open a terminal and type following
sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
This command will remove other existing openjdk installation
2. Once java is uninstalled use following command for installing correct version of java
sudo apt-get update
sudo apt-get install openjdk-s8-jdk
Check java version by typing following command
java -version
2. Installing some required packages
Type following in terminal to install some required packages
sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \
libgl1-mesa-dev libxml2-utils xsltproc unzip
3. Downloading Repo Tool and setting PATH
mkdir ~/bin
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Now open the bashrc file and so we can include the repo tool:
sudo nano ~/.bashrc
Add following in the end of the file
export PATH=~/bin:$PATH
Now we need to reload bash variables to include the new path:
source ~/.bashrc
4. Initializing a Repo client
Now we need to create a directory where our source code will be downloaded. I am creating a directory AOSP here
mkdir AOSP
cd AOSP
In the following command insert your name and email address
git config --global user.name "Your_Name"
git config --global user.email "Your_EMail"
Now care fully select your branch whether you are downloading aosp or Cyanogenmod
repo init -u https://android.googlesource.com/platform/manifest -b android-7.1.0_r7
type your desired branch name after the -b. This also applies to Cyanogenmod
5. Downloading source code
Now start downloading source code by typing following
repo sync
Note: this may take some time depending upon your internet speed and also please make sure you have enough storage
6. Configuring USB Access
type your username in following command and type enter
wget -S -O - http://source.android.com/source/51-android.rules | sed "s/<username>/$USER/" | sudo tee >/dev/null /etc/udev/rules.d/51-android.rules; sudo udevadm control --reload-rules
7. Now building Rom for your device
To build rom we need following
Device tree
Vendor tree
kernel
Finding device tree and Vendor Tree
To find your device tree search on Github or similar sources with your device code name. If you are lucky you will find it there and believe me it is the easiest way to build your rom rather than creating device tree and vendor tree from scratch
Your device tree will go on following location
device/device_manufacturer_name/device_codename
Same for vendor tree
vendor/device_manufacturer_name/device_codename
If you find device tree and vendor tree then how to download it
For device tree
git clone “Github url” -b (branch_tag) device/device_manufacturer_name/device_codename
2. For vendor tree
git clone “Github url” -b (branch_tag) vendor/device_manufacturer_name/device_codename
Note1: You may need to change some files if everything is not working or giving you some error in rom compiling. Look into output to find out error. You can use Google if you can't correct it
Note2: You may be not found your device tree and vendor tree then what to do?. You may need to create them. Please follow my guide
Creating Device tree and vendor tree from scratch
For creating device tree
http://azodik.com/how-to-create-device-tree-for-android-rom-building/
2. For creating Vendor tree
“Coming Soon”
Kernel
For kernel part if you are lucky than you can find your kernel source from Github or similar sources. If not you can use your prebuilt kernel Foolow this to extract your kernel http://azodik.com/how-to-create-device-tree-for-android-rom-building/
Kernel location
/kernel/device_manufacturer_name/device_codename
Downloading your kernel
Manually download it and extract to kernel location or use following command
git clone “Github url” kernel/device_manufacturer_name/device_codename
Note1: You can use your prebuilt kernel. To use your prebuilt kernel edit BoardConfig.mk file in your device tree.
Note2: If you created device tree from scratch following my guide. Use of prebuilt kernel set to default
How to build
Use following command for building your rom
Source build/envsetup.sh
lunch
Now select your device from menu
3. make or mka
I hope you found it usefull. Please follow my website for interesting guide. Please comment here if you face any error.
Thank You
Click to expand...
Click to collapse
how much storage is used to sync sir?
BryanHafidz said:
how much storage is used to sync sir?
Click to expand...
Click to collapse
depend on rom for me los17 took almost 70gb

Categories

Resources