[CAF] Kernel development newbie

Search This thread

errikosd

Senior Member
Mar 24, 2014
619
500
Hello to all. I hope someone can help me.

Background: I am a relatively experienced programmer. I have been programming with C/C++ (and other) in Linux for the last 6 years or so. However I have never dived in Linux Kernel development yet. So I would appreciate some help from anyone that can help me.

Goal: My goal is to learn more about Linux Kernel development. I want to start from my beloved G2, which is approaching its usage EOL. The device is fine, but I am planning on investing on a new one, so I will be able to squeeze it as much as I want.

I want to create a clean kernel for AOSP (CAF) based versions of Android. My vision is to start with a clean CAF base (without CM patches, etc) and bring it up-to-date till Linux 3.4.113 and manage it to boot. Then start backporting code, enhancements, etc. and making tests.

I searched in CAF repositories and I found them to be a mess. Can someone who is experienced with how things work point to the latest clean CAF source for msm8974?

I also want to hear anyone's thoughts on the attempt. Thanks ahead and regards.
 
Last edited:

shaneel1491

Senior Member
Apr 1, 2011
602
236
Hello to all. I hope someone can help me.

Background: I am a relatively experienced programmer. I have been programming with C/C++ (and other) in Linux for the last 6 years or so. However I have never dived in Linux Kernel development yet. So I would appreciate some help from anyone that can help me.

Goal: My goal is to learn more about Linux Kernel development. I want to start from my beloved G2, which is approaching its usage EOL. The device is fine, but I am planning on investing on a new one, so I will be able to squeeze it as much as I want.

I want to create a clean kernel for AOSP (CAF) based versions of Android. My vision is to start with a clean CAF base (without CM patches, etc) and bring it up-to-date till Linux 3.4.113 and manage it to boot. Then start backporting code, enhancements, etc. and making tests.

I searched in CAF repositories and I found them to be a mess. Can someone who is experienced with how things work point to the latest clean CAF source for msm8974?

I also want to hear anyone's thoughts on the attempt. Thanks ahead and regards.

I think the pure branch in GalaticStryder's Github is pure caf kernel, I don't think he added anything.
 
  • Like
Reactions: errikosd

shaneel1491

Senior Member
Apr 1, 2011
602
236
Unfortunately, I think that that branch does not exist anymore. Except if it is now called "marshmallow-caf".

It could be, not sure though.. I did download the source when he had it, I can zip and upload if you need?

Edit: nevermind, I forked his source a while back. Here https://github.com/shack-32/kernel_lge_msm8974/tree/pure
Also when I built it, as well as when he built, the mpdecision seems to be busted on boot, so the cores won't hotplug, you can enable it by looking in /sys directory and echo '1' for the mpdecision file.
 
Last edited:

errikosd

Senior Member
Mar 24, 2014
619
500
It could be, not sure though.. I did download the source when he had it, I can zip and upload if you need?

Edit: nevermind, I forked his source a while back. Here https://github.com/shack-32/kernel_lge_msm8974/tree/pure
Also when I built it, as well as when he built, the mpdecision seems to be busted on boot, so the cores won't hotplug, you can enable it by looking in /sys directory and echo '1' for the mpdecision file.

Thanks a lot! I believe this would be a good start.

I will try and pair it with anykernel packager and enable mpdecision on boot.
 

GalaticStryder

Senior Member
Nov 20, 2014
1,325
4,753
Porto Alegre
Well, I'd first need to explain some other stuff first before you get started

The CAF release for MSM8974 Kernel is oddly one of the no longer maintained ones: LA.BF.1.1.1.x.

To initialize a brand new clean Kernel you'd need to pull the CAF source code and copy the plain LGE Kernel code from the latest release they pushed which is if I'm not mistaken D80230F, then diff it to see what has got replaced and get it back, adapting the code manually on top of the recently merged LGE source code.
This would basically be the first step, then you'd head over to compilation fixes, create the scripts and the tools to bump the image and flash it to see if it boots.
To support more devices you'd need to merge the other variants as well from LGE source code and then do the same as before...

This doesn't make sense since you'd be getting an old Kernel from CAF and yet an older one from LGE. The little updates made on top of the first CyanogenMod 12.1 (CAF Kernel) were very basic and were caught already either by CM itself on their Kernel tree or mine.
Then you'd go forward to merging the kernel-common updates for 3.4.y coming from Google source code and then head over to update the base Linux Kernel version, fix compilation and such...

