[GUIDE] Bulding CM9 from Sources for O2X (P990) - LG Optimus 2x

Building CM9 from Sources for O2X
This Guide is a Step by Step Guide to Build CM9 from official CM9 Sources.
It based on:
aMpeX`s [TUTORIAL] The Step-By-Step guide to build Cyanogenmod7 for the LG Optimus 2X
loganmc10`s [GUIDE] Building CM9 for G2X
I only change to P990, respectively CM9 and add the fix for working Baseband
You need:
- a installed Linux, (I use Ubuntu 11.10, 64 Bit)
- a fast PC or Notebook is recommended
- a fast internet-connections is recommended, (you have to download several GBs)
There are 10 Steps, (8 for building, and 2 optionals ):
1. Installing Build-Packages
2. Install and setup Android-SDK
3. Update path
4. Create directories
5. Install repository and download CM9 Sources
6. Fix for non working camera
6a. Fix the known issues
7. Compiling Unofficial CM9 Build
8. Fix unknown Baseband
9. Extended building
10. Optional changes
Some infos before start:
- read the whole Guide carefully, (possibly you have to read it a few times, untill you understand all steps)
- if you do it exactly as explained, there should be no problems, and the result is a working Unofficial CM9-Build
- don`t login to Linux as root
- if you get problems, feel free to PM me, if you can`t post in Dev-Forum
lets start,
1. Installing Build-Packages
install this for 32 bit and 64 bit:
Terminal:
type:
Code:
sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev openjdk-6-jdk pngcrush schedtool
NOTE:
this will install Open-JDK instead of Sun-JDK,
(Sun-JDK isn`t longer official available for Ubuntu)
this will result in an error message at the beginning of compiling,
just ignore it, compiling will working fine.
If you want to install Sun-JDK instead of Open-JDK,
the user tonyp has made a tutorial.
use this line instead of above one
Terminal:
type:
Code:
sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.6-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev pngcrush schedtool
than go to this tutorial
for me the tutorial above doesn`t work (Ubuntu 11.10 64 Bit)
this is working for me:
open terminal:
Code:
sudo add-apt-repository ppa:ferramroberto/java
Code:
sudo apt-get update
Code:
sudo apt-get install sun-java6-jdk sun-java6-plugin
Code:
sudo update-alternatives --config java
(note: you have to press the tab button to be able to press ok, after the last command )
install this for 64 bit also:
Terminal:
type:
Code:
sudo apt-get install g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline-gplv2-dev gcc-4.4-multilib g++-4.4-multilib
2. Install and setup Android-SDK
Download newest Android-SDK from here (Linux (i386) )
Extract the Zip-Package to a directory of your choice
Terminal:
navigate to the tools-folder of Android-SDK and type:
Code:
./android
this will launch the AVD-Manager
check repository, select newest repository, and click install packages
3. Update path
go to your Home-Directory, and press CTRL + H to show hidden files,
open .bashrc
and add this:
Code:
export PATH="/home/<yourusername>/<path to the android SDK >/platform-tools/:${PATH}"
export PATH="/home/<yourusername>/bin/:${PATH}"
now you have to log out and in again for the changes take effect.
now check if changes are working,
Terminal:
type:
Code:
adb devices
you should see something like this:
[email protected]:~$ adb devices
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
List of devices attached
Click to expand...
Click to collapse
4. Create directories
Terminal:
type:
Code:
mkdir -p ~/bin
Code:
mkdir -p ~/android/system
5. Install repository and download CM9 Sources
Install repository
Terminal:
type:
Code:
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
Code:
chmod a+x ~/bin/repo
Code:
cd ~/android/system/
Code:
repo init -u git://github.com/CyanogenMod/android.git -b ics
enter name, email adress, and choose if you want colors or not
Download CM9 Sources:
Terminal:
type:
Code:
cd ~/android/system/
Code:
repo sync
depending on your internet connection speed this can take several hours
press CTRL + H
go to :
/android/system/.repo/
create:
local_manifest.xml
paste into local_manifest.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project path="device/lge/p990" name="CyanogenMod/android_device_lge_p990" />
<project path="device/lge/star-common" name="CyanogenMod/android_device_lge_star-common" />
<project path="vendor/lge" name="Owain94/proprietary_vendor_lge.git" remote="github" />
</manifest>
Terminal:
type:
Code:
cd ~/android/system/
Code:
repo sync
6. Fix for non working camera
download this zip-package MediaFire SolidFiles.
(I don`t make this patch, and don`t know who had made it, if you made it PM me and I`ll give credit for your work)
Extract the Zip-Package to a directory of your choice.
Terminal:
type:
Code:
cd ~/android/system
Code:
patch -p1 <
NOTE: after "<" there has to be a "blank space" (press spacebar)
now drop the first ...diff file from extracted package into terminal, the path will be automatically added,
run the created command,
the same procedure for the other 4 files
6a. Fix the known issues
for broken building:
open:
device/lge/p990/BoardConfig.mk
delete line:
Code:
BOARD_TOUCH_RECOVERY := true
For mobile data fix:
place this file to android/system/system/core/init/ (overwrite excisting file),
7. Compiling Unofficial CM9 Build
Terminal:
type:
Code:
~/android/system/vendor/cm/get-prebuilts
Code:
cd ~/android/system/
Code:
. build/envsetup.sh
Code:
brunch p990
depending on your PC or Notebooks specs compiling will take from 30 minutes to several hours
you can find your Rom-Zip-Package at:
/android/system/out/target/product/p990/
Click to expand...
Click to collapse
8. Fix unknown Baseband
open your Rom-Zip-Package and extract /system/build.prop
(don`t close Archivmanager)
open build.prop:
delete line:
ro.modversion=9-...-UNOFFICIAL-p990
Click to expand...
Click to collapse
(thanks to owain94 for deleting line info)
find line:
ro.cm.version=9-...-UNOFFICIAL-p990
Click to expand...
Click to collapse
replace this line with:
ro.cm.version=9.0.0-RC1-p990-UNOFFICIAL
Click to expand...
Click to collapse
save build.prop
drop modded build.prop into Archivemanager (/system, overwrite existing file)
Now your Unofficial CM9 Build is ready to install
------------------------------------------------------------------------------------------------------------------------------------------------------------
9. Extended building:
I decided to make a optional 9. Step to have a better building experience
(all tipps by owain94, thanks)
This Step is a replacement for Step 7!
Terminal:
type:
Code:
cd ~/android/system && clear && cd vendor/cm && ./get-prebuilts && cd ../../ && clear && . build/envsetup.sh && brunch p990 2> warn.log
this command downloads the cm-prebuilds,
sets up the build environment,
start the building,
exports all warnings and errors to a text file
and cleans the Terminal.
open another Terminal
type:
Code:
cd ~/android/system && clear && tail -f warn.log
this command cleans the terminal,
shows the warnings and errors in this second Terminal,
and keep the focus on it,
first terminal only shows the building process,
so it`s much easier to catch problems while compiling.
If you have connected two screens to your PC or Notebook,
you can also place second Terminal on second screen.
you can find your Rom-Zip-Package also at:
/android/system/out/target/product/p990/
Click to expand...
Click to collapse
10. Optional changes:
Fix for working torch and torch power-widget:
"activate" torch and power-widget:
open:
/android/system/packages/apps/Torch/res/values/config.xml
add or change to:
Code:
<bool name="useCameraInterface">true</bool>
open:
/android/system/packages/apps/Settings/res/values
add or change to:
Code:
<bool name="has_led_flash">true</bool>
add Torch.apk to the package:
open:
/android/system/device/lge/star-common/star.mk
change:
Code:
## LGE stuffs
PRODUCT_PACKAGES += \
LGEServices \
bridgeutil \
libbridges \
libbridge \
libbridge_jni \
secureclockd \
libsecureclock \
screencap \
hwprops \
com.android.future.usb.accessory
to:
Code:
## LGE stuffs
PRODUCT_PACKAGES += \
LGEServices \
bridgeutil \
libbridges \
libbridge \
libbridge_jni \
secureclockd \
libsecureclock \
screencap \
hwprops \
com.android.future.usb.accessory \
Torch
Credits:
aMpeX, loganmc10, pastime1971, owain94, tonyp, temasek

The -j part isn't needed anymore the build script figure it out on their own
and for the vendor files you can ad this to the local manifest
<project name="koush/proprietary_vendor_lge.git" path="vendor/lge" remote="github" />
it is less work we don't want to do to much
also this is maybe a nice addition
Code:
clear && cd vendor/cm && ./get-prebuilts && cd ../../ && clear && . build/envsetup.sh && brunch p990 2> warn.log
i use this build line
clear - make my terminal nice and empty
cd vendor/cm && ./get-prebuilts && cd ../../ - get the cm prebuilts
clear - make the terminal clean again
. build/envsetup.sh - set up the build env
brunch p990 - lunch and bacon for the p990
2> warn.log - exports al the warnings and errors to a text file to keep the terminal clean
i have three screens attached to my pc
on one screen i run the above command (clear && cd vendor/cm && ./get-prebuilts && cd ../../ && clear && . build/envsetup.sh && brunch p990 2> warn.log)
on another screen i run this command (clear && tail -f warn.log) this will print (and keep track of) the warn.log file with all the errors and warnings
and on the other screen i do useless stuff hehe
anyway i really like to use 2 terminals it is just easier to catch problems
Nice tut mate!
Sent from my HTC One X using xda premium

reserved
great guide bro.
Edit:
If anyone wants to install the SUN JDK instead of Open JDK you can install it from the partner repository:
Code:
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk

Thanks, for your replies, I'll change my Guide at the evening.
Gesendet von meinem HTC One S mit Tapatalk 2

Great! Maybe I will stay building
Sent from LG 2X using Tapatalk 2 Elite

Thanks a lot !!

The Guide is updated, (big thanks to owain94).
I`ll add a new Step or Section (lets see, atm I don`t know) for extended Build-Line and possibly multiscreen using, I`ll test it while compiling for my One-S.

i am getting an error
make: *** No rule to make target `out/target/product/p990/obj/lib/libnvdispmgr_d.so', needed by `out/target/product/p990/obj/SHARED_LIBRARIES/libsurfaceflinger_intermediates/LINKED/libsurfaceflinger.so'. Stop.
plz help me..

thanks for the tutorial.

podanimesh said:
i am getting an error
make: *** No rule to make target `out/target/product/p990/obj/lib/libnvdispmgr_d.so', needed by `out/target/product/p990/obj/SHARED_LIBRARIES/libsurfaceflinger_intermediates/LINKED/libsurfaceflinger.so'. Stop.
plz help me..
Click to expand...
Click to collapse
did you sync the vendor files?
libnvdispmgr_d.so is a vendor file that cannot be build because we don't have the sources
you need to sync them from koush his github or extract the vendor files using the script in the device folder
good luck

owain94 said:
did you sync the vendor files?
libnvdispmgr_d.so is a vendor file that cannot be build because we don't have the sources
you need to sync them from koush his github or extract the vendor files using the script in the device folder
good luck
Click to expand...
Click to collapse
ok now compiled successfully..
ROM booted but no wi-fi and camera..

podanimesh said:
ok now compiled successfully..
ROM booted but no wi-fi and camera..
Click to expand...
Click to collapse
Wifi working fine for me, but I'll add a step for camera fix, thanks for reporting
Gesendet von meinem HTC VLE_U mit Tapatalk 2

If anyone wants to have SUN JDK instead of Open JDK it's still possible:
Code:
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install sun-java6-jdk
I also put that in "my" post 3.

thanks for reporting, but as far as I know, sun has many security risks, isn`t it?

XXMrHyde said:
thanks for reporting, but as far as I know, sun has many security risks, isn`t it?
Click to expand...
Click to collapse
Hm I don't think so. As far as I know the reason why Open JDK is used in Ubuntu instead of Sun JDK is that Open JDK is fully open sourced while Sun JDK still uses some pre compiled closed source binaries. Some open source fanatics might call this a security risk as they can't check the source themselves, but apart from that their shouldn't be any risks.
Sent from my LG-P990 using xda app-developers app

this procedure did not make .zip file, but normal folder

tonyp said:
Hm I don't think so. As far as I know the reason why Open JDK is used in Ubuntu instead of Sun JDK is that Open JDK is fully open sourced while Sun JDK still uses some pre compiled closed source binaries. Some open source fanatics might call this a security risk as they can't check the source themselves, but apart from that their shouldn't be any risks.
Sent from my LG-P990 using xda app-developers app
Click to expand...
Click to collapse
Ok, nice to know, I`ll change the Guide, so users can decide, which JDK they want to install
tomsi91 said:
this procedure did not make .zip file, but normal folder
Click to expand...
Click to collapse
Then you make a mistake, if so, my Rom wouldn`t excist

Please upload camera fix tutorial....

Sorry, I was a little bit busy today, I`ll ad the camera fix to the guide now

added camera fix to the Guide
edit:
now it can be choosen if you want to install Sun- or Open-JDK

Related

[GUIDE CM10] How to build your own CyanogenMod 10 ROM from sources for LG P990 O2x

Make your 'own' ROM today!
Revision History:
V1.5 2013.01.07 Update to newest Java 6 version: Java SE Development Kit 6 Update 38
V1.4 2012.11.20 ParanoidAndroid ROM building guide added, minor changes
V1.3 2012.11.10 New FAQ, Updates Java section, WIFI fix
V1.2 2012.11.05 Sync part updated
V1.1 2012.11.04 Typos fixed
V1.0 2012.11.03 Initial release
Thank you note: Thank you Ricardo Cerqueira for your work on the LG P990. Without you none of this would be possible. Thank you ethansp for your feedback and your input regarding the sync matter. Thank you TrymHansen and Ferrum Master for your input in respect of the JAVA topic. And thank you p.valenta for your contribution to the WIFI build fix.
Overview
0. Preparation
I. Installation of the required packages
II. Installing JAVA
III. The sources
IV. Building the ROM
V. Rebuilding with newest sources
VI. FAQ
VII. Building ParanoidAndroid ROM
0. Preparation
Things you need for building:
A computer
An internet connection
An open mind
Time
Patience
First of all you need a running up-to-date Ubuntu/Linux system. I am using Ubuntu 12.10 64-bit.
Use the terminal to make the steps. A terminal window can be opened by pressing Ctrl+Alt+T. Every single command for the terminal is marked with a $ sign. Just paste every command (without the $ sign) to your terminal window and there shouldn't be any problem.
IMPORTANT: INSTALL EVERYTHING AS A NORMAL USER. DON'T INSTALL AS ROOT!
I. Installation of the required packages (Ubuntu 12.10 64-bit)
Install packages:
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 schedtool pngcrush xsltproc zlib1g-dev:i386
Set the links:
Code:
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
II. Installing JAVA
You need a Java Development Kit for building CM10. Recommended is the SUN JDK 6. As of writing the most recent version is SUN JDK 6 Update 38.
1. Download the jdk-6u38-linux-i586.bin from the Oracle/Sun Java Download Area. If you are on 64-bit Ubuntu as I am, you should grab jdk-6u38-linux-x64.bin.
2. Make the bin file executable:
Code:
$ chmod +x jdk-6u38-linux-x64.bin
3. Extract the bin file:
Code:
$ ./jdk-6u38-linux-x64.bin
4. Move the extracted folder to this this location:
Code:
$ sudo mv jdk1.6.0_38 /usr/lib/jvm/./jdk-6u38-linux-x64.bin
5. Install the new Java source in system:
Code:
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-6u38-linux-x64.bin/bin/javac 1
$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-6u38-linux-x64.bin/bin/java 1
$ sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk-6u38-linux-x64.bin/bin/javaws 1
$ sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk-6u38-linux-x64.bin/bin/javadoc 1
$ sudo update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/jdk-6u38-linux-x64.bin/bin/javah 1
$ sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/jdk-6u38-linux-x64.bin/bin/javap 1
$ sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk-6u38-linux-x64.bin/bin/jar 1
6. Select the default Java version for your system:
Code:
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javaws
$ sudo update-alternatives --config javadoc
$ sudo update-alternatives --config javah
$ sudo update-alternatives --config javap
$ sudo update-alternatives --config jar
7. Check Java version:
Code:
$ java -version
8. Verify the symlinks. Javac, Java, Javaws, Javadoc, Javah, Javap and Jar should all point to the new Java location and version:
Code:
$ ls -la /etc/alternatives/java* && ls -la /etc/alternatives/jar
III. The sources
Install repo:
Repo is a tool that makes it quite easy to download and maintain the sources of Cyanogenmod.
Code:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ cd ~/bin
$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
Create working directory:
Code:
$ mkdir ~/cm10
$ cd ~/cm10
Initialize Repo:
Code:
$ repo init -u git://github.com/CyanogenMod/android.git -b jellybean
and enter your credentials.
Download the sources:
Code:
$ repo sync
Wait until it's finished (takes a lot of time!)
If the process hangs use Ctrl+C to break out of it and resume the download with another
Code:
$ repo sync
Tip from ethansp: If you are running into a lot of syncing errors the reason might be that the 'repo sync' command is establishing four threads automatically. This might be too much. So try to change the command to run with one thread only by using
Code:
$ repo sync -j1
Initialize the environment
Code:
$ . build/envsetup.sh
Obtain the proprietary files:
Create a file with the name local_manifest.xml in the .repo directory. To see this directory, you have to press Ctrl-H in your file manager.
Create it with
Code:
gedit ~/cm10/.repo/local_manifest.xml
Paste the following lines to the editor
Code:
<manifest>
<project name="CyanogenMod/android_device_lge_p990" path="device/lge/p990" remote="github" revision="jellybean"/>
<project name="CyanogenMod/android_device_lge_star-common" path="device/lge/star-common" remote="github" revision="jellybean"/>
<project name="CyanogenMod/lge-kernel-star" path="kernel/lge/star" remote="github" revision="jellybean"/>
<project path="vendor/lge" name="TheMuppets/proprietary_vendor_lge.git" remote="github" revision="jellybean"/>
</manifest>
Save the file.
Run
Code:
$ repo sync
again to get the files needed.
Download the necessary prebuilts from cyanogenmod by running
Code:
$ ~/cm10/vendor/cm/get-prebuilts
And you are done!
IV. Building the ROM
Now build it:
Code:
$ brunch p990
And building process starts. Now have patience. Building takes around half an hour on fast systems and a lot more on older and slower machines.
When everything worked as it should you will find your new ROM-image in ~/cm10/out/target/product/p990
It is called cm-10-DATE-UNOFFICIAL-p990-zip. You can flash it via CWM as usual.
If you are having trouble with the WIFI not working with your newly flashed ROM, check the FAQ section C below for the solution.
V. Rebuilding with newest sources
Whenever you like to update your sources and build a new version you have to run these four simple commands:
Code:
$ cd ~/cm10
$ repo sync
$ . build/envsetup.sh
$ brunch p990
Building takes less time than it took for creating it the first build because it's only rebuilding new parts and using old parts that haven't changed.
Happy building!
VI. FAQ
A. How to tell how long it takes to build the ROM?
First, it depends on your hardware, second, whether it is your first build or a daily rebuild. To get a first number, you can use the “time” command and add the “brunch” command to it.
E.g.
Code:
time brunch p990
So the system will tell you how long it took to build the ROM. Then you know next time if it will be a short or long coffee break while waiting for your build to finish.
B. Is there a way to speed up the building process?
Actually, there are a lot of ways to speed up the process. Here are some of them:
1. Hardware:
When you build the first time it takes half an hour on fast machines and up to many hours on slower machines. What counts most is raw CPU power. Multi-core computers with a lot of fast RAM are recommended. The more cores the better. Memory-wise a setup with more than 8GB with aggressive but of course also stable timings is also adding to the building speed. A fast HDD or even SSD doesn't hurt either. When resourceful, you can use a system with multiple SSDs and gain more speed than single storage systems. But in most cases the CPU will be the biggest bottleneck. Check with tools, e.g. System Monitor in Ubuntu – and watch the resources tab to find out your bottleneck.
2. System-Software:
If you are using virtual machine software then try to optimize it. Look for “virtualization support” in the BIOS. Give it as much CPU power and memory as you can from your host system. Whenever it is possible it is recommended that you install the system directly, as the virtualization solution usually comes with a performance drop compared to a system installed and booted from directly.
3. The building software:
a. Out Directory
You can use a separate output directory for your builds, e.g. on a different hard drive with a fast file system.
Append
Code:
export OUT_DIR_COMMON_BASE=<path-to-your-out-directory>
to your .bashrc file.
b. Caching
You can setup Ccache, a system that acts as a compiler cache for all the parts of the building that are written in C. This is excellent if you rebuild often. But keep in mind that building the first time takes even longer when you have Ccache activated than building without it. So for first tests it is fine to build without Ccache enabled.
To enable Ccache add
Code:
export USE_CCACHE=1
to your .bashrc file
Optional: If you like to set the path, where the Ccache will be stored on your own, you have to add another line to the .bashrc
export CCACHE_DIR=<path-to-your-cache-directory>
Now run this command once to initialize the Ccache
Code:
prebuilts/misc/linux-x86/ccache/ccache -M 15G
C. I built the ROM successfully. I flashed it too, but the WiFi is not working anymore. What can I do?
The efforts of the CyanogenMod devs can be considered work in progress. And so it happens that features get broken while trying to fix others...
If you suffer from this then take the file 'wireless.ko'. You find the file below as an attachment. Push or copy it to '/system/lib/modules' and overwrite the file with the same name there. Change the rights to 644 or rw- r-- r-- It's the same as read/write by owner, read by group and read by other.
Without reboot, you can switch on the WiFi now. And you should be back in the game. Thanks to p.valenta for confirmation that it is working.
D. I checked the free space of the system partition. There isn't any. What can I do?
Without changing the size of the system partition not so much. But you can squeeze out a few MBs by removing some files from the created ROM image:
E.g. all the videos in /system/media/video can be deleted.
You can erase the /system/media/bootanimation.zip if you want.
Check /system/media/audio/, there you can delete some ringtones you are not using.
And if you know what you are doing, you can even get rid of some .apk files from '/system/app'.
For example LiveWallpapers.apk, VisualizationWallpapers.apk, CMWallpapers.apk, MagicSmokeWallpapers.apk, HoloSpiralWallpaper.apk are expendable.
E. I don't want to use Sun's/Oracle's Java Development Kit. Can I use another one instead?
Yes, you can. But using Sun's version is recommended by Google and CyanogenMod for building ROMs. So consider yourself warned. You can use the OpenJDK 6 that you will find already on your system if you installed the necessary packages as shown above. What you finally need to do is checking which Java version is active.
Code:
$ ls -la /etc/alternatives/java* && ls -la /etc/alternatives/jar
Select the default Java version for your system:
Code:
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javaws
$ sudo update-alternatives --config javadoc
$ sudo update-alternatives --config javah
$ sudo update-alternatives --config javap
$ sudo update-alternatives --config jar
Each time choose the OpenJDK6 variant.
Verify the symlinks: Javac, Java, Javaws, Javadoc, Javah, Javap and Jar should all point to the new Java location:
Code:
$ ls -la /etc/alternatives/java* && ls -la /etc/alternatives/jar
When everything you see says 'OpenJDK6' then you can build your ROM with the usual commands.
VII. Build your own ParanoidAndroid ROM based on CM10 for LG P990
IMPORTANT! THIS IS A FOLLOW-UP GUIDE THAT REQUIRES A WORKING BUILDING ENVIRONMENT.
Preparation
You need a tested and fully working building environment (Ubuntu 12.04/12.10, Java 6, etc.). If you do not have one already, please follow this guide throughly first and build a normal CM10 ROM from sources as a test. If everything works as it should, then you can proceed with the following lines.
ParanoidAndroid Environment
Let's start.
Use the terminal to make the steps. A terminal window can be opened by pressing Ctrl+Alt+T. Every single command for the terminal is marked with a $ sign. Just paste every command (without the $ sign) to your terminal window and there shouldn't be any problem.
Create a directory named 'paranoid' in your home folder
Code:
$ mkdir ~/paranoid
Initialize the Repo in your newly created directory:
Code:
$ cd ~/paranoid
$ repo init -u git://github.com/ParanoidAndroid/android.git -b jellybean
Before downloading the files you need to edit a file. One line leads to sync errors and has to be deleted from the file. Edit 'default.xml' in /paranoid/.repo/manifests/
(Hint if you can't see the .repo directory: it's hidden, so to make it visible press Ctrl+H) or use this line
Code:
$ gedit ~/paranoid/.repo/manifests/default.xml
Search (Ctrl+F) for 'ParanoidPreferences' and remove the whole line. Save and close the 'default.xml' file.
We need to add some LGE (P990) specific repositories as well. You can either copy the 'local_manifest.xml' file (it's the same!) from your cm10-build-environment or create a new file in /paranoid/.repo/
To create a new file use
Code:
$ gedit ~/paranoid/.repo/local_manifest.xml
Insert the following lines
Code:
<manifest>
<project name="TheMuppets/proprietary_vendor_lge.git" path="vendor/lge" remote="github" revision="jellybean"/>
<project name="CyanogenMod/android_device_lge_p990" path="device/lge/p990" remote="github" revision="jellybean"/>
<project name="CyanogenMod/android_device_lge_star-common" path="device/lge/star-common" remote="github" revision="jellybean"/>
<project name="CyanogenMod/lge-kernel-star" path="kernel/lge/star" remote="github" revision="jellybean"/>
<project name="TheMuppets/proprietary_vendor_lge" path="vendor/lge" remote="github" revision="jellybean"/>
</manifest>
Save it.
Sync the repositories (takes time!)
Code:
$ repo sync
Take a looong coffee break.
A few files
After the successful sync process go to 'paranoid/vendor/pa/products/'.
Create a new file with the name 'pa_p990.mk'
Code:
$ gedit ~/paranoid/vendor/pa/products/pa_p990.mk
Insert these lines:
(lines changed, xhdpi to hdpi, thanks rugglez)
Code:
# Check for target product
ifeq (pa_p990,$(TARGET_PRODUCT))
# Define PA bootanimation size
PARANOID_BOOTANIMATION_NAME := HDPI
# OVERLAY_TARGET adds overlay asset source
OVERLAY_TARGET := pa_hdpi
# include ParanoidAndroid common configuration
include vendor/pa/config/pa_common.mk
# Inherit CM device configuration
$(call inherit-product, device/lge/p990/cm.mk)
PRODUCT_NAME := pa_p990
GET_VENDOR_PROPS := $(shell vendor/pa/tools/getvendorprops.py $(PRODUCT_NAME))
endif
Save it.
Open 'AndroidProducts.mk' in 'paranoid/vendor/pa/products/' with
Code:
$ gedit ~/paranoid/vendor/pa/products/AndroidProducts.mk
and add these lines to then end of the file:
Code:
ifeq (pa_p990,$(TARGET_PRODUCT))
PRODUCT_MAKEFILES += $(LOCAL_DIR)/pa_p990.mk
endif
Save it.
Create a file called 'p990.proprietaries' in 'paranoid/vendor/pa/vendorprops/'
Code:
$ gedit ~/paranoid/vendor/pa/vendorprops/p990.proprietaries
Code:
[
{
"account": "TheMuppets",
"repository": "proprietary_vendor_lge",
"target_path": "vendor/lge",
"revision": "jellybean"
}
]
Save it.
Open 'vendorsetup.sh' in 'paranoid/vendor/pa/'
Code:
$ gedit ~/paranoid/vendor/pa/vendorsetup.sh
Add this line
Code:
add_lunch_combo pa_p990-userdebug
Save it.
Get CM Prebuilts
Now go to
Code:
$ ~/paranoid/vendor/cm/get-prebuilts
Building ParanoidAndroid
Ready to go! Build your ROM now with
Code:
$ cd ~/paranoid
$ ./rom-build.sh p990
The compiling takes around the same amount of time as when building CM10. Half an hour minimum, up to a few hours on slower systems. You will find your CWM flashable zip in 'paranoid/out/target/product/p990/'. It is called 'pa_p990-version-date-time.zip'
Rebuilding
Everytime you want to rebuild or build a new version, just change to the directory, resync the sources and start building:
Code:
$ cd ~/paranoid
$ repo sync
$ ./rom-build.sh p990
If you haven't enlarged your system partition yet, you have to delete some files or the ROM probably won't fit.
Deletable files
/system/media/: delete bootanimation.zip, saves 9.4 MB
/system/media/video/: delete all files, saves 6.4 MB
/system/media/audio/ringtones/: keep one or two, delete the rest, saves up to ~8 MB
You can even delete some system apps (.apk) from '/system/app/' like LiveWallpapers.apk, VisualizationWallpapers.apk, CMWallpapers.apk, MagicSmokeWallpapers.apk, HoloSpiralWallpaper.apk
I would personally love it if people included instructions for other distros. Not everything uses apt-get. That's kind of just me being nitpicky, but I've compiled CM9 on Archlinux with substituting a few things.
Also, what happened to the month of letting RC shine?
tetrahedonism said:
I would personally love it if people included instructions for other distros. Not everything uses apt-get. That's kind of just me being nitpicky, but I've compiled CM9 on Archlinux with substituting a few things.
Also, what happened to the month of letting RC shine?
Click to expand...
Click to collapse
Google their advice is to use ubuntu if you want to use a distros if your own choices you are probably advanced enough to change the instructions to your needs
And about Ricardo his month it is only a tut to compile it yourself you don't have to share it
Sent from my Galaxy Nexus using XDA Premium HD app
owain94 said:
Google their advice is to use ubuntu if you want to use a distros if your own choices you are probably advanced enough to change the instructions to your needs
And about Ricardo his month it is only a tut to compile it yourself you don't have to share it
Sent from my Galaxy Nexus using XDA Premium HD app
Click to expand...
Click to collapse
I guess I could always post my own adapted instructions! Maybe some day. Ahah.
As funny as it may seem to u, instructions to compile CM10 on different distro than Ubuntu would be highly appreciated. Not everyone uses Ubuntu (I do actually), so u may help someone trying to set it up on their distro...
Just my 2 cents....
tetrahedonism said:
I guess I could always post my own adapted instructions! Maybe some day. Ahah.
Click to expand...
Click to collapse
I think you should, and hey, please don't tempt us, share your things
Thanks for the tread as well raum1807
Great guide. This will probably let me make my own rom and share it on xda
Is it possible to compile on 32 bits system?
Sent from my LG-P990 using Tapatalk 2
slebit said:
Is it possible to compile on 32 bits system?
Sent from my LG-P990 using Tapatalk 2
Click to expand...
Click to collapse
No, 64 bits only
Sent from my LG-P990 using xda premium
HerrKuk said:
No, 64 bits only
Sent from my LG-P990 using xda premium
Click to expand...
Click to collapse
You mean it's impossible to compile on Ubuntu 12.04 32-bit ?
Litderose said:
You mean it's impossible to compile on Ubuntu 12.04 32-bit ?
Click to expand...
Click to collapse
If i've done my homework properly, yes
ICS and older are possible with 32bits though
Sent from my LG-P990 using xda premium
Hi, i'm trying to build following your guide.
I have a little problem with step 5.
When i put the line exactly like your
Code:
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-6u37-linux-x64.bin/bin/javac
I get fail, system told me they need prority in entire numeric. I get it work with this:
Code:
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-6u37-linux-x64.bin/bin/javac 1
Have to do the same with the other 2 commands.
Hope this help someone stucked.
Cheers,
eThAn
ethansp said:
Hi, i'm trying to build following your guide.
I have a little problem with step 5.
When i put the line exactly like your
Code:
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-6u37-linux-x64.bin/bin/javac
I get fail, system told me they need prority in entire numeric. I get it work with this:
Code:
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-6u37-linux-x64.bin/bin/javac 1
Have to do the same with the other 2 commands.
Hope this help someone stucked.
Cheers,
eThAn
Click to expand...
Click to collapse
Thank you for pointing me to that error. Somehow the priority got lost while pasting. I corrected it.
tetrahedonism said:
Also, what happened to the month of letting RC shine?
Click to expand...
Click to collapse
As owain already said, we devs have decided to wait for 3-4 weeks before using his work and releasing it as an "own" ROM.
This does only affect releasing a ROM, not building it.
I will always encourage everone to build their own ROM for their own purpose, there's nothing wrong with that. And you will learn a lot
slebit said:
Is it possible to compile on 32 bits system?
Sent from my LG-P990 using Tapatalk 2
Click to expand...
Click to collapse
HerrKuk said:
No, 64 bits only
Sent from my LG-P990 using xda premium
Click to expand...
Click to collapse
Litderose said:
You mean it's impossible to compile on Ubuntu 12.04 32-bit ?
Click to expand...
Click to collapse
HerrKuk said:
If i've done my homework properly, yes
ICS and older are possible with 32bits though
Sent from my LG-P990 using xda premium
Click to expand...
Click to collapse
HerrKuk is right. If you try to compile it on a 32-bit system you will see a lot of errors. As JBQ stated here, a 64-bit OS is mandatory.
Do any of you guys get working wi-fi on your kangs?
TrymHansen said:
Do any of you guys get working wi-fi on your kangs?
Click to expand...
Click to collapse
Is not working. I have too dead wifi. Stucks "activating WI-FI..."
I going to see logcat later and share here.
Good, thanks, was just wondering if I had to make a new build-system from scratch, I've re-used my old CM9-builder.
tonyp said:
As owain already said, we devs have decided to wait for 3-4 weeks before using his work and releasing it as an "own" ROM.
This does only affect releasing a ROM, not building it.
I will always encourage everone to build their own ROM for their own purpose, there's nothing wrong with that. And you will learn a lot
Click to expand...
Click to collapse
We all understand rest of the devs here are waiting for RC Shine, thats fine. But as these nightly builds are having too many annoying bugs liek slow battery charging, wifi-battery drain issue, screen wake issue, power button issue, which makes it impossible to even test, forget making it daily driver. In fact even some pals are not able to install it properly (4,5 builds). I dont understand why rest of the devs are not making fixes to these various issues in this nightlies. Other devs are expert who can understand this seperate issues and can make patches till a month, before actually making own custom roms.
Uptil now the fixes suggested by some members are either not working or even making it worse sometimes.
Devs, Please think again for your strong valuable expert fixes. How about a single file parmanent patch with all possible fixes? Will appreciate. Sorry if asking too much or out of protocol. I dont know much what you devs have decided long time back.
Was on the latest build from RC and on bb v20c and the ril which came with the build....wifi was working perfectly and I confirm without a big drain of battery....it was richly smooth
O2X with Magical ROM and supersonic kernels from my buddies

[GUIDE] Build CM10 kernel from source + wkpark's RAM hack

For any CM10 ROM, except new bootloader one, hackfest, and CM10.1
This tutorial shows you how to build CM10 kernel from RC and the CM team's source(it is their work), and using wkpark's ramhack patch or other patches
If you are uncomfortable in building the kernel, you use my flashable sample kernel at the end of the post, which uses 56 MB RAM hack.
Pre-requistes:
A Linux system
An internet connectionc
Some time and patience
But the time required for downloading resources, and building once everything is set up, is only a fraction of the time required for a full CM10 ROM
You can follow this guide, with or without having built CM10 following Raum1807's excellent CM10 building guide. At one of the places, the difference occurs whether you had built CM10 before or not, and I have listed it at that place
For a first time build, you need to follow all the steps, but 2nd time onwards, you can skip to the build step or RAM hack setting step
Instructions:
STEP 1: SETTING UP THE ENVIRONMENT
Install any CM10 ROM on the device (old bootloader, non-hackfest, non-CM10.1 one)
If you already have CM10 environment set up, skip to "Create an environment variable..." part
Install development support packages:
Debian based Linux distributions (like Ubuntu)
64bit systems:
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 schedtool pngcrush xsltproc zlib1g-dev:i386
then
Code:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Red Hat based Linux distributions
32bit and 64bit systems:
git gnupg java-1.6.0-openjdk-devel flex bison gperf SDL-devel esound-devel wxGTK-devel zip curl ncurses-devel zlib-devel gcc-c++ glibc-devel
64bit only:
glibc-devel.i686 libstdc++.i686 zlib-devel.i686 ncurses-devel.i686
Setting up Java (thanks to Raum for the java setup guide)
You need a Java Development Kit for building CM10. Recommended is the SUN JDK 6. As of writing the most recent version is SUN JDK 6 Update 37.
1. Download the jdk-6u37-linux-i586.bin from the Oracle/Sun Java Download Area. If you are on 64-bit Ubuntu as I am, you should grab jdk-6u37-linux-x64.bin.
2. Make the bin file executable:
Code:
$ chmod +x jdk-6u37-linux-x64.bin
3. Extract the bin file:
Code:
$ ./jdk-6u37-linux-x64.bin
4. Move the extracted folder to this this location:
Code:
$ sudo mv jdk1.6.0_37 /usr/lib/jvm/./jdk-6u37-linux-x64.bin
5. Install the new Java source in system:
Code:
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk-6u37-linux-x64.bin/bin/javac 1
$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk-6u37-linux-x64.bin/bin/java 1
$ sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk-6u37-linux-x64.bin/bin/javaws 1
$ sudo update-alternatives --install /usr/bin/javadoc javadoc /usr/lib/jvm/jdk-6u37-linux-x64.bin/bin/javadoc 1
$ sudo update-alternatives --install /usr/bin/javah javah /usr/lib/jvm/jdk-6u37-linux-x64.bin/bin/javah 1
$ sudo update-alternatives --install /usr/bin/javap javap /usr/lib/jvm/jdk-6u37-linux-x64.bin/bin/javap 1
$ sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk-6u37-linux-x64.bin/bin/jar 1
6. Select the default Java version for your system:
Code:
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javaws
$ sudo update-alternatives --config javadoc
$ sudo update-alternatives --config javah
$ sudo update-alternatives --config javap
$ sudo update-alternatives --config jar
7. Check Java version:
Code:
$ java -version
8. Verify the symlinks. Javac, Java, Javaws, Javadoc, Javah, Javap and Jar should all point to the new Java location and version:
Code:
$ ls -la /etc/alternatives/java* && ls -la /etc/alternatives/jar
Now,
If you have CM10 source fetched already (if you have built cm10)
If the directory name where the cm10 source exists is "cm10" (as in Raum's building guide)
Create an environment variable denoting the location of the android toolchain as follows:
Code:
export CCOMPILER=${HOME}/cm10/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
Or else, replace the path/name if yours is different
(If your arm-eabi version is not 4.4.3, check the folder name and change it accordingly)
If you do not have cm10 source on your pc, then you need to download the ARM EABI Toolchain separately
Download link, ready to extract
If above does not work, download from official site here
Download and extract then, create an environment variable denoting the location of the toolchain as follows:
Code:
export CCOMPILER=[extraction directory]/bin/arm-eabi-
Download Kernel Source Code:
Code:
mkdir -p ~/kernel
cd ~/kernel
Now download RC's CM10 kernel source
In terminal, do
Old bootloader:
Code:
git clone git://github.com/CyanogenMod/lge-kernel-star.git -b jellybean
New bootloader:
Here, pengus77 has made the necessary changes in his repo, so we fetch from that
Code:
git clone git://github.com/pengus77/lge-kernel-star.git
Thus, there should be a folder named "lge-kernel-star" inside /kernel folder
Then in terminal, cd to that directory "lge-kernel-star"
Code:
cd lge-kernel-star
Getting the config file
The next step is to copy the file "/kernel/lge-kernel-star/arch/arm/configs/cyanogenmod_p990_defconfig" to "/kernel/lge-kernel-star and rename it to ".config"
using the command:
Code:
cp arch/arm/configs/cyanogenmod_p990_defconfig .config
(Thanks to tonyp for the tip!)
STEP 2: CONFIGURATION
Configure the build:
Code:
make ARCH=arm CROSS_COMPILE=$CCOMPILER oldconfig
If it happens to ask anything, just accept the defaults at every step by pressing enter.
STEP 3: APPLYING PATCHES
Applying patches like wkpark's RAM hack patch
If you skip this step, the kernel will work, but you'll have a completely stock kernel without RAM hack or other tweaks
Download wkpark's two patches from here and here, and put them in your /kernel directory
Code:
cd ~/kernel
Now to apply the patches, we use the patch command like this:
Code:
patch -Np1 -d lge-kernel-star < patchname.patch
(replace patchname with name of the patch file)
Here, -N is for ignoring patches that seem to be already applied or reversed
p<num> Strip the smallest prefix containing num(here num=1) leading slashes from each file name found in the patch file
In this case, num=1 according to the path names in wkpark's patch, and in a lot of cases, the value of 1 is common
-d is to change to the directory immediately, before doing anything else
You need to apply wkpark's two patches one by one (0001-..., then bootloader-...)
If you get errors while patching, if they are basic errors like file not found etc. then you should manage to fix it yourself.
But if you get errors like "HUNK ... failed",
try
Code:
patch -Np1 --ignore-whitespace -d lge-kernel-star < patchname.patch
A "HUNK ignored" is ok, if patch was attempted previously, since that file might have been successfully patched last time
if a HUNK still fails, then read the troubleshooting guide
Setting RAM hack size (If you skipped the above patching step, dont do this)
wkpark's patch makes it possible for you to set ramhack size in kernel command line parameter.
The cmdline parameter has to have the full boot.img command line parameters, which you can obtain from dmesg. I have done it for you, so you can save time on that
Here's how it looks for the old bootloader: (for the new one, ignore this)
Code:
<5>[70:01:01 00:00:00.000] Kernel command line: loglevel=0 muic_state=1 CRC=10203036179a93 brdrev=1.0 uniqueid=37c7006421f6097 video=tegrafb console=ttyS0,115200n8 usbcore.old_scheme_first=1 tegraboot=sdmmc tegrapart=recovery:35e00:2800:800,linux:34700:1000:800,mbr:400:200:800,system:600:2bc00:800,cache:2c200:8000:800,misc:34200:400:800,userdata:38700:c0000:800 [email protected] vmalloc=128M androidboot.mode=normal androidboot.hardware=star androidboot.serialno=37c7006421f6097
Paste the line starting from loglevel=0 till the end (serialno) into .config file in lge-kernel-star folder in
CONFIG_CMDLINE="<here>"
Insert a carveout size in between vmalloc and androidboot.mode
Determing carveout size: carveout=<152 - RAM hack size>M
For example, if RAM hack size is 56, then carveout is 96M
So in that case, the cmdline is like this:
old bootloader:
Code:
CONFIG_CMDLINE="loglevel=0 muic_state=1 CRC=10203036179a93 brdrev=1.0 uniqueid=37c7006421f6097 video=tegrafb console=ttyS0,115200n8 usbcore.old_scheme_first=1 tegraboot=sdmmc tegrapart=recovery:35e00:2800:800,linux:34700:1000:800,mbr:400:200:800,system:600:2bc00:800,cache:2c200:8000:800,misc:34200:400:800,userdata:38700:c0000:800 [email protected] vmalloc=128M carveout=96M androidboot.mode=normal androidboot.hardware=star androidboot.serialno=37c7006421f6097"
new bootloader:
Code:
CONFIG_CMDLINE="tegraid=20.1.4.0.0 [email protected] carveout=152M android.commchip=0 vmalloc=128M androidboot.serialno=037c7006421f6097 video=tegrafb no_console_suspend=1 console=ttyS0,115200n8 debug_uartport=lsport,-3 androidboot.mode=normal usbcore.old_scheme_first=1 [email protected] [email protected] muic_state=0 tegraboot=sdmmc tegrapart=recovery:35e00:2800:800,boot:34700:1000:800,mbr:400:200:800,persist:600:2bc00:800,cache:2c200:7f00:800,misc:34200:400:800,userdata:38700:c0000:800,bcttable:0:600:800,bootloader:100:300:800,data/ve:f8800:1400:800,system:34c000:40000:800 "
and save the file
Dont set carveout too low, or else some gpu-intensive stuff may not work properly.
STEP 4: BUILDING THE KERNEL
In terminal,
Code:
cd ~/kernel/lge-kernel-star
Code:
make ARCH=arm CROSS_COMPILE=$CCOMPILER -j`grep 'processor' /proc/cpuinfo | wc -l`
This step may take a while, depending on your computer. Took ~5-10 mins for the first build for me, and ~1 min for the second build onwards.
If it asks in the terminal "use default config?" then say "y", if not, then ignore this
If you get some error and the building aborts within a few seconds, try the "Create environment variable part" again, and then return back directly to the build step.
After it is done, you should have a kernel stored in ~/kernel/lge-kernel-star/arch/arm/boot/zImage
Preparing the flashable zip for the kernel
Some compiled modules need to be included so that problems like wifi not switching on dont occur.
They are:
drivers/misc/bthid/bthid.ko
drivers/scsi/scsi_wait_scan.ko
drivers/net/wireless/bcm4329/wireless.ko
They will be used while preparing the flashable zip below.
Thanks to feav's compiled modules and benee's anykernel updater for star, all this is ready-made and you can simply:
Download the sample kernel zip attached below and replace /kernel/zImage and and the above modules in system/lib/modules/hw in that with yours, edit updater-script if you want.
Your flashable zip is now ready
STEP 5: FLASHING AND TESTING THE KERNEL
Put the sample kernel below as a backup in case your kernel does not boot and you need a working phone immediately.
Flash the kernel in recovery, wipe cache, dalvik cache and reboot.
If the phone goes past the LG logo screen(s) and into the bootscreen of the ROM, then it should work
Then you can check "kernel version" in settings->about phone to see your kernel information,
and you can see the new RAM size (which should be 342 MB + RAM hack size) in some app like battery dr saver, or antutu benchmark's system info.
If it doesnt work, make sure you have followed the entire guide properly and then ask queries
If you want to revert to another kernel, flash that kernel in recovery, or for stock kernel, flash your ROM.
Keeping kernel source up to date (for building again later after RC has made changes to the source):
Code:
cd ~/kernel/lge-kernel-star
git pull
This will update your source with the latest commits by RC. Then you can rebuild the kernel by doing the "create environment variable" and then skip directly to the build stage
Standard disclaimer:
I am not responsible if anything goes wrong with your phone or anything else.
Credits:
aremcee/RC and the rest of the CM team for all their work. This is their kernel you are building
wkpark for his valuable contributions, including the ramhack patches and cracking the new bootloader
benee for his Anykernel updater for star, and other tweaks
feav for his compiled wifi modules
pengus77 for the work to make it suitable for the new bootloader
Download links for sample kernels:
SAMPLE 56 MB RAMHACK KERNEL
SAMPLE 32 MB RAMHACK KERNEL
SAMPLE 24 MB RAMHACK KERNEL
Troubleshooting guide:
1. Patch failure
HUNK failed means that a particular file was not patched to some problem. In this case, a .rej file is saved in the same folder as the file to be patched, and it contains the stuff not patched.
Do not neglect "failed" hunk since it means a partially applied patch(some files patched, some files not), and may cause problems. "Ignored hunk" is ok, if the patch had been attempted before on a file and had succeeded on that file last time.
To manually patch the failed hunk, go that file where the hunk failed (has same name as .rej file without .rej extension)
For example, if .rej file is board-star.c.rej, and it contains the following sample lines (look for lines beginning with '+' and remove the + before adding, similar for -) go to board-star.c, and add the lines manually like this:
Code:
#if defined (CONFIG_STAR_REBOOT_MONITOR) || defined (CONFIG_BSSQ_REBOOT_MONITOR)
#define RAM_RESERVED_SIZE 100*1024
/* Force the reserved_buffer to be at its old (Froyo/GB) location
for reboot to work with the older bootloader */
if (strstr(saved_command_line, "brdrev=")) {
extern void *reserved_buffer;
pr_info("The older bootloader detected\n");
if (memblock_end_of_DRAM() > 0x17f80000) {
if (memblock_reserve(0x17f80000, RAM_RESERVED_SIZE)) {
pr_err("Fail to get reserved_buffer for the older bootloader\n");
} else {
pr_info("Change reserved_buffer for the older bootloader\n");
reserved_buffer = phys_to_virt(0x17f80000);
}
} else {
pr_info("Change reserved_buffer\n");
reserved_buffer = ioremap(0x17f80000, RAM_RESERVED_SIZE);
}
}
#endif
This was in the .rej file, and is to be added immediately after
Code:
#if defined(CONFIG_LGE_BROADCAST_TDMB)
star_dmb_init();
#endif /* CONFIG_LGE_BROADCAST */
in board-star.c (and before the next #if defined or closing bracket)
Similarly, the - lines to be deleted and + lines are to be added in that failed hunk file
(do this manual stuff only if hunk fails)
2. If ramhack kernel fails, but normal kernel works:
From your pc, in terminal do
adb shell dmesg > dmesg.txt
or from your phone, in android terminal emulator, do
dmesg > /sdcard/dmesg.txt
Copy it from your dmesg.txt starting from loglevel=0 till the end (serialno)
Look for a line in dmesg.txt which resembles this:
Code:
<5>[70:01:01 00:00:00.000] Kernel command line: loglevel=0 muic_state=1 CRC=10203036179a93 brdrev=1.0 uniqueid=37c7006421f6097 video=tegrafb console=ttyS0,115200n8 usbcore.old_scheme_first=1 tegraboot=sdmmc tegrapart=recovery:35e00:2800:800,linux:34700:1000:800,mbr:400:200:800,system:600:2bc00:800,cache:2c200:8000:800,misc:34200:400:800,userdata:38700:c0000:800 [email protected] vmalloc=128M androidboot.mode=normal androidboot.hardware=star androidboot.serialno=37c7006421f6097
Use your own phone's parameters instead of this and then set carveout size.
3. Problem with config file:
Pulling kernel config from device:
You need to retrieve a working kernel config from the device, and unzip it.
For that, connect your phone to your pc, enable USB debugging if it was disabled, and then in terminal
Code:
adb pull /proc/config.gz ~/kernel/lge-star-kernel-jellybean/config.gz
cat config.gz | gunzip > .config
Alternatively, you can pull the .config from the newest boot.img
Code:
scripts/extract-ikconfig boot.img > .config
Changes and updates:
25/12/12:
Added changes to be made for the new bootloader (in red color)
24/12/12:
Updated the guide, added some fixes and changes
22/12/12:
Slightly modified version of wkpark's 2nd patch (bootloader one) which may possibly fix one of the errors and may remove need for manually adding some lines
Last one
rugglez.....you rock mate....
I am not sure if I will really do something as I am getting old(lolz) and if I understand enough....
but thanks mate, for keeping spirits alive for this device
rugglez,
Did you see these posts: http://forum.xda-developers.com/showpost.php?p=34600723&postcount=189
http://forum.xda-developers.com/showpost.php?p=34601277&postcount=192
Did you experienced any ploblem with USB?
SREEPRAJAY said:
rugglez.....you rock mate....
I am not sure if I will really do something as I am getting old(lolz) and if I understand enough....
but thanks mate, for keeping spirits alive for this device
Click to expand...
Click to collapse
There are always some things worth experiencing once in life, like if you are an Android user, building a ROM and a kernel. You have experienced it with your wonderful AF kernel, thats important
feav said:
rugglez,
Did you see these posts: http://forum.xda-developers.com/showpost.php?p=34600723&postcount=189
http://forum.xda-developers.com/showpost.php?p=34601277&postcount=192
Did you experienced any ploblem with USB?
Click to expand...
Click to collapse
USB works fine, both adb and mass storage
This guide may seem intimidating, but trust me, once you complete it the first time, you'll find it really simple from the next build onwards.
Uploaded a slightly modified version of wkpark's 2nd patch (bootloader one) which may possibly fix one of the errors and may remove need for manually adding some lines. Updated link in OP and attached here too.
I tried the sample kernel and my camera stops functioning and so with other apps such as contacts, they don't start at all. Im on dec 20 nightly. Could it be the ramhack size? Maybe 32mb will suffice. Just saying.
Thanks to this, will probably try this next week..
aldyu said:
I tried the sample kernel and my camera stops functioning and so with other apps such as contacts, they don't start at all. Im on dec 20 nightly. Could it be the ramhack size? Maybe 32mb will suffice. Just saying.
Thanks to this, will probably try this next week..
Click to expand...
Click to collapse
Uploaded 32 MB ram hack kernel for those having problem with camera, try it out.
Download link 32MB RH
Update:
Added 24MB version too. Here you go:
24MB RH kernel
Thanks rugglez, 32 mb rh is ok so far, cm10 is way smoother and can still play nfs most wanted. Btw, can you apply the patch for double lg logo too by wkpark?
Sent from my P990-CM10
After installing the new kernel, if some apps still don't work or there any lag, disable "force gpu rendering" and "disable hardware overlays" in developer settings.
Thank you for your work! Just flashed the 32mb version without any problem. On cm7 the 48mb ramhack was the biggest without breaking 720p recording. Maybe you should give it a try!
Uhm download a kernel zip file?
How about git clone?
Sent from my Nexus 7 using xda app-developers app
tonyp said:
Uhm download a kernel zip file?
How about git clone?
Sent from my Nexus 7 using xda app-developers app
Click to expand...
Click to collapse
Git clone size = ~440mb
Zip size = 120mb which extracts to that same size
Takes more time to download more for people like me with slow Internet, no other reason
Hi rugglez, got the ff. error when installing the required packages, Im on ubuntu 12.10 x64.
Note, selecting 'libsdl1.2-dev' instead of 'libsdl-dev'
Package sun-java6-jdk is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'sun-java6-jdk' has no installation candidate
E: Unable to locate package libwxgtk2.6-dev
E: Couldn't find any package by regex 'libwxgtk2.6-dev'
How to fix? Thanks.
aldyu said:
Hi rugglez, got the ff. error when installing the required packages, Im on ubuntu 12.10 x64.
Note, selecting 'libsdl1.2-dev' instead of 'libsdl-dev'
Package sun-java6-jdk is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'sun-java6-jdk' has no installation candidate
E: Unable to locate package libwxgtk2.6-dev
E: Couldn't find any package by regex 'libwxgtk2.6-dev'
How to fix? Thanks.
Click to expand...
Click to collapse
Can you install the dependencies from Raum's CM10 building thread here?
Follow steps 1 and 2 there.
Let me know if that works, ive updated the guide's step 1(setting up environment)
Installing the dependencies from this guide was the only thing i didnt test, since i had the CM10 environment set up already
a step is missing from this guide.
adb pull /proc/config.gz ~/kernel/lge-star-kernel-jellybean/config.gz
cat config.gz | gunzip > .config
Click to expand...
Click to collapse
then
mv config arch/arm/configs/<your_config_name>_defconfig
make ARCH=arm CROSS_COMPILE=$CCOMPILER oldconfig
make <your_config_name>_defconfig
make ARCH=arm CROSS_COMPILE=$CCOMPILER menuconfig
Click to expand...
Click to collapse
then continue...
if you don't make the default config the compiler throws out some errors.
ps: nice guide btw
rugglez said:
Git clone size = ~1.5gb
Zip size = 440mb which extracts to that same size
Takes forever to download more than a gig for people like me with slow Internet, no other reason
Click to expand...
Click to collapse
Hmm.. downloading it now and wondering why it's only 120mb, not 440mb as you said.
rugglez said:
Can you install the dependencies from Raum's CM10 building thread here?
Follow steps 1 and 2 there.
Let me know if that works, ive updated the guide's step 1(setting up environment)
Installing the dependencies from this guide was the only thing i didnt test, since i had the CM10 environment set up already
Click to expand...
Click to collapse
Thanks, ok now using your updated guide.
Btw, did you happen to upload a copy of the kernel zip file? Downloading from github takes forever, only 8 kb/s.
aldyu said:
Thanks, ok now using your updated guide.
Btw, did you happen to upload a copy of the kernel zip file? Downloading from github takes forever, only 8 kb/s.
Click to expand...
Click to collapse
Just use "git clone git://github.com/CyanogenMod/lge-kernel-star.git", it should give you better download speed than for the zipped archive.
I synced the whole CM10 source tree on the remote buildbox in about 5-10 minutes - so github does provide great downspeed
@rugglez: You should add to the OP that you don't have to use adb to get the kernel config, it's already there
arch/arm/configs/cyanogenmod_p990_defconfig
Please refer to the old cm7 kernel how to by pastime: http://forum.xda-developers.com/showthread.php?t=1227241
I really like the fact that more and more building guides get posted here - and that more and more people are building their own ROMs and kernels these days.
After building (which already is a great start) many people even want to learn more about android development in general. That's the true xda spirit!
Kudos!

[Guide] to Build your KitKat ROM (CM-AOKP-Carbon-Slim) x N5 from source (Ubuntu14LTS)

Hi, my name's Stefano I'm from Italy, and sorry for my poor english. This is the guide to build your own the KitKat (or whatever branch you want) for your HammerHead. We'll start, obviously, setting up your client (PC), and here we'll use ubuntu x64. Is possible to use almost any linux distribution (also MacOSX) but I prefer to stay on what is much supported and known (for me!). This guide is taken from internet and reading forums/blogs. I didn't invent anything, you can found a lot of guides like this. Just this is updated with last changes. For the setup part I read and paste a lot from here (thanks to sylentprofet).
Regard the hardware side you'll need at least of:
a Dual Core processor
4 Gb of RAM
80 Gb of hard disk for each repository (Better if SSD but don't required)
The Graphics Card don't care, we don't use to compile
A good internet connection, you have to download up to 40 Gb of stuff
A lot of patience, if you aren't go to download a ready ROM, it's better!
Time, time, time, time and again time!
How to Configure Ubuntu for Properly Compiling Android ROMs​
This guide applies to Ubuntu 13.04 Raring Ringtail 64 bit (but also down to 12.04 LTS which is the version that I prefer). Do not use the 32 Bit version. Also, PAY CLOSE ATTENTION when to use “sudo” and when to not. It can make things funky if you do something as root that you shouldn’t. During normal build you don't have absolutely need to use "sudo", just during the PC setup.
Much thanks goes out to Google, ProTekk, Canonical, and everyone else that I read a random paragraph here and snippet there.
First, let’s set up the correct JDK.
Many of you probably have some kind of wrong Java installed. Sad cupcake.Let’s get rid of that. Copy and paste this into a Terminal window:
Code:
sudo apt-get purge openjdk-\* icedtea-\* icedtea6-\*
Back to the Terminal. Copypasta the following:
Code:
sudo add-apt-repository ppa:webupd8team/java
This will add the correct PPA to your system for updated builds of Java 6 JDK that are compatible with 13.04 (or less). No more unrecognized Java version errors! Yay! And it’s self updating, so you don’t have to redownload binaries everytime they release a new version.
Next, we actually need to install the package. More copypasta:
Code:
sudo apt-get update && sudo apt-get install oracle-java6-installer
Follow the onscreen instructions. You have to Accept the Licensing Agreement or whatever. Hopefully no human centipede clauses. Once that is completed successfully, you will have to restart any open browsers with Java content for it to display correctly.
To make sure the correct version of Java is activated, run the following at the Terminal prompt:
Code:
java -version
You should see something like the following:
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)​ 
Ok, back to a fresh Terminal prompt. Time for installing the guts to build stuff in Ubuntu. Because (K)Ubuntu no longer carries ia32-libs-multiarch and ia32-libs (from Saucy onwards), it is necessary to install from precise repos:
Code:
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse"
sudo apt-get update
sudo apt-get install ia32-libs-multiarch
once is installed, you can remove repository:
Code:
sudo add-apt-repository --remove "deb http://archive.ubuntu.com/ubuntu/ precise main restricted universe multiverse"
sudo apt-get update
Before start, install:
Code:
sudo apt-get install dpkg-dev
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev zlib1g-dev:i386 libc6-dev lib32ncurses5-dev x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 lib32z-dev libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc readline-common libreadline6-dev libreadline6 lib32readline-gplv2-dev libncurses5-dev lib32readline5 lib32readline6 libreadline-dev libreadline6-dev:i386 libreadline6:i386 bzip2 libbz2-dev libbz2-1.0 libghc-bzlib-dev lib32bz2-dev libsdl1.2-dev libesd0-dev squashfs-tools pngcrush schedtool libwxgtk2.8-dev python
And we wait. Don’t worry, this isn’t the crazy downloading part just yet.
When that is done, do this:
Code:
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Now it's time to download and setup SDK Tools. First of all download Android SDK Tools for Linux x64. Extract the folder “sdk”, inside package, into your "Downloads" folder and rename it to "AndroidSDK" e.g..
Then come to your terminal and type:
Code:
cd ~/Downloads/AndroidSDK/tools
and after:
Code:
./android sdk
You can now see the GUI that propose all installable packages. Install Platform tools and Tools for most recent Android (4.4), with the most higher API (19+) version. Flag "accept" and install.
Once is complete, you have you need the binary for repo that will let you talk to git servers and download all that precious source code:
Code:
mkdir ~/bin
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Open "~/.bashrc" to add a line:
Code:
sudo nano ~/.bashrc
At the very bottom, add the following line:
Code:
export PATH=~/bin:$PATH
Save it. In nano that would be Ctrl-O and then Enter. Then Ctrl-X to exit back to a prompt. Type to restart bash:
Code:
source ~/.bashrc
Now you have all need to work (or play) with your ubuntu and it's time to give the sources (repositories) from your preferred Team (who share the source code for their rom). The most known host service for sources and projects is GitHub. E.g. https://github.com/CyanogenMod/
The point of start of any repo is its "manifest" (default.xml) where the team list all it's projects (here an example), only the necessary to the building process.
Until last year was necessary to compile (before begin and looking to platform manifest) an own local manifest where we exclude from download all the devices/kernel/vendor parts unnecessary for our device. This saves up to some Gigabytes of download.
Fortunately now the repositories will download itself the necessary devices/kernel/vendor parts when we'll choose ("lunch") the device to build ("make"). With the exception of AOKP who wanna know, before initialize your local repo, for which device/s you'd like build.
Now I'll write a section for each Team/ROM you want to initialize, that's for me has sense. How take a sense to put each "platform/project" in a different folder (e.g. CarbonDev in a folder and Cyanogenmod in another, both sons of your Home folder).
In the waiting to read next part, better familiarize a little with terms like "breakfast, brunch, lunch, make" into Android contest.
Building Cyanogenmod
In the terminal, now we'll make a folder where to store the Android source code. Typically will make it in your home folder, within a folder called like your projected ROM, to identify from other stuff, open your terminal and type:
Code:
mkdir –p ~/Cyanogenmod
cd ~/Cyanogenmod
Now we are going to initialize your local repository, with the "branch" cm-11.0 (KitKat), in your terminal:
Code:
repo init -u git://github.com/CyanogenMod/android.git -b cm-11.0
And now, the most long part of the story: you’re going to get the source. We have to download around 10-15 Gbytes. First of begin the process, you must to know that you can accelerate the process related to your processor and, obviously, to your internet band. You can choose the number of simultaneous processes to start. They depends from the "#" in the "-j" parameter. E.g. the option -j6 is related to a “normal” processor. If you have a performant processor and/or internet connection, try to increment putting –j10 or more. On terminal:
Code:
repo sync -j6
From time to time, check the situation on output, maybe occurs a pair of hours or a whole night. But when all will be done, you’re ready to build Android!
Once you finish your repo sync, you’ll ready to build. In your terminal, into your working folder type (pay attention at the initial “dot”):
Code:
. build/envsetup.sh
The commands are loaded, now you can build (tune your -j# parameter as you want):
Code:
breakfast hammerhead && make -j6 bacon
At the end of all, your fresh ROM to flash will be in Cyanogenmod/out/target/product/hammerhead. Happy flash!
Thanks @Lloir for supervision.
Building AOKP
Reserved 2
Reserved 3
Reserved 4
Reserved 5
Reserved 6
Nice
Thank you man I'm gonna try it out
I am getting a tone of errors while compiling. Is this normal. I'm gonna assume as long as it doesn't stop everything should be OK.
Sent from my hammerhead
Cuzz1369 said:
I am getting a tone of errors while compiling. Is this normal. I'm gonna assume as long as it doesn't stop everything should be OK.
Sent from my hammerhead
Click to expand...
Click to collapse
When u have warnings, it's all right.
When u have errors the building stops itself...
I was about to do the same guide . I have made the part for paranoidandroid and aosp yesterday, but I am now late. Btw good guide. Better than mine.
Make this thread a sticky thread!
Sent from my Nexus 5 using xda app-developers app
@PippoX3 I really appreciate this guide and your help. My phone just booted into my self comiled cm11. This is always something I've wanted to do since I flashed my first ROM a couple years ago. @Lloir it was actually one of yours "evervolv" for HOV I would like to thank both of you for your help thus far and look forward to continue to ask silly questions. To some this sounds like nothing special. But using a rom you compiled yourself for the first time is quite a rush. Thanks again...
Cuzz1369 said:
@PippoX3 I really appreciate this guide and your help. My phone just booted into my self comiled cm11. This is always something I've wanted to do since I flashed my first ROM a couple years ago. (@Llor it was actually one of yours "evervolv" for HOV) I would like to thank both of you for your help thus far and look forward to continue to ask silly questions. To some this sounds like nothing special. But using a rom you compiled yourself for the first time is quite a rush. Thanks again...
Click to expand...
Click to collapse
You're welcome mate. I remember my first builded and flashed rom for HtcOneS and was a big goal for me. Then I understand you. A step away to grow again and learn more and more. Dig it! :laugh:
The only difference for aosp is just changing the link in repo init -u ? I wanna build a stock rom only with advanced brightness adjustment
Sent from my Nexus 5 using Tapatalk
andrei.voinea93 said:
The only difference for aosp is just changing the link in repo init -u ? I wanna build a stock rom only with advanced brightness adjustment
Sent from my Nexus 5 using Tapatalk
Click to expand...
Click to collapse
Generally yes. Take a look to their readme into manifest platform, usually they explain there how to initialize your local repo. The rest is same for alls...
Thank you
Sent from my Nexus 5 using Tapatalk
I'm getting this error while trying to install packages after the Java step.(Ubuntu 13.10)
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'lib32z1-dev' instead of 'lib32z-dev'
Package ia32-libs is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However, the following packages replace it:
lib32z1 lib32ncurses5 lib32bz2-1.0
I moved on to the next step and receive this:
[email protected]:~$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
ln: failed to create symbolic link ‘/usr/lib/i386-linux-gnu/libGL.so’: No such file or directory
Edit: Found my answer here
http://forum.xda-developers.com/showthread.php?p=50353201
Cuzz1369 said:
I'm getting this error while trying to install packages after the Java step.(Ubuntu 13.10)
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'lib32z1-dev' instead of 'lib32z-dev'
Package ia32-libs is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However, the following packages replace it:
lib32z1 lib32ncurses5 lib32bz2-1.0
I moved on to the next step and receive this:
[email protected]:~$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
ln: failed to create symbolic link ‘/usr/lib/i386-linux-gnu/libGL.so’: No such file or directory
Edit: Found my answer here
http://forum.xda-developers.com/showthread.php?p=50353201
Click to expand...
Click to collapse
I got issues with 13.10 (was a beta, now I don't know...) try 13.04. My prefer is 12.04 or 12.10.
PippoX3 said:
I got issues with 13.10 (was a beta, now I don't know...) try 13.04. My prefer is 12.04 or 12.10.
Click to expand...
Click to collapse
I found the answer and posted above. Worked great now.
Sent from my hammerhead
So I successfully compile slimKat. It gave me 2 different zips in my out folder slim****ota***.zip which was 186mb and slim*****.zip which was only 156mb. What the difference between the two?
Sent from my Nexus 7 using Tapatalk

[GUIDE] Android One (Sprout) Making Kernel's or ROM's in Simple Way [NOOB FRIENDLY]

Post is Influenced from @Anik_khan Kernel Post to make Procedure More Simple for Us All.
So Don't BE Shocked to see Things
Prerequisites:
Ubuntu 14.04 Trusty Tahr 64 Bit. (Can be on VirtualBox or Full Install Your Wish.)
RAM Minimum:2GB Recommended:4GB
Around 100GB Space for ROM’s. (Kernels can use upto 1GB.)
Unlimited (Fast) LAN Connection.
More RAM, or faster CPU, or SSD will speed up the process.
A Brain (Most Important of All :v)
At the starting of the post I have linked a script by @akhilnarang which if run will automatically install all these programs for lazy people.
If you not interested to do all procedure from below just use the script. Simply it will automatically configure the build environment.
NOTE-------- some of these packages may already be on your machine. Obviously, if you complete a step and you have one of these installed, the machine simply will not do anything. So...it will not hurt anything. Some of the packages are different from Ubuntu 12.04 and 13.04 (use these packages for Ubuntu 14.04 as many of the old ones have obsoleted - these are new replacements).
So if you set up your pc with Ubuntu we are good to go.
All code will be in code boxes like this:
Code:
$
means you have to run that command in the terminal (don't type the $).
All commands with sudo, gksudo, or gksu means it requires root permission.
It will ask for password.
Once you type, then in that terminal session it will not ask you for a few minutes again.
Any time you make changes to .bashrc or .profile file, make sure to run
Code:
$ source ~/.bashrc
$ source ~/.profile
Or exit and open new terminal else the changes will not take place
Setting Up Build Environment
Method 1:
So if you not interested in doing below all steps then simply use this script by my friend @akhilnarang
Open terminal and type:
Code:
$ sudo apt-get install git-core
then do
Code:
$ git clone https://github.com/akhilnarang/scripts.git
$ cd scripts
$ . build-environment-setup.sh
This script will install all required packages
Method 2:
1)Installing Java JDK
Open terminal (CTRL + ALT + T)
Then execute the following commands in terminal one by one:
Download & install java
Code:
$ sudo apt-get update && sudo apt-get install openjdk-7-jdk openjdk-7-jre
CHECK if java properly installed or not
Code:
$ java -version
If you get output like
Code:
Code:
java version "1.7.0_79" or anything higher(in my case)
on the first line then all is good
Now JDK is configured!
Note: Only for Ubuntu 14.04 or higher
2)Installing Required Packages
Open Terminal
Now execute this command:
Note: This will take some time, has to download about 500MB or so of packages
Code:
$ sudo apt-get update && sudo apt-get install git-core python gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.8-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev openjdk-7-jdk pngcrush schedtool \
libxml2 libxml2-utils xsltproc lzop libc6-dev schedtool g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline-gplv2-dev gcc-multilib liblz4-* android-tools-adb android-tools-fastboot ccache
3)Installing Android SDK
Download the SDK from here!
Accept Terms & download 64 bit.
Extract in your home directory & rename extracted folder "android-sdk".
Now, execute these commands in terminal:
Code:
$ cd ~/android-sdk/tools/
$ ./android sdk
At this point the SDK should come up and you will need to download at least all the tools and all the extras files (at least to 4.0, so select them and install them.When it finishes downloading & installing everything you have to run this command in ANOTHER TERMINAL:
Code:
$ sudo apt-get install gksudo
$ gksu gedit .bashrc
And you need to add at the end of it your SDK paths these three lines (copy and paste them):
Code:
export PATH=~/android-sdk/tools:$PATH
export PATH=~/android-sdk/platform-tools:$PATH
export PATH=~/bin:$PATH
Save and close the file, then close terminal, or
Code:
source ~/.bashrc
Find your .profile file and add this at the bottom of the file
Code:
PATH="$HOME/android-sdk/tools:$HOME/android-sdk/plartform-tools:$PATH"
SDK is configured.
4)Configuring USB Access
Now we need to set permissions so that our USB ports can detect our android devices
Type in the following commands, it will download a file with the permissions, give it permission to execute, and restart the service.
Code:
$ sudo curl --create-dirs -L -o /etc/udev/rules.d/51-android.rules -O -L https://raw.githubusercontent.com/snowdream/51-android/master/51-android.rules
$ sudo chmod 644 /etc/udev/rules.d/51-android.rules
$ sudo chown root. /etc/udev/rules.d/51-android.rules
$ sudo service udev restart
$ sudo killall adb
ADB & Fastboot are configured
5)Installing Repo Package
Open terminal and type:
Code:
$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
6)Configure Git
Open terminal and type:
Code:
$ git config --global user.email ""
$ git config --global user.name ""
Git is configured.
7)Configure ccache
Open terminal and type:
Code:
$ gksu gedit ~/.bashrc
Enter these lines
Code:
export USE_CCACHE=1
export CCACHE_DIR=~/.ccache
Save & close
Open terminal & execute:
Code:
$ source .bashrc
$ ccache -M 50G
I usually use 50 gigs. You can use more if you have more space, or build for many devices
Congrats
YOUR BUILD ENVIROMENT IS NOW SETUP .
Making Kernel
Good work !!! Waiting for completion
Sent from my Moto G using Tapatalk
Thread closed per OPs request

[DEV] Building CyanogenMod 13 for Zenfone 5/6

Development: Building CyanogenMod 13 for Zenfone 5/6​
Prerequisites:
Ubuntu 16.04 (Installation Guide)
~80 GiB of Available Disk Space
Establishing a Build Environment
Open a Terminal Emulator (Ctrl+Alt+T)
Install the latest Ubuntu updates:
Code:
sudo apt-get update
sudo apt-get dist-upgrade
Add the OpenJDK 7 Repository:
Code:
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
Install the Required packages by Android:
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip maven yasm optipng openjdk-7-jdk
Install Repo:
Code:
sudo wget https://storage.googleapis.com/git-repo-downloads/repo -O/usr/bin/repo
sudo chmod +x /usr/bin/repo
Setup Git:
Code:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
Recommended: Reboot.
Downloading the Source:
Create a Working Directory:
Code:
mkdir -p ~/CM13
cd ~/CM13
Initialize the Repository (choose a command below):
Stable (ZNH2K):
Code:
repo init -u git://github.com/zf5/android.git -b stable/cm-13.0-ZNH2K
Stable (ZNH5Y):
Code:
repo init -u git://github.com/zf5/android.git -b stable/cm-13.0-ZNH5Y
Nightly:
Code:
repo init -u git://github.com/zf5/android.git -b cm-13.0
Download the Code:
Code:
repo sync -c -j4
Optional: Setup ccache (ccache acts as a compiler cache that can be used to speed up rebuilds)
Code:
echo "export USE_CCACHE=1" >> ~/.bashrc
export USE_CCACHE=1
prebuilts/misc/linux-x86/ccache/ccache -M 50G
Applying the Patches:
Download the Patches
Extract the Patches at your working directory
Apply the patch files by changing the directory to where they are and using the following command:
Code:
patch -p1 < filename.patch
Example: Applying the Patch for Vibration:
Code:
cd frameworks/base
patch -p1 < vibration.patch
(Do the same for every patch file in their respective directories)
Building the System:
Prepare the build environment:
Code:
. build/envsetup.sh
lunch cm_T00F-user
Build the System:
Code:
make -j4
That's it. Your system.img is located at WORKING_DIRECTORY/out/target/product/T00F/system.img
Also check out: Development: Building a Marshmallow Kernel for Zenfone 5/6
XDA:DevDB Information
Development: Building CyanogenMod 13 for Zenfone 5/6, Tool/Utility for the Asus Zenfone 5
Contributors
dgadelha
Version Information
Status: Stable
Created 2016-04-21
Last Updated 2016-09-13
For T00G:
Device Tree: https://github.com/T00G-Marshmallow-DEV/android_device_asus_T00G
Vendor Tree: https://github.com/T00G-Marshmallow-DEV/android_vendor_asus_T00G
Information: Sensors and some bugs fixed.
Gooood! Thanks very much
For cm12.1 also same method? Because I got some error on building cm12.1
AhZhi said:
For cm12.1 also same method? Because I got some error on building cm12.1
Click to expand...
Click to collapse
Yes. But I think you'll need to apply the Vibration patch manually, as it will probably fail.
And, well, no need to apply all the patches, only vibration.
That's it.
dgadelha said:
Yes. But I think you'll need to apply the Vibration patch manually, as it will probably fail.
And, well, no need to apply all the patches, only vibration.
That's it.
Click to expand...
Click to collapse
Thank you now i go to try it
Error
dgadelha said:
Development: Building CyanogenMod 13 for Zenfone 5/6​
Prerequisites:
Ubuntu 15.10 (Installation Guide)
~80 GiB of Available Disk Space
Establishing a Build Environment
Open a Terminal Emulator (Ctrl+Alt+T)
Install the latest Ubuntu updates:
Code:
sudo apt-get update
sudo apt-get dist-upgrade
Install the Required packages by Android:
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip maven yasm optipng openjdk-7-jdk
Install Repo:
Code:
sudo wget https://storage.googleapis.com/git-repo-downloads/repo -O/usr/bin/repo
sudo chmod +x /usr/bin/repo
Setup Git:
Code:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
Recommended: Reboot.
Downloading the Source:
Create a Working Directory:
Code:
mkdir -p ~/CM13
cd ~/CM13
Initialize the Repository:
Stable:
Code:
repo init -u git://github.com/zf5/android.git -b stable/cm-13.0-ZNH2K
Nightly:
Code:
repo init -u git://github.com/zf5/android.git -b cm-13.0
Download the Code:
Code:
repo sync -c -j4
Optional: Setup ccache (ccache acts as a compiler cache that can be used to speed up rebuilds)
Code:
echo "export USE_CCACHE=1" >> ~/.bashrc
export USE_CCACHE=1
prebuilts/misc/linux-x86/ccache/ccache -M 50G
Applying the Patches:
Download the Patches
Extract the Patches at your working directory
Apply the patch files by changing the directory to where they are and using the following command:
Code:
patch -p1 < filename.patch
Example: Applying the Patch for Vibration:
Code:
cd frameworks/base
patch -p1 < vibration.patch
(Do the same for every patch file in their respective directories)
Building the System:
Prepare the build environment:
Code:
. build/envsetup.sh
lunch cm_T00F-user
Build the System:
Code:
make -j4
That's it. Your system.img is located at WORKING_DIRECTORY/out/target/product/T00F/system.img
Also check out: Development: Building a Marshmallow Kernel for Zenfone 5/6
XDA:DevDB Information
Development: Building CyanogenMod 13 for Zenfone 5/6, Tool/Utility for the Asus Zenfone 5
Contributors
dgadelha, tank0412
Version Information
Status: Stable
Created 2016-04-21
Last Updated 2016-05-11
Click to expand...
Click to collapse
Fetching projects: 51% (222/435)
error: Exited sync due to fetch errors
Can you help me ?
HONGARC said:
Fetching projects: 51% (222/435)
error: Exited sync due to fetch errors
Can you help me ?
Click to expand...
Click to collapse
type again last comand
it will resume, try use google there are some comands what will help you
And how to creat .zip flash on twrp
adekcan said:
And how to creat .zip flash on twrp
Click to expand...
Click to collapse
you can use otapackage but you must this have in device tree or you can extrac system.img file after build
Hi @dgadelha..
I have successfully built the rom and kernel in my laptop using the steps you provided on first page..
After that I flashed it to my phone and it's been working so smooth and stable. It was a great experience for me getting the phone work using the firmware compiled by me ?. Many thanks for you..
Sent from my ASUS_T00F using XDA-Developers mobile app
sapiterbang said:
Hi @dgadelha..
I have successfully built the rom and kernel in my laptop using the steps you provided on first page..
After that I flashed it to my phone and it's been working so smooth and stable. It was a great experience for me getting the phone work using the firmware compiled by me ?. Many thanks for you..
Sent from my ASUS_T00F using XDA-Developers mobile app
Click to expand...
Click to collapse
Ohh that's good it means new dev come !! ??
sapiterbang said:
Hi @dgadelha..
I have successfully built the rom and kernel in my laptop using the steps you provided on first page..
After that I flashed it to my phone and it's been working so smooth and stable. It was a great experience for me getting the phone work using the firmware compiled by me . Many thanks for you..
Click to expand...
Click to collapse
Nice to hear that.
What is the procedure if I want to run this rom on stock kernel? (I am asking this because I have no camera found bug after unlocking bootloader.)
Beside that your guide is awesome.
[email protected][email protected]@ said:
What is the procedure if I want to run this rom on stock kernel? (I am asking this because I have no camera found bug after unlocking bootloader.)
Beside that your guide is awesome.
Click to expand...
Click to collapse
There is no procedure, you can't do that.
[email protected][email protected]@ said:
What is the procedure if I want to run this rom on stock kernel? (I am asking this because I have no camera found bug after unlocking bootloader.)
Beside that your guide is awesome.
Click to expand...
Click to collapse
You have to build a Lollipop 5.0 based ROM to run with stock kernel.
leonardohenrique10 said:
You have to build a Lollipop 5.0 based ROM to run with stock kernel.
Click to expand...
Click to collapse
I'm a bit disappointed,but anyway thanks a lot for information.
getting error in applying patches
I am getting erros while applying patch.....I reffered ur steps from guide by u that how to build cyanogenmod for zenfone 5....I have downloaded and synced sources and when i come to apply patch then i get error..
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/linker/linker.cpp b/linker/linker.cpp
|index bc40cf1..899eeca 100644
|--- a/linker/linker.cpp
|+++ b/linker/linker.cpp
--------------------------
File to patch: y
y: No such file or directory
Skip this patch? [y]
Skipping patch.
2 out of 2 hunks ignored
please help me...
Desert fox2612 said:
I am getting erros while applying patch.....I reffered ur steps from guide by u that how to build cyanogenmod for zenfone 5....I have downloaded and synced sources and when i come to apply patch then i get error..
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/linker/linker.cpp b/linker/linker.cpp
|index bc40cf1..899eeca 100644
|--- a/linker/linker.cpp
|+++ b/linker/linker.cpp
--------------------------
File to patch: y
y: No such file or directory
Skip this patch? [y]
Skipping patch.
2 out of 2 hunks ignored
please help me...
Click to expand...
Click to collapse
You need to copy the file bionic/linker.patch to the directory ~/CM13/bionic/
then you need to do
Code:
cd ~/CM13/bionic
patch -p1 < linker.patch
dgadelha said:
You need to copy the file bionic/linker.patch to the directory ~/CM13/bionic/
then you need to do
Code:
cd ~/CM13/bionic
patch -p1 < linker.patch
Click to expand...
Click to collapse
Thanks....that helped me.. Btw should I ignore warnings generated between building img file? & one prob is linker.patch is not worked....rest all patches worked....will it create problem?

Categories

Resources