[Q] Porting kernel? - Android Q&A, Help & Troubleshooting

Hi guys, I'm doing a Cyanogenmod 12.1 porting for my device that is unsupported. I can build everything and I get a flashable zip but I'm using a prebuilt stock kernel image extracted from the stock lollipop rom. After flashing, the phone does not boot and It's impossible even to access to logcat, so I think it's a kernel related issue. My question is:
- I have the stock kernel source (v.3.10) given by the vendor
- I have the cyanogenmod kernel source (v.2.69)
Do I have to build the stock kernel or I can build the cyanogenmod one by merging the drivers modules and others stuff?
And if I flash a wrong kernel image can my device become unusable?
I read that is not fair importing built kernel modules from other kernel version, but if I merge the kernel trees, is it the same?
Sorry in advance if my question is a noob question

Well I don't know much about porting roms or kernels though. But with what I've heard flashing the wrong kernels can permanently render your phone useless..
Sent from my Tecno F7 a ...?

Related

[Q] Building Kernel for 4.2

Ok I have my 4.2 sources and jackpot 3.0 master kernel,
android1234567 stated, "
I don't think I made a 4.2 kernel with the radio driver included. The kernel on my GitHub (sultan-kernel-jackpot-3.0) can be used with Android 4.2.X as long as it is built with the Android 4.2 sources/ramdisk (I used CM10.1 sources to build it). The way the kernel is packaged for this device is that the kernel source is built and generates a kernel image, then the kernel image is packaged with the ramdisk and recovery to create a boot.img (which can be flashed to the device). The reason why the current kernel isn't compatible with Android 4.2 is because the ramdisk and other parts of the boot.img (besides the kernel image) are built for Android 4.3 and don't work with 4.2. That means that the kernel source on my GitHub is fully compatible with Android 4.2 but it just needs to be put together with the proper Android 4.2 sources."
I need to turn jackpots 3.0 master kernel into a bootable kernel for slimbean 4.2 to get the FM radio driver working.
https://github.com/sultanxda/sultan-kernel-jackpot-3.0
If someone could point me in the right direction on what to do Id be very happy. I'm using Sultan Kernel r5 now but it doesnt have the FM driver. I want to add this into slimbean 4.2, Any advice would be most welcome.
mrshane88 said:
Ok I have my 4.2 sources and jackpot 3.0 master kernel,
android1234567 stated, "
I don't think I made a 4.2 kernel with the radio driver included. The kernel on my GitHub (sultan-kernel-jackpot-3.0) can be used with Android 4.2.X as long as it is built with the Android 4.2 sources/ramdisk (I used CM10.1 sources to build it). The way the kernel is packaged for this device is that the kernel source is built and generates a kernel image, then the kernel image is packaged with the ramdisk and recovery to create a boot.img (which can be flashed to the device). The reason why the current kernel isn't compatible with Android 4.2 is because the ramdisk and other parts of the boot.img (besides the kernel image) are built for Android 4.3 and don't work with 4.2. That means that the kernel source on my GitHub is fully compatible with Android 4.2 but it just needs to be put together with the proper Android 4.2 sources."
I need to turn jackpots 3.0 master kernel into a bootable kernel for slimbean 4.2 to get the FM radio driver working.
https://github.com/sultanxda/sultan-kernel-jackpot-3.0
If someone could point me in the right direction on what to do Id be very happy. I'm using Sultan Kernel r5 now but it doesnt have the FM driver. I want to add this into slimbean 4.2, Any advice would be most welcome.
Click to expand...
Click to collapse
Read here: http://wiki.cyanogenmod.org/w/Development?setlang=en
Meticulus said:
Read here: http://wiki.cyanogenmod.org/w/Development?setlang=en
Click to expand...
Click to collapse
Thank you, this is a viable source that will help me learn coding and development. I will study and work on building using this guide. :good:
mrshane88 said:
Thank you, this is a viable source that will help me learn coding and development. I will study and work on building using this guide. :good:
Click to expand...
Click to collapse
If you have any more specific questions. Let me know, I'll do my best...

how to port device to different flavor of android?