Since all this is done already, all you'd need is forking the Kernel at 3.4.110 and cherry-pick the selected changes you'd like up to 3.4.113 and compile using my scripts and all that...
The HEAD for that is c8bd789d12f8299db2e5a319abeb4a95df9078b6 and you're set to freely modify it the way you think should be done...

This is the lazy way of course but a great start...
 

errikosd

Senior Member
Mar 24, 2014
619
500
Well, I'd first need to explain some other stuff first before you get started

The CAF release for MSM8974 Kernel is oddly one of the no longer maintained ones: LA.BF.1.1.1.x.

To initialize a brand new clean Kernel you'd need to pull the CAF source code and copy the plain LGE Kernel code from the latest release they pushed which is if I'm not mistaken D80230F, then diff it to see what has got replaced and get it back, adapting the code manually on top of the recently merged LGE source code.
This would basically be the first step, then you'd head over to compilation fixes, create the scripts and the tools to bump the image and flash it to see if it boots.
To support more devices you'd need to merge the other variants as well from LGE source code and then do the same as before...

This doesn't make sense since you'd be getting an old Kernel from CAF and yet an older one from LGE. The little updates made on top of the first CyanogenMod 12.1 (CAF Kernel) were very basic and were caught already either by CM itself on their Kernel tree or mine.
Then you'd go forward to merging the kernel-common updates for 3.4.y coming from Google source code and then head over to update the base Linux Kernel version, fix compilation and such...

Since all this is done already, all you'd need is forking the Kernel at 3.4.110 and cherry-pick the selected changes you'd like up to 3.4.113 and compile using my scripts and all that...
The HEAD for that is c8bd789d12f8299db2e5a319abeb4a95df9078b6 and you're set to freely modify it the way you think should be done...

This is the lazy way of course but a great start...

So that HEAD has to be the cleanest "working" snapshot I can get, right?

Thanks a lot for outlining the procedure and giving me the boost I needed. It will be definitely easier to get started now.
 
Last edited:

matteo0026

Senior Member
Jul 1, 2015
1,595
987
23
Treviso
Lenovo P2
BQ Aquaris X Pro
There's a lot of work for developing kernels! I would like to learn how to do step by step, but i think i have a lot of things that i must learn before starting developing a kernel... As languages i'm learning C, but i don't know other...
 

shaneel1491

Senior Member
Apr 1, 2011
602
236
There's a lot of work for developing kernels! I would like to learn how to do step by step, but i think i have a lot of things that i must learn before starting developing a kernel... As languages i'm learning C, but i don't know other...

Building a kernel is not too hard, adding stuff is a bit tougher. You should start but simply downloading the source of a kernel already found on GitHub. There are various guides on xda that teach you how to build. Once you are comfortable with building you can go on to adding governors and many other tweaks, that's where commits come into play as it makes everything easier to add stuff.

This is a simple tutorial, try look for some more as well http://xdaforums.com/showthread.php?t=2152819
 
  • Like
Reactions: matteo0026

matteo0026

Senior Member
Jul 1, 2015
1,595
987
23
Treviso
Lenovo P2
BQ Aquaris X Pro
Building a kernel is not too hard, adding stuff is a bit tougher. You should start but simply downloading the source of a kernel already found on GitHub. There are various guides on xda that teach you how to build. Once you are comfortable with building you can go on to adding governors and many other tweaks, that's where commits come into play as it makes everything easier to add stuff.

This is a simple tutorial, try look for some more as well http://xdaforums.com/showthread.php?t=2152819

I'm yet blocked on one step of guide... i can't find only one file g2_blablabla.deconfig...
 

shaneel1491

Senior Member
Apr 1, 2011
602
236
I'm yet blocked on one step of guide... i can't find only one file g2_blablabla.deconfig...

It's not actually named blablabla, the defconfig directory is basically the insturctions to build for all the different devices, so it should be g2_d802.defconfig or something along those lines for D802, as long as it has your device name, for example when Dorimanx builds, his file would be (https://github.com/dorimanx/Dorimanx-LG-G2-D802-Kernel/tree/LG-STOCK-KK/arch/arm/configs) -> dorimanx_d802_defconfig

The defconfig file is found in /arch/arm/configs directory
 
  • Like
Reactions: bejunk

matteo0026

Senior Member
Jul 1, 2015
1,595
987
23
Treviso
Lenovo P2
BQ Aquaris X Pro
It's not actually named blablabla, the defconfig directory is basically the insturctions to build for all the different devices, so it should be g2_d802.defconfig or something along those lines for D802, as long as it has your device name, for example when Dorimanx builds, his file would be (https://github.com/dorimanx/Dorimanx-LG-G2-D802-Kernel/tree/LG-STOCK-KK/arch/arm/configs) -> dorimanx_d802_defconfig

