[RESOURCE][TOOLCHAINS] Repo friendly Toolchains. - Android

I've been following all the wonderful guides for building and compiling; but I've been having trouble finding the exact locations of the toolchains.
So I'd like to share my manifest for the same.
The repo tool can be used for getting all the toolchains [that I know] in one go for ease of development,
https://github.com/HaoZeke/Android-ToolChains
The instructions are given there.
All credits to the actual developers.
Currently Synced
Uber ToolChains [48, 4.9, 5.1, 5.2, 6.0*]
Hyper-Toolchains {SaberNaro 4.8**, LinaroMod 4.8**, LinaroMod 4.9**} (Linaormod 4.9*, SaberNaro 4.9*)
Linaro [4.8, 4.9, 5.1, 5.2]
Archidroid [5.2]
Sabermod [4.8**, 4.9**]
* --> Kernel Only
** --> Rom Only
Use a local_manifests/del.xml to remove unecessary toolchains.
Click to expand...
Click to collapse
Please feel free to push changes & additions!!

Related

[ROM][AOSP][Nightly/Release] CarbonRom KitKat [i9100]

About Carbon
CarbonRom is an aftermarket firmware based on the Android Open Source Project. We are dedicated to fast, stable, and feature-filled roms, honesty and communication with our users, and openness with our code. We like frequent builds, with the very latest and greatest hardware support and fixes. We strive to not only provide you with the best rom we can build, but also to give back to the Android community and our fellow developers. For us, this is about creating something we can be proud of and hope you will enjoy.
Please feel free to look at, build, and use our code on CarbonDev GitHub. and on our Gerrit CarbonDev Gerrit.
We would like to thank CyanogenMod for their device trees, framework/settings mods and their code that was incorporated into this project. We also extend our gratitude to the devs whose code that we have incorporated. Proper authorship has been maintained and can be viewed on our repository.
Special thanks also go to Slim Rom for some of their features, PA, AOKP, and anyone else we may have borrowed commits from that hasn't been mentioned here. If you feel you have been unfairly left out, please - let us know.
While we make every effort to test these builds as much as possible, we are not responsible for anything that may happen to your device, family, pets, or perception of reality. We ask that you do your part to know your device and know how to recover from problems before you flash! If you have questions, ask your fellow users or ask us in #teamcarbon on freenode IRC.
Features
All of our features can be found on our site here:
Carbon Features
Here are some screenshots:
Carbon Screenshots
Carbon Updates
Join us on these Social Media Channels to keep yourself up-to-date on all the latest Carbon news, updates, contests, and more! Join our completely open Google+ community for insider conversation with devs and other users.
Download Carbon
All Carbon downloads and further information such as features, changelog, and FAQ can be found on our website.
Carbon Downloads
Changelog
For a detailed changelog, check out the changes made each night here:
Carbon Changelog
Support
We spend an astonishing amount of time developing this software. We can't spend much time on XDA as a result, so if you need support, please try the following:
1) Search. Search, search, search. Yes, you. I don't care how unique or important your question is, it's very likely someone has adressed it already. Especially if you're even close to new at this.
2) Read our FAQ, which can be found on our website. Carbon FAQ
3) Ask a question in your device forum. Someone will no doubt try to help you. Warning: this help may come in the form of telling you it's a dumb question that has been asked before. See step 1 - such are the perils of asking questions when you haven't done the research yourself. Android is about helping yourself.
4) Ask a question on our IRC channel. Connect to #teamcarbon on irc.freenode.net or click here. You'll find several other Carbon fans and usually one or more devs as well. Please be polite.
Who is Team Carbon?
Find out here:
Carbon Team
Remember, every penny you send to us goes right back into the rom. It's used for hardware, server costs, etc - all the things that help us make Carbon better with every release. Your support means the world to us! If you've enjoyed Carbon, please consider a donation toward this goal. Thank you, and we hope you continue to enjoy Carbon!
​
XDA:DevDB Information
[ROM][AOSP][Nightly/Release] CarbonRom KitKat [i9100], ROM for the Samsung Galaxy S II
Contributors
CarbonDev, Myself5
ROM OS Version: 4.4.x KitKat
Based On: AOSP
Version Information
Status: Beta
Created 2014-02-14
Last Updated 2014-06-07
Reserved
Reserved
Hello Guys.
I'm your i9100 device maintainer.
I meanwhile tweaked the Rom specially for the i9100 so its difference to our other devices is:
Compiled using SaberMod arm-eabi 4.7 (Kernel code) and SaberMod arm-linux-androideabi 4.8 (ROM code) toolchain compilers
Cross-compiled using those custom toolchains results in a more smoother, faster, and battery friendly ROM
F.A.Q.:
What is Toolchain?
In software, a toolchain is the set of programming tools that are used to create a product (typically another computer program or system of programs). The tools may be used in a chain, so that the output of each tool becomes the input for the next, but the term is used widely to refer to any set of linked development tools.
A simple software development toolchain consists of a compiler and linker to transform the source code into an executable program, libraries to provide interfaces to the operating system, and a debugger. A complex product such as a video game needs tools for preparing sound effects, music, textures, 3-dimensional models, and animations, and further tools for combining these resources into the finished product.
Click to expand...
Click to collapse
Source: http://en.wikipedia.org/wiki/Toolchain
What is SaberMod?
The term "SaberMod" is coming from:
SaberMod is a AOSP based ROM with some extra features added in and mostly from CyanogenMod. SaberMod started out pure AOSP when android 4.2.1 launched. Originally it was pure AOSP with a few extra features I ported over from CyanogeMod and linaro optimizations. Then I rebased everything off of rasbeanjelly because I liked many features found in rasbean. Since then I've modified a lot of the code so not much of it is rasbeanjelly based anymore. But you will still find some commonly used features found in rasbeanjelly. SaberMod is not a rasbeanjelly or CM clone, or KANG. Custom kernels are included for certain devices when available. These are personal builds we make for ourselves and originally became very popular in the nexus 7 forums. Features are very rarely added, and are built to SaberMod's team members liking. Currently there are two members of SaberMod working on this project. Myself and @jarjar124. Please understand our time is limited and we are only two people who have lives, and do not have 25-50 members like CyanogenMod to add things. And our goal is not to add a bunch of features that bloat the system of the ROM.
Click to expand...
Click to collapse
Source: http://forum.xda-developers.com/show....php?t=2158698
About GCC main compiler cflags
-O1
Optimize. Optimizing compilation takes somewhat more time, and a lot more memory for a large function. With -O, the compiler tries to reduce code size and execution time, without performing any optimizations that take a great deal of compilation time.
-O2
Optimize even more. GCC performs nearly all supported optimizations that do not involve a space-speed tradeoff. As compared to -O, this option increases both compilation time and the performance of the generated code. -O2 turns on all optimization flags specified by -O.
-O3
Optimize yet more. -O3 turns on all optimizations specified by -O2 and also turns on the -finline-functions, -funswitch-loops, -fpredictive-commoning, -fgcse-after-reload, -ftree-loop-vectorize, -ftree-slp-vectorize, -fvect-cost-model, -ftree-partial-pre and -fipa-cp-clone options.
-Os
Optimize for size. -Os enables all -O2 optimizations that do not typically increase code size. It also performs further optimizations designed to reduce code size.
Click to expand...
Click to collapse
Greetings
Myself5
Nice Work Dude !
Mine
Sent from my SAMSUNG-SGH-T769 using Tapatalk
Whats Up Whith "Mine" ?
great ...thanks ....will try it surly
Great!! carbon finally arrived gonna try
Sent from my GT-I9100 using Tapatalk
im not able to see the download link in carbon page, i select our device but the links to download the ROM doesnt appear, can someone share the download link?
attack11 said:
im not able to see the download link in carbon page, i select our device but the links to download the ROM doesnt appear, can someone share the download link?
Click to expand...
Click to collapse
I have found that this link:
http://carbon-rom.com/downloads/?device=i9100&type=nightly&country=US
Showing some dates but still no luck with working link...
Послато са GT-I9100 уз помоћ Тапатока
Will this rom contain the tweaks/things that Myself5 added to his unofficial build?
It seems like we're currently having some issues with our download page getting accessed by mobile browsers. Please use your computer to download until we fixed it.
@GreekBlood: All in all the most tweaks I made were coommits from gerrit, so sooner or later they will be included
http://carbon-rom.com/downloads/?device=i9100&type=nightly&country=BE
Here i can see the downloads perfectly and they also work.
And here is the latest nightly for our SII :> http://eu1.dl.carbon-rom.com/files/i9100/nightly/CARBON-KK-NIGHTLY-20140215-0148-i9100.zip
congrats myself5 on getting to be the maintainer for this great rom on our s2.
i think i will just dl from the official carbon page,and then just use the updater to get all the improvements and fixes moving forward!!
well first hour whit this rom.and everything seems good after all! just one question,how i can enable wheater widget in the lockscreen? i cant find an option..
also some translations are missing (in spanish) i can help if you want.
also another question Halo will be added on the future?
i flashed newest rom all good.kernel included is not compatible with stweaks.
I plan on flashing gustavo 2\09 kernel.
will nightly updates flash a another kernel each update??
thnx
A little problem
I have a little problem,when i try to install gapps it says that i have insufficient space. How would i fix that? I`m using PA-GOOGLE APPS (FULL MODULAR PACKAGE) .
And another question. Previous versions that were unofficial had TWRP, how could I get that back too?
@attack11 the Weather Widget is called cLock. HALO will be added it just has some small bugs ATM we need to fix. Thanks for your help, I will later PM you all files you need to translate.
@saskrider: It will flash a new Kernel every Update. However when you later (as soon as it's working) use CarbonDelta to update there will be a option to add Custom Zip's to flash after the Rom (like GApps and Custom Kernels)
@Pecka40: the S2's Sytem Partition is to small for these GApps, use some smaller ones
Greetings
Myself5
Sent from my GT-I9100 using Tapatalk
Myself5 said:
@attack11 the Weather Widget is called cLock. HALO will be added it just has some small bugs ATM we need to fix. Thanks for your help, I will later PM you all files you need to translate.
@saskrider: It will flash a new Kernel every Update. However when you later (as soon as it's working) use CarbonDelta to update there will be a option to add Custom Zip's to flash after the Rom (like GApps and Custom Kernels)
@Pecka40: the S2's Sytem Partition is to small for these GApps, use some smaller ones
Greetings
Myself5
Sent from my GT-I9100 using Tapatalk
Click to expand...
Click to collapse
Thanks for the reply! And there is no way of making it bigger?
And could you please answer the other question. About how can I get TWRP on it.

[ROM][KK][4.4.4][LINARO/SABERMOD] SlimKat [WEEKLY BUILDS][9.0][FINAL]

v500/G Pad 8.3" SLIMKAT LINARO/SABERMOD WEEKLY BUILDS
Final Build 9.0 is ONLINE
DOWNLOAD
(infected server)
(md5sum included with all builds)
kernel code compiled with linaro arm-eabi-4.7.4 201406 toolchain
rom code compiled with with sabermod arm-linux-androideabi-4.8.5 201412 toolchain
-O3 optimizations
strict-aliasing rules
custom performance flags
+30 cherry-picks used
graphite
(buildbot: intel core i7 [email protected], asus p8z77-v, 16gb corsair vengeance pro 2133mhz cl11, nvidia gtx 970, 2x samsung 128gb ssd 840 pro raid 0 array,
4x western wigital wd3200aaks raid 10 array, samsung f1 1tb, seagate 2tb, silverstone olympia 1000w psu, antec 1200 high-tower)
(wc setup: swiftech apogee xt cpu-block, black-ice gtx-lite 240 radiator, 2x noiseblocker eloop b12-3 1900rpm fans, swiftech mcp355 water-pump, danger den 5.25" reservoir bay)
(Linux Mint 17.1 x64 "Rebecca" 3.13.0-39)
Disclaimer:
These builds are freshly compiled/synced from SlimRoms open-source code:
https://github.com/SlimRoms
latest linaro arm-eabi-4.7.4 used to compile the kernel code & sabermod arm-linux-androideabi-4.8.5 toolchains to compile ROM code
Special Thanks
SlimRoms Dev Team​
Flashing Instructions
First time installing:
Flash CWM recovery or TWPR recovery.
Option #1 = http://forum.xda-developers.com/showthread.php?t=2588671
Option #2 = http://forum.xda-developers.com/showthread.php?t=2641409
Place build zip + gapps on internal/external memory
reboot into recovery
wipe /system /data /cache
flash build + gapps
wipe cache
reboot
you're done, enjoy!
Coming from previous build version:
Flash build, flash gapps
you're done, enjoy!
Gapps = SlimRom Gapps
F.A.Q (Frequently Asked Questions)
What is the difference between these builds and the official builds?
These are unofficial builds of SlimKat for the v500/LG G Pad.
ROM is built using the same source code (github) like the official one but with these following additions:
Compiled using linaro arm-eabi 4.7.4 14.04 (kernel code) & sabermod arm-linux-androideabi 4.8.3 14.04 (rom code) toolchain compilers
May contain some custom cherry-picks. Always see changelog for details.
Cross-compiled using those custom toolchains results in a more smoother, faster, and battery friendly ROM
What is Toolchain?
In software, a toolchain is the set of programming tools that are used to create a product (typically another computer program or system of programs). The tools may be used in a chain, so that the output of each tool becomes the input for the next, but the term is used widely to refer to any set of linked development tools.
A simple software development toolchain consists of a compiler and linker to transform the source code into an executable program, libraries to provide interfaces to the operating system, and a debugger. A complex product such as a video game needs tools for preparing sound effects, music, textures, 3-dimensional models, and animations, and further tools for combining these resources into the finished product.
Click to expand...
Click to collapse
Source: http://en.wikipedia.org/wiki/Toolchain
What is SaberMod?
The term "SaberMod" is coming from:
SaberMod is a AOSP based ROM with some extra features added in and mostly from CyanogenMod. SaberMod started out pure AOSP when android 4.2.1 launched. Originally it was pure AOSP with a few extra features I ported over from CyanogeMod and linaro optimizations. Then I rebased everything off of rasbeanjelly because I liked many features found in rasbean. Since then I've modified a lot of the code so not much of it is rasbeanjelly based anymore. But you will still find some commonly used features found in rasbeanjelly. SaberMod is not a rasbeanjelly or CM clone, or KANG. Custom kernels are included for certain devices when available. These are personal builds we make for ourselves and originally became very popular in the nexus 7 forums. Features are very rarely added, and are built to SaberMod's team members liking. Currently there are two members of SaberMod working on this project. Myself and @jarjar124 . Please understand our time is limited and we are only two people who have lives, and do not have 25-50 members like CyanogenMod to add things. And our goal is not to add a bunch of features that bloat the system of the ROM.
Click to expand...
Click to collapse
Source: http://forum.xda-developers.com/show....php?t=2158698
What is Linaro?
Linaro is the place where engineers from the world's leading technology companies define the future of Linux on ARM. The company is a not-for-profit engineering organization with over 120 engineers working on consolidating and optimizing open source software for the ARM architecture, including the GCC toolchain, the Linux kernel, ARM power management, graphics and multimedia interfaces.
Click to expand...
Click to collapse
Source: http://www.linaro.org/linux-on-arm/
About GCC main compiler cflags
-O1
Optimize. Optimizing compilation takes somewhat more time, and a lot more memory for a large function. With -O, the compiler tries to reduce code size and execution time, without performing any optimizations that take a great deal of compilation time.
-O2
Optimize even more. GCC performs nearly all supported optimizations that do not involve a space-speed tradeoff. As compared to -O, this option increases both compilation time and the performance of the generated code. -O2 turns on all optimization flags specified by -O.
-O3
Optimize yet more. -O3 turns on all optimizations specified by -O2 and also turns on the -finline-functions, -funswitch-loops, -fpredictive-commoning, -fgcse-after-reload, -ftree-loop-vectorize, -ftree-slp-vectorize, -fvect-cost-model, -ftree-partial-pre and -fipa-cp-clone options.
-Os
Optimize for size. -Os enables all -O2 optimizations that do not typically increase code size. It also performs further optimizations designed to reduce code size.
Click to expand...
Click to collapse
Wow.. Thanks Again..
Removed.
I must have picked the right time to root etc my Pad as yet another superb ROM is now here to try.
Having just nandroid the CM 11 build I have now wiped and flashed this. It looks every bit as good as it does on my Nexus 5. I love the built in DPI as well as the inverted GAPPS, when the darker Slim is selected.
All seems well so far.
Thanks for sharing
Seems to work well, thanks!
Am I the only one who is having a problem with the screen being way too dim? Setting up the tablet after the first reboot was a pain. Could it be tied to the recovery version on my device? I am running TWRP 2.7.
Running fine. Swapped over from Demetris' build to see if any different. Did have a sound glitch when on Spotify that I don't notice here. Might be smoother as well or could be placebo effect.
new linaro/sabermod SlimKat build 4.9 is up!
regards.
Love the Rom, best I've tried. Can't seem to see 4.9 on the download server? Sorry if I'm being blind
Sent from my LG-V500 using Tapatalk
joegrant said:
Love the Rom, best I've tried. Can't seem to see 4.9 on the download server? Sorry if I'm being blind
Sent from my LG-V500 using Tapatalk
Click to expand...
Click to collapse
It's on the Slim website. Download section, weekly, and V500 device.
thanks, I was looking at the infected server from the Op. maybe that can be changed to the slimkat website if the infected server is not being updated. cheers
Sent from my MI 2S using Tapatalk
sorry, but i wasnt aware the upload failed.
i re-uploaded build 4.9
regards.
@infected_ Could you build the v5.PCFR release?
Thanks
Demetris said:
@infected_ Could you build the v5.PCFR release?
Thanks
Click to expand...
Click to collapse
yes.
Code:
SLIM_VERSION=Slim-4.4.2.build.5.PCFR-INFECTED-20140510-1607
i'll upload as soon has it finishes.
build 5 PCFR is up!
Ok I'll bite
What is PCFR...?
BTW excellent work yet again for the continuing support
vimesUK said:
Ok I'll bite
What is PCFR...?
BTW excellent work yet again for the continuing support
Click to expand...
Click to collapse
Whatever it is I lost root after flashing it
Sent from my LG-V500 using XDA Premium 4 mobile app
xyojimbox said:
Whatever it is I lost root after flashing it
Sent from my LG-V500 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
go to developer settings and enable it...
Is it possible to install SuperSU from Chainfire on this after you enable root? It just feels a little faster.
infected_ said:
go to developer settings and enable it...
Click to expand...
Click to collapse
Infected Thanks for the GREAT effort you are putting into these ROMs, really appriciated.
You will be the first I will donate some beer to!!!

Do I Need To Put The Toolchain On My PATH?

Whilst compiling Cyanogenmod I got this error:
Code:
ccache: FATAL: Could not find compiler "arm-eabi-gcc" in PATH.
Based on the manifest
https://github.com/LineageOS/android/blob/cm-12.1/default.xml#L542
the compiler is platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8
from
https://android.googlesource.com/pl...inux-x86/arm/arm-eabi-4.8/+/android-5.1.1_r37
If I add that full path to my PATH variable I can compile the ROM successfully.
However, that seems wrong to me.
The compiler is already part of the source tree.
Shouldn't something in one of the make files or build scripts be setting this rather than me setting it manually?
Note: I am not using a custom toolchain, it is the standard one from aosp.
opticyclic said:
Whilst compiling Cyanogenmod I got this error:
Code:
ccache: FATAL: Could not find compiler "arm-eabi-gcc" in PATH.
Based on the manifest
https://github.com/LineageOS/android/blob/cm-12.1/default.xml#L542
the compiler is platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8
from
https://android.googlesource.com/pl...inux-x86/arm/arm-eabi-4.8/+/android-5.1.1_r37
If I add that full path to my PATH variable I can compile the ROM successfully.
However, that seems wrong to me.
The compiler is already part of the source tree.
Shouldn't something in one of the make files or build scripts be setting this rather than me setting it manually?
Note: I am not using a custom toolchain, it is the standard one from aosp.
Click to expand...
Click to collapse
Toolchains aren't automatically set, at least for now. Possible causes being...
There are multiple versions of Toolchain that are synced together, and it isn't necessary that the newer version of the same toolchain "must" compile the code with success, which was properly compiled by an older version.
Also, by this, the developer has complete freedom to change the ROM/Kernel toolchain.
Coming to the Question in Thread Title, If you're building a ROM, then toolchain has to be added in PATH
Arvind7352 said:
Toolchains aren't automatically set, at least for now. Possible causes being...
There are multiple versions of Toolchain that are synced together, and it isn't necessary that the newer version of the same toolchain "must" compile the code with success, which was properly compiled by an older version.
Also, by this, the developer has complete freedom to change the ROM/Kernel toolchain.
Coming to the Question in Thread Title, If you're building a ROM, then toolchain has to be added in PATH
Click to expand...
Click to collapse
Thanks for clarifying.
Ideally it should scan the source tree for the compiler by default so it has something to fall back to in case a custom one is not specified.
What confused me is that I don't see this nugget of information specified in any of the guides I read about compiling ROMs.

[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