Building linux kernel for AOSP for Nexus 6 - Android Q&A, Help & Troubleshooting

I have been following the instructions for building a linux kernel for the AOSP for Nexus 6. I get to the point where I need to checkout a git version (git checkout < some branch >) and it is not clear which one. I checked out android-7.1.2_r0.20, but there is no shamu_defconfig in that view. Any help is appreciated.
Thx,
Y-

Related

compile aokp on galaxy ace

Hi guys, I'm new on deving and this is the first time I try to compile a rom...
I'm a sensation user, but I want to make an aokp build for my friend that has a galaxy ace with a good working cm9 rom...
now, can someone help me to understand which source use, which git sync, I am pretty confused...
I have the aokp source here https://github.com/aokp
and maclaw source (fixing things on cm9) here https://github.com/MaclawStudios
I followed a classic guide to compile aokp/cm9 fron source and I already installed all the necessary stuff (sdk, jdk ecc) to compile.
now I'm confused about how proceed with source and git...maybe if someone tells me what I have to type on the terminal and the reason why I am typing it would be great
thanks for your time
throcker said:
Hi guys, I'm new on deving and this is the first time I try to compile a rom...
I'm a sensation user, but I want to make an aokp build for my friend that has a galaxy ace with a good working cm9 rom...
now, can someone help me to understand which source use, which git sync, I am pretty confused...
I have the aokp source here https://github.com/aokp
and maclaw source (fixing things on cm9) here https://github.com/MaclawStudios
I followed a classic guide to compile aokp/cm9 fron source and I already installed all the necessary stuff (sdk, jdk ecc) to compile.
now I'm confused about how proceed with source and git...maybe if someone tells me what I have to type on the terminal and the reason why I am typing it would be great
thanks for your time
Click to expand...
Click to collapse
https://github.com/AOKP/platform_manifest/tree/ics
Read the read me there,then add your device and kernel tress then.add the proprietary files (vendor tree)
Then you should be able to compile...keyword should...
Sent from my HTC PH39100 using Tapatalk 2
ok! exactly, but I'm a bit confused about device trees, proprietary files....I don't know exactly what they are and what commands I should use to add them!...
example: ok I add the aokp repo
$ repo init -u https://github.com/AOKP/platform_manifest.git -b ics
$ repo sync
temporary fix to build:
$ install -d prebuilt/android-arm/kernel
curl -o prebuilt/android-arm/kernel/LINUX_KERNEL_COPYING -O
now? what sould I take from here https://github.com/MaclawStudios and how do I add on the source? with what commands I mean...
and I don't know which of them are the device tree and vendor tree...(but at least I understood which one is the kernel tree XD)
thanks a lot for your help
I found this command to clone git from a cm9 source
$ git clone https://code.google.com/p/cooper-cyanogen/
here https://code.google.com/p/cooper-cyanogen/source/checkout
and what if I sync the aokp repo, than clone this git?
if is possible to do, when should I add it?

[Q] Help porting AOSP roms using source ?

Hi all..
I want to learn how to port an AOSP rom to my Sony Xperia S..
I followed this guide: http://xda-university.com/as-a-developer/porting-aosp-roms-using-source-code
But I'm stuck at this:
Now once that’s done go to the github page of the AOSP rom that is being ported and also fork their vendor setup repo so we can add the device to the setup so it can be called later on when we run the . build/envsetup or source build/envsetup.sh command this allows us to compile the rom after when we have selected our target device.
Click to expand...
Click to collapse
How can I find an AOSP source in github ?
Yes I found this but I don't know how to deal with it.
Maybe it's a noob question for you but really need help..
Thanks.
Downloading the Source | Android Open Source Project
source.android.com
repo init -u https://android.googlesource.com/platform/manifest -b YOUR_BRANCH

Errors syncing Cyanogenmod source and building rom.

