M Kernel reference (3.10.92, Interactive, Wireless branches) - Nexus 6 Developer Discussion [Developers Only]

Hi.
Just sharing this for reference for them who wants to:
- Build a linux mainline up-to-date kernel (3.10.y). Builds fine with some reverts and no other kernel commits. Updated straight on M kernel (3.10.40). (branch 'mainline'). Easy to maintain and update yourself when linux mainline is updated.
- Build with interactive governor from 3.18 kernel. (branch 'interactive')
- Build with an up to date wireless driver from: https://android.googlesource.com/kernel/common/+log/bcmdhd-3.10. (branch 'wireless')
All three sorted in respective branches at https://github.com/PerLycke/kernel_moto_shamu
And all of those branches are independent, all applied on pure M (r26) source, so merge away!
Master branch is the branch I'm using personally, so that's not a reference. Or sort off. If you like what I like (very stockish).
Cheers
pemell

@pemell
This is great! Thanks for sharing your work! I too tried to merge all the way to .96 and ended up with no sound lol. Regardless, I will be working on basing my new Shamu kernel off of your work. It looks great! Thanks again!

Related

[Dev][Kernel][2.04] Stock source + Linux upstream commits

I've seen at least 5 people now apply patches to the kernel source code to bring it up to a more recent version. To save the 6th and subsequent person from doing so, I pushed up a "clean" version of the stock (1.15, of course) kernel source code after merging in all linux mainline commits. FYI, to do so and preserve the history, I do:
git merge --strategy=ours v3.4.10
git merge v3.4.11
..
and resolve the conflicts as I go. There is a readme that explains (without having tested the procedure, so let me know if it needs to be tweaked) how to use to to patch an existing kernel source. This also serves as a good base if you want to start building a completely new kernel or if you want to compare your conflict resolutions to my conflict resolutions.
I plan to continue to update this with upstream patches as they are released as I will be using this to do my own merging of upstream commits.
The source is at http://github.com/crpalmer/dna-kernel-plus-upstream.
The branch "stock" contains the HTC released source code and also includes a commit that restores many of the comments that HTC stripped out of the source code when they released the 2.04 release. This should be much easier to merge with existing commits and make a more easily patched base of a kernel than what HTC released.
crpalmer said:
I've seen at least 5 people now apply patches to the kernel source code to bring it up to a more recent version. To save the 6th and subsequent person from doing so, I pushed up a "clean" version of the stock (1.15, of course) kernel source code after merging in all linux mainline commits. FYI, to do so and preserve the history, I do:
git merge --strategy=ours v3.4.10
git merge v3.4.11
..
and resolve the conflicts as I go. There is a readme that explains (without having tested the procedure, so let me know if it needs to be tweaked) how to use to to patch an existing kernel source. This also serves as a good base if you want to start building a completely new kernel or if you want to compare your conflict resolutions to my conflict resolutions.
I plan to continue to update this with upstream patches as they are released as I will be using this to do my own merging of upstream commits.
The source is at http://github.com/crpalmer/dna-kernel-plus-upstream.
Click to expand...
Click to collapse
this is awesome man thanks
Re: [Dev][Kernel][3.4.38] Stock source + Linux upstream commits
Sweet. Thanks man.
Sent from my HTC Droid DNA
Merged in the 2.04 source drop.
The branch "stock" contains the HTC released source code and also includes a commit that restores many of the comments that HTC stripped out of the source code when they released the 2.04 release. This should be much easier to merge with existing commits and make a more easily patched base of a kernel than what HTC released.
If you've already done your own merge (zarboz), you may want to try cherrypicking this commit:
https://github.com/crpalmer/dna-kernel-plus-upstream/commit/c81741a8337c2342d856ffeac0cc087452729290
Excellent Thanks for this, it's very handy
crpalmer said:
Merged in the 2.04 source drop.
The branch "stock" contains the HTC released source code and also includes a commit that restores many of the comments that HTC stripped out of the source code when they released the 2.04 release. This should be much easier to merge with existing commits and make a more easily patched base of a kernel than what HTC released.
If you've already done your own merge (zarboz), you may want to try cherrypicking this commit:
https://github.com/crpalmer/dna-kernel-plus-upstream/commit/c81741a8337c2342d856ffeac0cc087452729290
Click to expand...
Click to collapse
I looked through all my rej files and they were all comments I personally didn't care about lol
Thanks for the update though