Ok so I have built cm11 for my device (galaxys s 4g), and ported cm11 from another device to (aries -> galaxy s 4g). CM11 has too much going on IMO and I just want pure aosp on my device, the problem is that there are no (recent) aosp roms for my device, or any similar devices.
So how do I port my device to a different flavor of android when there are no roms of that flavor?
What have I tried?
So far I have setup the aosp 4.4 repo to a different folder than my cm11 repo (the build environment files should be the same right?)
I tried using the manifest from the cm11 rom and buidling with aosp,that didnt work it didnt even finish compiling =(.
I browsed the aosp source for other devices by the same manufacturer, but everything looked completely different from what I am used to.
The most helpful guide in this direction sofar has been cyanogenmods guide but it has left me with more questions than answers.
What [I think] I need to know
Custom recovery - aosp doent seem to include a recovery, the cm guide says to start with the recovery. So i need to know if I need to add a custom recovery to aosp, or if i can install aosp roms from twrp without breaking it.
Binaries - It is safe to use the binaries used in CM11 for aosp/any other flavor, or are the binaries flavor specific? (im thinking they are safe to use, but not entirely sure).
Device files - what files should be safe to use for any flavor?
Kernel - Cm builds the kernel when you compile the rom (or so it says), does aosp build the kernel when you build the rom, or do I have to build the kernel separately? Is it safe to say use a CM11 kernel with an aosp rom?

[Q]How to build a kernel

HEY GUYS,
My device is M8tl and I want to build an ElementalX kernel.... However, I am not familiar with it .I searched rhe forum but I cannot find a tourial like this....I have downloaded My device's kernel source from HTCDEV.com and ElementalX kernel source from GitHub... Can anyone tell me what to do next?Waiting for reply...

Android kernel how to make compatible with higher os? (+Where can I find the patch?)

Hello, I'm newbie dev trying to build CM13 for Lenovo Phab plus.
I think I'm almost finished with device and vendor, but I cannot figure it out what to do with kernel.
The circumstance is,
I have a stock kernel source which runs in 5.1.1 LP, with version of 3.10.49.
What I want is to make kernel compatible with 6.0.1.
I already know that linux kernel version doesn't have to be exactly same with new Android OS versions and I can just make a few patches in order to run kernel in higher OS.
So I googled and studied(?) for 2-3weeks, but got not many useful informations and I still cannot figure out where to find required patches for 6.0.1 .
So here's what I am not sure about.
1. I found that I can either upstream, merge, cherry-pick kernel sources from higher OS. For instance, if I merge kernel patches (starting from 3.10.50 to 3.18 step by step) and check if the kernel compiles successfully, is this a right thing to do? I am confused whether merging or cherry-picking is required for my situation.
2. I see lots of commits when comparing with other kernel sources in github. How do you find those kinds of patches? -> just keep compiling kernel and if error comes out->search->commit
Always this pattern goes again and again till boot properly?
3. i'm quite curious with backports. What i know is that "backports" are the files which is compatible for lower version kernels. For example, backported audio driver originally based on 4.9 can be used in kernels with version below 4.9. Is it right?
4. If there is an useful links, anything could be helped a lot.
THANKS IN ADVANCE.

Understanding different source components of the custom ROM?

I have been experiencing some problems lately compiling kernels, and just wanted to take a step back to try to understand the bigger picture of Android custom ROMS.
Let's take this Havoc OS for the Realme 2 Pro as an example:
https://forum.xda-developers.com/realme-2-pro/development/rom-havoc-os-t3925153
Under sources there are 2 links:
https://github.com/Havoc-OS
https://github.com/Havoc-Devices
1) Can anyone explain the difference between the 2 sets of sources (OS vs. Devices) and which ones would be used for the above custom ROM?
2) Can we assume that the official kernel has been used (see link below) or a modified/generic one instead? Is this kernel included anywhere in the Havoc source code links?
https://github.com/realme-kernel-opensource/Realme2Pro-kernel-source
3) What is vendor.img? Is it simply another name for the compiled kernel?
4) How does the kernel know which OS/filesystem it's booting and how easy is it to interchange another OS with the same kernel?
5) Can just the kernel be updated and flashed without updating the main OS of the custom ROM? If so, which partition is the kernel flashed to?
6) Could an entire custom ROM be booted from the recovery partition instead of the boot/system partition?
7) Any useful links/books/resources for Android ROM development from scratch?

Categories

Resources