I am trying to follow this guide:
Code:
https://wiki.cyanogenmod.org/w/Build_for_h901#What_you.E2.80.99ll_need
in order to build cyanogenmod for my H901, but after the initial repo sync "completed" without error, i follow the guide through breakfast and the the file extraction, and brunch fails to build all targets. after this, doing repo sync again gives me this:
Code:
Fetching projects: 99% (524/529) Fetching project CyanogenMod/android_hardware_qcom_display
Fetching project CyanogenMod/android_hardware_qcom_display
Fetching project CyanogenMod/android_hardware_qcom_display
fatal: Couldn't find remote ref refs/heads/cm-13.0
error: Cannot fetch CyanogenMod/android_kernel_lge_pplus
error: Exited sync due to fetch errors
I want to say this is due to the v10 not being a "supported device" for CM13 yet, as it is not listed on the lunch menu. but i was running the test builds in the dev section just fine, and i'm sure it's a fairly simple matter to pull the right stuff from git, but i'm a newbie to this kind of development.
After successfully building from source, i want to build a custom rom based on CM13 and keep the LG stock camera app, and the LGSignboard second screen function, and gain all the Cyanogenmod goodies too. any help or guidance with that quest would be appreciated.
I really hope someone can answer this for you.. :/
I think, you are trying to sync cm-13.0 branch of cyanogenmod lge_pplus kernel repo in your local manifest. But this is not there. Its only the cm-12.1 branch there: https://github.com/CyanogenMod/android_kernel_lge_pplus. For cm-13 you will need a different kernel source path. Hopefully there are already cm-13 roms for your device and with sources on github, where from you can sync?
Okay, that makes sense.
I was following a guide on CM wiki to build CM13 for the v10, why would that branch not be present on github if there is a guide to build from it?
I'll poke around github and xda for available kernel source.
Sent from my LG-H901 using XDA-Developers mobile app

[GUIDE] Building Pure Nexus