[EOL][KERNEL][UNOFFICIAL BUILDS] Boeffla Kernel Linaro/Uber

hi Guys,
as some of u maybe know from the Samsung Galaxy S3 area i'm doing a "build-service" for non official boeffla kernel builds and as we recently also got a boeffla kernel for the One Plus One device (kudos to @Lord Boeffla!) i want to share with u my self made Linaro (and here also Uber!) builds for that device in addition.
i'm gonna reduce redundancy and keep it shorter this time as about how this started and my primary intention can also be taken from the corresponding Samsung Thread
for people who asks themself: Linaro, Sabermod, Uber what? here some good info about it: https://docs.google.com/document/d/1C-ehLWl6XcStOmB30QHDA_DOdceXiGIyzXT_0eIg5nQ/edit (thx to @ViditM14 for providing the link!) and finally more infos about Uber Toolchains : https://plus.google.com/+ChetKener/posts/YzMJEkzPQgp and here: https://plus.google.com/communities...3/stream/ac70dec1-dad7-438d-baeb-f8d6644217fd
so without further ado let's go:
First of all the obligatorily Disclaimer:
As also written in the title please note these builds are UNOFFICIAL, are NOT SUPPORTED in any way by Lord Boeffla or myself and might be EVEN UNSTABLE! So take them as they are! As always flash them at your own risk and make a backup before flashing! (yeah take this advice seriously!)
About bugs: Before you report ANY issues with the linaro/uber builds provided here (doesn't matter which one!) FIRST TRY the non-linaro/uber official builds from HERE to see if they will be gone then. if they wont, you can go on and report your problems in the official boeffla kernel thread! I hope you understand that we have to treat and keep these builds here completely separate from official ones as they have in no terms something to do with each other! Not respecting this will force me to stop building further linaro/uber builds of boeffla kernel.
About benchmarks and comparisons between toolchains: It's common known that linaro (maybe also uber?) builds might give us higher benchmark rates and that seems great for some people (in fact it's pointless per se in my opinion ) so please if you really must, post them ONLY here and NOT in official boeffla kernel thread, thanks!
Now some more precise informations about what's going on here:
what i did:
the images are always build with original sources from official boeffla kernel OPO repositories from HERE
with some not worth to mention minor changes to be able to build it on my build environment with non stock toolchains.
all images are compiled from special branches from this forked Boeffla Kernel repository
with Toolchain Linaro 4.8.4-2014.11 + Toolchain Linaro 4.9.3-2015.03 - Credits to @Christopher83 for this pre-configured toolchains and Toolchain Sabermod 4.8.4 + Toolchain Sabermod (Uber) 4.9.3 - Credits to RobbieL811 for this preconfigured toolchains and thx to @ak for pointing me to it! Since 27.03.15 there are also images compiled with Toolchain Uber 4.9.3 20150501 + Toolchain Uber 5.1.1 20150501 + 6.0.0 20150501 (experimental) Credits and Thx to Uber Team!
all images are build with changes from following repos
for Boeffla Kernel CM13.0/CM12.1/CM12/CM11/CM11s/CM12s/COS12.1 Linaro/Uber :
https://github.com/zanezam/boeffla-kernel-cm-bacon
for Boeffla Kernel Oxygen OS 1.0.x Linaro/Uber :
https://github.com/zanezam/boeffla-kernel-oos-bacon
Beside of some additional fixes from my side all changes are mixed up and taken from repositories of ak
and DerRomtester so all credits to them!
...and also for letting me bother them! thank u guys for bring me "on track"!
before someone asks some last words about the used toolchain versions: i did a lot of testing before releasing these builds here
and the used Linaro / Uber versions are the maximum versions which can be used to make working builds with pure boeffla
kernel sources and without changing a lot of code in addition. So if u still want to try higher versions i must state here that Linaro versions
above 4.8 might produce a "messed up" image (without optimized flags and without warnings/errors etc. during build!)
which at the end gives you a boot-looping device and that might even be dangerous, so be aware !! if someone has a clue what exactly has to be
done to use higher versions of the corresponding toolchains (with respecting the original kernel source of course) feel free to let us know,
it will be definitely appreciated!
Update 15.03.15: found one reason and i'm able to use some higher versions now!
But with CM11s and CM11 only Uber 4.9.3 and Linaro 4.8.4 are possible!
builds with higher Linaro/Uber toolchain versions still doesn't boot!
what i will do:
build the source code with linaro/uber toolchain and (like Lord Boeffla usually does) provide a CWM image of recent boeffla kernel versions.
do a test for about 1 day with this builds and if they work without any big issues, add them here in the thread.
i will try to keep the linaro/uber toolchain as up-to-date as possible till the need of bigger code change will be reached.
not providing versions that are not released by Lord Boeffla yet.
not providing an image if it is not working - well of course not *g* but it will be marked as "canceled" then for info.
not change the source code to add/remove features or fix boeffla kernel related bugs.
not support the whole stuff here.
what i will maybe do (sooner or later):
provide ZZMoove Governor test builds if there are any new versions to test - more infos and discussions about ZZMoove Governor can be found HERE
maybe tune the build flags if some more linaro/uber experienced dev comes up with "better" ones (feel free to post and let me know, toolchain specialists! *g*)
Downloads:
CM11s (for stock roms!)
One Plus One Bacon CM11s stock builds
(for CM11s XNPH38R/44S/05Q *l484* linaro / *u493* uber)
CM12s (for stock roms!)
One Plus One Bacon CM12s stock builds
(for CM12s YNG1TAS0YL+YNG1TAS17L+YNG1TAS2I3 *l494* linaro / *u494* + *u521* + *u600* uber)
CM12.1s (for stock roms!)
One Plus One Bacon CM12.1s stock builds
(for CM12.1s YOG4PAS1N0 *l494* linaro / *u494* + *u521* + *u600* uber)
COS13.0 (for stock roms!)
One Plus One Bacon COS13.0 stock builds
(for COS13.0 ZNH0EAS2JK *l494* + *l531* linaro / *u494* + *u531* + *u600* + *u700* uber)
COS13.1 (for stock roms!)
One Plus One Bacon COS13.1 stock builds
(for COS13.1 ZNH2KAS1KN *l494* + *l531* linaro / *u494* + *u531* + *u600* + *u700* uber)
CM11 (for genuine roms!)
One Plus One Bacon CM11 builds
(for CM11 roms only! *l484* linaro / *u493* uber)
CM12 (offical nightlies and based ones)
One Plus One Bacon CM12 builds
(for CM12 roms only! *l493* linaro / *u493* + *u511* + *u600* uber)
CM12.1 (official builds and based ones)
One Plus One Bacon CM12.1 builds
(for CM12.1 roms only! *l494* linaro / *u494* + *u521* + *u600* uber)
Oxygen OS 1.x.x
One Plus One Bacon Oxygen OS 1.x.x builds
(*l494* linaro / *u494* + *u521* + *u600* uber)
Oxygen OS 2.x.x
One Plus One Bacon Oxygen OS 2.xx builds
(*l494* + *l531* linaro / *u494* + *u531* + *u600* uber)
CM13.0 (official builds and based ones) + Nethunter and "Cafcam" special builds
One Plus One Bacon CM13.0 builds
(for CM13.0 roms only! *l494* + *l531* linaro / *u494* + *u531* + *u600* + *u700* uber)
CM14.1 (official builds and based ones) + Nethunter special builds
One Plus One Bacon CM14.1 / LineageOS 14.1 builds
(for CM14.1 roms only! *l494* + *l531* linaro / *u494* + *u531* + *u600* + *u700* uber)
Mirror on Androidfilehost for all devices (only latest kernel versions)
Nethunter Install Packs:
For One Plus One Bacon Marshmallow Roms
finally i wanna throw out big thanks to Lord Boeffla for his great work and for accepting that i provide you these linaro/uber builds here! :highfive:
so now i wish u much fun with these builds and maybe some of u can drop a line about how they work for u
reserved
this one too
Welcome, will test the versions. I tried Ak with linaro. It's ready fast.
Sent from my A0001 using Tapatalk
---------- Post added at 11:40 PM ---------- Previous post was at 11:00 PM ----------
Test now the sabemod version, It's fast. Apps open very quick. Scrolling is Smooth en benchmarks are great 47350 point on antutu. Tomorrow I will test more. Thanks ZaneZam.
Sent from my A0001 using Tapatalk
I'd be interested to see what gains/ if any can be made with another toolchain, but I'm holding out on a CM version..
Sent from my One A0001 using XDA Premium 4 mobile app
yeah that's the question on this device the differences are hard to see but well not every system is the same and maybe "something" works significant better.
i had the impression the builds are a bit more "fluid" then stock and sabermod a bit more "fluid" then linaro but well atm with 2 tired eyes will have to look closer tomorrow
and yes i will add CM11 builds after Lord Boeffla releases im also curious about that CM11s-CM11 differences
ZaneZam said:
yeah that's the question on this device the differences are hard to see but well not every system is the same and maybe "something" works significant better.
i had the impression the builds are a bit more "fluid" then stock and sabermod a bit more "fluid" then linaro but well atm with 2 tired eyes will have to look closer tomorrow
and yes i will add CM11 builds after Lord Boeffla releases im also curious about that CM11s-CM11 differences
Click to expand...
Click to collapse
He has test builds up, I'm running it now.. It IS speed, it IS fluidity.. Its also stable, no worries.. If a new tool chain could make this any better, I'd be such a happy camper.. All in its own time.. Rest up, I'm here to test when you have time to build..
Sent from my One A0001 using XDA Premium 4 mobile app
Setting.Out said:
He has test builds up, I'm running it now.. It IS speed, it IS fluidity.. Its also stable, no worries.. If a new tool chain could make this any better, I'd be such a happy camper.. All in its own time.. Rest up, I'm here to test when you have time to build..
Sent from my One A0001 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
Which one are you currently running? Also to anyone out there, what's the main differences between linaro and sabormod? Thanks.
ZaneZam said:
yeah that's the question on this device the differences are hard to see but well not every system is the same and maybe "something" works significant better.
i had the impression the builds are a bit more "fluid" then stock and sabermod a bit more "fluid" then linaro but well atm with 2 tired eyes will have to look closer tomorrow
and yes i will add CM11 builds after Lord Boeffla releases im also curious about that CM11s-CM11 differences
Click to expand...
Click to collapse
I'm sure he would link you to where he has builds already would love to see the difference having ran lord boeffla kernel for a while the cm11 version much alohas
Sent from my One A0001 using Tapatalk
My Phone reboot, after I overclock the Phone. It doesn't matter but Ak kernel is stable at 2.88
Sent from my A0001 using Tapatalk
ZaneZam version that you recommend? Linaro or Sabermod... Sorry my english but I'm using a translator ...
otisman said:
I'm sure he would link you to where he has builds already would love to see the difference having ran lord boeffla kernel for a while the cm11 version much alohas
Sent from my One A0001 using Tapatalk
Click to expand...
Click to collapse
actually I have access to Lord boefflas "other" reposities so I even could make a build but it's not official yet so I won't
mdv53 said:
My Phone reboot, after I overclock the Phone. It doesn't matter but Ak kernel is stable at 2.88
Sent from my A0001 using Tapatalk
Click to expand...
Click to collapse
Ah oc, well I had problems too (on every build also official stock and with pvs value of 5)
They are gone after using +50mv (+25mv is the actual standard) on all oc freq or at least on 2.88. So maybe that helps?
NeGriTa79 said:
ZaneZam version that you recommend? Linaro or Sabermod... Sorry my english but I'm using a translator ...
Click to expand...
Click to collapse
I cannot give any recommendations atm because the builds are too "fresh" had only about 1 day with each of them and also did rebuilds/reboots during that time. So I'm testing like u haven't found "mine" yet.
Any consideration for F2FS compatibility in future ?
Sent from my A0001 using Tapatalk
I'm afraid not from my side as stated in op I will make no changes to the source code except toolchain related ones, so it stays a pure boeffla. If Lord boeffla considers to add it it will also be in these builds here but I think he has already made his point clear about f2fs and not adding it. it's a benefits/problems question I guess.
suaverc118 said:
Which one are you currently running? Also to anyone out there, what's the main differences between linaro and sabormod? Thanks.
Click to expand...
Click to collapse
about the toolchain difference: well honesty i dunno exactly sabermod toolchain was made for the Sabermod AOSP rom and has AOSP related patches included
but i think the biggest difference between the used toolchains HERE is the difference in gcc version per se 4.7 and 4.8 but someone with more experience/knowledge can surely "spend more light" only thing i know for sure is that these versions are working
ZaneZam said:
actually I have access to Lord boefflas "other" reposities so I even could make a build but it's not official yet so I won't
Ah oc, well I had problems too (on every build also official stock and with pvs value of 5)
They are gone after using +50mv (+25mv is the actual standard) on all oc freq or at least on 2.88. So maybe that helps?
Click to expand...
Click to collapse
+25 did the trick. Thanks, sabemod kernel works great.
Sent from my A0001 using Tapatalk
@ZaneZam
finally your thread is born .... i'm here for eventually help ...
thanks a lot for your hard work. :good:
I have to thank, mate! Because of your work/help I was able to start this and thx good to know that u have an eye on
Very good kernel. With my personal config and ZZMoove governor OPO is very smooth with good battery performance.
Regards !

