[Q] [Need Help] How to edit and compile a kernel - HD2 Android Q&A, Help & Troubleshooting and Genera

Hello
Is there a tutorial on how to compile a kernel ?...
I would like to do some tests of kernel-editing for my extended battery.
For example, if I just want to start from tytungr14 kernel, edit one or two files and compile it.
Thanks for your help.

denseye said:
Hello
Is there a tutorial on how to compile a kernel ?...
I would like to do some tests of kernel-editing for my extended battery.
For example, if I just want to start from tytungr14 kernel, edit one or two files and compile it.
Thanks for your help.
Click to expand...
Click to collapse
Have a look here. Good luck.

shanman-2 said:
Have a look here. Good luck.
Click to expand...
Click to collapse
That is only a tutorial on how to unpack boot.img, not kernel. The boot.img *contains* the kernel and ramdisk, but you cannot directly edit the kernel. Some people have edited the kernel with a hex editor, but that is very hacky and not everything can be edited that way.
To download tytung's kernel source, make a directory, and download the kernel source there.
Code:
git clone >insert link to git repo here<
and if tytung makes any updates/changes to his repo, you can use
Code:
git pull
while cd'd to the directory the kernel is in
I learned how to compile my first kernel by cross referencing these two guides:
http://wiki.cyanogenmod.com/wiki/Building_Kernel_from_source and
http://forums.androidcentral.com/ht...how-build-your-own-kernel-package-source.html
Of course, this is not a complete guide, and I assume you have downloaded the andorid source and all the tools before.

OOPS! :cyclops:
Sorry wrong link, thanks for correcting.
This is the one I meant to post, it seems like a good beginner tut, even though I haven't delved in there myself yet ( have had a read through.)
http://forum.xda-developers.com/showthread.php?t=1748297

Related

[DEV TOOL] EasyDev-v9 - "Roll Your Own" [8-28-11]

