[DEV] Building a Marshmallow Kernel for Zenfone 5/6 - Zenfone 5 Android Development

Development: Building a Marshmallow Kernel for Zenfone 5/6​
Prerequisites:
Ubuntu 16.10 (Installation Guide)
~5 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
Install Wine (you'll need it for AndImgTool):
Code:
sudo dpkg --add-architecture i386
sudo add-apt-repository ppa:wine/wine-builds
sudo apt-get update
sudo apt-get install --install-recommends winehq-devel
Setup Wine (don't modify the settings, just press OK):
Code:
WINEARCH=win32 winecfg
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 ~/Kernel
cd ~/Kernel
Initialize the Repository:
Code:
repo init -u git://github.com/intel-ctp/android.git -b zf5/kernel
Download the Code:
Code:
repo sync -c -j4
Important: Remove a Conflicting Directory: (you may face build errors if you don't run that)
Code:
rm -Rf bionic/tests
Building the Kernel:
Prepare the build environment:
Code:
. build/envsetup.sh
lunch mini_T00F-user
Build minigzip:
Code:
make -j4 minigzip
Build the Kernel:
Code:
make -f KernelMakefile -j4 build_kernel
make -f KernelMakefile -j4 modules_install
make -f KernelMakefile -j4 copy_modules_to_root
Generating the Boot Image:
Download the Ramdisk to a Working Directory:
Code:
cd ~
git clone https://github.com/zf5/Kernel.git Boot -b cm-13.1
Enter Working Directory:
Code:
cd Boot
Download AndImgTool:
Code:
wget https://basketbuild.com/uploads/devs/dgadelha/ASUS_T00F/Tools/AndImgTool.exe
Remove my prebuilt files:
Code:
rm -v PARTS/BZIMAGE
rm -Rv ramdisk/lib/modules/*
Copy your just-built kernel files:
Code:
cp -v ~/Kernel/out/target/product/T00F/kernel PARTS/BZIMAGE
cp -Rv ~/Kernel/out/target/product/T00F/root/lib/modules/* ramdisk/lib/modules/
Generate your Boot Image:
Code:
wine AndImgTool.exe . boot.img
Enjoy your Kernel!
Also check out: Development: Building CyanogenMod 13 for Zenfone 5/6

Great,
Thank you!

i dont think its a good idea by using wine for building

ccxex29 said:
i dont think its a good idea by using wine for building
Click to expand...
Click to collapse
You'll just use Wine to generate the boot.img. It works and I tested it. All my Boot images were generated using it.

@dgadelha Hey, thanks for the good work there. How would you suggest me to edit kernel default config with menuconfig? I tried to copy and use defconfig but it was problematic. I wanted to hear your opinions on this. Thanks.
Sent from my ASUS_T00F using Tapatalk

smgdev said:
@dgadelha Hey, thanks for the good work there. How would you suggest me to edit kernel default config with menuconfig? I tried to copy and use defconfig but it was problematic. I wanted to hear your opinions on this. Thanks.
Sent from my ASUS_T00F using Tapatalk
Click to expand...
Click to collapse
Hi @smgdev
I already played a lot with menuconfig, but if you want to try out, that's how I recommend you to do:
Cleanup your build environment, delete the out/target/product and kernel/asus directories
Run a repo sync
Play with menuconfig:
Code:
make -f KernelMakefile TARGET_DEVICE=hd menuconfig
When you finish, press Save and save it as "defconfig", your file will be now at out/target/product/asusctp_hd/kernel/linux/defconfig
Copy your new defconfig to Desktop and cleanup the environment again (delete out/target/product/asusctp_hd and kernel/asus)
Run another repo sync
Copy your defconfig to kernel/asus/T00F, replacing mine
Build it.
That's my recommended way to use menuconfig, keeping the environment cleanest as possible.
Thanks.

dgadelha said:
Hi @smgdev
I already played a lot with menuconfig, but if you want to try out, that's how I recommend you to do:
Cleanup your build environment, delete the out/target/product and kernel/asus directories
Run a repo sync
Play with menuconfig:
Code:
make -f KernelMakefile TARGET_DEVICE=hd menuconfig
When you finish, press Save and save it as "defconfig", your file will be now at out/target/product/asusctp_hd/kernel/linux/defconfig
Copy your new defconfig to Desktop and cleanup the environment again (delete out/target/product/asusctp_hd and kernel/asus)
Run another repo sync
Copy your defconfig to kernel/asus/T00F, replacing mine
Build it.
That's my recommended way to use menuconfig, keeping the environment cleanest as possible.
Thanks.
Click to expand...
Click to collapse
Oh, and i was wondering why I was getting compilation errors. Thank you so much! Never thought a repo sync. But I have a 2-3 line mac802.11 patch. Can I apply it as soon as I repo sync? I do not experience problems with that patch.
Thank you so much again!
Sent from my ASUS_T00F using Tapatalk

smgdev said:
Oh, and i was wondering why I was getting compilation errors. Thank you so much! Never thought a repo sync. But I have a 2-3 line mac802.11 patch. Can I apply it as soon as I repo sync? I do not experience problems with that patch.
Thank you so much again!
Click to expand...
Click to collapse
Hi @smgdev
Yes, you can do it.
But also you could submit the patch directly to the GitHub repository to be available to everyone.
Thanks.

@dgadelha hey, its me again and sorry for bothering you again.
I am porting nethunter kernel, its a tx injection patch but I can submit it if you want.
Anyways, can you see the problem?
{
"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"
}
Sent from my ASUS_T00F using Tapatalk

smgdev said:
@dgadelha hey, its me again and sorry for bothering you again.
I am porting nethunter kernel, its a tx injection patch but I can submit it if you want.
Anyways, can you see the problem?
Sent from my ASUS_T00F using Tapatalk
Click to expand...
Click to collapse
Edit cpiostatfile.txt and remove the mentioned missing file.
Thanks.

dgadelha said:
Edit cpiostatfile.txt and remove the mentioned missing file.
Thanks.
Click to expand...
Click to collapse
Fixed one line and moved modules to lib/modules from lib root. That might be an issue of Makefile. Suggest you to check it. Anyway, I built the image and its working. Thank you for dealing with my ignorance.
By the way, do you have communication with BORETS24? I have to get into touch with him/her for his/her HID keyboard patch.

smgdev said:
Fixed one line and moved modules to lib/modules from lib root. That might be an issue of Makefile. Suggest you to check it. Anyway, I built the image and its working. Thank you for dealing with my ignorance.
By the way, do you have communication with BORETS24? I have to get into touch with him/her for his/her HID keyboard patch.
Click to expand...
Click to collapse
Hi @smgdev
Your issue was because you modified your defconfig and disabled (or changed to built-in) the module t4k35_180 and then it was not generated, not fault of Makefile or etc.
Then, AndImgTool threw an error because it could not find the file (which was mentioned at cpiostatfile.txt).
So basically it is, for every file that you add or remove from the ramdisk, you need to update cpiostatfile.txt.
Thanks.

dgadelha said:
Hi @smgdev
Your issue was because you modified your defconfig and disabled (or changed to built-in) the module t4k35_180 and then it was not generated, not fault of Makefile or etc.
Then, AndImgTool threw an error because it could not find the file (which was mentioned at cpiostatfile.txt).
So basically it is, for every file that you add or remove from the ramdisk, you need to update cpiostatfile.txt.
Thanks.
Click to expand...
Click to collapse
I found out the error wasn't t4k35_180.ko generating. Modules were copied to a wrong directory. boot/lib instead of boot/lib/modules which was declared in the cpiostatfile. I was talking about that. Anyway,
You are the best, thanks for everything.
Sent from my ASUS_T00F using Tapatalk

smgdev said:
I found out the error wasn't t4k35_180.ko generating. Modules were copied to a wrong directory. boot/lib instead of boot/lib/modules which was declared in the cpiostatfile. I was talking about that. Anyway,
You are the best, thanks for everything.
Sent from my ASUS_T00F using Tapatalk
Click to expand...
Click to collapse
Ah, thanks. I'll fix that.

Hey, probably a silly question but;
What should I change to port a stock-rom booting kernel to run CM-based rom kernel?
I have both sources of two kernels and I need to make stock-booting kernel to CM-booting kernel (for an experiment).

ozank said:
Hey, probably a silly question but;
What should I change to port a stock-rom booting kernel to run CM-based rom kernel?
I have both sources of two kernels and I need to make stock-booting kernel to CM-booting kernel (for an experiment).
Click to expand...
Click to collapse
By "stock-rom booting kernel" you mean the kernel-only (bzImage) or full boot image (bzImage+Ramdisk)?

dgadelha said:
By "stock-rom booting kernel" you mean the kernel-only (bzImage) or full boot image (bzImage+Ramdisk)?
Click to expand...
Click to collapse
Actually I need to port Borets24 to CM13 again for some experiments and I think the both of source codes has bz+RDisk.

ozank said:
Actually I need to port Borets24 to CM13 again for some experiments and I think the both of source codes has bz+RDisk.
Click to expand...
Click to collapse
Build his bzImage, normally, and use my Ramdisk.
I built his kernel before and it had many issues (drain, lag, etc) and then I got back into stock. Unfortunately, I don't keep history of my builds.
And remember: disable SELinux

dgadelha said:
Build his bzImage, normally, and use my Ramdisk.
I built his kernel before and it had many issues (drain, lag, etc) and then I got back into stock. Unfortunately, I don't keep history of my builds.
And remember: disable SELinux
Click to expand...
Click to collapse
Thank you; yes, I saw that you were using in the earlier builds, I wanted to try with latest freeze-reboot things (some people were saying the freeze is not happening and I thought what if I recompile again for CM13 based roms and try it for 2-3 days).
Thanks again and have a good day.

Hey @dgadelha , so sorry to bother you again but as far as I know this devices boot.img structure is different. If so, can you explain it?
Thanks
Sent from my ASUS_T00F using XDA-Developers mobile app

Related

[DEV & TUTORIAL] HOW TO BUILD CM7 OR CM9 for GALAXY MINI DEVICE

Requirements :
OS linux Ubuntu 11.04 64bits ( recommended ) or above
2Gb RAM with 3Gb swap or above
Processor Centrino Duo or above
120Gb Harddisk or above
Fast internet connection ( i have no this )
First download this file
Installer SDK and Build packages by me
Password : squadzone
you will get installerBuildRomGalmin.sh , run this file via Terminal on Ubuntu
follow all instruction that appears,
after Finish, now we goto download repository
still on Terminal
type
mkdir -p ~/android/system
sudo curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > /bin/repo
sudo chmod a+x /bin/repo
for build cm7
cd /android/system
repo init -u git://github.com/CyanogenMod/android.git -b gingerbread
repo sync -j32
clone this
choose branch gingerbread
put on device tree or replace tass folder on device tree
for build cm9
cd /android/system
repo init -u git://github.com/CyanogenMod/android.git -b ics
repo sync -j32
clone this
replace cm9 folder tree with this
choose what you want to build, if you choose for build cm7 and cm9, do with different folder
after you prepare the whole file that needed for build
run . build/envsetup.sh && brunch tass on terminal
for reference , READ THIS
for kernel
clone this
and build using device config from working device
have fun to build the rom and kernel
for update
see this
I WILL NOT ANSWER ANY QUESTION FROM NOOB ! !
DO WITH YOUR OWN RISK
{
"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"
}
Thanks Squadzone. Finally I got what I wished !!
Thanks a lot will try later
Sent from my GT-S5570 using XDA App
yeah, thanks so much squadzone!
I'm currently using your CM 9.0 BETA 2. It's awesome!
I have a small request: can you please modify the TASS.rle file and change the flashscreen or the pre bootanimation screen. It shows a CM7 for galaxy mini in a purple and orange colour as the previously released CM7.x versions!
Doubt: Can I replace the TASS.rle file in yours with the one in tj style's CM7.1?
Happy New Year too!
Squadzone, Thanks For Your Kind Help..........
Thank you so much for the tutorial.
Actually I'm very interested about developing Android Applications.
I know a bit about Java and a bit more about C# (now I'm working on this).
I just want to ask, wether developing application and ROM is same?
Thank SquadZone (Terima Kasih Harry)
Terima kasih squadzone atas tutorialnya, mudah2an saya bisa bikin cm9 menjadi lebih baik. yang saya ingin pelajari bikin kernel 825 Mhz, mudah mudahan saya bisa.
Big thank for Squadzone, squadzone my idol. (Sory for bad english)
lonestrider said:
I just want to ask, wether developing application and ROM is same?
Click to expand...
Click to collapse
Different to some extent I guess. Android apps are completely built using Java, and could be built from any Platform. About ROM, its based on UNIX or Linux programming so Linux is mandatory. Kernels are written in C/CPP and compilation is being done executing UNIX commands. Just my assumptions about ROM and Kernel, maybe I'm wrong too.
coolsandie said:
Different to some extent I guess. Android apps are completely built using Java, and could be built from any Platform. About ROM, its based on UNIX or Linux programming so Linux is mandatory. Kernels are written in C/CPP and compilation is being done executing UNIX commands. Just my assumptions about ROM and Kernel, maybe I'm wrong too.
Click to expand...
Click to collapse
apps=java
kernel=c
rom=java on a linux kernel. If ur not modifying kernel c is not reqd. everything else is java in the rom but it's compiled a little differently as u said. knowing linux will obviously help.
cmiiw
Thank you!
This is the best tutorial I've seen yet
Taking really long to do a 'repo sync' Now I know how hard you guys worked
siddhanathan said:
This is the best tutorial I've seen yet
Taking really long to do a 'repo sync' Now I know how hard you guys worked
Click to expand...
Click to collapse
lol yea repo sync is actually the easiest part
compiling without errors is tough, but squad made it easier here i think.
Actually just downloading the source from CM is easy. And compiling after the download is easy too.... The hardest part is to make the mods.... squadzone codded those cool functions in his CM source.... The bootanimation, the status bar transperancy.... That the hard part.... To implement something
just finished compile the cm9 but after flash, it failed to boot into homescreen. what should I edit to make it boot?
najashark said:
just finished compile the cm9 but after flash, it failed to boot into homescreen. what should I edit to make it boot?
Click to expand...
Click to collapse
Upload you work!
We need see...
najashark said:
just finished compile the cm9 but after flash, it failed to boot into homescreen. what should I edit to make it boot?
Click to expand...
Click to collapse
Try Squadzone's boot.img maybe.
AntiBillOS said:
Upload you work!
We need see...
Click to expand...
Click to collapse
this is my zip file after compiling, the problem is. it cannot boot into homescreen after flashing.
DOWNLOAD
TheWhisp said:
Try Squadzone's boot.img maybe.
Click to expand...
Click to collapse
will try it now
EDIT: ah, still no luck. the phone boot, vibrate but nothing shows on the screen. i hope squadzone will help.
najashark said:
this is my zip file after compiling, the problem is. it cannot boot into homescreen after flashing.
DOWNLOAD
will try it now
EDIT: ah, still no luck. the phone boot, vibrate but nothing shows on the screen. i hope squadzone will help.
Click to expand...
Click to collapse
But it works! But why screen dont show anythin?
AntiBillOS said:
But it works! But why screen dont show anythin?
Click to expand...
Click to collapse
the screen is to many flicker and cause cant update the layer, this cause by egl, read refresh rate upto 60Hz, and this need to hack the egl again, but i will not continue this cm9 project until get stable source for do that, and NEED FAST INTERNET that i havent
Was a pain to follow your tutorial, squad...
Anyways, I got to the building part (I think):
Now the galaxy s building wiki link that you posted tells me to run some file extraction file, which I just can't find. Without that I'm getting shtloads of errors (Don't know if same happens when I've managed to extract the files).

[HOW-TO] Dev basic´s: Source, Compiling, Github & co ~ Day 4

Welcome to fuss132 dev basic´s​
So you want to become a developer for android? You dont know where to start? Well, I will try to give you some point you can start with.
"There are many tutorials on compiling source code?", you may ask "So no need of this?". No, youre not right. Of course there are many how tos that explain you how to compile something... but to do the magic there is more needed than just "Execude this commands and ready". You need to know the things behind, you need to get the flair of android.
What I want:
First of all, I know that there are many people that see how devs are failing; or some that need help and those people cant help them. They have the time to learn something, but they dont know how. You can expect a point to start with, some welcome drink of android development. Expect the falir of android! Join the android open source project! I posted this in the I9100G section, because I use my kernel (called horsepower) as an example, but it can be used for every device! And please if I helped you thank me in whatever post I helped you I´m doing this in my spare free time to help you!
What I dont want:
I cant give you everything! You will need some time, it took me one and a half years to get to know a big part of how android works and stuff. You will not be a "full" developer after this! Furthermore, I dont teach you for 10 variants of my kernel coming up at the forum or of cm roms what ever! Android is an opensource project. This means creating something new - but together. If you did something you think its worth to publish make a git push request and your work will be included to my kernel f.e. Every dev that notice your work will let you post in his thread and your work will be thanked!
Also required for this howto:
A computer running ubuntu 12
Some basic ubuntu terminal knowledge
Time and more time
Also a good internet connection could be usefull
How it will work:
So you think you can manage this? Good luck, I will help you whereever I can. But please understand, that my work on kernels and roms will come first I will try to post every day a new tutorial. We will start with setting up your computer and will end up in some weeks with compiling your own aosp rom. Ready? So lets go to the second post here and start with Day 1: Introduction
PS: Well we only have one forum so, besides this fact that this is about learning developing, I posted it here...
Day one: Introduction and downloading source code
This is all for jellybean!
So no longer talking about developement, let´s do some of itselfe.
We first need the source code. For completeness we will download both - kernel source and main rom source. If you dont know what kernel is for please stop reading here... you will fail 99,9999%. (Maybe you just forgot which files this is for: Kernel is the boot.img in your update.zip´s and the rest located in /system is the compiled main rom.)
1. Creating your working directory and stuff
You should know the commands, just use the same folder names and structure for a better chance that I can help you if something goes wrong.
cd
mkdir cyanogenmod
cd cyanogenmod
Click to expand...
Click to collapse
2. Downloading the source and required software
At this part we use a very useful build script made by teamhacksung, thanks to them!
Staying at your /cyanogenmod folder do the following (What this git command mean ~ well dont think about it we will learn it afterwards):
git clone git://github.com/teamhacksung/buildscripts.git -b cm-10.1 buildscripts
ln -s buildscripts/samsung/build.sh
./build.sh prepare
Click to expand...
Click to collapse
This script will now do some very useful things for you Select the specifics of your system and wait for finishing till the point "Download sources?" Tipe a "y" and select "cm-10.1". (When it asks for your folder you want the source in only tipe "sources" and hit enter). This will download the main uncompiled canogenmod sources for you (including some kernel and device specific stuff). It will take looong Depeding on your net connection. Some hours usually
3. Downlading kernel sources and recovery stuff
Everything went well? So this means we need to go further. In /cyanogenmod/sources should now be some folders and files... And now we should download a kernel source for our device (choose one for your device, I will use I9100G ones).
Navigate to your source and execute
cd
cd cyanogenmod
cd sources
mkdir kernel/samsung/
cd kernel/samsung/
git clone https://github.com/fuss132/android_kernel_samsung_t1.git -b greenblob-4.2.2 t1
Click to expand...
Click to collapse
Hah, you now have latest greenblobkernel source on your computer.
But to finally build the kernel and rom we will also need some device specific files for our I9100G. For other devices you will find these files when you search on gitbub. Or google device xy ics device tree.
cd
cd cyanogenmod
cd sources
git clone git://github.com/CyanogenMod/android_device_samsung_i9100g.git -b cm-10.1 device/samsung/i9100g
Click to expand...
Click to collapse
As it finished you have all the sources you need
Thats enough for day one, I think. See you soon
Day 2: Github basics part 1
So we successfully downloaded all sources. Brilliant, now let´s go on. In future time you may work on kernels of even the main rom, and of course you should upload the changes you made to contribute to the community. You will need github for this. For some basic info go here I will only focus on how to use it.
The script from above post should already installed git, if not do the following:
sudo apt-get install git
Click to expand...
Click to collapse
And you should also register an account for free at github.com -> here
As you did this we will also need to set up your github account on your computer, so use the following commands and replace it with the email adress and username you chose before:
First we should be in our kernel example local repository so use cd /cyanogenmod/sources/kernel/samsung/t1 to switch to it
git config --global user.name "Your Name Here"
git config --global user.email "[email protected]"
Click to expand...
Click to collapse
If you now upload some changes you have to enter your password every time. To make the things easier we will use an ssh key and will add it to our github account. Its not important to know what all these commands are doing just do them
ssh-keygen -t rsa -C "[email protected]"
//Now you need to enter a passphrase.
sudo apt-get install xclip
xclip -sel clip < ~/.ssh/id_rsa.pub <- this is the path to your stored key
Click to expand...
Click to collapse
Now go to https://github.com/settings/ssh, login and click "add ssh key". Choose a name (doesnt matter which one) and paste your key from your clipboard into the field below. Thats it github is now set up
1. Some basics commmands
There are some basic commands you should know. Firstly, some explanations for you. The source you downloaded is stored on www.github.com.
With git clone [email protected]/pathtsource you can download new files and sources from existing repositorys.
When you change some files in your local repository (all files from one source path f.e. cd /cyanogenmod/sources/kernel/samsung/t1 and then execute and then) use git status to display the changes you made.
You made some changes? Then pack these changes into a commit by typing git add -A and also add a commit message that will appear later like git commit -m "Camera freeze fix" and finally upload it: git push. We will make some practical examples tomorrow, so dont worry about this now. Just keep that in mind.
Thanks for reading and see you tomorrow!
As usuall, if you like this thread and stuff please submit it as news tip!
Day 3: Github basics part 2 and preparing for compiling
Welcome to Day 3: Github basics part 2 and preparing for compiling! Lets beginn our "session" with a short test. Remember which command you have to use for cloing a repository (downloading the files to your computer)? Well we need this one here.
1. Again Github basics
Imagine the following situation; You want to help another person to fix a bug. You should create your own repository first to dont mix files up. In short we copy all files from a repository to our own new one. We have a point to start then and will use his code, but his code wont change when we change ours.
Go to www.github.com/ and login
I create a short repository for you all, nothing special but you can practise with it.
Open the following page (its the repositiory shown in your webbrowser: https://github.com/fuss132/lerninggit_practical_repository. Click on fork at the right:
{
"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"
}
If github is asking you to which user it should fork the files click the only availabe button ^^
You have now your own repository with the same files. We will download the files now. Open your terminal and navigate to the folder (it should be an empty one). So you have to do the following:
cd whereeveryyouwantit
git clone [email protected]:[B]yourusernamehere[/B]/lerninggit_practical_repository.git
Click to expand...
Click to collapse
Now we "fix the bug" and do some changes to your local files.
cd tutorialmembers
sudo gedit memberlist
// add your name to the list, save and exit //
cd ..
Click to expand...
Click to collapse
So we made the changes, now we will upload them, you should know the commands already. If you have any questions please post in this thread
git status
git add -A
git commit -m "add my name to the list"
git push
Click to expand...
Click to collapse
Brilliant, if you know visit https://github.com/yournamehere/lerninggit_practical_repository you will see that your changes have been uploaded. So you fixed my problem, you should now share the solution with me.
Open your repository in a webbrowser https://github.com/yournamehere/lerninggit_practical_repository and click on Pull Requests on the right side. Now select on the right side as head repo mine fuss132 one and as base repo in the left the default, your one. Describe what you did in the filed below and finally click on "Send pull request.
Thats it you now shared it with me and I will include your changes to my repo
2. Back to the roots: Prepare for compiling
Now cd to the folders you downloaded all the sources in. You should see folders like bionic, fendor, main... I will call this main source directory now
If you would compile the sources now you would stuck after some seconds Android needs a special java version for building. And this one cant be downloaded anymore. Well, bad situation... We will give up here we will never compile android :'(
Ok, **** you java we will rule you
There is an error only because the build system does not recognize the java version when it is an openSDK
$ java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.1) (6b24-1.11.1-4ubuntu2)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
To work around it, you can just comment out the following lines in build/core/main.mk:
cd build/core/
gedit main.mk
instead of
ifneq ($(shell java -version 2>&1 | grep -i openjdk),)
java_version :=
endif
there should be
# ifneq ($(shell java -version 2>&1 | grep -i openjdk),)
# java_version :=
# endif
Click to expand...
Click to collapse
Java is now no longer checking its version and everything is working. Stupid solution, but working
The second part is that the linker would complain that it cannot find -lGL .
The workaround for it would be:
just execute this line:
sudo ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 /usr/lib/libGL.so
Click to expand...
Click to collapse
The last thing what we need is again the buildscript file, just do the following (you dont have to remember this):
// be in the main directory of your sources //
gedit build.sh
copy all lines from https://github.com/teamhacksung/buildscripts/blob/ics/samsung/build.sh and paste them into your file
save and close
in terminal: chmod 777 build.sh
Click to expand...
Click to collapse
Thats it for today, thanks for reading! Please press thanks if you like it and maybe click on "newsworthy thread". Questions, as usuall in this thread please
Day 4: Compiling your first things and looking into the source code
It´s been a long time since we met the last time, I hope you didnt forgot everything. If you did - you know - just go to through the first posts and learn again. Sorry that it took so long for you to wait, but I´m writing this in my spare free time and I´m involved into many many projects at this time that are more important that this one. But I didnt forget you! So lets go in again and start coding!
1. Going through the source code
I know, I turned things around in the title of this thread, but compiling will take a very long time so lets go through the source code first.
Open a file explorer and navigate to your root forlders. You will see there many folders. As you all know, Cyanogenmod is a Custom Rom and adds much features to your devices, thats why they are using custom product configs. One for each phone and one for all phones.
Let´s go into the folder vendor/cm. You will see a file called "vendorsetup.sh" in which all available devices are written in.
Ok, you will wonder why theres only something like this in your folder if you downloaded the sourcecode for Cyanogenmod 10:
for combo in $(cat vendor/cm/jenkins-build-targets)
do
add_lunch_combo $combo
done
Click to expand...
Click to collapse
Because since cm10 they´re doing things a bit different. In the next few days we will download the aokp source code and start porting aokp to a new device, because aokp is using the old building system like in cm9 and previous version - and I want that you know all of them. So back to our cm10 thing: All product specific files are now directly in the source code of the device, the device tree. Its the one we downloaded and stored in /device/samsung/i9100g.
But to build a fully working Cyanogenmod Rom we need more that only te device tree, we need some proprietary files from your device. In short, they are files that are very device specific like camera.t1.so (a camera module only for our device) that is pre generated and could not be build by our system. (Thats also the reason why developers cant edit it. We are not able to edit it, too). To pull all those files from your device, please connect it and be sure that you are already running a cyanogenmod 10 rom, otherwise some files might be different and not be copyed - your rom will not be successfully build.
Open our terminal and execute:
Code:
sudo bash
cd cyanogenmod/sources/device/samsung/i9100g
chmod 777 proprietary-files.sh
./proprietary-files.sh
Using adb all the files are now being pulled from your device and stored in the right directory of your system. If you successfully did this (and I didnt forget something) we should be now able to compile our own cyanogenmod rom.
2. Compiling your rom
So let´s go! (We will update the sourcecode before again, maybe some cool things changed). We will not use the build script for this, we´re doing things "oldschool". If you want to make things as easy as possible do ./build.sh i9100g and everything will be done for you.
sudo bash
cd cyanogenmod/sources
repo sync
/* start building*/
. build/envsetup.sh
lunch
/* pick the device you are building for */
make bacon or make fullota or make -jx (where x is the number of your cpu cores)
Click to expand...
Click to collapse
And now we have to wait some hours depending on your computer. I´ll catch you guys in the next tutorial!
Please press thanks and submit this thread as newsworthy one! Thank you and have a good time
First page of the thread!
This post also...
3 left if my math education not failed
Oh no, it was just one... hmm thats why I want to became a computer scientist not a mathematician ^^
newsworthy thread
@fuss
Submitted as newsworthy thread . Guys pls do the same if its useful to u guys . First to comment n ur thread
+1 will wait time after time..
Good one Fuss Should be recommended to make this sticky once you complete the tutorial.
This happens when fuss is in playful mood...lol.. hoping to see more of it..... I have already built a rom...its a modified stock rom...but I am failing to compile and decompile systemui Apk...using apktool..I tried installing framework-res apk...but eventually found out that apktool won't work for ics...so any help from your side is appreciated...
Sent from my GT-I9100G using xda premium
Wow very useful ty fuss
Sent from my GT-I9100G using xda app-developers app
seriously long thread..
pergh....
Will wait for this guide! Very usefull!!!
Kingspp said:
This happens when fuss is in playful mood...lol.. hoping to see more of it..... I have already built a rom...its a modified stock rom...but I am failing to compile and decompile systemui Apk...using apktool..I tried installing framework-res apk...but eventually found out that apktool won't work for ics...so any help from your side is appreciated...
Sent from my GT-I9100G using xda premium
Click to expand...
Click to collapse
Use apk-manager or the latest smali and baksmali binaries.
Added Day 2: Github basics part 1 to todays agenda
superatmos said:
Use apk-manager or the latest smali and baksmali binaries.
Click to expand...
Click to collapse
Thanks for the reply.... I will try and use smali and baksmali...since apk manager did not work...
Sent from my GT-I9100G using xda premium
Awesome guide you are doing here! Cannot wait to see how it continues today. Big thumbs up for this mate!

[DEV] How to build CM10.1 (Android 4.2.1) for the LG-P990 O2x

Build your 'own' CM10.1 ROM (Android 4.2.1) today!
Revision V1.3 2013.01.09 Updates: No more patching needed. local_manifest.xml updated to new branch revision. Text updates.
Revision V1.2 2012.12.13 Updates: Repo sync branch finally changed from mr1-staging to cm-10.1. Thanks HerrKuk.
Revision V1.1 2012.12.11 Updates: New Patch: WiFi shows networks, BT works, audio.h reworked, notification lights are back, USB mass-storage support included. Compatible to V30A Kernel.
Revision V1.0 2012.12.01 Initial release
Thank you note: Thanks to Ricardo Cerqueira for his work on this device.Thanks to marsgod for BT and WiFi patches/tips.
General note: Please keep in mind that CM10.1 is still experimental. This guide is for those who cannot wait...
{
"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"
}
Preparation
What you need:
You need a fully working build environment. If you don't have one running already, you can follow my guide in the other thread to get a fully working environment under Ubuntu 12.10 64bit. Follow the easy steps in the guide. Make a test build with CM10 to see if it is working. Then you will be ready for the next step.
Your build environment is now set? Good, 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.
Get the sources
Start with creating a new working directory for CM10.1:
Code:
$ mkdir ~/cm10.1
$ cd ~/cm10.1
Initialize Repo for Android CM10.1 (Android 4.2.1):
Code:
$ repo init -u git://github.com/CyanogenMod/android.git -b cm-10.1
and enter your credentials if needed.
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
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 add additional sources. To see the hidden .repo directory, you have to press Ctrl-H in your file manager.
Create the xml-file with
Code:
$ gedit ~/cm10.1/.repo/local_manifest.xml
20130109: Update! New branch revisions!
Paste the following lines to the editor
Code:
<manifest>
<project name="TheMuppets/proprietary_vendor_lge.git" path="vendor/lge" remote="github" revision="cm-10.1"/>
<project name="CyanogenMod/android_device_lge_p990" path="device/lge/p990" remote="github" revision="cm-10.1"/>
<project name="CyanogenMod/android_device_lge_star-common" path="device/lge/star-common" remote="github" revision="cm-10.1"/>
<project name="CyanogenMod/lge-kernel-star" path="kernel/lge/star" remote="github" revision="cm-10.1"/>
</manifest>
Save the file.
Run another
Code:
$ repo sync
Download the necessary prebuilts from cyanogenmod by running
Code:
$ ~/cm10.1/vendor/cm/get-prebuilts
Ok. That's done!
Patching
20130109: Thanks to Ricardo Cerqueira's Update to the CyanogenMod repos there is no more patching needed!
Only for those who have patched the sources before and want to build with the new sources. If you are new to this skip the 'Patching' part and go to 'Build the ROM' directly.
If you have patched/changed the sources and want to get up-to-date, here is what you can do:
change the local.manifest.xml file that it looks like the one you see above
delete all the directories inside your ~/cm10.1/ directory but keep the hidden .repo directory
repo sync now and the missing files will be downloaded and the whole structure will be recreated without redownloading the repos you already have
get the prebuilts with ~/cm10.1/vendor/cm/get-prebuilts
and this is it, just brunch p990 again
Build the ROM
Code:
$ repo sync
$ brunch p990
and flash it via CWM. Make a clean start (if necessary) with format /system, wipe data/factory reset, etc..
Have fun!
FAQ
Revision V1.5 20130110 New GAPPS, now without the nasty force closing AOSP keyboard 'bug'
Revision V1.4 20130109 Sections updated: bootloader section, Baseband section, partition size, mass storage mode. Sections removed: building smaller ROMs, mobile data connection, Flight mode, WIFI & BT
Revision V1.3 20121214 Updates: New GAPPS from 20121212
Revision V1.2 20121211 Updates: Bluetooth working, WiFi Networks showing and more. Plus typo fixes.
Revision V1.1 20121206 Updates: Partition size, swapping internal/external memory, USB mass-storage mode.
Revision V1.0 20121201 Initial release
Thanks to key.ita, XXMrHyde, tonyp, Custom40 and marsgod for their contributions to this FAQ.
Where are the Google Applications - GAPPS?
Get the fixed GAPPS here. Fix: The 'bugged' gesture typing is disabled. That's due to Tegra2 which isn't supporting NEON instructions. With the fix you can use the keyboard as usual without force closes.
Or you can get the 'original' GAPPS from 20121212 for 4.2.1 here. Download and flash them via CWM.
The keyboard is force closing all the time. Is there a solution?
Yes. Just flash the fixed GAPPS over your installation via CWM. The gesture typing will be disabled but you can use the AOSP keyboard then as you used it in the previous versions. It's up to you but now you can disable the useless gesture trail, dynamic floating preview etc. under 'Settings>>>Language & input>>>Android keyboard AOSP>>>Enable gesture typing'. Then remove the tick from 'Enable gesture typing' and you are ready to use the AOSP keyboard without any problems.
What bootloader should be used?
You have to use the old bootloader.
Any Baseband recommendations?
I am using the 30B Baseband. You can find it in tonyp's Baseband thread under 'ICS Basebands'. But it is working with other BBs like V20L as well.
[/I]
What about the partition size? Will this ROM (including the GAPPS) fit in the old partition layout?
Yes, it does. Some files get copied to /data so the ROM plus GAPPS fit the old partition size completely.
The 'Developer options' from 'settings' are gone. Where are they?
Touch the 'Build number' seven times in 'about phone'. Then they will appear.
How do I use the external SD-Card as the internal memory (swap SD-Cards)?
Edit the 'vold.fstab' file on your phone under 'system/etc/' and change the lines to:
Code:
dev_mount sdcard /storage/sdcard0 auto /devices/platform/sdhci-tegra.2/mmc_host/mmc1
dev_mount emmc /storage/sdcard1 9 /devices/platform/sdhci-tegra.3/mmc_host/mmc0
If you want to use it permanently on your building system and in every ROM you make then edit '~/CM10.1/device/lge/p990/vold.fstab' and use the both lines above accordingly.
I want to transfer files from/to the phone via USB. How do I turn on the mass-storage mode?
Use the terminal on the phone or use adb shell:
Code:
su
setprop persist.sys.usb.config mass_storage
And reboot. When you use your Computer's USB connection the next time, Android will ask you whether you like to switch on the mass-storage mode.
I want to use the mass-storage mode in my builds. What can I do?
I included it in the ROM building process by editing "~/CM10.1/device/lge/star-common/star.mk'. At the very end of the file you find the line 'persist.sys.usb.config=mtp'. Change it to 'persist.sys.usb.config=mass_storage'. Next time you build a new ROM the mass-storage mode is included. Tip: if you are updating your ROM then sometimes you have to make the switch manually (one time only!) as described above to initiate the change.
Are there any other problems?
I think it is awesome!!! Very fast, nice camera, same energy usage as CM10. I am using it as my daily driver. (well, since Nov 28 now... :fingers-crossed
Please build CM10.1 yourself and test it thoroughly. Maybe we can remove some of the remaining problems together.
Reserved for future use
nice guide :silly:
mivv a lazy one....
Are the sources downloading fast? I didn't try Paranoid... You said few coffees... I think I drank a bucket of coffee and it still wasn't there = went to sleep
I'll try, Although I am busy with my pi... that sdcard corruption bug with OC driwes me crazy, I guess I'll ssh my kitchen PC too do something in parallel...
Does this build has the call bug or it's like Benee's hackfest free of it?
and Raum1807 does HW acceleration work?
Will do this guide next week. Just finished REMICS TOUCHWIZ UX now released for everyone. Then Motorola UI... So next week I'll have time
Sent from my Xoom using XDA Premium HD app
Might give this a go myself, but as you said, it's still in pretty early stages of development.
Thanks for the useful guide though
Shouldn't the file's name be local_manifest.xml?
I.e.
Code:
$ gedit ~/cm10.1/.repo/local.manifest
needs to be changed into
Code:
$ gedit ~/cm10.1/.repo/local_manifest.xml
in order for it to work. Right?
svante38 said:
Shouldn't the file's name be local_manifest.xml?
I.e.
Code:
$ gedit ~/cm10.1/.repo/local.manifest
needs to be changed into
Code:
$ gedit ~/cm10.1/.repo/local_manifest.xml
in order for it to work. Right?
Click to expand...
Click to collapse
Of course. Corrected it. Thanks!
puma99dk| said:
Does this build has the call bug or it's like Benee's hackfest free of it?
and Raum1807 does HW acceleration work?
Click to expand...
Click to collapse
HWA is working. It is basically running like CM10.
The call bug hasn't occurred to me (yet). But I think it is the wrong name anyway: in my opinion it is an microphone/audio bug.
In this ROM the RIL and audio are a bit different. So maybe this bug isn't there. But this is a good reason why I would like to see more people building and testing CM10.1.
Raum1807 said:
Of course. Corrected it. Thanks!
Click to expand...
Click to collapse
Also, looking at your patch, it seems to point to directories on your local machine:
Code:
/home/ac64/cm10.1/...
Shouldn't this be changed to:
Code:
~/cm10.1/...
In order for it to work on all computers?
Can someone upload a build of this?
Sent from my LG-P990 using xda app-developers app
svante38 said:
Also, looking at your patch, it seems to point to directories on your local machine:
Code:
/home/ac64/cm10.1/...
Shouldn't this be changed to:
Code:
~/cm10.1/...
In order for it to work on all computers?
Click to expand...
Click to collapse
By applying the patch with the "-p 4" argument, the first 4 "parts" of the path will be ignored,
by typing:
Code:
cd ~/cm10.1
patch -p4 < CM10.1_building.patch
the path will be "set" correct.
It`s a better to do it this way, so the patch is working also if your path to your repo is different,
e.g. your repo path is CM10.1/android/system/
you have to type:
Code:
cd ~/cm10.1/android/system/
patch -p4 < CM10.1_building.patch
But you can change the path in the CM10.1_building.patch to ~/CM10.1...
but in this case, you have to change the -p4 argument to -p0, or just apply the patch without -p argument
XXMrHyde said:
By applying the patch with the "-p 4" argument, the first 4 "parts" of the path will be ignored,
by typing:
Code:
cd ~/cm10.1
patch -p4 < CM10.1_building.patch
the path will be "set" correct.
It`s a better to do it this way, so the patch is working also if your path to your repo is different,
e.g. your repo path is CM10.1/android/system/
you have to type:
Code:
cd ~/cm10.1/android/system/
patch -p4 < CM10.1_building.patch
But you can change the path in the CM10.1_building.patch to ~/CM10.1...
but in this case, you have to change the -p4 argument to -p0, or just apply the patch without -p argument
Click to expand...
Click to collapse
Oh I see. Thanks for clearing that up.
Thanks OP for the building instructions too, teaching people to fish instead of just providing them one!
Raum1807 said:
HWA is working. It is basically running like CM10.
The call bug hasn't occurred to me (yet). But I think it is the wrong name anyway: in my opinion it is an microphone/audio bug.
In this ROM the RIL and audio are a bit different. So maybe this bug isn't there. But this is a good reason why I would like to see more people building and testing CM10.1.
Click to expand...
Click to collapse
I highly doubt a magic fix
Sent from my Optimus 2X using xda app-developers app
Custom40 said:
Might give this a go myself, but as you said, it's still in pretty early stages of development.
Thanks for the useful guide though
Click to expand...
Click to collapse
if you get it done, please share
last i have test a CM10.1 from EaglesBlood and there work no camera and BB28g has no Signal... would in this CM10.1 all fixed??
See the Screenshots in post #1, signal is working,
just building CM10.1, will report if camera is working
MetaIIica said:
last i have test a CM10.1 from EaglesBlood and there work no camera and BB28g has no Signal... would in this CM10.1 all fixed??
Click to expand...
Click to collapse
EaglesBlood is not CM, its based on AOSP.

[GUIDE] Building CyanogenMod 10.2 for Nexus 4 with Ubuntu 13.04 x64 + NIGHTLIES

If you are looking for my nightly builds, you can find them here.
{
"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"
}
NOTE: Official nightly builds for CM 10.2 are now available! Get them here.
Click to expand...
Click to collapse
So after countless hours of frustration and face-desking, I finally managed to make a working build of CyanogenMod 10.2 (Android 4.3). To make the process slightly less painful for you, I've decided to create this noob-friendly guide. This is my first development guide, so feel free to leave criticism or suggestions through PM.
Prerequisites
You will need:
A relatively recent computer running Ubuntu with a reasonable amount of RAM (I recommend at least 4 GB) and around 35 GB of free hard drive storage
A decent internet connection
Some understanding of basic Android and Linux operation and terminology is helpful
NOTE: This guide is for Ubuntu 13.04 x64, but should work with other relatively recent versions of Ubuntu as well; i.e. 12.04, 12.10.
Click to expand...
Click to collapse
Setting up the build environment
The first thing you need to do is install the correct Java Development Kit/JDK, Oracle Java 6. If you have OpenJDK installed, you have to uninstall it by typing this command into the terminal, which can be brought up by pressing Ctrl+Alt+T or searched for in the dash.
Code:
sudo apt-get purge openjdk*
To install Oracle Java 6, type this into the terminal (one line at a time):
Code:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java6-installer
y
Android SDK requires the x32 compatability packages, ia32-libs. Install it by entering this:
Code:
sudo apt-get install ia32-libs
y
Now you will need to get the Android SDK/Software Developer Kit, if you haven't already. Go ahead and download it here.
Extract it to a folder of your choice (in this guide, I will refer to it as ~/android/sdk) and from that folder, enter these commands into the terminal:
Code:
cd ~/android/sdk/adt-bundle/sdk/tools
./android sdk
Click Install packages. cd to ~/android/sdk/adt-bundle/sdk/platform-tools and type:
Code:
adb
fastboot
If you've done everything correctly, you should get a big block of text for both (which list all of the adb/fastboot commands).
Next, install the build packages. Copy and paste this command into the terminal:
Code:
sudo apt-get install git-core gnupg flex bison gperf libsdl1.2-dev libesd0-dev libwxgtk2.8-dev squashfs-tools build-essential zip curl libncurses5-dev zlib1g-dev pngcrush schedtool libxml2 libxml2-utils xsltproc g++-multilib lib32z1-dev lib32ncurses5-dev lib32readline-gplv2-dev gcc-multilib
y
You will now need to set up the directories for your build environment. Type this into the terminal:
Code:
mkdir -p ~/bin
mkdir -p ~/android/cm-10.2
Set up the repo binary (used for syncing your local repository with the CM source):
Code:
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
NOTE: In order to run the repo command when you're not in ~/bin (the folder where you saved the repo binary), you need to add it to your path of execution. To do this, type:
Code:
gedit ~/.bashrc
And then add the line
Code:
export PATH=${PATH}:~/bin
to the top of the file and click save. You can do the same for the adb and fastboot commands by adding
Code:
export PATH=${PATH}:~/android/sdk/adt-bundle/sdk/tools
export PATH=${PATH}:~/android/sdk/adt-bundle/sdk/platform-tools
to the file.
Click to expand...
Click to collapse
Syncing your local repository with the CM source
The next step is to initialize the repository and download the CM source code to your computer. Type the following lines into the terminal:
Code:
cd ~/android/cm-10.2
repo init -u git://github.com/CyanogenMod/android.git -b cm-10.2
repo sync
You have now begun downloading all of the CM source code to your build directory. Depending on your internet speed, this can take up to a couple of hours. If the sync interrupts, don't worry. Simply continue the sync (you don't have to restart completely, only the project you were downloading when the interrupt occured, phew) by entering:
Code:
repo sync
Remember, you need to cd into your build directory (~/android/cm-10.2, if you've been following this guide) for the command to work.
Go and get yourself a drink or something, this step takes a long time.
NOTE: If the sync gets stuck at 99%, stop the sync (exit the terminal window), open up a new one, cd to your build directory, and type the following:
Code:
repo sync -j1
This reduces the amount of threads/connections to 1 for the final unsynced project(s). It should work.
Click to expand...
Click to collapse
Now comes the fun part: Building
You're almost to the end! In order to make a working build, you have to get the proprietary files (mainly device build files and drivers) for the Nexus 4. The easiest way to do this is to create a file named "roomservice.xml" in the ~/android/cm-10.2/.repo/local_manifests directory. Now, .repo is a hidden directory, so in order to access that directory you can either 1) show hidden files and folders in Nautilus (the Ubuntu file manager) or 2) access the folder and create the file using terminal commands. Both methods are explained below (2 is probably easier, but does not always work, in my experience).
1) Open up a Nautilus window. Navigate to your build directory (once again, ~/android/cm-10.2) and press Ctrl+H. This allows you to see hidden files and folders. You should see a folder labelled .repo. Enter it and inside, create a directory called "local_manifests", if there isn't already one. Enter that folder and create a blank file called "roomservice.xml". Next, copy the following lines into the file and press save:
Code:
<manifest>
<project name="TheMuppets/proprietary_vendor_lge.git" path="vendor/lge" remote="github" revision="cm-10.2"/>
</manifest>
2) Type this into the terminal:
gedit ~/android/cm-10.2/.repo/local_manifests/roomservice.xml
ext, copy the following lines into the file and press save:
Code:
<manifest>
<project name="TheMuppets/proprietary_vendor_lge.git" path="vendor/lge" remote="github" revision="cm-10.2"/>
</manifest>
If you get an error, try method 1.
Do another repo sync:
Code:
repo sync
After this, you can download the necessary pre-built apps:
Code:
~/android/cm-10.2/vendor/cm/get-prebuilts
Finally, you will build. If you aren't there already, cd to your build directory and run the following commands in the terminal:
Code:
. build/envsetup.sh
brunch mako
Now, just let your computer do the rest. This step is very demanding for your computer, so I recommend you leave it alone while it builds. Go get another drink.
Done? If everything went correctly, cd to ~/android/cm-10.2/out/target/product/mako and you should see your newly built ROM entitled:
cm-10.2-20xxxxxx-UNOFFICIAL-mako.zip
Congratulations! You've successfully built CM 10.2!
For re-builds (i.e. when the source code has been updated and you would like to make a new nightly), just do this:
Code:
cd ~/android/cm-10.2
make clean [I](for incremental builds, you can skip this step. You can also do make clobber; thanks [user=4520802]@obtained[/user])[/I]
repo sync
. build/envsetup.sh
brunch mako
If you ever encounter an error or problem and need help, feel free to post here or send me a PM.
Happy building, everyone!
Sources:
How To Build CyanogenMod Android for Google Nexus 4 ("mako")
http://wiki.cyanogenmod.org/w/Build_for_mako
[GUIDE] How to build CM10.1 (Android 4.2.1) for the Nexus 4 (mako)
http://forum.xda-developers.com/showthread.php?t=2047981
[GUIDE] Building CM10.2 for Nexus 4 with Mac OS X 10.8.X)[UPDATED: 8.8.2013]
http://forum.xda-developers.com/showthread.php?t=2087318
UBUNTU 12.04 - INSTALL ANDROID TOOLS (ADB, FASTBOOT, ...)
http://bernaerts.dyndns.org/linux/245-ubuntu-precise-install-android-sdk
Reserved
Nice thanks for the guide muchly appreciated!
Sent from my Nexus 4 using Tapatalk 4
Other phones
Very nice guide, but i was wondering if this is working for other phones too? Which i think it does but i was kind of wondering about this part "Now comes the fun part: Building", i want to do this on samsung galaxy s2 (gt-i9100), will i write the same things (execpt from bunch mako)?
You missed the "repo sync" command after creating roomservice.xml file, it is necessary to download the device specific files. (sorry my english)
Cheerpipe said:
You missed the "repo sync" command after creating roomservice.xml file, it is necessary to download the device specific files. (sorry my english)
Click to expand...
Click to collapse
You are absolutely correct. Thanks for that
Sent by carrier pigeon
Chekhn said:
Very nice guide, but i was wondering if this is working for other phones too? Which i think it does but i was kind of wondering about this part "Now comes the fun part: Building", i want to do this on samsung galaxy s2 (gt-i9100), will i write the same things (execpt from bunch mako)?
Click to expand...
Click to collapse
You'd also need the correct proprietary (device-specific) files. I'm not sure that TheMuppets has the files for the i9100. You may need to extract them from a working build of CM yourself.
You can check out CM's guide for your device here: http://wiki.cyanogenmod.org/w/Build_for_i9100
Sent by carrier pigeon
klvnhng said:
You'd also need the correct proprietary (device-specific) files. I'm not sure that TheMuppets has the files for the i9100. You may need to extract them from a working build of CM yourself.
You can check out CM's guide for your device here: http://wiki.cyanogenmod.org/w/Build_for_i9100
Sent by carrier pigeon
Click to expand...
Click to collapse
I have checked the CM build guide, but i don't get the zip file when i do cd $OUT, have been searching but no answer and I can't find any threads or posts with this problem.
Chekhn said:
I have checked the CM build guide, but i don't get the zip file when i do cd $OUT, have been searching but no answer and I can't find any threads or posts with this problem.
Click to expand...
Click to collapse
You probably didn't get the device blobs correctly. I did a search for the i9100 and it turns out that TheMuppets repo does have it.
So for roomservice.xml:
Code:
<manifest>
<project name="TheMuppets/proprietary_vendor_samsung" path="vendor/samsung" remote="github" revision="cm-10.2" />
</manifest>
And when building:
Code:
brunch i9100
klvnhng said:
You'd also need the correct proprietary (device-specific) files. I'm not sure that TheMuppets has the files for the i9100. You may need to extract them from a working build of CM yourself.
You can check out CM's guide for your device here: http://wiki.cyanogenmod.org/w/Build_for_i9100
Sent by carrier pigeon
Click to expand...
Click to collapse
TheMuppets does have i9100 proprietary files.
Edit: looks like I'm 1 minute late.
Also: make clobber and make clean are the same for cm. "make clobber" actually does a "make clean".
Sent from my Nexus 4 using xda premium
@klvnhng
Are you sure we can make this with Java 7?. I tried some days ago to build AOSP and some other ROM´s, and I had so much problems becasue of the Java version when building. I had Java 7, but specifically the build asked for Java 6, so I had to downgrade.
Another question would be if it is necessary to download the code for all the devices, instead of downloading the code just for Mako.
Thanks.
Galaxo60 said:
@klvnhng
Are you sure we can make this with Java 7?. I tried some days ago to build AOSP and some other ROM´s, and I had so much problems becasue of the Java version when building. I had Java 7, but specifically the build asked for Java 6, so I had to downgrade.
Another question would be if it is necessary to download the code for all the devices, instead of downloading the code just for Mako.
Thanks.
Click to expand...
Click to collapse
Hmm...you may be correct. I have both 6 and 7 installed, so it could be that I'm actually using 6.
Edit: JDK 6 is required (http://source.android.com/source/initializing.html). I have a mixed environment.
And yes, in order to build CM, you need to have the entire source repo synced. Sorry
Thank you for the help guys!
Excellent!
Great guide... Very thorough and informative. Getting ready to build my first 10.2 shortly... Thanks again
VoiD_Dweller said:
Great guide... Very thorough and informative. Getting ready to build my first 10.2 shortly... Thanks again
Click to expand...
Click to collapse
Let me know how it goes!
wow i needed this thread since 1 month i am trying but not able to build properly now u r here to help thnkx.
I will try ! Thx
Sent from my Nexus 4 using xda app-developers app
Noob's question ; what are the differences between a home compiled rom and the rom you can download on the CM website ?
klvnhng said:
Let me know how it goes!
Click to expand...
Click to collapse
Got the build done.. flashed it, flashed gapps, everything works excellent!
One thing though, I noticed the build size of the zip is 9 mb larger than the official nightly for yesterday. Whats up with that?
Also what are the perks of building on ubuntu 13.04 vs the recommended 12.04 I always see in the other guides? are the tools more optimized or something? I'm a linux newb so excuse me if it's a lame question
---------- Post added at 08:06 AM ---------- Previous post was at 08:05 AM ----------
french-anonymous said:
Noob's question ; what are the differences between a home compiled rom and the rom you can download on the CM website ?
Click to expand...
Click to collapse
You built it, and you don't have to wait for their build server. Also after you learn more about it, you can customize and add things of your own.. basically.
VoiD_Dweller said:
Got the build done.. flashed it, flashed gapps, everything works excellent!
One thing though, I noticed the build size of the zip is 9 mb larger than the official nightly for yesterday. Whats up with that?
Click to expand...
Click to collapse
To be honest, I'm not quite sure. My builds average 206 MB.
VoiD_Dweller said:
Also what are the perks of building on ubuntu 13.04 vs the recommended 12.04 I always see in the other guides? are the tools more optimized or something? I'm a linux newb so excuse me if it's a lame question
Click to expand...
Click to collapse
Apparently, the 3.8 kernel included in 13.04 handles tasks more efficiently. There are other optimizations as well, I'm sure. Most people recommend 12.04 because it is a LTS version and therefore will have bug fix and security updates for for 5 years, as opposed to 9 months. But I like to keep up-to-date :good:

LazyFlasher - make and install your own custom kernels!

INTRODUCTION
Hello Pixel C users and developers! I saw your device forum is a little lonely, so I offer you this in the hopes it may become slightly more eventful and 2017 becomes the year of the Pixel C development!
I expect that before you start, you have a Linux installation in either a virtual machine or on a physical PC.
Debian Jessie, Kali Linux, Mint, or Ubuntu are excellent choices and what I'm familiar with, so if you get stuck it'll be easier for me to help you if you use these.
NEED LINUX? I'VE GOT YOU COVERED
If you don't have a Linux installation, consider installing the latest version of Oracle VM VirtualBox.
You can download a minimal Debian VM from my site: https://build.nethunter.com/possibly-the-coolest-things/Debian.ova (SHA1SUM)
It should be fairly simple to "Import Appliance..." from VirtualBox and set up the Shared Folders properly, everything else is set up for you!
Username: root
Password: xda
Once logged in, create your own user account from LXTerminal:
Code:
adduser [b]yourname[/b]
# answer the questions, you can leave it all blank except the password if you want>
echo "[b]yourname[/b] ALL=(root) NOPASSWD: /bin/su" > /etc/sudoers.d/me
The second command will allow you to type "su" to become root whenever you need.
You should then log out and log in to your new account instead.
PREREQUISITES
First off, you'll want to download some tools necessary for building and downloading kernel sources:
bc - a tool needed by the kernel build system
git-core - you'll want git for downloading and maintaining your sources
build-essential - native gcc & tools for building (needed for build commands)
libncurses5-dev - needed to build menuconfig
diffutils - used to compare config changes
colordiff - used by diff to provide colorful human readable diff output
Code:
apt-get install bc git-core build-essential libncurses5-dev diffutils colordiff
PREPARING YOUR ENVIRONMENT
Once you've got that out of the way, you should create an organized environment for working. I like to use ~/build.
Code:
mkdir -p ~/build/toolchain ~/build/kernel
DOWNLOADING & INSTALLING A TOOLCHAIN
You'll want to download a toolchain for kernel building. I recommend using Linaro's optimized ARM64 (aarch64) toolchains.
GCC 4.9: https://releases.linaro.org/components/toolchain/binaries/4.9-2016.02/aarch64-linux-gnu/
GCC 5.X: https://releases.linaro.org/components/toolchain/binaries/latest-5/aarch64-linux-gnu/
The actual file that you want ends in -x86_64_aarch64-linux-gnu.tar.xz (assuming you have a 64-bit Linux install, seriously, 32-bit needs to go! )
We'll use the GCC 5.3.1 2016.5 toolchain in this example.
Let's download and extract it now:
Code:
cd ~/build/toolchain
wget "https://releases.linaro.org/components/toolchain/binaries/latest-5/aarch64-linux-gnu/gcc-linaro-5.3.1-2016.05-x86_64_aarch64-linux-gnu.tar.xz"
tar xf ./*linux-gnu.tar.xz
rm ./*linux-gnu.tar.xz
That's it for installing the toolchain, easy right?
DOWNLOADING THE KERNEL
First, you'll want to create a GitHub account if you don't have one already.
This will allow you to upload your changes and share your kernel with other interested users and developers.
Once you've got your account, and you're logged in, browse to:
https://github.com/jcadduono/android_kernel_google_chromeos
You want to fork the sources to your own account, to do this simply click the [Fork | ] button near the top right of the page:
{
"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"
}
Now you've got your own copy of the Google ChromeOS (dragon / ryu) 3.18 kernel sources on your GitHub!
The next step is to use git to download it to your PC.
Replace "your_username" with your actual GitHub username. Using [email protected] you can avoid being asked for your username each time you push new changes.
Code:
cd ~/build/kernel
git clone https://yo[email protected]/your_username/android_kernel_google_chromeos
cd android_kernel_google_chromeos
The default branch is android-7.1. This is what most users will want. I've added build and menuconfig scripts to assist in building for you.
There may be some additional branches available to choose from.
You can use git log <branch> to view commits, and git cherry-pick <commit id> to copy commits from those branches into yours if you like.
CONFIGURING GIT
Before you start working on your kernel, you will need to set up your git profile.
The user values show up in commit messages to tell people who authored them.
Code:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
git config --global push.default simple
YOUR FIRST COMMIT
We'll want to check out a new branch, and give it your own cool name. I suggest adding a -7.1 suffix to it because you'll probably want to start a new branch for each time a new version of Android releases.
We're going to use "coolname" as our example, so be sure to replace that with what you really want it to be called in the next steps.
Code:
git checkout -B coolname-7.1
Next we'll need to modify the build scripts to fit our setup.
Open build.sh and menuconfig.sh.
You'll want to set the TOOLCHAIN= path in both scripts. If you're following this guide, then it's already correct!
You will also want to set your default target config name.
See the line:
Code:
[ "$TARGET" ] || TARGET=google
You'll want it to look like this:
Code:
[ "$TARGET" ] || TARGET=coolname
Now you want to copy the default Google kernel configuration so you have your own to work with:
Code:
cp arch/arm64/configs/google_dragon_defconfig arch/arm64/configs/coolname_dragon_defconfig
Now you'll have prepared your kernel source for starting work on your own custom kernel!
Let's turn that into a commit, but first look at the changes you've made using:
Code:
git diff
Does that look good? If not, fix what's broken before proceeding.
Next you'll want to add files that will be part of your commit.
For simplicity's sake, let's just add all of the changed files into the commit.
Code:
git add .
Now to make your commit:
Code:
git commit -m "My first commit, setting up my coolname kernel!"
You've done it!
CONFIGURING YOUR KERNEL
We'll use the menuconfig.sh script to launch the kernel menuconfig.
Code:
./menuconfig.sh
Change whatever options you're interested in, but don't change a lot all at once, otherwise when or if you run into issues, you won't know which option caused it.
Once you're done playing in the menuconfig, exit and save.
You'll be shown a colorful difference between your old configuration and your new one.
It will ask you if you want to save it, and you just have to type "y" and press enter for it to be saved.
At this point it's a good idea to make another commit to save your configuration changes.
If you need to edit the commit, you can easily use git commit --amend to fix it up.
BUILDING YOUR NEW KERNEL
Let's take your new config for a test drive.
To build your kernel, simply run:
Code:
./build.sh dragon
Once your kernel is finished building, the resulting files will be located at:
Code:
build/arch/arm64/boot/Image.fit
build/lib/modules/ (if modules are enabled)
INSTALLING YOUR NEW KERNEL
The LazyFlasher project comes to the rescue here. It's the swiss army knife of kernel flashing in TWRP.
To download it (feel free to fork it so you can have a copy on your GitHub to modify instead!):
Code:
cd ~/build
git clone -b kernel-flasher https://github.com/jcadduono/lazyflasher.git
cd lazyflasher
To use LazyFlasher, you'll probably want to take a look at the Makefile, config.sh, and META-INF/com/google/android/update-binary (a shell script).
There's a few things you can change there to personalize it to your needs.
(make another git commit to save your setup!)
Once the installer is set up to your liking, all you have to do to build it is copy the Image.fit from your build output into the lazyflasher folder.
If you have built with kernel modules, copy build/lib/modules -> lazyflasher/modules.
Now simply run:
Code:
make
A TWRP flashable zip and sha1sum is created!
Transfer it to TWRP and flash away, you've just lost your custom kernel development virginity.
Go have a few beers to celebrate, or to drown your sorrows in the case of a boot loop.
UPDATING THE KERNEL SOURCES
Of course my repository will become out of date after a while. In this situation, you want to add a remote that is more updated.
We'll use Google's official Pixel C kernel repository here.
Inside your kernel source directory, run the command:
Code:
git remote add google -t chromeos-3.18 https://chromium.googlesource.com/chromiumos/third_party/kernel
Every time you want to fetch updates from Google's branch, run the command:
Code:
git fetch google --tags
After fetching updates, you have to apply them. You can choose between a rebase strategy or a merge strategy.
In most cases you'll want to use the merge strategy.
The merge strategy will merge Google's updates into your branch.
The rebase strategy will move your work on top of Google's latest instead.
Code:
# the merge strategy (pick one, recommended)
git merge google/chromeos-3.18
# the rebase strategy (will require a force push and rewrite history, not recommended)
git rebase google/chromeos-3.18
JUST WANT TO DISABLE VERITY/ENCRYPTION?
You can build lazyflasher by itself, empty, without a kernel Image.fit or modules and flash it!
It's already set up to automatically disable verity and make encryption optional.
Alternatively, there's a branch already set up called no-verity-opt-encrypt. You can find prebuilt official zips at: https://build.nethunter.com/android-tools/no-verity-opt-encrypt/
It should work on any and all kernels!
PROBLEMS?
Post a reply here and I'll try to find a solution and add it to this post.
RESOURCES
Need a text editor for coding? I use gedit. It's pretty, light, and you can get some decent plugins for it.
It's a minimal editor, so don't expect anything really fancy. Configure it and enable plugins before you decide to trash it.
Code:
apt-get install gedit gedit-plugins
Here's an awesome git starter guide: http://rogerdudler.github.io/git-guide/
Lazy flasher worked great for me, on Linux.
OMFG this is a wonderfu TUT maybe it requires more knowledge than I have but I take a look this weekend (I use and love Ubuntu a lot).
Also I know you from OP 3T forums and your development is amazing, is nice to see good developers and development here.
Thanks!!!
I've followed your instructions, but I'm not finding a dtbgen.sh in the kernel/android_kernel_google_chromeos/ folder. Am I missing something? I have the build.sh and the menuconfig.sh...
michaave said:
I've followed your instructions, but I'm not finding a dtbgen.sh in the kernel/android_kernel_google_chromeos/ folder. Am I missing something? I have the build.sh and the menuconfig.sh...
Click to expand...
Click to collapse
Fixed the guide, I combined it into build.sh for simplicity at some point. It has been some time since the repository was updated, but you should be able to simply add google as a remote and fetch & rebase to be up-to-date. (I think I mentioned this already)
this looks pretty cool! :good:
Q: are the pre-built no-verity zips Pixel-C specific, or can they be used on any device?
... doesnt work for me - the compiled kernel always ends up in a boot loop
hagbardceline23 said:
... doesnt work for me - the compiled kernel always ends up in a boot loop
Click to expand...
Click to collapse
Pls try to use the sources from here ..
https://android.googlesource.com/kernel/tegra/
If you use chromeos 3.18 you need to know what to exclude
https://chromium.googlesource.com/chromiumos/third_party/kernel/+/chromeos-3.18
Its the full 3.18 with changes for all relevant devices.
Have a try with tegra sources and start with dragon_defconfig.
It will boot
Cheers
thanks !!! works like a charm with the tegra sources
I expect that before you start, you have a Linux installation in either a virtual machine or on a physical PC.
Debian Jessie, Kali Linux, Mint, or Ubuntu are excellent choices and what I'm familiar with, so if you get stuck it'll be easier for me to help you if you use these.
Click to expand...
Click to collapse
For what it's worth, I've successfully rebuild the kernel on the Ubuntu Userspace on Windows: https://insights.ubuntu.com/2016/03...-the-ubuntu-userspace-for-windows-developers/
And then flashed it with LazyFlasher.
Thanks for your work!
I have an idea to customize the kernel, but at the moment I can't open the kernel, these are farther away for me, but I want to make it my first device developed.
Panokiaran said:
I have an idea to customize the kernel, but at the moment I can't open the kernel, these are farther away for me, but I want to make it my first device developed.
Click to expand...
Click to collapse
thank you

Categories

Resources