The defconfig file is found in /arch/arm/configs directory
Ok, then there isn't nothing of d802_something_deconfig
See this too Screenshot_2016-11-07-19-26-29.png
 

matteo0026

Senior Member
Jul 1, 2015
1,595
987
23
Treviso
Lenovo P2
BQ Aquaris X Pro

shaneel1491

Senior Member
Apr 1, 2011
602
236
Ok, maybe the problem is that i took full stock sources kernel from opensource.lge.com ... Then now i try to do the same thing with lambda sources...

Hmmm, as far as I know you might run into problems building LG provided ROM for an AOSP/CM rom, so if you follow the same process with caf kernel it should work.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 5
    Well, I'd first need to explain some other stuff first before you get started

    The CAF release for MSM8974 Kernel is oddly one of the no longer maintained ones: LA.BF.1.1.1.x.

    To initialize a brand new clean Kernel you'd need to pull the CAF source code and copy the plain LGE Kernel code from the latest release they pushed which is if I'm not mistaken D80230F, then diff it to see what has got replaced and get it back, adapting the code manually on top of the recently merged LGE source code.
    This would basically be the first step, then you'd head over to compilation fixes, create the scripts and the tools to bump the image and flash it to see if it boots.
    To support more devices you'd need to merge the other variants as well from LGE source code and then do the same as before...

    This doesn't make sense since you'd be getting an old Kernel from CAF and yet an older one from LGE. The little updates made on top of the first CyanogenMod 12.1 (CAF Kernel) were very basic and were caught already either by CM itself on their Kernel tree or mine.
    Then you'd go forward to merging the kernel-common updates for 3.4.y coming from Google source code and then head over to update the base Linux Kernel version, fix compilation and such...

    Since all this is done already, all you'd need is forking the Kernel at 3.4.110 and cherry-pick the selected changes you'd like up to 3.4.113 and compile using my scripts and all that...
    The HEAD for that is c8bd789d12f8299db2e5a319abeb4a95df9078b6 and you're set to freely modify it the way you think should be done...

    This is the lazy way of course but a great start...
    1
    Hello to all. I hope someone can help me.

    Background: I am a relatively experienced programmer. I have been programming with C/C++ (and other) in Linux for the last 6 years or so. However I have never dived in Linux Kernel development yet. So I would appreciate some help from anyone that can help me.

    Goal: My goal is to learn more about Linux Kernel development. I want to start from my beloved G2, which is approaching its usage EOL. The device is fine, but I am planning on investing on a new one, so I will be able to squeeze it as much as I want.

    I want to create a clean kernel for AOSP (CAF) based versions of Android. My vision is to start with a clean CAF base (without CM patches, etc) and bring it up-to-date till Linux 3.4.113 and manage it to boot. Then start backporting code, enhancements, etc. and making tests.

    I searched in CAF repositories and I found them to be a mess. Can someone who is experienced with how things work point to the latest clean CAF source for msm8974?

    I also want to hear anyone's thoughts on the attempt. Thanks ahead and regards.

    I think the pure branch in GalaticStryder's Github is pure caf kernel, I don't think he added anything.
    1
    There's a lot of work for developing kernels! I would like to learn how to do step by step, but i think i have a lot of things that i must learn before starting developing a kernel... As languages i'm learning C, but i don't know other...

    Building a kernel is not too hard, adding stuff is a bit tougher. You should start but simply downloading the source of a kernel already found on GitHub. There are various guides on xda that teach you how to build. Once you are comfortable with building you can go on to adding governors and many other tweaks, that's where commits come into play as it makes everything easier to add stuff.

    This is a simple tutorial, try look for some more as well http://xdaforums.com/showthread.php?t=2152819
    1
    I'm yet blocked on one step of guide... i can't find only one file g2_blablabla.deconfig...

    It's not actually named blablabla, the defconfig directory is basically the insturctions to build for all the different devices, so it should be g2_d802.defconfig or something along those lines for D802, as long as it has your device name, for example when Dorimanx builds, his file would be (https://github.com/dorimanx/Dorimanx-LG-G2-D802-Kernel/tree/LG-STOCK-KK/arch/arm/configs) -> dorimanx_d802_defconfig

    The defconfig file is found in /arch/arm/configs directory
    1
    Either, lambda is a modified caf version
    Ok thanks, can i contact you via telegram? This thread was born for another thing from another person... Write me... My username is matteo0026 or via hangouts... You can find my contact on xosp.org site on Manteiners section, I'm Matteo Lima.