[Build Jelly Bean AOSP] Galaxy S2 - Galaxy S II General

To compile Jellybean on Ubuntu I'm going to first give you steps to set up your computer to get this thing rolling. Also note that this appears to be a development preview source code.
This is the base how you build it for our device, it will be updated daily if fixes are made
Running into an error, make sure to write what the problem is.
Thanks List:
koudd For helping me out wih errors/Pointing me to right direction
stormtroopercs For Helping Me out/point to right direction
MemoryController Helping US, with errors while compiling,
Kalgecin for helping me fix my errors/pointing me to right direction
dastin1015 For his brilliant Tutorial which this is based uppon: Here
Krizp0 for pointing out that i missed to credit dastin1015 for tutorial which this one is based uppon!
princescar for pointing out that the java jdk was wrong
Note: The source download is approximately 6GB in size. You will need 25GB free to complete a single build, and up to 80GB (or more) for a full set of builds.
1) You need the following:
-JDK 6 if you wish to build Jellybean.
Code:
$ sudo apt-get install sun-java6-jdk
if you got any problem go: https://github.com/flexiondotorg/oab-java6 or to developers website: http://www.oracle.com/technetwork/java/javase/downloads/index.html
-Python 2.4 -- 2.7, which you can download from python.org. Or:
Code:
$ sudo apt-get install python
-Git 1.7 or newer. You can find it at git-scm.com. Or:
Code:
$ sudo apt-get install git-core
-Android SDK:
Download the SDK here: http://developer.android.com/sdk/index.html
Extract the SDK and place it in your home directory.
I renamed my SDK to android-sdk to make it easier to navigate to.
Go to your home folder, press Ctrl+H to show hidden files, and open up your .bashrc file.
Add these lines at the bottom of the file:
Code:
# Android tools
export PATH=${PATH}:~/android-sdk/tools
export PATH=${PATH}:~/android-sdk/platform-tools
export PATH=${PATH}:~/bin
Find your .profile file and add this at the bottom of the file:
Code:
PATH="$HOME/android-sdk/tools:$HOME/android-sdk/platform-tools:$PATH"
You have now successfully installed the Android SDK.
To check for updates issue this into your terminal:
Code:
$ android
2) Install required packages. 64-bit (recommended)
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
On newer versions of Ubuntu such as 11.10 you may need to do the following:
Code:
$ sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so
Building on Ubuntu 12.04 is currently only experimentally supported and is not guaranteed to work on branches other than master.
Code:
$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl 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
3) Configure your USB.
Code:
$ gksudo gedit /etc/udev/rules.d/51-android.rules
in this case we only need Samsung USB (If your building for other devices such as LG you can add thoose too!)
Code:
#Samsung
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666"
Inside of this blank text file insert:
Code:
#Acer
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666"
#ASUS
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666"
#Dell
SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0666"
#Foxconn
SUBSYSTEM=="usb", ATTR{idVendor}=="0489", MODE="0666"
#Garmin-Asus
SUBSYSTEM=="usb", ATTR{idVendor}=="091E", MODE="0666"
#Google
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666"
#HTC
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666"
#Huawei
SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0666"
#K-Touch
SUBSYSTEM=="usb", ATTR{idVendor}=="24e3", MODE="0666"
#KT Tech
SUBSYSTEM=="usb", ATTR{idVendor}=="2116", MODE="0666"
#Kyocera
SUBSYSTEM=="usb", ATTR{idVendor}=="0482", MODE="0666"
#Lenevo
SUBSYSTEM=="usb", ATTR{idVendor}=="17EF", MODE="0666"
#LG
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666"
#Motorola
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666"
#NEC
SUBSYSTEM=="usb", ATTR{idVendor}=="0409", MODE="0666"
#Nook
SUBSYSTEM=="usb", ATTR{idVendor}=="2080", MODE="0666"
#Nvidia
SUBSYSTEM=="usb", ATTR{idVendor}=="0955", MODE="0666"
#OTGV
SUBSYSTEM=="usb", ATTR{idVendor}=="2257", MODE="0666"
#Pantech
SUBSYSTEM=="usb", ATTR{idVendor}=="10A9", MODE="0666"
#Philips
SUBSYSTEM=="usb", ATTR{idVendor}=="0471", MODE="0666"
#PMC-Sierra
SUBSYSTEM=="usb", ATTR{idVendor}=="04da", MODE="0666"
#Qualcomm
SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666"
#SK Telesys
SUBSYSTEM=="usb", ATTR{idVendor}=="1f53", MODE="0666"
#Samsung
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666"
#Sharp
SUBSYSTEM=="usb", ATTR{idVendor}=="04dd", MODE="0666"
#Sony Ericsson
SUBSYSTEM=="usb", ATTR{idVendor}=="0fce", MODE="0666"
#Toshiba
SUBSYSTEM=="usb", ATTR{idVendor}=="0930", MODE="0666"
#ZTE
SUBSYSTEM=="usb", ATTR{idVendor}=="19D2", MODE="0666"
4) Save the file and close it and then issue this command:
Code:
$ sudo chmod a+r /etc/udev/rules.d/51-android.rules
5) Install the repo:
Code:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
6) Initialize the repo:
Code:
$ mkdir WORKING_DIRECTORY (Note the WORKING_DIRECTORY can be named whatever you wan't just don't use a name with spaces!)
$ cd WORKING_DIRECTORY
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.1.1_r1
6.1) For people who have already done a repo init:
Code:
$ cd WORKING_DIRECTORY
$ repo init -b android-4.1.1_r1
$ repo sync
7) When prompted, enter your real name and email address.
8) Gather the files:
Code:
$ repo sync
This is not nessesary to do now, this is more a check to see if anything is working properly! (if you know everything is working skip to how to add a device to the list!)
Code:
9) Compiling: [CODE]$ source build/envsetup.sh
Or:
Code:
$ . build/envsetup.sh
10) Issue:
Code:
$ lunch
11) Pick your poison.
12) Now issue (The '#' is the number of cores your processor has plus 1, ex. I have a dual core processor so I type 'make -j3':
Code:
$ make -j#
[/CODE]
~How To Add A Device To The List~
1) Find the github for your device you wish to add. In this tutorial we use GalaxyS2
2) Now navigate to the location you are going clone the device tree to:
Code:
$ cd WORKING_DIRECTORY/device
$ mkdir samsung
3) Clone the github device tree from remote to local: in this case i clone the git to non existing folder, this folder will be created if you write etc galaxys2 after the git tree.
Code:
$ git clone git://github.com/cleaton/device_samsung_galaxys2 galaxys2
4) Now navigate into the folder:
Code:
$ cd galaxys2
5) Connect phone to computer and make sure USB debugging is enabled and you have adb set up.
Before Doing Step 6 Make sure you use latest CM9-Nightly or else you may not getting all files!
Click to expand...
Click to collapse
6) Extract Device Proprietary Files:
Code:
$ ./extract-files.sh
7) Navigate back to your home directory for building:
Code:
$ cd ~/WORKING_DIRECTORY
Now before doing an buld/evensetup.sh compile, make sure you have the exynos4.mk file its located in hardware/samsung
if you don't have any samsung folder in the hardware folder make sure to clone one from: git clone git://github.com/cleaton/android_hardware_samsung.git -b jb-dirtyfix hardware/samsung (don't use cyanogenmod samsung_hardware as its doesn't have updated drivers!)
8) Prepare To Compile:
Code:
$ source build/envsetup.sh
Or:
Code:
$ . build/envsetup.sh
9) Get your list of devices:
Code:
$ lunch
10) Pick your poison.
11) Now compile:
Code:
$ make -j#
Or for a flashable zip:
Code:
$ make -j# otapackage
~FIXES~
If you are running into issues such as:
Code:
Which would you like? [full-eng] 5
build/core/product_config.mk:209: *** No matches for product "full_shooter". Stop.
Device shooter not found. Attempting to retrieve device repository from CyanogenMod Github (http://github.com/CyanogenMod).
Repository for shooter not found in the CyanogenMod Github repository list. If this is in error, you may need to manually add it to your local_manifest.xml.
build/core/product_config.mk:209: *** No matches for product "full_shooter". Stop.
** Don't have a product spec for: 'full_shooter'
** Do you have the right repo manifest?
What you need to do is to edit your blob to match the PRODUCT_NAME to the file name. For example with mine I have full_shooter.mk therefore in this file I need to have PRODUCT_NAME to match it. Whatever error it is looking for you just need to change the PRODUCT_NAME line to match what the error shows.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
If you run into issues with Java being the incorrect version here is the fix:
Make sure Java 6 JDK is installed by typing in:
Code:
$ java -version
Open the file main.mk in build/core and delete this line from the java error code section:
Code:
$(error stop)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Change all references in your device repo from frameworks/base to frameworks/native

Are you sure Java Open SDK will do this???

Credit the author?
http://forum.xda-developers.com/showthread.php?t=1762641

princescar said:
Are you sure Java Open SDK will do this???
Click to expand...
Click to collapse
done
Krizp0 said:
Credit the author?
http://forum.xda-developers.com/showthread.php?t=1762641
Click to expand...
Click to collapse
ah yes sorry forgot edit; fixed

Didn't you post this before and it got closed?
My bad, it was for compiling, same rule still applies mate. http://forum.xda-developers.com/showthread.php?t=1764296&highlight=build+jellybean
EDIT: This just looks like a straight copy and paste anyways...?

As to reference with this thread I will also lock this thread.

Related

[Tutorial] Compile JB on Ubuntu for SII [Originaly By Dastin1015]

Please not that i don't take credits for this tutorial its dastin1015 who made this! but as many people don't look in other forums except the forum for their devices i would like to give you the info here about how to build JB from source​
Original Thread;Here=)
dastin1015 said:
To compile Jellybean on Ubuntu I'm going to first give you steps to set up your computer to get this thing rolling. Also note that this appears to be a development preview source code.
This will NOT make a fully functional ROM, but will give you a place to start. Also I CANNOT fix every error you run into.
Note: The source download is approximately 6GB in size. You will need 25GB free to complete a single build, and up to 80GB (or more) for a full set of builds.
1) You need the following:
-JDK 6 if you wish to build Jellybean. You can download it from java.sun.com. Or:
Code:
$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
$ sudo apt-get update
$ sudo apt-get install sun-java6-jdk
-Python 2.4 -- 2.7, which you can download from python.org. Or:
Code:
$ sudo apt-get install python
-Git 1.7 or newer. You can find it at git-scm.com. Or:
Code:
$ sudo apt-get install git-core
-Android SDK:
Download the SDK here: http://developer.android.com/sdk/index.html
Extract the SDK and place it in your home directory.
I renamed my SDK to android-sdk to make it easier to navigate to.
Go to your home folder, press Ctrl+H to show hidden files, and open up your .bashrc file.
Add these lines at the bottom of the file:
Code:
# Android tools
export PATH=${PATH}:~/android-sdk/tools
export PATH=${PATH}:~/android-sdk/platform-tools
export PATH=${PATH}:~/bin
Find your .profile file and add this at the bottom of the file:
Code:
PATH="$HOME/android-sdk/tools:$HOME/android-sdk/platform-tools:$PATH"
You have now successfully installed the Android SDK.
To check for updates issue this into your terminal:
Code:
$ android
2) Install required packages. 64-bit (recommended)
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
On newer versions of Ubuntu such as 11.10 you may need to do the following:
Code:
$ sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so
Building on Ubuntu 12.04 is currently only experimentally supported and is not guaranteed to work on branches other than master.
Code:
$ sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl 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
3) Configure your USB.
Code:
$ gksudo gedit /etc/udev/rules.d/51-android.rules
Inside of this blank text file insert:
Code:
#Acer
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666"
#Samsung
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666"
4) Save the file and close it and then issue this command: [CODE]$ sudo chmod a+r /etc/udev/rules.d/51-android.rules
5) Install the repo:
Code:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
6) Initialize the repo:
Code:
$ mkdir WORKING_DIRECTORY
$ cd WORKING_DIRECTORY
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.1.1_r1
6.1) For people who have already done a repo init:
Code:
$ cd WORKING_DIRECTORY
$ repo init -b android-4.1.1_r1
$ repo sync
7) When prompted, enter your real name and email address.
8) Gather the files: [CODE]$ repo sync
9) Compiling:
Code:
$ source build/envsetup.sh
Or:
Code:
$ . build/envsetup.sh
10) Issue:
Code:
$ lunch
11) Pick your poison.
12) Now issue (The '#' is the number of cores your processor has plus 1, ex. I have a dual core processor so I type 'make -j3':
Code:
$ make -j#
~How To Add A Device To The List~
1) Find the github for your device you wish to add. (For me it is the HTC Evo 3D CDMA)
2) Now navigate to the location you are going clone the device tree to:
Code:
$ cd WORKING_DIRECTORY/device
$ mkdir samsung
3) Clone the github device tree from remote to local: (The shooter would be whatever you want that folder to be named so make sure it is whatever standard name would be for your device, example: Nexus One [passion], Nexus S [crespo], Motorola Droid [sholes], HTC Incredible [inc], etc.)
Code:
$ git clone git://github.com/CyanogenMod/android_device_htc_shooter.git shooter
4) Now navigate into the folder:
Code:
$ cd shooter
5) Connect phone to computer and make sure USB debugging is enabled and you have adb set up.
6) Extract Device Proprietary Files:
Code:
$ ./extract-files.sh
7) Navigate back to your home directory for building:
Code:
$ cd ~/WORKING_DIRECTORY
8) Prepare To Compile:
Code:
$ source build/envsetup.sh
Or:
Code:
$ . build/envsetup.sh
9) Get your list of devices:
Code:
$ lunch
10) Pick your poison.
11) Now compile:
Code:
$ make -j#
Or for a flashable zip:
Code:
$ make -j# otapackage
~NOTE~
If you are running into issues such as:
Code:
Which would you like? [full-eng] 5
build/core/product_config.mk:209: *** No matches for product "full_shooter". Stop.
Device shooter not found. Attempting to retrieve device repository from CyanogenMod Github (http://github.com/CyanogenMod).
Repository for shooter not found in the CyanogenMod Github repository list. If this is in error, you may need to manually add it to your local_manifest.xml.
build/core/product_config.mk:209: *** No matches for product "full_shooter". Stop.
** Don't have a product spec for: 'full_shooter'
** Do you have the right repo manifest?
What you need to do is to edit your blob to match the PRODUCT_NAME to the file name. For example with mine I have full_shooter.mk therefore in this file I need to have PRODUCT_NAME to match it. Whatever error it is looking for you just need to change the PRODUCT_NAME line to match what the error shows.
Click to expand...
Click to collapse
reserved for Q/A
It's frowned upon to re-distribute threads across multiple forums, trust me it wasn't allowed for a thread compiled by RC's so the same will go for this and any other thread especially one that was published on the portal as has been made aware to alot of people. Regardless of them reading other forums its clear to see thanks to the new 2013 theme having the new sidebar with top stories where I saw it earlier today. Just a heads up
AvRS said:
It's frowned upon to re-distribute threads across multiple forums, trust me it wasn't allowed for a thread compiled by RC's so the same will go for this and any other thread especially one that was published on the portal as has been made aware to alot of people. Regardless of them reading other forums its clear to see thanks to the new 2013 theme having the new sidebar with top stories where I saw it earlier today. Just a heads up
Click to expand...
Click to collapse
theres alot of people like me who never goes to the porta, dunno why tough
LastStandingDroid said:
theres alot of people like me who never goes to the porta, dunno why tough
Click to expand...
Click to collapse
Either way if it's already posted somewhere it's not advised to repeat the information in device specific forums as it's not device specific and why it's been put in a general section.
Yeah, listen to AvRS, you can face some warnings because it counts as duplicate thread spam. Calling a mod here to decide. Thanks! :good:
protomanez said:
Yeah, listen to AvRS, you can face some warnings because it counts as duplicate thread spam. Calling a mod here to decide. Thanks! :good:
Click to expand...
Click to collapse
thats amazing i never heard of it,
ill make this as much as possible for the SII
Thread closed
AvRS said:
Either way if it's already posted somewhere it's not advised to repeat the information in device specific forums as it's not device specific and why it's been put in a general section.
Click to expand...
Click to collapse
protomanez said:
Yeah, listen to AvRS, you can face some warnings because it counts as duplicate thread spam. Calling a mod here to decide. Thanks! :good:
Click to expand...
Click to collapse
LastStandingDroid said:
thats amazing i never heard of it,
ill make this as much as possible for the SII
Click to expand...
Click to collapse
And the mod has decided, as stated above, the thread is in General for a reason, it's applicable across phones.

Trouble rooting on ubuntu

OK so I have an old laptop running Ubuntu 10.04lts (because it runs best on that laptop) and no other computer. I was trying to root with the guide on the nexus4root website but when I go to unlock the boot loader it doesn't do anything. And I tried running the toolkit from the sticky with wine but no avail there either. Anyone have advice on how to do this, or do I need to bite the bullet and use a friends PC?
(I got the nexus 4 from T-Mobile, and I'm still very new to Linux. I went to college for computer engineering but lost interest in messing with computers)
Sent from my Nexus 4 using xda premium
This might help (not watched it but Google bought it up)...
http://www.youtube.com/watch?v=VfmulWBobTQ
skaroger867 said:
OK so I have an old laptop running Ubuntu 10.04lts (because it runs best on that laptop) and no other computer. I was trying to root with the guide on the nexus4root website but when I go to unlock the boot loader it doesn't do anything. And I tried running the toolkit from the sticky with wine but no avail there either. Anyone have advice on how to do this, or do I need to bite the bullet and use a friends PC?
(I got the nexus 4 from T-Mobile, and I'm still very new to Linux. I went to college for computer engineering but lost interest in messing with computers)
Sent from my Nexus 4 using xda premium
Click to expand...
Click to collapse
Hey, I have a Ubuntu 12.04 LTS machine and successfully unlocked my N4's bootloader and rooted it, but it shouldn't make any difference. Can you post exactly what the following command (which I assumed you entered, without the $ prompt) outputs:
Code:
$ fastboot oem unlock
Setting up your PATH
Also you need to make sure adb and fastboot executables are in your path. I can help you do that:
Open up .bashrc in your home folder with your favorite text editor (mine's gedit, without the $ prompt):
Code:
$ gedit ~/.bashrc
Add the following lines:
Code:
export PATH = ${PATH}:/home/username/android-sdk-linux/platform-tools/
export PATH = ${PATH}:/home/username/android-sdk-linux/tools/
Note:
You need to put the directory where you installed the Android SDK on your machine correctly. The paths above are just examples in my case and probably won't work for you.
Save and exit gedit. Close every Terminal window you have and open up a new one. Test by typing in (without the $ prompt) with an Android device plugged in and USB Debugging checked:
Code:
$ adb devices
Setting up the udev service
Once you're sure adb and fastboot are in your path, you also need to add the extra udev rules for Fastboot and ADB (in recovery) to work. To do that:
As root, create a file called 51-android.rules and put it in /etc/udev/rules.d/ (again with gedit, without the $ prompt):
Code:
sudo gedit /etc/udev/rules.d/51-android.rules
Copy and paste the following contents into the file:
Code:
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0e79", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0502", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0b05", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="413c", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0489", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="091e", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="24e3", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="2116", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0482", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="17ef", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="22b8", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0409", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="2080", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0955", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="2257", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="10a9", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1d4d", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0471", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04da", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="05c6", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1f53", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04dd", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fce", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0930", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="19d2", MODE="0666"
Save and close the file. Then, run the following commands (without the $ prompt):
Code:
$ sudo chmod 644 /etc/udev/rules.d/51-android.rules
$ sudo chown root:root /etc/udev/rules.d/51-android.rules
$ sudo service udev restart
$ sudo killall adb
Disconnect and reconnect your device (making sure it's in Fastboot/bootloader mode) and run the following command (without the $ prompt) to test:
Code:
$ fastboot devices
I used the video, it was a lot better than the written version they had up on the site. Phone is rooted and I'm downloading carbon rom now. Thanks!
Sent from my Amazon Kindle Fire using xda premium

[GUIDE] The Comprehensive AOKP Building Guide

Thread is outdated for 4.3... Working on Update. Thanks for your patience
Contents:
Introduction
Glossary & Linux Quick Guide
Setting up Linux (Dual-Boot Style Setup)
Setting up your Build Environment
Building
Cherry-Picking
Using CCache
Editing Local Manifests/Adding APKs to the build
Bash Scripting Autonomy
Creating Launchers
Uploading
Reserved
1. Introduction
Welcome To The Most Comprehensive Tutorial For Building AOKP ROMs I Can Think Of! All of the tutorials I have found have links to other websites interspersed throughout and are dependent on the other sites keeping their information current. Also, they can be confusing. My goal is to create a single document which, unfortunately, will contain some links but will flow in an orderly manner and include a discussion thread for building AOKP nightlies. The setup I will be describing will be using an Ubuntu - 64bit System. YOU MUST USE 64 BIT TO BUILD/COMPILE ANDROID. That said, I recommend Ubuntu 13.04
PLEASE POST ANY QUESTIONS, COMMENTS OR ITEMS YOU THINK WOULD BE BENEFICIAL IN THE THREAD. If this post has helped you, HIT THANKS and TELL OTHERS where to find the info they need. Post the thread on your G+, Facebook, Twitter Etc Accounts. Let's get the word out! Anyone can build! The goal is to create a community feel to this thread. Beginners to advanced users are welcome!
Here is My version of GAPPS. It will install AOKP Camera (Alongside Stock so You can Keep the Photo Sphere feature), Removes the Old Calendar and installs the newest Play Store Version, ***Play Store Version 4.0.25!!!*** Yay!!!!! The First Time you Flash it you might have to select your default calendars again
Thanks to:
VonEsch
Romanbb
These guys have been indispensable for helping me out when I got started, either pointing me in the right direction or learning together...
2. Glossary & Linux Quick Guide
2. Glossary & Linux Quick Guide
Let's start with some basic terms I will use.
Kang: Internet term meaning to steal.​Root: Akin to Android's SuperUser​Nautilus: Ubuntu's default file manager​sudo: Terminal Command to perform the request as Root.​gksu: Terminal Command to open a program as Root i.e. nautilus, gedit, terminal...​Repo: 1. Repository. 2. A Python Script used for synchronization between your local repository and AOKP's server repository.​Gerrit: A web based code review system, facilitating online code reviews for projects using the Git version control system.​Git: An online system used to store source code and manage version control (branches).​jb-mr1: Google's branch name for Jellybean 4.2 (jb-mr1.1 is 4.2.2).​Terminal: A Linux command prompt. (Ctrl+Alt+t).​Commit: A new feature/fix either implemented (merged) or awaiting review and/or approval (open).​Build: A completed ROM. (v) To compile a ROM​Cherry-Pick: To merge an open commit into your local repository to be incorporated into the build.​Nightly: A build containing all the merged commits since the last Official Build.​Bash: A simple programming language similar in function to DOS.​Distro: Short for distribution. Used to refer to a "flavor" of Linux. Different distros have different pros/cons and abilities.​Ubuntu: The Linux distro I use.​PPA: A Linux package containing software... sorta' like a windows executable.​Clone: To download the contents of an online Git repository folder onto your local machine.​Build Box: (Box) The PC you are using to build your ROMs.​MBR: Master Boot Record - The Hard Drive's own index.​Manifest: An XML file that tells the repo script what to include and where to get it from when it syncs your local repository.​URL: Short for Universal Resource Locator... basically a Web address.​
Linux Quick Guide:
Show Hidden Files in Nautilus: Ctrl+H​
Terminal Keyboard Shortcuts:
Copy: Ctrl+Shift+C​
Paste: Ctrl+Shift+V​
Break Operation: Ctrl+C​
3. Setting up Linux (Dual-Boot Style Setup)
3. Setting up Linux (Dual-Boot Style Setup)
I am using the assumption that you have no dedicated PC to build ROMs. The following method will turn your Windows PC into a Dual-Boot Ubuntu/Windows PC. If you already have a build box, go ahead and skip to post #3. Let's get started.
First you need to download Ubuntu. We're going to download Ubuntu 13.04 64-bit. (By the way, Ubuntu's Version control is Year.Month so 13.04 is the April 2013 version). You can burn the image to a disk or a USB stick (Pen Drive). I'm going to show you how to use a pen drive. *IN EITHER CASE* Make sure your BIOS is set to boot from that device first. Don't forget to switch it back afterward.
You can download Ubuntu here: http://www.ubuntu.com/download/desktop
You can download the pen drive installer here: http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/
OK... Here you're gonna follow the directions for Using the appropriate tools to make your bootable disk. So, Yes I am going to give you some links... but they will be specific, I promise!
To create a bootable DVD: http://www.ubuntu.com/download/help/burn-a-dvd-on-windows
To create a bootable USB stick: http://www.ubuntu.com/download/help/create-a-usb-stick-on-windows
OK.. That done? Great! Moving on...
Another link... But it is fantastic and has pictures! Here you will receive excellent instructions on how to create the dual-boot.
Windows 7
http://www.linuxbsdos.com/2012/05/17/how-to-dual-boot-ubuntu-12-04-and-windows-7/
Windows 7 with 2 hard drives
http://www.linuxbsdos.com/2012/07/2...d-windows-7-on-a-computer-with-2-hard-drives/
Windows 8
http://www.linuxbsdos.com/2012/11/05/dual-boot-windows-8-and-ubuntu-12-10-on-uefi-hardware/
4. Setting up your Build Environment
4. Setting up your Build Environment
OK! Make sure your system is completely functional and up to date, using software updater.
Ready to make a build box? Good!
The following will make life easier and your Box more fun. The following are optional but recommended. All code should be cut and pasted into terminal to prevent typos.
Install proprietary media codecs/libraries:
Code:
sudo apt-get install ubuntu-restricted-extras
Code:
sudo wget --output-document=/etc/apt/sources.list.d/medibuntu.list http://www.medibuntu.org/sources.list.d/$(lsb_release -cs).list && sudo apt-get --quiet update && sudo apt-get --yes --quiet --allow-unauthenticated install medibuntu-keyring && sudo apt-get --quiet update
Code:
sudo apt-get install libdvdcss2
Install VLC Media Player:
Code:
sudo apt-get install vlc
Install "Open in Terminal" Extension. This allows you to open a terminal window in any folder by right click and selecting "Open in Terminal" This is very helpful for cherry picking!!!! ***THIS ONE ISN'T A TERMINAL COMMAND*** Either option will work.
Option #1 Paste this into the address bar of your browser and install in Software Center
Code:
apt:nautilus-open-terminal
Option #2 Paste this into the software center search box and install.
Code:
Nautilus plugin for opening terminals in arbitrary paths
Install gvfs-mtp mount to easily mount and unmount your android 4.2 devices upon plugging in and unplugging: (Not Required for 13.04)
Code:
sudo add-apt-repository ppa:langdalepl/gvfs-mtp
Follow the prompts then:
Code:
sudo apt-get update
Then run software updater
Now, create a file /etc/udev/rules.d/51-android.rules (as the root user) and to copy the following lines in it. must be replaced by the actual username of the user who is authorized to access the phones over USB.
1. Open a Root Access Nautilus Session:
Code:
gksu nautilus
2. Now, Click on File System in the Left Hand Pane, then navigate to etc/udev/rules.d/
3. Now, right click in the folder and Select "Create New Document" then "Empty Document"
4. Name the document 51-android.rules
5. Open 51-android.rules
Paste the following:
Code:
# adb protocol on passion (Nexus One)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e12", MODE="0666", OWNER="thebytesmasher"
# fastboot protocol on passion (Nexus One)
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0fff", MODE="0666", OWNER="thebytesmasher"
# adb protocol on crespo/crespo4g (Nexus S)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e22", MODE="0666", OWNER="thebytesmasher"
# fastboot protocol on crespo/crespo4g (Nexus S)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e20", MODE="0666", OWNER="thebytesmasher"
# adb protocol on stingray/wingray (Xoom)
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", ATTR{idProduct}=="70a9", MODE="0666", OWNER="thebytesmasher"
# fastboot protocol on stingray/wingray (Xoom)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="708c", MODE="0666", OWNER="thebytesmasher"
# adb protocol on maguro/toro (Galaxy Nexus)
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0666", OWNER="thebytesmasher"
# fastboot protocol on maguro/toro (Galaxy Nexus)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e30", MODE="0666", OWNER="thebytesmasher"
# adb protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d101", MODE="0666", OWNER="thebytesmasher"
# fastboot protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d022", MODE="0666", OWNER="thebytesmasher"
# usbboot protocol on panda (PandaBoard)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d00f", MODE="0666", OWNER="thebytesmasher"
# usbboot protocol on panda (PandaBoard ES)
SUBSYSTEM=="usb", ATTR{idVendor}=="0451", ATTR{idProduct}=="d010", MODE="0666", OWNER="thebytesmasher"
# adb protocol on grouper (Nexus 7)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e42", MODE="0666", OWNER="thebytesmasher"
# fastboot protocol on grouper (Nexus 7)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e40", MODE="0666", OWNER="thebytesmasher"
# mtp protocol on the grouper (Nexus 7)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e41", MODE="0666", OWNER="thebytesmasher"
## Google
#SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4ee2", MODE="0666", OWNER="thebytesmasher"
## LG Nexus 4
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666", OWNER="thebytesmasher"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666", OWNER="thebytesmasher"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0502", MODE="0666", OWNER="thebytesmasher"
SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="0666", OWNER="thebytesmasher"
SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", MODE="0666", OWNER="thebytesmasher"
SUBSYSTEM=="usb", ATTRS{idVendor}=="22b8", MODE="0666", OWNER="thebytesmasher"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666", OWNER="thebytesmasher"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0fce", MODE="0666", OWNER="thebytesmasher"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0489", MODE="0666", OWNER="thebytesmasher"
SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", SYMLINK+="android_adb", MODE="0666"
SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666", GROUP="plugdev"
# Google Nexus 7 MTP mode : automatic mount when plugged (all android versions)
ENV{ID_MODEL}=="Nexus_4", ENV{ID_MODEL_ID}=="4ee2", ACTION=="add", RUN+="/usr/bin/sudo -b -u yourlogin /usr/local/sbin/go-mtpfs -allow-other=true /media/Nexus4"
ENV{ID_MODEL}=="Nexus_4", ENV{ID_MODEL_ID}=="4ee2", ACTION=="add", RUN+="/usr/bin/sudo -b -u yourlogin /usr/local/sbin/go-mtpfs -allow-other=true /media/Nexus4"
ENV{ID_MODEL}=="Nexus_7", ENV{ID_MODEL_ID}=="4e41", ACTION=="add", RUN+="/usr/bin/sudo -b -u yourlogin /usr/local/sbin/go-mtpfs -allow-other=true /media/Nexus7"
ENV{ID_MODEL}=="Nexus_7", ENV{ID_MODEL_ID}=="4e42", ACTION=="add", RUN+="/usr/bin/sudo -b -u yourlogin /usr/local/sbin/go-mtpfs -allow-other=true /media/Nexus7"
# Google Nexus 7 MTP mode : automatic unmount when unplugged (all android versions)
ENV{ID_MODEL}=="Nexus_4", ENV{ID_MODEL_ID}=="4ee2", ACTION=="remove", RUN+="/bin/umount /media/Nexus4"
ENV{ID_MODEL}=="Nexus_4", ENV{ID_MODEL_ID}=="4ee2", ACTION=="remove", RUN+="/bin/umount /media/Nexus4"
ENV{ID_MODEL}=="Nexus_7", ENV{ID_MODEL_ID}=="4e41", ACTION=="remove", RUN+="/bin/umount /media/Nexus7"
ENV{ID_MODEL}=="Nexus_7", ENV{ID_MODEL_ID}=="4e42", ACTION=="remove", RUN+="/bin/umount /media/Nexus7"
6. Use the Find and Replace (magnifying glass with pencil) option to find thebytesmasher and replace with your Ubuntu username.
7. Save the file.
Reboot for the above changes to take effect.
** Now to install the required libraries to make your build box work! **
Copy and paste this in terminal:
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
After that is done installing do:
Code:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Then:
Code:
sudo apt-get install schedtool pngcrush
Next we will make the required directories, get the Repo binary/script, Add repo to the path & give it permissions, initialize the repo binary and download the Manifest, then sync the source. Ready?
Make directory for repo binary:
Code:
mkdir ~/bin
Add that directory to your path:
Code:
PATH=~/bin:$PATH
Download repo binary and place it in the proper directory This has recently changed:
Code:
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
Give repo the proper permissions:
Code:
chmod a+x ~/bin/repo
Create directory for where the AOKP repo will be stored and synced, then go to it:
Code:
mkdir ~/aokp_kk && cd ~/aokp_kk
Notice in the above code how We used && to string together 2 commands.
Initialize the AOKP repo and download the manifest for the KITKAT branch ( -b kitkat):
INITIALIZING REPOSITORY
Init core trees without any device/kernel/vendor :
Code:
repo init -u https://github.com/AOKP/platform_manifest.git -b kitkat
Init repo with all devices, kernels and vendors supported by OurROM :
Code:
repo init -u https://github.com/AOKP/platform_manifest.git -b kitkat -g all,kernel,device,vendor
Init repo only for a particular device :
Code:
repo init -u https://github.com/AOKP/platform_manifest.git -b kitkat -g all,-notdefault,<devicename>,<vendorname>
for example, to init only trees needed to build mako
Code:
repo init -u https://github.com/AOKP/platform_manifest.git -b kitkat -g all,-notdefault,mako,lge
Init repo for multiple devices
Code:
repo init -u https://github.com/AOKP/platform_manifest.git -b kitkat -g all,-notdefault,<devicename1>,<devicename2>,<devicename3>,<vendorname1>,<vendorname2>,<vendorname3>
for example, to init trees needed to build mako and grouper
Code:
repo init -u https://github.com/AOKP/platform_manifest.git -b kitkat -g all,-notdefault,mako,grouper,lge,asus
Sync AOKP source. This can be sped up by using the -j variable. -j4, -j8, -j16, -j32.. Take the number of THREADS your processor have and multiply by 4. The higher the value, the more multitasking... also the higher the number, the slower your build box will run if YOU try to multitask while using a command with a -j variable. Change the number after -j to your liking:
Code:
repo sync -j8
Go do something else. This will take a LONG time! You will be downloading about 10GB of source code. Then Continue on... At this point I reboot my Linux box... Why Not, Right?
Get it? OK!
5. Building...Finally!
5. Building...Finally!
Now we're going to build our first ROM.
The easiest way is to create the ROM and build it into a zip file in one step. to do this we will use the BRUNCH command.
Later we'll set up bash scripts and launchers to simplify the process.
Open a new terminal in the aokp_jb folder using the right click - open in terminal extension we set up earlier
-OR-
you can open a terminal and do
Code:
cd ~/aokp_jb
Then, I always make sure all my variables are set and the build directory is clear:
Code:
PATH=~/bin:$PATH
Code:
make clobber
Now for the next step, use your -j number you decided on earlier (or try another) and substitute mako (both instances) with the device you want to build for (again, don't forget the "."), -j8 or -j12 are reasonable compromises:
Code:
. build/envsetup.sh && brunch mako aokp_mako-userdebug -j32
That's it... for a basic nightly. Now to watch the progress, you can maximize the Terminal Window and open the edit menu (***By default, the Global Menu is enabled in Ubuntu 13.04, that means that for the current window in focus, if you place your mouse pointer at the top left of the screen, you'll get the menu options for that window) and select "Profile Preferences" under the "Scrolling" tab, select "scroll on output"
Now on to More customizations!
6. Cherry-Picking
6. Cherry-Picking
This is the part that most people really want to know about. What is cherry-picking and how do I do it?
On your local computer, you actually have 2 copies of the online Repo. One is in a hidden directory and the other is the one you work with. That way you can modify your visible local copy and if you want to revert or screw something up, it's usually relatively painless to fix. Cherry-picks modify the visible local directory with the modified/added/deleted information of the cherry. When you revert, you're basically calling back up the information from the hidden directory that has been unchanged.
Here is how to cherry pick:
Open up the AOKP Gerrit at
HTML:
http://gerrit.sudoservers.com/#/q/status:open,n,z
Find a change you want to add.
This is where you want to be careful. If the change has multiple parts (i.e. [1/2]) You'll want to cherry-pick both parts.
____________________________________________________________________________________________________________________________________
This is what the Open Commit will look like:
{
"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"
}
____________________________________________________________________________________________________________________________________
Choosing the Commit below the highlight by clicking on the Subject name, The next screen looks like this:
Notice the Commit message, (circled in BLUE) it often contains a brief description of the change.
To the left of the commit message is the basic change info.
***The section entitled Project is the important one.*** This section (Circled in RED) tells you where the cherry pick needs to be downloaded to. For this Commit, it needs to be downloaded to your "/home/YourUserName/aokp_jb/device/asus/grouper" directory.
About halfway down the page, you'll find the download section (Circled in GREEN. Click on the "cherry-pick" label. Now copy the URL underneath by either Ctrl+C or right click and copy.
Now we're going to use the "Open in Terminal" extension we installed earlier. You need to navigate into the aokp_jb/device/asus/grouper directory and right click then select "Open in Terminal" or you can do the same by right clicking on the grouper folder and selecting "Open in Terminal"
____________________________________________________________________________________________________________________________________
Once the terminal is open, paste the URL at the command prompt. Either with a right click and paste or Ctrl+Shift+V.
Press Enter
If successful, You should see this or a similar message:
____________________________________________________________________________________________________________________________________
If you want to cherry pick into the same directory as an active pick, you'll need to commit those changes first:
The easiest way is open a terminal in the folder containing the pick you want to commit and type
Code:
git add -A
then
Code:
git commit -a
Select the files you want to keep and press Ctrl+O (like save) and enter, the Ctrl+X to exit.
When you're done picking go back to the root aokp_jb folder and build!
===================================================================================================================
**In order to sync, you'll need to revert your cherry picks, so sync completes successfully. To do this, type the following in a terminal in each directory you picked into.**
Code:
git reset --hard HEAD && git clean -f && git checkout aokp/jb-mr1
This can also be split up into 3 different commands.
7. Using CCache
7. Using ccache
ccache is a compiler cache for C and C++ that can help make builds faster. It will use space on your Home Partition. The recommended size is 50-100GB. I use 20-30GB and find it speeds up things tremendously. Using ccache is easy. in the root of your build directory (aokp_jb) type the following in Terminal:
Code:
export USE_CCACHE=1
Code:
export CCACHE_DIR=/<path_of_your_choice>/.ccache
Code:
prebuilts/misc/linux-x86/ccache/ccache -M 50G
The 50G is the size you want for your ccache. If you want to watch ccache doing its thing type the following in a new terminal:
Code:
watch -n1 -d prebuilts/misc/linux-x86/ccache/ccache -s
Later, we'll use a script to automate using ccache each time.
8. Editing Local Manifests/Adding APKs
8. Editing Local Manifests/Adding APKs
So, if you've followed this, You've already edited your /home/YourUserName/aokp_jb/.repo/local_manifests/kernel_manifest.xml file. We're going to use this file as our local_manifest.xml. Your default.xml found in the directory platform_manifest is the file that repo uses to sync your local repository. kernel_manifest.xml is a local manifest that adds to your default manifest. We're going to use it to add to and remove from the default manifest. Why is this useful? Well if you want to add something to your build that isn't in AOKP's repository, or replace something that is, you use the local manifest to accomplish this.
Your default.xml defines where on the internets repo can find the base repository (called a remote) for the project you want to add. With some basic deduction, we can see in the following example that the name of the remote is cm and the base repository domain is at https://github.com/:
<remote name="cm"
fetch="https://github.com/"
review="review.cyanogenmod.com" />
Click to expand...
Click to collapse
Understanding how the remote is defined is important because if you want to add projects from a different source, not defined by the default.xml, you'll need to define it in your local manifest. You can name it whatever you want, you'll use that name to call it out in your project path statement.
To add a project that doesn't already exist in default manifest you'd simply add a line to the local manifest (kernel_manifest.xml) like this:
Code:
<project path="packages/apps/CMFileManager" name="CyanogenMod/android_packages_apps_CMFileManager" remote="cm" revision="cm-10.1" />
Defined:
"project path=": this is the local folder the project will sync into/with
"name=": this is the remote location of the repository.
"remote=": this is a call the the remote defined at the head of the manifest.
"revision=": this is the branch of the repository you want.
So in this case:
We are downloading the server repository "android_packages_apps_CMFileManager" from "https://github.com/CyanogenMod/" from the "cm-10.1" branch into our local repository ~/aokp_jb/packages/apps/CMFileManager. GET IT?
So now, whenever we perform a repo sync from the root folder, ~/aokp_jb/packages/apps/CMFileManager will be updated with new commits from CyanogenMod's repository. Cool, huh?
That won't create an app in the build by itself, but it gets us much closer!
In order to tell the AOKP build that you want to build in that app, you need to add it to ~/aokp_jb/build/target/product/core.mk. In this case you add the name of the app "CMFileManager" to the list of Apps in core.mk
Code:
abcc \
apache-xml \
atrace \
bouncycastle \
bu \
cacerts \
CMFileManager \
com.android.location.provider \
com.android.location.provider.xml \
core \
So all we did was add it, plus a space and a back-slash. That's it! Now if we build, CMFileManager will be an available app!
But what if you want to replace an existing app with one from a different repository? You first must remove the AOKP project path, then add the new one as shown above. For this example, we'll say that AOSPs calendar app is different from AOKPs and we want to use AOSPs version. So in kernel_manifest.xml we'll do the following:
Code:
<remove-project name="platform/packages/apps/Calendar" />
<project path="packages/apps/Calendar" name="platform/packages/apps/Calendar" remote="aosp" revision="jb-mr1.1-release" />
See, we removed the standard one, then called out the one we wanted. Since this app has the same name, there is no need to modify any other files. Play with it... See what you can do.
Some applications require other "hooks" like a way to access their settings like CMs LockClock or Chronus. You need to add additional strings and xml settings to create a settings menu in ROM Control.
=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
Adding APKs.
Sometimes it's not possible to build an app in from a repository. In this case, we'll use the APK itself!
OK, This is a little trickier..
First you need a copy of the APK you want to install during the build. Do I need to tell you not to install paid versions unless the ROM is solely for you???
Then copy the APK into ~/aokp_jb/vendor/aokp/prebuilt/common/app
Now we need to modify 2 Files to incorporate the APK into the Build.
The first is ~/aokp_jb/vendor/aokp/prebuilt/Android.mk
You'll need to add the following code (For this example, we'll assume we are adding the DashClock APK):
Code:
include $(CLEAR_VARS)
LOCAL_MODULE := DashClock
LOCAL_MODULE_OWNER := aokp
LOCAL_SRC_FILES := common/app/$(LOCAL_MODULE).apk
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_SUFFIX := .apk
LOCAL_MODULE_CLASS := APPS
LOCAL_CERTIFICATE := PRESIGNED
include $(BUILD_PREBUILT)
The next file to edit is ~/aokp_jb/vendor/aokp/configs/common.mk
Here you just need to add DashClock in the same format as the other APKs like this:
Code:
PRODUCT_PACKAGES += \
AOKPtips \
AppWidgetPicker \
DashClock \
LatinImeDictionaryPack \
Microbes \
NovaLauncher \
PerformanceControl \
ROMControl \
Superuser \
su \
SwagPapers \
Torch \
UnicornPorn
That's it. Now when you build you'll see that the APKs you added are built in and annotated as pre-signed!
9. Bash Scripting Autonomy
9. Bash Scripting Autonomy
Bash scripting is an easy tool to create an automated method to perform all of the multi-step functions we've covered already. To create a bash script open a new empty document by right clicking and selecting "create new document", then "empty document". Name it something convenient to the task you want to accomplish with the extension ".sh" like "makemako.sh" Obviously omit the quotes. Open the file.
for a bash script the first line should be:
Code:
#!/bin/bash
Then put all the commands you want in the order you want. For this example, I will show you a script to make a MAKO build incorporating all of the previous elements we've covered so far.
Code:
#! /bin/bash
cd ~/aokp_jb
PATH=~/bin:$PATH
make clobber
export USE_CCACHE=1
wait
export CCACHE_DIR=/home/thebytesmasher/.ccache
wait
prebuilts/misc/linux-x86/ccache/ccache -M 20G
wait
startBuildTimeM=$(date +%r)
. build/envsetup.sh && brunch mako aokp_mako-userdebug -j32
wait
endBuildTimeM=$(date +%r)
echo " "
echo "Build Time: $startBuildTimeM"
echo "Finished: $endBuildTimeM"
cd ~/aokp_jb/out/target/product/mako/
file=$(echo aokp_mako_Purely_Merged*.zip)
cp $file /home/thebytesmasher/Desktop/Latest_Builds/mako/
echo ""
echo "File copy complete"
I used the command "wait" in between operations to ensure they complete prior to commencing the next. Additionally I created Start and Stop variables called "startBuildTimeM" and "endBuildTimeM" to display (echo "") the start and stop times so I can find out exactly how long the build took to make. Also in this command, I specified a ccache size of 20GB.
Next, right-click on the newly created script and go to the permissions tab and select "Allow executing file as a program" as seen below:
Doing this allows you to double click the script and select "Run in Terminal" to execute your script. Later on it will be necessary to have this box checked to allow a launcher to work.
Basically, you can make scripts to automate all of your tasks. The next section, Creating Launchers will simplify the process even more.
**Hint: Put all of your scripts into a folder in your Home directory in a folder to keep them out of the way**
10. Creating Launchers
10. Creating Launchers
What a launcher does: It allows you to create a link that automatically launches your script.
Install the following:
Code:
sudo apt-get install gnome-panel
Then to create a launcher:
Code:
gnome-desktop-item-edit --create-new ~/Desktop
Of course, that gets to be a PITA after awhile... So Why not Create a launcher to make launchers?!!
Create a document called Make New Launcher
Copy & Paste The Following:
Code:
gnome-desktop-item-edit --create-new ~/Desktop
Save the document.
Modify the properties of the document to allow it to be executed as a program.
Move it to your scripts folder.
Open a Terminal.
Paste in the following:
Code:
gnome-desktop-item-edit --create-new ~/Desktop
Now the Make a new launcher window will pop up.
For this Launcher, We're going to select:
Type: Application
Name: Make New Launcher
Command: (Click Browse and navigate to the location where the file you just created is and open it)
Comment: Any Comment you may want
Click on the Springy Platform thing to select a different icon, then click OK.
Now whenever you want to create a new Launcher, just double click the new Icon on your desktop!
For Bash Scripts, You'll want to select "Application in Terminal" for Type. That's it! Now you can make a script for Syncing and for building, make launchers and do it all with one double click!
11. Uploading
11. Uploading
12. Also Reserved
12. Also Reserved
TBS, a very gd thread and guide u had open. I understand it for AOKP. I trying to pull someone source from his github after repo sync from cm source. I goo ard but couldn't find and answer. Pls help me with it. Tks.
orbital_71 said:
TBS, a very gd thread and guide u had open. I understand it for AOKP. I trying to pull someone source from his github after repo sync from cm source. I goo ard but couldn't find and answer. Pls help me with it. Tks.
Click to expand...
Click to collapse
I don't quite understand what you are trying to do, can you elaborate a little please?
Example u already build a rom with all the commit and the stuff u want and u push to github. And i like to pull it all and merge with the latest CM source.
orbital_71 said:
Example u already build a rom with all the commit and the stuff u want and u push to github. And i like to pull it all and merge with the latest CM source.
Click to expand...
Click to collapse
So, you want to make a CM repository, and replace certain CM parts with stuff from another git repository?
TheByteSmasher said:
So, you want to make a CM repository, and replace certain CM parts with stuff from another git repository?
Click to expand...
Click to collapse
Yes..
orbital_71 said:
Yes..
Click to expand...
Click to collapse
Well, I don't build CM... I'm not sure if the directory structure is different..., the concept should be the same though. I'm currently writing the section called editing local manifests (Section 8) It should accomplish the basics of what you want, but there may be other hooks required for whatever you add... Please tell me if this is what you're talking about!
hey man I gotta say I've been building AOKP for a while now. here and there I'd cherry pick so that was easy. recently I was trying to figure out how to get features and apps from other roms like CM over to aokp. CMFilemanager was the first one I wanted to try.
I've followed your guide and my rom is building right now. so far so good. thanks for the guide.
Also the scripting is a great idea. ive been doing that too and it saves a ton of time

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

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

[Guide][Ref][Z][BYO] Project Developer - AIO TUTORIAL

Project Developer
Welcome
This is a guide for all those who want to build for their Xperia Z Device but do not neccesasarily have the knowledge or experience.
This is an unofficial guide for the building of custom ROMs and other mods for the Xperia Z. This is a work in progress, with additions being made as often as possible. This thread has already grown with the help of the devs established in this forum. BMP777 began this project a year ago when I was using a Samsung GS II Skyrocket. BMP777 started another alike thread called PR II in the LGOG forum a while back as well. I have since moved on to a ONE, but both threads remain to this day. and Started by Me on Xperia Arc The point is this: everyone who uses this site has a desire for modding, customizing, and/or otherwise altering their device. Unfortunately, many have no idea how to go about doing these things for themselves. As such, there is a lot of dissatisfaction among developers about receiving constant demands, suggestions, and requests for updates. This thread is meant to give those who want to step up and build for themselves the means to do so. It is an ever-changing thread, with all assistance welcomed.
READ ME:
On one hand, it should go without saying that if you have no knowledge and/or experience with building, java, C++, and various other tools, you probably shouldn't begin here. At the same time, it is possible to learn to build, provided you can read, follow directions, and aren't too lazy to RESEARCH.
OH YEAH, and you better have patience. This isn't easy. It will be work. The quickest way to get flamed is to show yourself to be lazy. If you think that with a couple clicks, you can have your own flashy ROM, forget it. But, if you do want to learn, this is a good place to get started. I have no ego about this; I started the same way and just want to help everyone learn to build their own ROM. But, everyone will struggle to get to a successful point, and lazy, unmotivated people just irritate those who have had to learn from scratch too. Tutorials will be posted for any new thing learned and built as time and space allow. ALL ARE WELCOME AND ALL QUESTIONS ARE TOO. But, seriously, if it's a really ridiculous one, I/we reserve the right to screw with you about it.
ALWAYS REMEMBER:
{
"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"
}
Thread Disclaimer:
The instructions and extras posted here are to be used at your own risk. I am working hard to provide good, workable tutorials that will make successful building much easier. Nevertheless, I am not responsible if you lose your files, brick your device, or inadvertently cause a nuclear war. If you are seeking absolute perfection, RUN NOW WHILE YOU STILL CAN!!
Thread Navigation :
# 2 > Setting Up Build enviorment
# 3 > Building instructions & How To Build Using Linaro Toolchain
# 4 > Kernel building and CCACHE
# 5 > reserved for future
XDA:DevDB Information
Project Developer, a Tool/Utility for the Sony Xperia Z
Contributors
officiallysonyrebel, car vs driver , BMP777, @Saki3d , @FXP , @kali , @codeworkx , @cdesai
Version Information
Status: Testing
Created 2013-11-29
Last Updated 2013-12-03
Build Enviorment Set up :
This is a combination of the steps offered in the threads 'Compile JB on Ubuntu' and TeamChopsticks CyanogenMod.
Special thanks to dastin1015 and TeamChopsticks.
Tip: Allocate at least 75 gigs of space for the building of ONE ROM. If you install ccache, you will want 90. A complete build directory can use as much as 100 gigs, so make sure you have plenty of room. One of the ways to fail out a build is too use all of your partition before acquiring all the necessary files.
Here are the steps from those 2 tutorials in correct order:
0.1 ))
Install Gedit
Code:
# gedit
sudo apt-get install gedit
1) You need the following:
-JDK 6 if you wish to build Jellybean.
Code:
[COLOR="Black"]$ sudo apt-get oracle-java7-installer
-Python 2.4 -- 2.7, which you can download from python.org.[/COLOR]
Or:
Code:
[COLOR="black"]$ sudo apt-get install python
-Git 1.7 or newer. You can find it at git-scm.com.[/COLOR]
Or:
Code:
[COLOR="black"]$ sudo apt-get install git-core[/COLOR]
-Android SDK:
Download the SDK here: http://developer.android.com/sdk/index.html
Extract the SDK and place it in your home directory.
I renamed my SDK to android-sdk to make it easier to navigate to – this tutorial assumes you've done that as well.
Go to your home folder, press Ctrl+H to show hidden files, and open up your .bashrc file.
Add these lines at the bottom of the file:
Code:
[COLOR="black"]# Android tools
export PATH=${PATH}:~/android-sdk/tools
export PATH=${PATH}:~/android-sdk/platform-tools
export PATH=${PATH}:~/bin[/COLOR]
Find your .profile file and add this at the bottom of the file:
Code:
[COLOR="black"]PATH="$HOME/android-sdk/tools:$HOME/android-sdk/platform-tools:$PATH"
You have now successfully installed the Android SDK.[/COLOR]
To check for updates issue this into your terminal:
Code:
[COLOR="black"]$ android[/COLOR]
2) Install required packages. 64-bit (recommended)
Code:
[COLOR="black"]$ 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 lib32readline-gplv2-dev lib32z-dev
libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown
libxml2-utils lzop schedtool[/COLOR]
On newer versions of Ubuntu such as 11.10 you may need to do the following:
Code:
[COLOR="black"]$ sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so[/COLOR]
Code:
[COLOR="black"]$ 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[/COLOR]
3) Configure your USB.
Code:
[COLOR="black"]$ gksudo gedit /etc/udev/rules.d/51-android.rules[/COLOR]
Inside of this blank text file insert:
Code:
[COLOR="black"]#Acer
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666"
#ASUS
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666"
#Dell
SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0666"
#Foxconn
SUBSYSTEM=="usb", ATTR{idVendor}=="0489", MODE="0666"
#Garmin-Asus
SUBSYSTEM=="usb", ATTR{idVendor}=="091E", MODE="0666"
#Google
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666"
#HTC
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666"
#Huawei
SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0666"
#K-Touch
SUBSYSTEM=="usb", ATTR{idVendor}=="24e3", MODE="0666"
#KT Tech
SUBSYSTEM=="usb", ATTR{idVendor}=="2116", MODE="0666"
#Kyocera
SUBSYSTEM=="usb", ATTR{idVendor}=="0482", MODE="0666"
#Lenevo
SUBSYSTEM=="usb", ATTR{idVendor}=="17EF", MODE="0666"
#LG
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666"
#Motorola
SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0666"
#NEC
SUBSYSTEM=="usb", ATTR{idVendor}=="0409", MODE="0666"
#Nook
SUBSYSTEM=="usb", ATTR{idVendor}=="2080", MODE="0666"
#Nvidia
SUBSYSTEM=="usb", ATTR{idVendor}=="0955", MODE="0666"
#OTGV
SUBSYSTEM=="usb", ATTR{idVendor}=="2257", MODE="0666"
#Pantech
SUBSYSTEM=="usb", ATTR{idVendor}=="10A9", MODE="0666"
#Philips
SUBSYSTEM=="usb", ATTR{idVendor}=="0471", MODE="0666"
#PMC-Sierra
SUBSYSTEM=="usb", ATTR{idVendor}=="04da", MODE="0666"
#Qualcomm
SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0666"
#SK Telesys
SUBSYSTEM=="usb", ATTR{idVendor}=="1f53", MODE="0666"
#Samsung
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666"
#Sharp
SUBSYSTEM=="usb", ATTR{idVendor}=="04dd", MODE="0666"
#Sony Ericsson
SUBSYSTEM=="usb", ATTR{idVendor}=="0fce", MODE="0666"
#Toshiba
SUBSYSTEM=="usb", ATTR{idVendor}=="0930", MODE="0666"
#ZTE
SUBSYSTEM=="usb", ATTR{idVendor}=="19D2", MODE="0666"[/COLOR]
4) Save the file and close it and then issue this command:
Code:
[COLOR="black"]$ sudo chmod a+r /etc/udev/rules.d/51-android.rules[/COLOR]
5) Install the repo:
Code:
[COLOR="black"]$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo[/COLOR]
Create your work directory:
Code:
[COLOR="black"]mkdir ~/"your directory name here" For example: mkdir ~/cm10
cd ~/cm10[/COLOR]
Setup local manifest:
Code:
[COLOR="Black"]mkdir .repo/local_manifests
touch .repo/local_manifests/sony.xml
gedit .repo/local_manifests/sony.xml[/COLOR]
Necessary Files for Xperia Z :
Tip :For Building any Rom for Xperia Z u need these specific device files
1 . first is "sony.xml"
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project path="device/sony/fusion3-common" name="CyanogenMod/android_device_sony_fusion3-common" remote="github" revision="cm-11.0" />
<project path="device/sony/qcom-common" name="CyanogenMod/android_device_sony_qcom-common" remote="github" revision="cm-11.0" />
<project path="device/sony/yuga" name="CyanogenMod/android_device_sony_yuga" remote="github" revision="cm-11.0" />
<project path="vendor/sony" name="CyanogenMod/proprietary_vendor_sony" remote="github" revision="cm-11.0" />
<project path="kernel/sony/apq8064" name="CyanogenMod/android_kernel_sony_apq8064" remote="github" revision="cm-11.0" />
<project path="hardware/sony/DASH" name="CyanogenMod/android_hardware_sony_DASH" remote="github" revision="cm-11.0" />
</manifest>
Building Instructions : For CyanogenMod :: AOKP :: Carbon roms :: Beanstalk
Unofficial
To get started with Android/CyanogenMod, you'll need to get familiar with Git and Repo.
To initialize your local repository using the CyanogenMod trees, use a command like this:
first create folder named " cm "
Code:
mkdir cm
enter into cm
Code:
cd ~/cm
For CM - 11.0 kitkat 4.4.x
Code:
[COLOR="black"]repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0[/COLOR]
Then to sync up:
Code:
[COLOR="black"]repo sync[/COLOR]
Please see the CyanogenMod Wiki for building instructions.
For more information on this Github Organization and how it is structured, please read the wiki article.
Create and edit semc.xml in .repo:
Code:
[COLOR="black"]gedit .repo/local_manifests/sony.xml[/COLOR]
Add this to the semc.xml:
For CM 11.0 KitKat 4.4.x
copy paste semc.xml for kikat 4.4 from above
then
Code:
[COLOR="Black"]repo sync[/COLOR]
Code:
[COLOR="black"]. build/envsetup.sh (notice the period and space)
vendor/cm/get-prebuilts
[/COLOR]
then
Code:
brunch yuga
Special thanks to scott.hart.bti for his hard work -
From terminal
1. type
Code:
[COLOR="black"]cd[/COLOR]
.
This will bring you to your root folder.
2. type
Code:
[COLOR="black"]mkdir beanstalk[/COLOR]
.
This will create a folder named beanstalk.
3. type
Code:
[COLOR="black"]cd beanstalk[/COLOR]
.
This will take you to the beanstalk directory created from previous step
4. type
Code:
[COLOR="black"]repo init -u git://github.com/scotthartbti/android.git -b kk44[/COLOR]
.
This will setup the folders to be synced.
5. For Beanstalk KitKat 4.4.x
copy paste sony.xml for kikat 4.4 from above
then
Code:
[COLOR="Black"]repo sync[/COLOR]
apply patches for 4.4
9. Outside of terminal, navigate to beanstalk/vendor/cm. Double click on the get-prebuilts file and select run in terminal. This will fetch necessary files needed to build and place them where they need to be.
10. Type
Code:
[COLOR="Black"]. build/envsetup.sh && brunch yuga[/COLOR]
11. Previous step will start building beanstalk for your device. The process takes anywhere from 1 - 3 hours depending on your computer.
12. Once completed, it will say package complete and you will have a beanstalk named zip file in your out folder.
Unofficial
Special thanks to spleef and ktempleman for laying this out
This set of instructions is unverified. If you build successfully or have build issues, please post here so we can confirm or fix what isn't working
First:
Code:
[COLOR="Black"]mkdir aokp[/COLOR]
then
Code:
[COLOR="black"]cd aokp[/COLOR]
then
Code:
[COLOR="black"]repo init -u https://github.com/AOKP/platform_manifest.git -b kitkat[/COLOR]
after it does its thing
Code:
[COLOR="black"]mkdir .repo/local_manifests
touch .repo/local_manifests/sony.xml
gedit .repo/local_manifests/sony.xml[/COLOR]
copy paste semc.xml for kikat 4.4 from above
save and exit then
Code:
[COLOR="black"]repo sync[/COLOR]
after everything syncs
Code:
[COLOR="black"]gedit vendor/aokp/vendorsetup.sh[/COLOR]
and add this to the bottom:
Code:
[COLOR="black"]add_lunch_combo aokp_yuga-userdebug[/COLOR]
save and exit.. then
Code:
[COLOR="black"]. build/envsetup.sh[/COLOR]
Code:
[COLOR="black"]brunch yuga[/COLOR]
For more on AOKP building, try here: http://aokp.co/learn/so-you-want-to-build-aokp-jb-ubuntu-1204
And Here: https://github.com/AOKP
Unofficial
Getting Started
To get started with the Carbon-Dev sources, you'll need to get familiar with Git and Repo.
Create the Directories
You will need to set up some directories in your build environment.
To create them run:
Code:
[COLOR="black"]mkdir -p ~/carbon[/COLOR]
Install the Repository
You may need to reboot for these changes to take effect. Now enter the following to initialize the repository:
Code:
[COLOR="black"]cd ~/carbon[/COLOR]
Repositories:
Before you continue --> run this in the terminal
Code:
[COLOR="black"]repo init -u https://github.com/CarbonDev/android.git -b kk[/COLOR]
after it does its thing
Code:
[COLOR="black"]mkdir .repo/local_manifests
touch .repo/local_manifests/sony.xml
gedit .repo/local_manifests/sony.xml[/COLOR]
copy paste sony.xml for kikat 4.4 from above
save and exit then
Code:
[COLOR="black"]repo sync[/COLOR]
after everything syncs
Code:
[COLOR="black"]gedit vendor/carbon/vendorsetup.sh[/COLOR]
and add this to the bottom:
Code:
[COLOR="black"]add_lunch_combo carbon_yuga-userdebug[/COLOR]
save and exit.. then
Code:
[COLOR="black"]. build/envsetup.sh[/COLOR]
Code:
[COLOR="black"]brunch yuga[/COLOR]
To get started with AORP, you'll need to get familiar with Git and Repo.
To initialize your local repository using the AORP trees, use a command like this:
first create folder named " AORP "
Code:
mkdir AORP
enter into AORP
Code:
cd ~/AORP
For kitkat 4.4.x
Code:
[COLOR="black"]repo init -u git://github.com/AORP/android.git -b kk[/COLOR]
Then to sync up:
Code:
[COLOR="black"]repo sync[/COLOR]
Please see the CyanogenMod Wiki for building instructions.
For more information on this Github Organization and how it is structured, please read the wiki article.
Create and edit sony.xml in .repo:
Code:
[COLOR="black"]gedit .repo/local_manifests/semc.xml[/COLOR]
Add this to the semc.xml:
For KitKat 4.4.x
copy paste sony.xml for kikat 4.4 from above
then
Code:
[COLOR="Black"]repo sync[/COLOR]
Code:
[COLOR="black"]. build/envsetup.sh (notice the period and space)
vendor/cm/get-prebuilts
[/COLOR]
then
Code:
brunch yuga
Next Tutorial is Strictly Not for beginners
Building with Linaro 4.8 toolchain
Go into Terminal and navigate to the root folder of your source tree, then:
Code:
[COLOR="Black"]prebuilts/gcc/linux-x86/arm/[/COLOR]
Run:
Code:
[COLOR="black"]wget http://releases.linaro.org/13.06/components/toolchain/gcc-linaro/4.8/gcc-linaro-4.8-2013.06.tar.bz2[/COLOR]
Run:
Code:
[COLOR="black"]bunzip2 *.tar.bz2[/COLOR]
Run:
Code:
[COLOR="black"]tar -xvf *.tar[/COLOR]
Using your file manager, navigate to the root folder of your source tree again.
Navigate To "/build", in your root folder.
Run:
Code:
[COLOR="black"]gksudo gedit envsetup.sh[/COLOR]
change the line in bold, to look exactly like this one:
Code:
[COLOR="black"]case $ARCH in
x86) toolchaindir=x86/i686-linux-android-4.6/bin
;;
[B]arm) toolchaindir=arm/gcc-linaro-4.8-2013.06[/B] [COLOR="Red"]<--------[/COLOR]
;;
mips) toolchaindir=mips/mipsel-linux-android-4.6/bin
;;
*)
echo "Can't find toolchain for unknown architecture: $ARCH"
toolchaindir=xxxxxxxxx
;;
esac
[/COLOR]
Exit out and open new. Initialize and build. That's it! Makes you wonder why you never did it before, right?
Not so fast. You may have build issues, you may not. I had a few lengthy sets of errors in gsm calltracker and another .java file that was solved by using Meld and making it look exactly like a successful build's file. More as I learn.......
Thanks to infected_ for this tut; his post can be found here: [/COLOR]
http://forum.xda-developers.com/showpost.php?p=42976693&postcount=12
This is a work in progress. Many more pieces of information will be added and this is meant to be an ever-changing thread. If you see something that is outdated or incorrect, please let me know ASAP, so I can make the correction. Also, make sure that any info offered can be and has been confirmed as functional.
Thanks to:
CyanogenMod
scott.hart.bti
Team Carbon
david279
MallardDuck
ktempleton
AdhvanIt
matthew0776
spleef
M4570D0N
car vs driver
mikeioannina
BMP777
Kernel Building and Ccache
Building your first kernel
:
This is a set of steps to get you building your first kernel. Special thanks to thewadegeek for putting this tutorial together. His thread can be found here: http://forum.xda-developers.com/showthread.php?t=1748297
Step 1. Build Environment
A. Install Ubuntu 12.04(Not holding your hand here, if you can't do this you shouldn't be messing with kernels)
B. Required packages: git-core, gnupg, flex, bison, gperf, libsdl-dev, libesd0-dev, libwxgtk2.6-dev, build-essential, zip, curl, libncurses5-dev, zlib1g-dev, ia32-libs, lib32z1-dev, lib32ncurses5-dev, gcc-multilib, g++-multilib, and Adb.
C. Open a terminal
D. Type
Code:
[COLOR="black"]mkdir android[/COLOR]
E. Type
Code:
[COLOR="black"]cd android[/COLOR]
G.Type
Code:
[COLOR="black"]mkdir kernel[/COLOR]
Step 2. Your Source
A. Open your Terminal Prompt
B. Type
Code:
[COLOR="black"]cd android/kernel[/COLOR]
C. Type
Code:
[COLOR="black"]git clone git://github.com/DooMLoRD/android_prebuilt_toolchains.git toolchains[/COLOR]
D. Now comes the tricky part, you need to have some-type of source for your kernel. Check the following two sites for your device as appropriate. Once you have it download it is extracted/cloned into a folder in your kernel directory.
http://developer.sonymobile.com/wpor...ads/opensource
Step 3. Modifications
This is the part people are curious about, they want to make modifications to the kernel to make it "special". Start all these from the root directory of your kernel source.
Mod 1. Applying a patch
A. Download the patch you wish to apply, in this case this one should work.
B. Save that file as "kernelPatch" in your kernel directory.
C. Open a Terminal
D. Move into the root directory of the kernel you wish to patch.
E. Type
Code:
[COLOR="black"]patch -p1 < ../kernelPatch[/COLOR]
Mod 2. Adding a Governor Alone
A. Open "drivers/cpufreq/Kconfig"
B. Add the following lines in appropriate spot amongst the other govenor's
Code:
[COLOR="Black"]config CPU_FREQ_DEFAULT_GOV_SMARTASS
bool "smartass"
select CPU_FREQ_GOV_SMARTASS
select CPU_FREQ_GOV_PERFORMANCE
help
Use the CPUFreq governor 'smartass' as default.
[/COLOR]
Code:
[COLOR="Black"]config CPU_FREQ_GOV_SMARTASS
tristate "'smartass' cpufreq governor"
depends on CPU_FREQ
help
smartass' - a "smart" optimized governor!
If in doubt, say N.[/COLOR]
C. Open "drivers/cpufreq/Makefile"
D. Add the following line in the appropriate spot.
Code:
[COLOR="Black"] obj-$(CONFIG_CPU_FREQ_GOV_SMARTASS) += cpufreq_smartass.o[/COLOR]
E. Create a file called "drivers/cpufreq/cpufreq_smartass.c"
F. Put the following code in that file.
http://pastebin.com/f0Bk9kVZ
G. open "include/linux/cpufreq.h"
H. Under the "Cpufreq Default" section add
Code:
[COLOR="Black"]#elif defined(CONFIG_CPU_FREQ_DEFAULT_GOV_SMARTASS)
extern struct cpufreq_governor cpufreq_gov_smartass;
#define CPUFREQ_DEFAULT_GOVERNOR (&cpufreq_gov_smartass)[/COLOR]
Ok there is a governor added, do the exact same steps for any other one's you would like to add.
Step 4. Getting a Config file
Option A. Pulling a config file from a kernel.
A. Hook up a device that is using a kernel similar to one you are using as your base.
B. Open a terminal
C. Change to your root kernel directory
D. Type
Code:
[COLOR="black"]adb pull /proc/config.gz[/COLOR]
E. Type
Code:
[COLOR="black"]gunzip config.gz[/COLOR]
F. Type
Code:
[COLOR="black"]mv config arch/arm/configs/<your_config_name>_defconfig[/COLOR]
Option B. Using the manufacturers config.
Unfortunately as stated above, not all kernels support the "/proc/config.gz" method. You can typically find a manufacturer's configuration file in "arch/arm/configs". I believe the one for my HTC Flyer was called "flyer_hc_defconfig", so look for a layout similar to that one. Also read the README to get a better idea of how to modify it. I would personally make a copy of it called "<your_config_name>_defconfig" and use that as my base.
Step 5. Building
Time to start the real "build" section of this tutorial.
Part A. Pre-build Steps
A. Open terminal and change to the root of your kernel directory
B. Type
Code:
[COLOR="black"]export ARCH=arm[/COLOR]
C. Type
Code:
[COLOR="black"]export CROSS_COMPILE=~/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-[/COLOR]
Part B. The First Build
A. Type
Code:
[COLOR="black"]make <your_config_name>_defconfig[/COLOR]
B. Type
Code:
[COLOR="black"]make menuconfig[/COLOR]
and make the required changes to use any modules you added or similar changes.
C. Type
Code:
[COLOR="black"]make -j<maximum number of jobs>[/COLOR]
Part C. Re-Builds
A. Type
Code:
[COLOR="black"]make clean[/COLOR]
B. Type
Code:
[COLOR="black"]make oldconfig[/COLOR]
C. Type
Code:
[COLOR="black"]make -j<maximum number of jobs>[/COLOR]
Part D. Building Modules
You have two options:
A. Type
Code:
[COLOR="black"]make modules[/COLOR]
B. Type
Code:
[COLOR="black"]make path/to/your/module.ko[/COLOR]
The above steps explained:
Part A.(These steps are required every time you close your terminal and re-open it to build again.)
A. Ok shouldn’t need to explain this.
B. This command sets your target architecture.
C. Defines the path to the toolchain we are going to use to compile our kernel. You can change this to point towards whatever toolchain you have downloaded or feel like using, the way it is currently configured it will use the Linaro toolchain that we downloaded above.
Part B.(These only need to be run the first time you build a kernel.)
A. Load's your configuration file from earlier.
B. Open up a menu to configure your kernel. It will use the config file you loaded in the previous step as a base.
C. Viola start the build. I typically allow 1 job per core, so on my quad core machine I put "make -j4". Just raising that number will not make your build faster, your processor needs to be able to support the number of jobs you are assigning it.
Part C. (Use the command's when you are building any-time outside of the first)
A. This command gets rid of any old/outdated binaries or modules you compiled before, and let's start fresh. I like to run it every I build unless my changes are really small and localized.
B. A very awesome command, it parses through what has changed and only prompts you about new options.
C. See the explanation for the above "Part C.".
Part D.(Use these for just building kernel modules.)
A. This will re-build all modules.
B. Will rebuild just the module you need. Very useful when you need to rebuild a WiFi module.
Step 6. Now what
Ok we have now started our build and we are waiting for it to finish, so there are two possible outcomes:
Outcome A. Build Succeeds
W00t!! You have a kernel built by your self from source. There are a couple things you need in-order to use this kernel on your device any ".ko" modules and the zImage binary. If you pay attention to the output of your compiler then you will see the location of those objects. However the following commands will make your life a bit easier(Thanks Recognized Developer Hacre):
A. Open a terminal
B. Change to your root kernel directory
C. Type
Code:
[COLOR="black"]mkdir ../<your_kernel>_output[/COLOR]
D. Type
Code:
[COLOR="black"]cp arch/arm/boot/zImage ../<your_kernel>_output/zImage[/COLOR]
E. Type
Code:
[COLOR="black"]find . -name "*.ko" -exec cp {} ../<your_kernel>_output \;[/COLOR]
The above steps explained:
A-C. Self-Explanatory
D. Move our kernel binary into our output folder
E. This handy bit of magic finds all ".ko" modules and also copies them into your output file.
You will also need to assemble a kernel image containing a initramfs for your device, along with the kernel binary and such. That however is beyond the scope of this tutorial. To get started though try searching the following phrases.
Code:
[COLOR="Black"]building android kernel image
xda build kernel image
xda unpack boot.img[/COLOR]
Outcome B. Build Fails
Oh dear. It failed. Well guess what...this is going to happen..a LOT. Get used to it, and get used to googling and experimenting with different solutions. The following are some tips that will help you with debugging your issues.
Running a "Clean" build
A. Backup your config file - Type
Code:
[COLOR="black"]cp .config ../backupConfig[/COLOR]
B. Re-run the build process using just your defconfig from earlier.
Limiting Output(Thanks Hacre.)
A. Another good tip is to run "make -j1" to get the error, as it will limit the amount of text you need to scroll through.[/COLOR]
[/CENTER]
Building TWRP recovery - http://forum.xda-developers.com/showthread.php?t=1943625​
Building CWM recovery - http://forum.xda-developers.com/showthread.php?t=1866545​
CCACHE​
Here is a brief tutorial on the installation of Ccache, which can shorten build times drastically :
If you have room on your build system you can speed
your builds up considerably by using ccache. ccache is a compiler
cache. It speeds up re-compilation of C/C++ code by caching
previous compiles and detecting when the same compile is
being done again.
Install it with apt-get:
Code:
[COLOR="Black"]sudo apt-get install ccache[/COLOR]
Set environment vars for Android use:
(I put these exports in my .bashrc)
Code:
[COLOR="Black"]export USE_CCACHE=1
export NDK_CCACHE=ccache[/COLOR]
Set a cache size of 10G for optimal results:
Code:
[COLOR="black"]ccache -M 10G[/COLOR]
Check the status of your cache with the command:
Code:
[COLOR="black"]ccache -s [/COLOR]
Returns:
Code:
[COLOR="black"]
cache directory /home/jocala/.ccache
cache hit 106673
cache miss 18379
called for link 3758
preprocessor error 5
not a C/C++ file 4425
unsupported compiler option 678
no input file 4565
files in cache 36758
cache size 3.2 Gbytes
max cache size 10.0 Gbytes[/COLOR]
Really Useful things
Here are some relevant topics/tutorials/sites:
Download | Ubuntu - www.ubuntu.com/download
Official Ubuntu Documentation: Help for all versions. - https://help.ubuntu.com/
How To Windows Dual Boot: - https://help.ubuntu.com/community/WindowsDualBoot
How To Use The Terminal: Commandline stuff. - https://help.ubuntu.com/community/UsingTheTerminal/
[HOW TO] Beginners Guide to Android ROM Development - http://forum.xda-developers.com/showthread.php?t=1272270 (courtesy of isidromxz)
[Tutorial] Compile JB on Ubuntu - http://forum.xda-developers.com/showthread.php?t=1762641 (courtesy of dastin1015)
[CM10] [PPA] Cyanogenmod Compiler v0.6 - http://forum.xda-developers.com/showthread.php?t=1789190 (courtesy of lithid-cm)
[Wiki] How to: Gerrit - http://wiki.cyanogenmod.com/wiki/Howto:_Gerrit
[Wiki] How to: Git - http://wiki.cyanogenmod.com/wiki/Howto:_Git
[Wiki] How to: Connect to device with SSH - http://wiki.cyanogenmod.com/wiki/Howto:_Connect_to_Device_with_SSH
Here is an easy-to-use page on common Linux commands: - http://www.pixelbeat.org/cmdline.html
Linux Newbie Guide : - http://www.unixguide.net/linux/linuxshortcuts.shtml
Also, Team Chopsticks has a good page with some useful tips as well, located here:
http://www.teamchopsticks.org/p/contributing.html (thanks to bdusmc for the tip)
Here is a link to LIFEHACKER's command line tutorials. Very good stuff!! : http://lifehacker.com/5743814/become-a-command-line-ninja-with-these-time+saving-shortcuts
CyanogenMod git : - https://github.com/CyanogenMod
LegacyXperia git : - https://github.com/LegacyXperia
Original Beanstalk thread : - http://forum.xda-developers.com/showthread.php?t=2091900
Beanstalk git : - https://github.com/scotthartbti?tab=repositories
The Muppets git : - https://github.com/TheMuppets
[/FONT][/CENTER]
Build Your Own ROM "Like a Boss" Share it!
lets roll the clock

Categories

Resources