[KERNEL][UBERTC 4.9.3][Blu_active] Crystal Kernel [03/04/15]

Features:
Based on Chroma Kernel (special credit for TomorrowLand_Ace work)
Blu_active Default Governor
Blu_plug - CPU Hotplug (removed Franco hotplug)
FIOPS I/O Scheduler
Enabled Overclocking CPU & GPU
Undervolted GPU
Build on Ubuntu 14.10
Kernel is secure
Compiled with lastest UBERTC 4.9.3, -O3 flags (GPU included), Graphite, hardfloat, and many other otimizations
FauxSound
PowerSuspend Driver
MSM Sleeper
Battery Life eXtender
LCD KCAL (Last version from @savoca, can't be tuned from any kernel manager for now)
Init.d Support
USB OTG
LZ4 (for a faster boot)
S2W / DT2W
Wake Gestures (huge thanks to @flar2)
Stereo Call Recording
Removed a lot of debug
Some Features from 3.7+ linux kernel
Upstream with Linux kernel .00
Full F2FS support (need to mod ramdisk to make it work, will make it automatic later)
Lots of optimizations from CAF, CM, and other kernels around xda
Main idea: Greatly patched kernel with the best governor, I/O scheduler and hotplug built with UBER toolchain.
Download for Lollipop 5.1
MOD EDIT, Download removed, rule 12 @gregbradley
Credits:
@TomorrowLand_Ace
@eng.stk
@franciscofranco
@faux123
@flar2
@show-p1984
@neobuddy89
@savoca
@RIPng
Source
If you want to support student and his work:
​
XDA:DevDB Information
Crystal Kernel, Kernel for the Google Nexus 5
Contributors
mastero9017
Source Code: https://github.com/mastero9017/hammerhead
Kernel Special Features:
Version Information
Status: Stable
Created 2015-04-03
Last Updated 2015-04-03
Reserved.
Where is the download link.? Can't open
Zonkoprince said:
Where is the download link.? Can't open
Click to expand...
Click to collapse
Fixed, link is under clickable Mediafire.
What app i should use to customise?
Zonkoprince said:
What app i should use to customise?
Click to expand...
Click to collapse
I suggest Kernel Auditor.
Kinda wondering could you maybe add some features from this kernel thread?
http://forum.xda-developers.com/showthread.php?t=2845768
It has nexus 5 kernel too but the devs mainly focused on n4 so maybe you could make the n5 version of it especially the 5.1 version. If it is allowed by the devs. Since the last commit is 2 months old and no new updates for 2 months
JJsevol said:
Ah makes sense now.
@mastero9017 are there any other changes you made from chroma besides the blu changes and toolchain? Liking the kernal so far :good:
Click to expand...
Click to collapse
Everything is listed in OP. I'm not sure yet about future of this kernel. TomorrowLand_Ace will provide great patches for kernel itself and i will try to port changes to blu modules from shamu and tweaks some values, flags, etc
Thread temporarily closed whilst I look in to the multiple reports made
@eng.stk has explicitly said that you have not got permission to share his work.
Download removed, thread remains closed

[REFERENCE/TEMPLATE] Marlin Kernel clang template

Clang Kernel template for Marlin/Sailfish​
What is this?
This is a marlin clang template that can be used to create kernels that compile using clang toolchains. It has all the commits by @nathanchance that optimize clang for the Pixel and XL models
What Does this Mean for me?
The 4.x kernels use clang as a toolchain for compilation. Our kernel is 3.18.x, we do not immediately use clang for compilation. GCC is the key part when compiling a 3.18.x kernel. Using clang adds battery and stability improvements (which I have observed). People are readily adopting clang as a compiler and I just want to ease the workload to cherry pick all the commits required to run clang on a marlin or sailfish device.
Where can I find it?
It is found in my git repository linked here: https://github.com/kingbri1/MarlinClangRef
How Do I use it?
All you do is clone it and look at @nathanchance's guide on how to compile with clang https://github.com/nathanchance/android-kernel-clang
Updates
I will be updating this kernel base to the latest security patches and versions, nothing more, nothing less
Thanks to...
@razorloves -I used his kernel base
@nathanchance for putting the time in to create the commits for clang to be used on Pixels and other devices
Want to collaborate?
Feel free to private message me or email me at [email protected] so we can sort out the details

[GUIDE]Working with Android Kernel from Scratch

Introduction
I am writing this guide as I was unable to find a well-documented thread over XDA (there are just a lot of them). In case there is anything that concerns this guide, feel free to ask in this thread. I expect you to know the basics of Linux, GIT, Android. Please look over some guides in the forum in case you are not familiar with them. In case you want to contribute to this, feel free to do so. I welcome everyone's contribution to be it fixing my derp, pointing a mistake or adding a new section.
Links to some nice documentations:
Git Documentation
Linux Kernel Newbies
How to take logs in Android
How to get an Android kernel up to date with linux-stable
Checking Current CAF Tag of the Kernel
We will be using best_kernel for this purpose, whose aim is to compare your current kernel source code with different CAF tags and select the best possible match using git diff.
Clone/Download your kernel repo and commit your changes(if not already committed) as best_kernel depends upon git diff to compare changes.
Depending upon your kernel version, add required CAF kernel repo as remote and fetch it. best_kernel will use this fetched data to compare changes.
After fetch is done, run best_kernel. It should run automatically if you have placed dotfiles in the $BIN directory and have the necessary dependencies installed.
best_kernel will compare changes and will provide results based on that. However, depending on the number of tags, it will take time. A lot of time, so go and grab a cup of coffee till then.
A Dummy Example:
Downloading stock kernel source code from OEM’s website
Code:
wget http://nokiaphones-opensource.azureedge.net/download/phones/Nokia6.1_V2.22J.tar.bz2 && tar xvjf Nokia6.1_V2.22J.tar.bz2 && cd kernel
Adding and committing all files due to lack of a .git dir.
Code:
git init && git add --all && git commit -m "Initial Commit"
As the kernel source code version is 4.4, I will add 4.4 remotes from CAF and fetch it.
Code:
git remote add caf https://source.codeaurora.org/quic/la/kernel/msm-4.4/ && git fetch caf
After fetch, I will check for the current CAF tag using best_kernel. As my device platform is sdm660 and CAF has been releasing sdm660 tags as sdm660.0, I will be using it as an argument in best_kernel. This will ensure that best_kernel doesn’t waste time checking CAF Tags of other platforms and will speed up the process considerably.
Code:
best_kernel "*sdm660.0"
RESULT will be something like this:
Code:
Best match TAG: LA.UM.6.2.r1-06900-sdm660.0 Lines changed: 177924
What is CAF/Code Aurora | CodeAurora Android Releases Page | CAF Kernel Sources​
Creating/Importing GIT History for Kernel Source
A lot of OEMs release kernel sources in a compressed format excluding the .git dir which results in no git history. Creating or it's better to say to import one is simple and easy.
Download and check the current CAF tag of your Android kernel source.
Note: If your chipset is not Qualcomm, you should visit Linux Kernel Source or AOSP's Kernel Common and use that as a base while checking out to the specific version of your kernel source you are going to copy-paste. Qualcomm devices can also use that as a ref but I will recommend them to use CAF source.
Based on that CAF tag, download the respective kernel repository from CAF and checkout for that specific tag.
Copy and paste your downloaded kernel source (with no history) over the CAF one (which has the history of that CAF tag).
Commit the changes.
You have accomplished creating/importing history.
A Dummy Example:
My current CAF tag is LA.UM.6.2.r1-06900-sdm660.0.
Therefore, cloning kernel source from CAF and checking out for this tag while creating a new branch named rebase.
Code:
git clone https://source.codeaurora.org/quic/la/kernel/msm-4.4/
cd msm-4.4/
git checkout tags/LA.UM.6.2.r1-06900-sdm660.0 -b rebase
Now, I will copy-paste the kernel source that I downloaded from OEM's website over the CAF one. Assuming the downloaded kernel is in ~/Downloads/kernel and CAF kernel source is in ~/msm-4.4 directories.
Code:
#Renaming the dir so, that it will get merged while copying due to similar names
mv kernel/ msm-4.4/
cp -avr msm-4.4/ ~/msm-4.4
cd ~/msm-4.4
git status
git commit -m "Import Nokia Kernel Source"
Keep in mind that a .gitignore is generated which can and will ignore files during commit which were not getting ignored earlier due to its absence. In case during compilation you encounter any error stating about missing file, add it forcefully and commit again.
Remember, its always good to split that one big commit into small parts. It's helpful when you start rebasing your kernel usually when new CAF Tag for new android versions come out. Solving a few conflicts ina lot of commit is much better than solving a load of them in one. It also gives you a chance to easily diff on websites like GitHub so that you can figure what's a particular line is doing.
Doing that is also easy. Just reset head for a particular folder like driver/touchscreen and commit them separately. Check git rebase documentation which will help you with this.
Upstreaming your Kernel
Merging upstream versions is a really good thing. It brings in security patches, stability, new features and much more. The usual and best way is to visit Linux Kernel Source and check if there are upstream updates available. If yes, start merging them in your kernel source one by one.
Note: If your chipset is not Qualcomm, you should visit Linux Kernel Source or AOSP's Kernel Common and use that as a base. Qualcomm devices can also use that as a ref but I will recommend them to use CAF source.
A Dummy Example:
Assuming my current kernel version is v4.4.205, I will fetch v4.4.206 from Linux Kernel Source and merge that. I can also fetch and merge different branches from CAF Source which are usually upstreamed with Linux-stable (for example, aosp/upstream-linux-4.4.y branch)
Code:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git v4.4.206
git merge FETCH_HEAD
Fix conflicts if you get some. What to keep and what not is a question that depends upon the device to device. Usually, you should compare local changes and upstream and try to figure out what could be the best way to fix it. I will advise to check the history of that file in upstream and see which commit caused that conflict and why. You can also check similar merges by other same kernel versions to see if they had the same conflict and how they fixed it.
I will also advise merging AOSP's kernel/common and new CAF upstream tags (Only QCOM devices should merge new CAF tags) regularly when available. The reason is pretty simple. There are commits that get merged in AOSP like which improves performance or other stuff which doesn't get merged in Linux Kernel Source. This way you can get the benefit from all sources. This, however, is not pretty easy and might result in a huge number of conflicts considering if OEM has modified the source a lot from upstream.
CAF also hosts f2fs and other file system changes on their servers. Merge it if you want and use it.
Compiling Standalone Kernel
Compiling a kernel standalone requires you to have a compatible toolchain like GCC or Clang. The best way to figure out which one suits your need is testing and debugging. The standard AOSP GCC toolchains are recommended for devices with old kernels, to begin with, while newer ones can use clang with backports or upstream merges. In case you want to compile with clang, checking out android-kernel-clang is a good way, to begin with.
Compiling standalone kernels can give a lot of missing headers errors/warnings. This is due to not compiling it in a ROM environment. This can be easily fixed either by correcting paths of those header files being included or creating an out dir manually and using it as output. You can also use this commit to do that automatically.
Clone your kernel source and desired toolchain(s). Export arch and cross compiler arguments. Choose the desired defconfig to make and compile.
A Dummy Example:
I will clone the kernel source and toolchain in the same dir and export the following arguments in kernel source root dir.
Code:
export ARCH=arm64
export CROSS_COMPILE=/media/hdd/aayush/kernel/aarch64-elf-gcc/bin/aarch64-elf-
make nokia_defconfig
make -j$(nproc --all)
Kernel conflicts might occur. You can search on GitHub to check if someone has fixed that already, otherwise fix the issues yourself. Comparing code with upstream repositories is also a way to figure out the differences. Choosing defconfig can be a bit tricky if you are doing bringups. I recommend pulling the current defconfig from your device itself. Its usually by the name of config.gz in /proc/ of your device.
Links to some cross compiler
GNU Toolchain by ARM
DragonTC
GNU and Linaro
Working with TWRP from Scratch
This post is supposed to help you with building TWRP from scratch for the first time if you are a newbie. There are some good resources already available for that over the web, specially XDA. I am linking some good ones below that you can read for more info on it.
How to compile TWRP Touch Recovery
The aim of a device tree is to contain the device-specific code for the build you are doing. In this case, as we are building TWRP which is a custom recovery, only flags relating to building TWRP and a normal recovery are enough to build it. Adding system specific codes like partition sizes for the system, vendor, boot and other doesn't contribute anything. An example tree can be begonia's tree hosted on TeamWin's org maintained by me.
Now coming to the device you want to build TWRP for, you will the following :
- A working kernel
- Device-specific binaries/libraries etc required for features like encryption which heavily differs on OEM implementation
AB devices need an extra commit in their kernel to make 'fastboot boot' command work: init: initramfs: disable do_skip_initramfs . Additionally if your device ships a separate DTBO image you will also need the following flag and the DTBO image: begonia: Build DTBO image into recovery
Newer devices are nowadays coming with 'fastboot boot' command disabled. Nokia 8.1 is an example of it. To make it work again, you might need to tweak bootloader which can prove to be risky.
Now coming to creating a device tree for TWRP. The very first step is to look out if someone else has booted TWRP on a similar SOC, OEM or same device. It can be used as a reference to fix similar/OEM related bugs and hacks quickly. In case, one doesn't exist, just pick a latest one from Teamwin's Github org for the android version you are compiling for.
Reserved (2)
Wew many thanks,
Thanks
Have just started exploring xda chef central.
I cam across this guide, really ahlepful Hope you complete it soon.
Updated the thread. Fixed formatting, links and added a new section.
How To Unofficially Unlock Bootloader For LG G8
We all know LG G8 is a android device. It's open source. But I recently bought a LG G8 only but it's locked to sprint sim . No any sim work. I can't unlock bootloader. I can't root. I can't flag firmware or install custom recovery. Anyone know here , how to totally remove firmware and but another firmware ? Why we can't build a method to do that?
TheImpulson said:
Updated the thread. Fixed formatting, links and added a new section.
Click to expand...
Click to collapse
Can you create a guide for, "How to Rebase an Android Kernel". Like from Android 9 to Android 10?
thanks for this guide bro
While using best caf kernel, Prefix of the caf tag should start with a -
For example, "*- sdm660.0"
@theimpulson
Hey there,
Am getting this error del.dog/megupebinu.txt
While trying execute best_kernel script
This is helpful, thanks mate
@theimpulson I had a question: (Before reading this guide) I had already downloaded stock Samsung sources and git init push the thing to my Github. So will anything bad happen if I did it this way or do I have to rebase it with CAF?
Also what are the benefits of these so-called CAF based kernels everywhere? Improved performance? Cuz I really wanted to compile my own kernel specifically for performance with WSL-2 (shameless plug)
Thanks in advance and sorry if the @ bothered you,
Ishaq
NullCode said:
@theimpulson I had a question: (Before reading this guide) I had already downloaded stock Samsung sources and git init push the thing to my Github. So will anything bad happen if I did it this way or do I have to rebase it with CAF?
Also what are the benefits of these so-called CAF based kernels everywhere? Improved performance? Cuz I really wanted to compile my own kernel specifically for performance with WSL-2 (shameless plug)
Thanks in advance and sorry if the @ bothered you,
Ishaq
Click to expand...
Click to collapse
The existing sources are fine, no issues if you are fine without any git history.
SOC specific optimizations, bug fixes etc. Nothing more. So, yeah, if you want SOC specific optimizations, performance improvements, you will want to merge latest CAF tags for your kernel.
theimpulson said:
The existing sources are fine, no issues if you are fine without any git history.
SOC specific optimizations, bug fixes etc. Nothing more. So, yeah, if you want SOC specific optimizations, performance improvements, you will want to merge latest CAF tags for your kernel.
Click to expand...
Click to collapse
thanks a lot for the reply! Another thing, because of your suggestion I tried to Import the git history (and i succeeded). Then I wanted to upload these sources to my own Github, which I can't figure out how to do. It only gives Github repo for the place where it came from (msm-3.18). Help me please
Edit: The guides which I found for merging CAF tags say that my base also has to be CAF (which it isn't) and this guide here basically does not work

Categories

Resources