This is a continuation of the "Compiling CM6 for Eris" thread - http://forum.xda-developers.com/showthread.php?t=856215. But since Team ADX has really come together on this, we are releasing it in it's new form.
Thanks to workshed for working to get the Eris on the Official CM list and merged into the main repo. And also, thanks to workshed for most of the v6 --> v7 changes to EasyDev!
This script will grab CM7 source and compile a CM7 ROM for you using the official vendor tree that is built-in to the CM source. You have the option of including Google Apps or not.
Uses:
CM source - https://github.com/CyanogenMod/android.git
Conap's CFS kernel that's built-in to CM source - https://github.com/Conap30/htc_kernel_desirec_cfs
Requirements
-------------
1) 64- bit Linux -tested on Debian, Ubuntu 10.04, Linux Mint (if you have a different flavor of linux and easydev worked for you, please let us know so we can update this list)
2) An existing Eris ROM that the script will pull the proprietary files from.
INSTRUCTIONS
1) Download the script
2) 'chmod a+x easydev-v9.sh'
3) copy it to the directory of your choice or leave it where it is
4) copy an existing ROM to the same directory (tested with GSB, but most should work)
5) run it ('sudo ./easydev-v9.sh')
Possilbe future features:
Done.
Changelog
v1 - initial release
v2 - added squisher, made 'make clean' optional, added installation of dependencies, cleaned up output
v3 - uses existing ROM to pull proprietary files, renamed to 'easydev' for case sensitive linux admins
v4 - fixed file missing from list in unzip-files.sh in vendor tree, fixed move/rename of existing ROM, change 'make clean' option to default to no instead of yes
v5 - added 'apt-get update' to refresh repo list (should install dependencies now), swapped order of extract-files and unzip-files to fix 'chmod akmd' issue, tried not to break anything else
v6 - moved questions to beginning of script, added check to only init repo the first time, added check for existing ROM, modded vendor tree to fix compile issues
v7 - removed CM6 stuff, removed kernel compilation code, removed vendor tree code, changed from CM6 to CM7, fixed path bug, added 32-bit libs to dep list
v8 - added ALL official CM devices (mostly untested), minor update to dependency installer code (4-21-11)
v9 - added an extra check for correct Java version, fixed .zip rename issue
Download links:
v7+ --> https://github.com/gnarlyc/EasyDev-Eris
NOTE: If you have issues with google setup or not being able to pass andy the android at the beginning of setup, please delete Provisions.apk for system/app you shouldn't have a problem, but just incase, this will remedy it. -workshed
I'm all over this sh*t
Oh damn, I'm excited for this. good thing I use ubuntu!
Sent from my ERIS using XDA App
this should be fun once i get my new laptop.
Nice! I will be trying this later.
This is awesome! Thanks alot. What does the 'make clean' option do?
Skrip037 said:
This is awesome! Thanks alot. What does the 'make clean' option do?
Click to expand...
Click to collapse
The make clean removes everything that has been compile so far leaving only the original source.
Skrip037 said:
This is awesome! Thanks alot. What does the 'make clean' option do?
Click to expand...
Click to collapse
It removes any previously built ROMs, etc. It's not needed every time, so I've made it optional in the next version. The problem was that sometimes the script would be broken in some way and wouldn't build a ROM. But, there's so much text displayed to the screen, it's not always easy to notice. So, I was actually flashing the same test ROM over and over instead of getting a new build...
Great work guys. Going to try it out on Arch Linux and if anyone's interested I'll give details about how to get it working there (or just modify the script to detect Arch as opposed to Ubuntu and work accordingly.
<gripe>One complaint: commands (including scripts) should *always* start with a lowercase letter </gripe>
good work gnarlyc & conap.
this sounds great and i will be trying this when i get home. I have just one question. Why would i want to run this instead of conap's rom? Both being pure CM. I see alot of the other cm6 roms have stuff themed, but conap's rom doesn't. I'm assuming this is complete pure cm without little tweaks done by devs of the respective roms. Thanks in advance.
ngc604 said:
this sounds great and i will be trying this when i get home. I have just one question. Why would i want to run this instead of conap's rom? Both being pure CM. I see alot of the other cm6 roms have stuff themed, but conap's rom doesn't. I'm assuming this is complete pure cm without little tweaks done by devs of the respective roms. Thanks in advance.
Click to expand...
Click to collapse
Some people just like to "roll their own", more or less. If you like having someone else make improvements and fix issues for you, then you'll probably want to stick with another ROM.
I would love to make my own fixes and tweaks but i dont have the knowledge nor the time to gain said knowledge. guess i will just stick with the devs roms. thanks
Very very exciting. I am installing Ubunto 10.4 now. So does EasyDev-v2 pull from the CM6 nightlies or the stable version and can we change where it pulls from for the CM6 source. This is great.
Will have to check this out later. Always wanted to understand the compile process, always to busy with other software projects. Thanks for building this resource for the rest of us.
morrisdan said:
Very very exciting. I am installing Ubunto 10.4 now. So does EasyDev-v2 pull from the CM6 nightlies or the stable version and can we change where it pulls from for the CM6 source. This is great.
Click to expand...
Click to collapse
Hmmm. Someone correct me if I'm wrong, but I'm pretty sure that this is currently grabbing 'stable'.
Code:
repo init -u git://github.com/CyanogenMod/android.git -b froyo
I'm thinking that to get the nightly, we'll have to change that to:
Code:
repo init -u git://github.com/CyanogenMod/android.git -b master
I'll try it as soon as I can. You got me to thinking that we could add that as an option, if I understand this correctly.
Nightly vs Stable
Yes, you answered my question regarding nightly and stable. I am having fun so far. I got all the necessary packages installed. That was pretty easy using the Ubunto package manager deal. So where do I find the proprietary.zip now? I am almost there to cook this sucker up.
morrisdan said:
Yes, you answered my question regarding nightly and stable. I am having fun so far. I got all the necessary packages installed. That was pretty easy using the Ubunto package manager deal. So where do I find the proprietary.zip now? I am almost there to cook this sucker up.
Click to expand...
Click to collapse
I was apparently wrong about the "-b master" switch, but I think I mostly got it right...
Right now, you'll have to grab the files listed in the OP and zip them up into a file called 'proprietary.zip'. Then place it in the same directory that you run the script from.
I'm working on a way that you can just place an existing ROM there, and it will extract the proprietary files for you. That should be in v3.
Proprietary.zip Files
Can I download CELB Froyo 3.8 and uncompress it and do searches for those files and pull them out and zip them up?
morrisdan said:
Can I download CELB Froyo 3.8 and uncompress it and do searches for those files and pull them out and zip them up?
Click to expand...
Click to collapse
Yes, that should work fine. Here's a list with the paths -
https://github.com/Conap30/android_device_htc_desirec/blob/master/extract-files.sh

[Q] How to get source code and set up Git?

I want to start developing a custom rom(or at least to try).But firstly I don't know how to setup git and python on ubuntu.I read on google that I need that files.And when I set them up,how can I get the source code?If you know,please help.
Thanks in advance.
Edit: We downloaded the cyanogenmod source code successfully with repo.
Another question: Do I need python when I have eclipse?
If you know how, please tell us!
I know you can download source codes at github.com.
That's all I know....
Joost
Get linux and learn to use then get git then use git to get repo then use repo to download sources.
Mark
Pm me where u are at and i will help more in depth with u.
Mark
pashinator said:
Get linux and learn to use then get git then use git to get repo then use repo to download sources.
Mark
Click to expand...
Click to collapse
I know how to use ubuntu.I think I downloaded the kernel yesterday but don't know where it is.
Currently there are no proper manifest for compiling Android 2.2 or 2.3 for LG Swift, those that exist are outdated or deleted by the developers. We need a correct manifest for,lg shift device, vendor, kernel..etc to start building.
fdespotovski said:
I want to start developing a custom rom(or at least to try).But firstly I don't know how to setup git and python on ubuntu.I read on google that I need that files.And when I set them up,how can I get the source code?If you know,please help.
Thanks in advance.
Edit: We downloaded the cyanogenmod source code successfully with repo.
Another question: Do I need python when I have eclipse?
Click to expand...
Click to collapse
Can somebody tell us how to compile the system and kernel for unsupported devices like the lg gt540?
this is from the readme with Quarx rom if that helps
Компиляция:
make -j3 ARCH=arm CROSS_COMPILE=/путь до ndk/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/arm-eabi-
eoghan2t7 said:
this is from the readme with Quarx rom if that helps
Компиляция:
make -j3 ARCH=arm CROSS_COMPILE=/путь до ndk/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/arm-eabi-
Click to expand...
Click to collapse
Thanks for your reply!

[For DEV] Samsung Galaxy S I9070 Advance kernel & platform source code

Hello!
This is a thread where potential developers can get kernel and platform source code for Samsung Galaxy S I9070 Advance, and other info. I will try to update this until we will have first custom rom ready. I encourage everybody with some experience with android development, to share their knowledge with other users here. Please if any of you will make any progress in rooting, making recovery or developing custom rom, to write here in this thread or even start a new one if some major break trough will be made.
Ok so here are the links to sources (I don't know the diference between those to, but I guess it is region related):
GTI9070_GB_OpenSoruce
GTI9070_LA_GB_OpenSoruce
All sources, can be found HERE.
In the attachment you can also find some other info I've pulled from my phone, which used to be rooted, cause I had some test version. I hope all this stuff will help us get root access, custom recovery and last but not least a whole bunch of custom roms.
NOW LETS HACKING AND DEVELOPING BEGIN!!!
One more thing, PLEASE take a minute to VOTE for this phone to get its own forum section here on XDA. Just make a post in THIS THREAD. The device is not in the poll yet, so you must write a post in thread. THANK YOU!
We've made a step into a right direction with a lot of help from forum I've made a working root method!
I've hard bricked my phone, so I am off the developemnt from this phone, only if by some chance I get a replacement. Sorry guys, in spirit of developing I've killed my phone .
I wish I was better at kernel development... I would love some development for this phone!
Sent from my GT-I9070 via Tapatalk 2
I've somehow managed to configure linux and pulled andorid sources from the repo, now I have to figured out how to compile a kernel. I have much to learn but if nobody else will give it a try, maybe I will succeed.
yeah...we as new wannabe devs are learning back the basics...i'm still trying to figure out what to do about the kernel source...afraid of bricking my phone in the process... hehe.. but all the kernel sources for all regions has been released...
kilsmap said:
yeah...we as new wannabe devs are learning back the basics...i'm still trying to figure out what to do about the kernel source...afraid of bricking my phone in the process... hehe.. but all the kernel sources for all regions has been released...
Click to expand...
Click to collapse
Dear friend. I come from China, now I already have a good i9070, I can help you with your test, you can send to my mailbox [email protected]
hmmm...qzem, im getting stuck at initramfs...how do we get these for our phones? because the kernel can only be flashed safely when it is compiled with initramfs files from our phone... and for the phone to get custom recovery, i think they will also need initramfs files...
kilsmap said:
hmmm...qzem, im getting stuck at initramfs...how do we get these for our phones? because the kernel can only be flashed safely when it is compiled with initramfs files from our phone... and for the phone to get custom recovery, i think they will also need initramfs files...
Click to expand...
Click to collapse
Same thing here. I have no idea how to get those, been asking around the forum an searching, but for now all the directions indicates that you need to have root access to get iniramfs. That really sucks...
hahaha...from this point of view, all Samsung phones after Galaxy S Advance will be quite hard to root... I'm waiting for the Galaxy SIII to launch, and for someone to root it... Maybe then we will be able to use the same way to root our phone... If only we can see what's inside our kernel.bin.md5... I'm sure the files we needed are in there...
the initrams? u mean ramdisk?
grab stock boot.img and extract from it.
the stock boot.img can be grabbed from odin flashable stock rom.
an0nym0us_ said:
the initrams? u mean ramdisk?
grab stock boot.img and extract from it.
the stock boot.img can be grabbed from odin flashable stock rom.
Click to expand...
Click to collapse
Yeah.. We have the stock rom, but can't figure out which one should we extract the boot.img from.. There was system.img.md5, cache.img.md5, hidden.img.md5, modem.bin.md5, and kernel.bin.md5... So which one? My suspicion lies to the kernel.bin, but I have no idea how to extract it..
Sent from my GT-I9070 using XDA
I have compiled a stock kernel from source code, so I got zImage file, now I have to find out how to build boot.img from this. I will contiue tommorow I hope I am close to the solution! Mabe few days to crack this baby .
qzem said:
I have compiled a stock kernel from source code, so I got zImage file, now I have to find out how to build boot.img from this. I will contiue tommorow I hope I am close to the solution! Mabe few days to crack this baby .
Click to expand...
Click to collapse
Good luck!
Hope you get to a solution soon
I can't work on it as I currently don't have a phone to test on, sent it in for repairs.
qzem said:
I have compiled a stock kernel from source code, so I got zImage file, now I have to find out how to build boot.img from this. I will contiue tommorow I hope I am close to the solution! Mabe few days to crack this baby .
Click to expand...
Click to collapse
Have u tried flashing it directly to the phone? You don't have to make it into a boot.img to flash it.. Because I'm afraid that the zImage will be useless if not paired with working initramfs.. Compiling the kernel is quite straightforward, the thing is to get the initramfs to turn the kernel insecure.. There are also scripts to extract initramfs from zImage, but I haven't had time to test it..
Sent from my GT-I9070 using XDA
Ok what exactly is in initramfs, that is what I am trying to figured out? I've recompiled some other samsung boot.img with dsixda kitchen, and I got zImage and a folder caled boot.img-ramdisk, which included different files like init, init.goldfish.rc init.rc, default.prop, etc. In a file default prop is the setting ro.secure=0, and this is the settign I belive, that makes kernel insecure. I've also tried to unpack the zImage that I got from thsi boot.img, with the kitchen to see if includes those so called initramfs, but it doesn't. So I think that if I figured out which files should be in ramdisk, and if those files can be pulled of the phone, that than maybe I can repack a working boot.img. What do you think?
qzem said:
Ok what exactly is in initramfs, that is what I am trying to figured out? I've recompiled some other samsung boot.img with dsixda kitchen, and I got zImage and a folder caled boot.img-ramdisk, which included different files like init, init.goldfish.rc init.rc, default.prop, etc. In a file default prop is the setting ro.secure=0, and this is the settign I belive, that makes kernel insecure. I've also tried to unpack the zImage that I got from thsi boot.img, with the kitchen to see if includes those so called initramfs, but it doesn't. So I think that if I figured out which files should be in ramdisk, and if those files can be pulled of the phone, that than maybe I can repack a working boot.img. What do you think?
Click to expand...
Click to collapse
Yep, you got everything right there, I think.. Initramfs, ramdisk are the same thing.. They should include the cpio.gz, init.rc, default.prop etc... Have you extracted these files from the source kernel? Cos I don't think we can copy directly from phone, cos we need to preserve the permissions set on the files... Can you do that with kitchen?
Sent from my GT-I9070 using XDA
I am following the topic and hoping it works out the development of kernels and roms to the device.
Come on it has to be a way to compile an insecure kernel without having the access to rooted phone. Cause all the options I found till now, required some files, that can only bee pull from rooted phone. But the whole point of an insecure kernel is the possibility to root the phone. Anybody can help us? Maybe I should start another thread, damn it!
Haha... Yeah, somehow I feel that Samsung is screwing with us, what with the new firmware format (never had kernel.bin before) and secured kernel, this is becoming impossible.. If we just have some devs good-hearted enough to port CWM recovery for us.. But without initramfs, I don't know if it's possible..
Sent from my GT-I9070 using XDA
The initramfs is inside kernel.bin.md5 (as for the Galaxy S firmware).
kernel.bin.md5 is a normal zImage Linux kernel (+md5).
the initramfs is included in the kernel image (see http://forum.xda-developers.com/wiki/Extract_initramfs_from_zImage)
the initramfs is in our case a uncompressed cpio archive, therefore the script in the wiki does not work, but https://github.com/mistadman/Extract-Kernel-Initramfs/blob/master/unpack-initramfs can extract it without problem.
So, there should be no difficulty to root the i9070...
The easiest way would be to change the initramfs and repack everything.

[Script] Build ICS/JB Kernel

Thanks to the amazing work of mapkel you can now use this script to compile and pack the kernel!
UPDATE: read mapkel's post here: http://forum.xda-developers.com/showpost.php?p=43419784&postcount=45
Thank him here.
This is an informative guide and I decline responsibility for any damage to your device.
Do not attempt to build this kernel if you are going to complain to devs about issues.
That being said, mapkel has made this so that even those with little knowledge can build the kernel without any issues. If you do have any issues, post here and I will try to assist you.
The following is a complete tutorial to building the kernel.
Credits:
Kernel Devs: krystianp, lehjr, Epinter, and mmontuori for making this kernel; without them there is no kernel.
Big thanks to mapkel for this amazing script.
Another big thanks to benouch for the original idea.
A final big thanks to zen25205 for help with building the kernel and getting the Linaro Toolchain.
Kernel Kitchen
I suggest building this with the latest CM9 MROM until the public beta is released.
You need to install Ubuntu 12.04 64bit (Google for instructions)
Prerequisites:
Open a terminal and run the following commands the first time:
Code:
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2
Code:
sudo apt-get install git
If there are any issues with this guide, or if you have any issues building the kernel, post here and I will assist you as best I can.
Stage 1 (start at stage 2 if you have already built the kernel using this script:
Code:
cd ~
Code:
wget https://www.cubby.com/pl/kernel_script.zip/_25f010125b924ec7a42fe1d66245f36a
Code:
unzip ${HOME}/kernel_script.zip -d ${HOME}
Stage 2:
Code:
cd kernel
Code:
./script
There will be 4 choices to make throughout the script:
Clean install y/n (choose "n" on first run of script)
What defconfig? (Usually it is MROM but in the last update it is temporarily MROM2)
Compile CM9 or CM10 kernel? (self explanatory)
Name of config (Any name works. I chose "olympus".)
enjoy)
Built but cam not working
paladin881 said:
Built but cam not working
Click to expand...
Click to collapse
cameras disabled due to battery drain
Click to expand...
Click to collapse
https://github.com/CyanogenMod-Atrix/android_kernel_motorola_olympus/commits/master
Post here if it worked well for you. Give some feedback for mapkel.
No Wifi
Cheers, the script works great on Ubuntu 11.10, without a hic.
However, upon flashing the kernel, I get no wifi. I'm going to try your step by step tutorial...
Edit: I built the kernel using MROM2 defconfig and for CM10, and flashed "someone's" CM10
Newbleeto said:
Cheers, the script works great on Ubuntu 11.10, without a hic.
However, upon flashing the kernel, I get no wifi. I'm going to try your step by step tutorial...
Edit: I built the kernel using MROM2 defconfig and for CM10, and flashed "someone's" CM10
Click to expand...
Click to collapse
Strange..
The modules should copy with this.
Try CM9
atrix4g18 said:
Strange..
The modules should copy with this.
Try CM9
Click to expand...
Click to collapse
I'm updating Ubuntu, maybe the problem is on my end. Will try CM9 in the meanwhile and let you know!
Newbleeto said:
I'm updating Ubuntu, maybe the problem is on my end. Will try CM9 in the meanwhile and let you know!
Click to expand...
Click to collapse
You won't be able to do both.
If you compiled the kernel for CM10 you will only be able to use it on CM10.
Unless you are able to update Ubuntu as you compile the kernel for CM9.
atrix4g18 said:
You won't be able to do both.
If you compiled the kernel for CM10 you will only be able to use it on CM10.
Unless you are able to update Ubuntu as you compile the kernel for CM9.
Click to expand...
Click to collapse
It's impossible to compile while updating, didn't remember that, silly me :silly:
Anyhoot, wifi still doesn't work in Ubuntu 12.04. Fresh install on a different PC, way faster than updating
I'll try CM9 tomorrow, should've been asleep for a while
Can anyone or everyone list sites that work with a direct link.
That means I go to www.sitename/filename.zip and it starts downloading.
All I can think of right now is a cloud storage like Dropbox or Google Drive. I know Dropbox has a traffic limit for public files. Don't know about Google drive
Sent from my MB860 using xda app-developers app
upndwn4par has unlimited bandwidth, iirc. Maybe you can contact him and ask if you can host that one tiny script file there?
Or you could sign up with a free webhost and upload it there. There are several free webhosts with unlimited bandwidth (with a very limited space as trade-off, but I think it's more than enough for the script file).
If it's just a single script, maybe something like pastebin.com or similar might be an option? A little inconvenient since you have to copy and paste content instead of just download, but AFAIK it does have unlimited bandwidth.
atrix4g18 said:
Can anyone or everyone list sites that work with a direct link.
Click to expand...
Click to collapse
Maybe copy.com? Here is my ref for extra 5 GB: https://copy.com?r=qfhUoV
If this does not solve the problem, I can provide space for the script on my own server with a separate FTP account.
priard said:
Maybe copy.com? Here is my ref for extra 5 GB: https://copy.com?r=qfhUoV
If this does not solve the problem, I can provide space for the script on my own server with a separate FTP account.
Click to expand...
Click to collapse
Doesn't have a direct download link.
quetzalcoatl2435 said:
Doesn't have a direct download link.
Click to expand...
Click to collapse
Not quite. You can still download a file, for example using wget.
If You have a short public link, for instance: copy.com/PJzYgAUKECQm, You need to open it and copy the full link. In this case: copy.com/s/PJzYgAUKECQm/BetterBatteryStats_xdaedition_1.13.4.0.apk
then:
wget copy.com/s/PJzYgAUKECQm/BetterBatteryStats_xdaedition_1.13.4.0.apk
and done.
I will look at all the suggestions later today.
Thank you.
Delete

[GUIDE] How to Compile Your Own CM11/CM12/AOSP Kernel

Hi guys, long time no post. I have updated this guide on how to build kernels for Falcon so that anyone can learn! It's pretty simple once you get the hang of it. So yeah, here we go!
Prerequisites:
- You must have a Linux firmware running on your computer (I suggest Builduntu because you can skip the next one [build environment setup])
- Build environment setup (Put the this in terminal and follow instructions)
- Patience and a heart willing to learn
- You need to know the languages C, C++, Java, Ruby, Python... NOT! You don't need to know ANY coding languages.
[MOTIVATIONAL SPEECH]
Truth be told, when I first started out developing, I knew NO coding languages except for HTML and a little bit of Java. Both have nothing to do with kernels! I actually learned how to do this when I suffered from a concussion. So if you really want to learn how to kernel dev and you give up halfway, just know that a 14/15 year old kid could do it..
[/MOTIVATIONAL SPEECH]
Click to expand...
Click to collapse
WARNING: I am not responsible for any damages to your phone or computer or pet unicorn. When you modify the wrong partitions, set too many jobs for your compiler, break your keyboard out of frustration etc., that is not anyone's fault but yours. Or your pet unicorn.
Your Personal Handbook to the Following:
- Anything inside "CODE" boxes, type it into your terminal. If you can't find terminal, then press CTRL, ALT, t.
- If I were you, I would write these by hand instead of copying and pasting it because after a certain amount of times, you will remember the linux commands and it will be easier for you to compile more kernels for different devices
- Use this thread as a "Help Me" button. Ask for help!
Click to expand...
Click to collapse
A New Beginning:
Let's start out with something simple, getting the actual code:
Code:
git clone https://github.com/cyanogenmod/android_kernel_motorola_msm8226
This could range from 3 minutes to 2 hours!
Once that's done, open up your file manager and rename the folder (should be android_kernel_motorola_msm8226) to whatever you want. I will refer it as "mykernel".
Click to expand...
Click to collapse
Pokemon!
For this tutorial, we will be using a Sabermod 4.7 toolchain to compile. I WOULD teach you how to compile with 4.8+, but it creates errors that will take even longer for me to write about sooooooooo :fingers-crossed:. Now to get the toolchain:
Code:
git clone https://github.com/SaberMod/android_prebuilts_gcc_linux-x86_arm_sabermod-arm-eabi-4.7
Rename this to whatever you like, but I will be referring this as "toolchain"
Now go into you folder where the kernel source is stored...
Code:
cd mykernel
Click to expand...
Click to collapse
You're Almost There!:
Time to set-up the compiler!
Code:
export CROSS_COMPILE=/home/(insert linux home name here)/toolchain/bin/arm-eabi-
This tells the toolchain that "OK, we want to make ALL this code here into a kernel".
This next line tells it that your defconfig (the toolchain's manual for compiling the kernel) that it's in the arch/arm/configs folder.
Code:
export ARCH=arm
Now to tell the it what the defconfig is!
Code:
make falcon_defconfig
Hehe, now to the hardest part of all...
MuHAHHAHAHa
Click to expand...
Click to collapse
THE HARD (coding) PART
You ready for this? HERE IT IS! TIME TO BUILD THE KERNEL!
Code:
make -j4
Now sit back, relax, and watch the code! Or you could read a book, watch ****, count your fingers, play with your toes...
If you have an error during the waterfall of code, find the part where it actually says *error* (you'll probably have to scroll upwards) and search it on Google or post it here.
Click to expand...
Click to collapse
THE BEST PART
If you manage to get something that says "the kernel zImage is ready" or something like that, that means you've made it!
You have officially compiled your own kernel from source! Now you need to put it in a flashable zip.
Download this file and open it up, but DON'T EXTRACT IT.
Now go to your kernel source then "CTRL + F" and search for "zimage-dtb".
Find it and put it in the "kernel" folder of "FalconKernel - Signed.zip". Then "CTRL + F" and search ".ko".
Copy radio-iris-transport.ko and put it in the system/lib/modules (not pronto) of the zip.
Then find wlan.ko and rename it to pronto_wlan.ko. Copy and paste it in system/lib/modules/pronto of the zip.
Click to expand...
Click to collapse
Now you can put it on your phone and flash it! ​
I will update this in a bit. What feature would you guys want in your kernel? The most votes in the POLL above will be the one I teach you here!
Here I will walk you through on how to add the intelliplug feature made by @faux123
First, fetch my Green Machine kernel source (go into your kernel folder in terminal):
Code:
git fetch https://github.com/YoshiShaPow/green_machine_falcon
Then you could cherry-pick (basically copy) all my cherry picks for intelliplug from my source.
If you do check my source out, you can see there's a little link to a history of commits near the middle of the screen, right above the files/folders. You can see at this page of my features history, you'll see a bunch of commits for intelliplug. I will use those commits and copy it to your own kernel.
This copies the initial coding/first commit of intelliplug!
Code:
git cherry-pick 01a850f
This cherry-picks the remaining commits so that your newly added intelliplug is updated.
Code:
git cherry-pick 6623f2f^..4e1ece7
One more thing though, you need to add the line to compile intelliplug!
Almost all things compiled along with the zImage are in a file called defconfig. What a defconfig does, is tell your machine to build certain modules, kernel objects, drivers, governors, etc.etc.etc.. Now, all of them are found in the folder
arch/arm/configs
Click to expand...
Click to collapse
As stated in the OP, you have to modify the defconfig you use. (CM11 Kernel is falcon_defconfig, Gummy Kernel is msm8226_mmi_defconfig). Open up the corresponding defconfig and add this to ANY line anywhere.
Code:
CONFIG_INTELLI_PLUG=m
Now, for those who are familiar with "y=yes/n=no/m=maybe", you'll see that I specifically told you to put the "m=maybe" one. That's because when you compile the kernel again, right after you're about to start your build. Since you put that "m", the terminal will prompt you with a "y=yes/n=no" question on whether or not you would like to add the following feature. Since you would like to add the feature, put in "y". Later on when you feel more comfortable with adding features to your kernel, you can go back into the defconfig and put it as
Code:
CONFIG_INTELLI_PLUG=y
So that it will compile it without asking, since you have given it an answer.
Now you have officially compiled a "Custom Kernel" and with the knowledge you know, you could create a feature packed one by just kanging (copying one's work/features).
Always remember to
Code:
make clean && make mrproper
after every build to prevent errors and such!
Click to expand...
Click to collapse
I will use this to teach you how to make your own Bash Building scripts (and save time) to make it easier for your development life to flourish... eventually....
Any guide on adding governors or hotplug driver??
Sent from my Moto G using XDA Free mobile app
Best guide but how to add features likes s2w,dt2w etc
Flashhhh said:
Any guide on adding governors or hotplug driver??
Sent from my Moto G using XDA Free mobile app
Click to expand...
Click to collapse
Vote in the poll above! I will make a guide for one or more of the top chosen picks!
Brawn_Sg said:
Best guide but how to add features likes s2w,dt2w etc
Click to expand...
Click to collapse
DT2W and S2W are more complex. They require a few other things (ex. Powersuspend). I'll wait a bit and see what feedback I get before moving forward to something a bit more complex like DT2W, or GPU Overclock.
Can i use make menuconfig?
Krizthian said:
Can i use make menuconfig?
Click to expand...
Click to collapse
Yes you can. Normally when using "make menuconfig", you use the command after making the kernel's defconfig (falcon_defconfig).
Build using Docker
If you're on Linux, take a look at this approach which uses Docker for building CyanogenMod 12.0:
http://forum.xda-developers.com/showthread.php?t=2650345
(Disclaimer: It's written by me)
YoshiShaPow said:
Hi guys, long time no post. I have updated this guide on how to build kernels for Falcon so that anyone can learn! It's pretty simple once you get the hang of it. So yeah, here we go!
WARNING: I am not responsible for any damages to your phone or computer or pet unicorn. When you modify the wrong partitions, set too many jobs for your compiler, break your keyboard out of frustration etc., that is not anyone's fault but yours. Or your pet unicorn.
Now you can put it on your phone and flash it! ​
Click to expand...
Click to collapse
when i was trying to flash cm12 rom in cwm recovery it says error in zip and getting status 1 error , installation aborted ,
pls help im using moto g gpe and when trying to flash from twrp it says error executing updater binary in zip ,
no idea what to do pls help me out
karthik432 said:
when i was trying to flash cm12 rom in cwm recovery it says error in zip and getting status 1 error , installation aborted ,
pls help im using moto g gpe and when trying to flash from twrp it says error executing updater binary in zip ,
no idea what to do pls help me out
Click to expand...
Click to collapse
When you downloaded the anykernel zip, you aren't supposed to extract it. The best way to put the kernel in the zip is to just drag and drop it while IN LINUX. It will not work for windows! Or you could try signing the zip in TWRP (I think there's an option for that somewhere).
YoshiShaPow said:
When you downloaded the anykernel zip, you aren't supposed to extract it. The best way to put the kernel in the zip is to just drag and drop it while IN LINUX. It will not work for windows! Or you could try signing the zip in TWRP (I think there's an option for that somewhere).
Click to expand...
Click to collapse
im not extracting anything , i just downloaded the official cm12 nightly and flashed but didn't workout ,any ideas
karthik432 said:
im not extracting anything , i just downloaded the official cm12 nightly and flashed but didn't workout ,any ideas
Click to expand...
Click to collapse
That has nothing to do with this thread :silly:. You probably have to sign the zip again.
@YoshiShaPow.... i need some help
i compile a kernel for my device and it booted fine but no display....
can you help me in this....
sorry for posting here..my device is Redmi 1s
Luffy.d said:
@YoshiShaPow.... i need some help
i compile a kernel for my device and it booted fine but no display....
can you help me in this....
sorry for posting here..my device is Redmi 1s
Click to expand...
Click to collapse
No problem, I welcome anyone with kernel development questions here! When booted, what do you mean? And if there's no display, how do you know it booted? Also, did you use my anykernel zip? I may be wrong but I don't think it is compatible with all phones.
YoshiShaPow said:
No problem, I welcome anyone with kernel development questions here! When booted, what do you mean? And if there's no display, how do you know it booted? Also, did you use my anykernel zip? I may be wrong but I don't think it is compatible with all phones.
Click to expand...
Click to collapse
yeah it booted bro....i can hear lock unlock sound and even i can hear incoming call ring
i was trying to fix this from a week and found out it not kernel it rom problem ...
my device is build using prebuilt kernel so any compile kernel wont work...but now they are build with this kernel source so compile kernel work
thanks bro...
and one thing bro... i m new to kernel development so how can i optimize kernel
i know about and can add governors and use custom toolchain but i don't know about o2 or o3 optimization etc and all
sorry if i m being too much
great I start today
Luffy.d said:
yeah it booted bro....i can hear lock unlock sound and even i can hear incoming call ring
i was trying to fix this from a week and found out it not kernel it rom problem ...
my device is build using prebuilt kernel so any compile kernel wont work...but now they are build with this kernel source so compile kernel work
thanks bro...
and one thing bro... i m new to kernel development so how can i optimize kernel
i know about and can add governors and use custom toolchain but i don't know about o2 or o3 optimization etc and all
sorry if i m being too much
Click to expand...
Click to collapse
Those changes are a bit more advanced because it will bring build errors. The kernel is already preoptimized with o2 changes. The errors are fixable though. I don't think I'll be able to add an explanation for those in this thread, maybe through pm?
YoshiShaPow said:
Those changes are a bit more advanced because it will bring build errors. The kernel is already preoptimized with o2 changes. The errors are fixable though. I don't think I'll be able to add an explanation for those in this thread, maybe through pm?
Click to expand...
Click to collapse
thanks bro...will pm you when i finish setuping my git
etvtaglios said:
great I start today
Click to expand...
Click to collapse
Go for it bro!!

Categories

Resources