[HOW TO] Compile and Deploy a Kernel

doomboss

Senior Member
Jan 17, 2013
252
47
Once you guys get good at kernel building, you might want to try your hand at toolchain building, this is very hard, consider building a kernel a warm up.

to get info about your kernel, including the toolchain used to build the kernel.

adb shell

cat /proc/version

My current kernel displays.

root@android:/ # cat /proc/version
Linux version 3.1.10 (vampirefo@vampirefo-GA-MA78GM-US2H) (gcc version 4.7.3 20130102 (prerelease) (crosstool-NG hg+default-20f2459b97bf) ) #1 SMP PREEMPT Sun Feb 3 13:00:51 EST 2013

This is way more advanced than my knowledge about kernel... But it seems like you are using the Linaro Toolchain right? That is what i know so far, and i don't even know anything about the toolchain building :( I still have a lot to learn :D
 

vampirefo.

Senior Member
Developer
Nov 8, 2011
3,836
1,394
This is way more advanced than my knowledge about kernel... But it seems like you are using the Linaro Toolchain right? That is what i know so far, and i don't even know anything about the toolchain building :( I still have a lot to learn :D

Yes I am using Linaro Toolchain, You are doing fine, no need to rush, it's more important to learn what you are doing, then just doing it.
 

doomboss

Senior Member
Jan 17, 2013
252
47
I kind of get how to use Linaro ToolChain to complie the kernel, and i am still messing about with the kernel right now :D :D But i have a question: in order to modify cpu frequency or governor, i need to open up the code file from the kernel that i complied right? So for example, i see a bunch of file (I believe it is c code?) on my kernel folder, and there is a file name cpu.c. Do i just need to modify the code if i want to change the frequency? Sorry if this is confusing, and please point me at the right direction if i am totally going to the wrong side :) :p :D B)

It would be awesome if the code is actually written in C or C++, so that I can practice my programming skills hehe :cool::p
 
Last edited:

FloRider

Senior Member
Dec 2, 2012
358
111
I kind of get how to use Linaro ToolChain to complie the kernel, and i am still messing about with the kernel right now :D :D But i have a question: in order to modify cpu frequency or governor, i need to open up the code file from the kernel that i complied right? So for example, i see a bunch of file (I believe it is c code?) on my kernel folder, and there is a file name cpu.c. Do i just need to modify the code if i want to change the frequency? Sorry if this is confusing, and please point me at the right direction if i am totally going to the wrong side :) :p :D B)

It would be awesome if the code is actually written in C or C++, so that I can practice my programming skills hehe :cool::p

You've got the source. It's written in C. Don't bother with trying to write overclocking into the kernel unless you want to try integrating someone else's code into the A2109 code. It's not simple. Governors are a different matter. Those you can cut & paste in. That'd be a good place to start.

Sent from my IdeaTabA2109A using Tapatalk HD
 

doomboss

Senior Member
Jan 17, 2013
252
47
You've got the source. It's written in C. Don't bother with trying to write overclocking into the kernel unless you want to try integrating someone else's code into the A2109 code. It's not simple. Governors are a different matter. Those you can cut & paste in. That'd be a good place to start.

Sent from my IdeaTabA2109A using Tapatalk HD

Alright, time to apply what i learn at school to the kernel :D i will try to add more Governors on the kernel first before integrate other overclock code into the A2109 :) I am re-installing my Ubuntu right now since the system randomly freeze sometime and it is really making me mad... I was reading the code and then suddenly i couldn't move my mouse and everything was frozen :mad:
 

doomboss

Senior Member
Jan 17, 2013
252
47
Oh one more question: If i want to copy the Governor code from Nexus 7 kernel, how do i view the code??
 

FloRider

Senior Member
Dec 2, 2012
358
111
Oh one more question: If i want to copy the Governor code from Nexus 7 kernel, how do i view the code??

Open it in your editor of choice. I like Eclipse for C/C++. Oh, you're going to have to download the git repo and checkout the branch you want. I think XDA U has some good info on using git.

Sent from my HTC DNA using Tapatalk 2.
 

doomboss

Senior Member
Jan 17, 2013
252
47
Open it in your editor of choice. I like Eclipse for C/C++. Oh, you're going to have to download the git repo and checkout the branch you want. I think XDA U has some good info on using git.

Sent from my HTC DNA using Tapatalk 2.

I guess i need the kernel source for Nexus 7. Let me try to figure out what is git repo :D Thanks for your patience :)

Wait, actually i am confused now, I was going to ask where can i find those code. I downloaded a custom kernel on the Nexus 7 forum on XDA, but I don't know where i should start to look for those code since it is a zip file. I opened it and just don't know where those file is. Can you tell me which file i should look at? :) :)
 
Last edited:

FloRider

Senior Member
Dec 2, 2012
358
111
I guess i need the kernel source for Nexus 7. Let me try to figure out what is git repo :D Thanks for your patience :)

Wait, actually i am confused now, I was going to ask where can i find those code. I downloaded a custom kernel on the Nexus 7 forum on XDA, but I don't know where i should start to look for those code since it is a zip file. I opened it and just don't know where those file is. Can you tell me which file i should look at? :) :)
There will be a link on the page to the source. They have to publish it as part of the GPL. See this page as an example: [KERNEL][GPL][N7][30 JAN] franco.Kernel - r42 - xda-developers
 

doomboss

Senior Member
Jan 17, 2013
252
47
What you want is the Nexus 7 kernel source and a custom kernel. Run a file diff to see what they changed and why. Here's the Nexus 7 stock kernel: https://android.googlesource.com/device/asus/grouper/.
PS Eclipse is a good editor for this purpose.

Ok thank you! I will try to mess around with the kernel again during weekend :D :D :D
Oh i realized sometimes i ask some question but it is just me didn't see the answer on your post. So just say it in advance that if i ask something that you already answered before, then please don't mind :) :) :p
I will try to use the Eclipse. Alright thanks again :D
 

doomboss

Senior Member
Jan 17, 2013
252
47
Just a quick question: Does anyone use kernel-tool for the kernel development or modify?

Also, i think i have a clue of where the CPU frequency is. It is on the drivers folder of the source right?
 
Last edited:

vampirefo.

Senior Member
Developer
Nov 8, 2011
3,836
1,394
Just a quick question: Does anyone use kernel-tool for the kernel development or modify?

Also, i think i have a clue of where the CPU frequency is. It is on the drivers folder of the source right?

Never heard of kernel-tool, so I am pretty sure I don't use it.
 
Top