Introduction
Alright guys, there was a lot of talk about building Pure Nexus in the main thread, which was a little irritating for some so now we get our own thread! In this post, I will be giving you some resources to go over in order to help you with compilation. If you have any questions, just ask!
If you compile successfully, feel free to share your accomplishment and your computer specs
Compilation Guide
This is available on my Github, where it may be a little more up to date.
0. Getting started
In this guide, I will go over how to build Pure Nexus on your Linux machine. This particular tutorial will focus on Ubuntu 16.04 (Mint 18 is also good) since that is what Google recommends but this should work with any version of Linux (here are steps for setup with Arch Linux, which will cover step 1); it does need to be 64-bit however. I will leave the installation of that up to you, Google is a wonderful resource. If you don't have a good computer but still want to build, check out this thread on XDA: http://forum.xda-developers.com/chef-central/android/guide-how-to-build-rom-google-cloud-t3360430
1. Set up your environment
1. Automatically
Code:
sudo apt-get install git-core
git clone https://github.com/akhilnarang/scripts
cd scripts
ls
bash <script-name>
<script-name> should be one of the scripts in the folder for your particular architecture.
2. Manually
1. Install Java 8
Code:
sudo apt-get update
sudo apt-get install openjdk-8-jdk
sudo apt-get install openjdk-8-jre
2. Install other build tools
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip
2. Configure repo and git
If you have any problems with the below commands, try running as root:
Code:
sudo -s
Git is an open source version control system which is incredibly robust for tracking changes across repositories. Repo is Google's tool for working with Git in the context of Android. More reading if you are interested: https://source.android.com/source/developing.html
Run these commands to get repo working (only do this if you did the manual set up method above:
Code:
mkdir ~/bin
PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
Run these commands to get git working:
Code:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
3. Download the source
First, before downloading the source, create a folder for the source and move into it.
Code:
mkdir ~/<foldername> (eg. mkdir ~/PN or ~/PureNexus)
cd ~/<foldername>
Then, we need to grab the manifest and sync down the repositories. Here are the commands to do this for Pure Nexus for Nougat (make sure you are in the source folder you made above):
Code:
repo init -u https://github.com/PureNexusProject/manifest.git -b android-7.1
repo sync --force-sync
NOTE: The value for the -b flag, "android-7.1", may change; you will need to go to the manifest's page and see what the branch currently is.
Here is the process generally for other ROMs:
When you go to build a ROM, you must download its source. All, if not most, ROMs will have their source code available on Github. To properly download the source, follow these steps:
Go to your ROM's Github (e.g. http://github.com/PureNexusProject)
Search for a manifest (usually called manifest or android_manifest).
Go into the repo and make sure you are in the right branch (located right under the Commits tab).
Go into the README and search for a repo init command. If one exists, copy and paste it into the terminal and hit enter.
If one does not exist, you can make one with this formula:
Code:
repo init -u <url_of_manifest_repo>.git -b <branch_you_want_to_build>
For example:
Code:
repo init -u http://github.com/PureNexusProject/manifest.git -b android-7.1
After the repo has been initialized, run this command to download the source:
Code:
repo sync --force-sync
This process can take a while depending on your internet connection.
4. Build it!
At this point, it'd be a good idea to set up ccache. ccache is a compiler cache, it stores previously compiled files in a directory and pulls from that instead of recompiling if nothing has changed. This speeds up compilation a LOT. If you want to use it, follow the below steps:
Open up your .bashrc file in your home directory using a text editor or nano and append this to the end of it:
Code:
export USE_CCACHE=1
Then type:
Code:
source ~/.bashrc
After that, run one of the below command (replacing the # with how many GBs of ccache you want, 50 is recommended)
Use this one if you used the manual method of set up in section 1:
Code:
prebuilts/misc/linux-x86/ccache/ccache -M #G
Use this one if you used the automatic method of set up in section 1:
Code:
ccache -M #G
After that, it's time to build!
Code:
. build/envsetup.sh
breakfast angler
mka bacon
After that, your computer will build the flashable zip file and if you see something that says make completed, you've done it!
Any time that you want to rebuild, type the following commands:
Code:
repo sync --force-sync
. build/envsetup.sh
breakfast angler
mka clobber
mka bacon
I also have a script to do this on my Github here
Frequently Asked Questions
1.1 Q: I got an error, what do I do??
1.1 A: Well to start, if it is anything with Ninja, I would go ahead and disable it. You can add this to your .bashrc file:
Code:
export USE_NINJA=false
Then type this
Code:
source ~/.bashrc
. build/envsetup.sh
breakfast angler
mka clobber
mka bacon
If it is saying you ran out of memory, follow this post.
If it isn't Ninja related, check out @AzraelsKiss's post here, where he has documented a few common issues. If none of those apply, post here with a detailed list of what you have done and we will do our best to help you.
1.2 Q: Can you guys share your personal builds?
1.2 A: No, personal builds are just that: personal. Beans releases whenever he feels that the release is ready for the masses and if a bunch of personal builds are floating around, that tarnishes the Pure Nexus name. We are more than happy to help get you up and running but we will not be sharing our builds. Thanks for understanding!
MOD EDIT - THIS IS A DEVELOPER DISCUSSION. NOT FOR ORDINARY USERS. There is No Rom for you to Flash. Nor will there be any support for you. Any ETA or other NON-DEVELOPMENT posts here will be removed without warning!
XDA:DevDB Information
A Guide to Building Pure Nexus for Nougat, ROM for the Huawei Nexus 6P
Contributors
nathanchance, BeansTown106
Source Code: https://github.com/PureNexusProject
ROM OS Version: 7.x Nougat
ROM Kernel: Linux 3.10.x
Based On: AOSP
Version Information
Status: Stable
Created 2016-09-15
Last Updated 2017-01-15
Building PureNexus Nougat
RESERVED
Building PureNexus Nougat
Ubuntu is what Google recommend for Android AOSP development. See you http://source.android.com/source/requirements.html
Sent from my Nexus 6P using XDA-Developers mobile app
XDA:DevDB Information
Building Pure Experience Nougat, ROM for the Huawei Nexus 6P
Contributors
Fralund
ROM OS Version: 2.3.x Gingerbread
Version Information
Status: Testing
Created 2016-09-15
Last Updated 2016-09-15
Fralund said:
Ubuntu is what Google recommend for Android AOSP development. See you http://source.android.com/source/requirements.html
Sent from my Nexus 6P using XDA-Developers mobile app
Click to expand...
Click to collapse
But you can actually use most any flavor you wish... You just have to figure out the speedbumps yourself. You can even build using OSX, but that's a whole nutter ball of worms...
Have a good one!
AzraelsKiss said:
I'm a little late, but better late that never... Brand new build with the brand new vendor and blobs... It runs so pretty...
Have a good one!
Click to expand...
Click to collapse
Link?
iSilverBullet said:
Link?
Click to expand...
Click to collapse
It's a personal build, so no link.
iSilverBullet said:
Link?
Click to expand...
Click to collapse
As nathanchance has already said... Personal builds shouldn't be passed around. It's disrespectful to the devs...
Have a good one!
nathanchance said:
Code:
export USE_NINJA=false
mka clobber
breakfast angler
mka bacon
Does that work?
Click to expand...
Click to collapse
Worked very well for me
For those of you that are building PN Nougat, are some minor customizations implemented yet? I ask since I am compiling a copy for myself right now.
laxattack said:
For those of you that are building PN Nougat, are some minor customizations implemented yet? I ask since I am compiling a copy for myself right now.
Click to expand...
Click to collapse
https://plus.google.com/+NathanBenis/posts/21sRasA8Abj
From the sound of Nate's post... He's just got the ROM to the point that he's ready to start on customization. We do have a power menu though.
Have a good one!
laxattack said:
For those of you that are building PN Nougat, are some minor customizations implemented yet? I ask since I am compiling a copy for myself right now.
Click to expand...
Click to collapse
Advanced reboot menu, ADB over network, and stock nav bar tuner and night mode re-enabled are the major ones right now.
Somehow haven't been able to get my virtual machine to compile PN over the weekend (really need to convert my old laptop into a Linux only machine, that's for another day).
So since I want my first N rom to be PN on my N6P and am waiting patiently for it, that means that my Samsung Tab S 8.4 is running Nougat first
Go figure!
GO PN
laxattack said:
For those of you that are building PN Nougat, are some minor customizations implemented yet? I ask since I am compiling a copy for myself right now.
Click to expand...
Click to collapse
nathanchance said:
Advanced reboot menu, ADB over network, and stock nav bar tuner and night mode re-enabled are the major ones right now.
Click to expand...
Click to collapse
What @nathanchance said. But I was surprised to find that after restoring all my previous apps, it works very well and very fast. Definitely faster than 6 builds. Too early to tell
Substratum works with no issues.
Could not get some apps to work like gmd gestures, etc . Not the roms fault but the apps have to be updated for nougat support.
kipue said:
Somehow haven't been able to get my virtual machine to compile PN over the weekend (really need to convert my old laptop into a Linux only machine, that's for another day).
So since I want my first N rom to be PN on my N6P and am waiting patiently for it, that means that my Samsung Tab S 8.4 is running Nougat first
Go figure!
GO PN
Click to expand...
Click to collapse
With some support from this thread, I had no issues compiling... ( I am a super newbie )
aalupatti said:
What @nathanchance said. [...]
With some support from this thread, I had no issues compiling... ( I am a super newbie )
Click to expand...
Click to collapse
Yeah something is wrong with my environnement, the repo sync does not even complete.
I suspect is that I need to give my VM more room to breeze RAM wise.
Anyhow, will see that on my side, that's probably quite OP already.
Thanks ^^
Hey, @nathanchance I'm pretty certain you are running Ubuntu on a VM, right? If so can you share how much memory and storage you have allocated to the VM? I didn't allocate enough space I don't think. Thanks!
I'm attempting to repo sync and it had failed a few times. Could this be due to lack of room on partition? I followed your guide.
Sent from my Nexus 6P using Tapatalk
jmtjr278 said:
Hey, @nathanchance I'm pretty certain you are running Ubuntu on a VM, right? If so can you share how much memory and storage you have allocated to the VM? I didn't allocate enough space I don't think. Thanks!
Click to expand...
Click to collapse
No I have a server I build on but I would say you should allocate half of your computer's memory at a minimum.
Sent from my Nexus 6P using XDA Labs
nathanchance said:
No I have a server I build on but I would say you should allocate half of your computer's memory at a minimum.
Sent from my Nexus 6P using XDA Labs
Click to expand...
Click to collapse
Thanks. I edited my post with another question. Could you have a peek for me please?
Sent from my Nexus 6P using Tapatalk
jmtjr278 said:
Hey, @nathanchance I'm pretty certain you are running Ubuntu on a VM, right? If so can you share how much memory and storage you have allocated to the VM? I didn't allocate enough space I don't think. Thanks!
I'm attempting to repo sync and it had failed a few times. Could this be due to lack of room on partition? I followed your guide.
Sent from my Nexus 6P using Tapatalk
Click to expand...
Click to collapse
I haven't been running Linux under VM for more then a year now but back then 8 GB memory allocated to VM was needed to build (I know some say 4 GB should do the trick but it never worded fine for me).
Disk space I would suggest at least 100-150 GB, If you have the space allocated 200-250GB, that will give you space for ccache and a custom kernel if you like.
jmtjr278 said:
Thanks. I edited my post with another question. Could you have a peek for me please?
Click to expand...
Click to collapse
Depends on what they are. If they are fetch errors, use this: https://android.googlesource.com/new-password
Sent from my Nexus 6P using XDA Labs
kantjer said:
I haven't been running Linux under VM for more then a year now but back then 8 GB memory allocated to VM was needed to build (I know some say 4 GB should do the trick but it never worded fine for me).
Disk space I would suggest at least 100-150 GB, If you have the space allocated 200-250GB, that will give you space for ccache and a custom kernel if you like.
Click to expand...
Click to collapse
Thanks @kantjer I have reallocated the space to 250gb and the memory to 4gb. That's the most I can use and run the VM. I will attempt repo sync again. I appreciate there help! Have been here a while and never attempted this. Wish me luck!
Sent from my Nexus 6P using Tapatalk

[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