Please help me with 3.x kernel compilation... - Android Q&A, Help & Troubleshooting

Hi,
Please tell me how to compile a 3.x kernel from sources of 2.x kernel (i know it won't be fully functional,i just need a point to start i think then i'll be able fix bugs in C lang).
what i've done - downloaded 3.0.63 source from kernel.org.
there was a config for msm devices,i used it and configured it according to msm7x30 board (which i have) and built it with that config.
build was successful and i got zImage and wireless.ko.
But i'm still afraid of flashing it as i doubt (because i've not added single file from 2.x source) that may be it'll hard brick my device.So please devs tell me some basics of porting newer kernel.
Thanks...

Related

Kernel sources

I have a Garminfone and have done a lot of Rom hacking with it so far, enough that I want to port cyanogen to it now. In the config.gz file there are references to Garmin specific items... how do I go about figuring what is included in the kernel and if the stock one might work with the right config settings. I know that they load a few ko modules at boot, but I don't know the requirements for when they must release kernel sources and what to do with it if they do.
I know they have released some in the past for the a10 but not the a50, and none for the 2.1 build.
I do know that they use the 2.6.29 kernel so is there a chance that I could use the current kernel with froyo?
Any assistance would be appreciated.

Q on building the "latest" Android Kernel

I have a general question about building the Android kernel. For understanding purposes, I'm a C/C++/C# developer (and Android application developer), but have little functional knowledge of the Linux kernel.
With regard to porting Android, I'm curious how one builds the latest Kernel. The Android Kernel is not simply the standard Linux Kernel branch, correct? Where does one get the latest "Android" Kernel from? Does Google host a Kernel site as part of AOSP that we can sync with?
Once you have the latest Kernel, is it simply a matter of ensuring the Make file is accurate, adding the appropriate device drivers (as .so files?) for your particular hardware, and performing a Make? Then I assume you can update your device's Kernel with the one you've buildt?
In closing, for example, I'd like to sync the Android 3.0 Kernel, update the drivers necessary for my EVO 4G, build the latest Kernel, and then flash it to my phone. Just looking for some insight as I start getting educated on the topic.
Thanks for any advice you can offer!
Actually, the android kernel is very similar to the linux kernel (well it is based on the linux kernel). You can get the kernel from here: http://source.android.com/source/downloading.html. You can also take a look here: http://elinux.org/Android_Kernel_Download and here: http://elinux.org/Android_Kernel_Features. It will be quite difficult to build a kernel for your device without the source (there's none for 3.0.1 for your device), but you could still build it from a lower kernel version: http://linux.softpedia.com/progDownload/HTC-EVO-4G-Sprint-Kernel-Source-Code-Download-58254.html.
Thanks for the info, Theonew. When you say that it will be difficult for me to build the kernel for an EVO without the source, is that because the vendors (Qualcomm, for example) haven't made source for their devices available, so it's hard to build the drivers (.so files?) that are compatible with the latest kernel?
Shidell said:
Thanks for the info, Theonew. When you say that it will be difficult for me to build the kernel for an EVO without the source, is that because the vendors (Qualcomm, for example) haven't made source for their devices available, so it's hard to build the drivers (.so files?) that are compatible with the latest kernel?
Click to expand...
Click to collapse
HTC hasn't released the source of the kernel v3.0.1 (which comes in Ice Cream Sandwich) for your device (since it's not available for your device...yet at least).

[Q] Where to start for Android Kernel Development?

Hello Guys,
I see a lot of threads for starting with android rom development, but can anyone give me pointers for kernel development? I would like to start kernel development and do not know where to start. I am not interested in rom development at the moment, but that is because I assume that the android rom is like a user space app over the kernel. Please correct me if I am wrong. It would be great if you guys could point me to some beginner friendly kernel development tutorials. I am looking through Linux Device Drivers (LDD) book but am having a hard time comparing that with android. I have cloned mediatek 6589 source from android repository. I am submitting partial url cos I am not allowed to submit full url yet. URL(android.googlesource.com/kernel/mediatek/+/android-5.1.0_r0.2) since I am running a mtk6589 device (Walton X1/ Gionee Dream D1) and would like to understand where to start coding kernels for android. Any help would be greatly appreciated.
Oh and I would like mediatek specific help if possible. I have gone through some of the general kernel building and overclocking tutorials. I want to do some more enhancements if possible. Since mediatek seems to be the mysterious one with bare minimum source availability, I would like to take up that challenge
Thanks.
I don't have a tutorial for you but a small checklist. You need:
* Kernel source tree
* A config for your device (e.g. arch/arm/configs/*defconfig*)
* A cross compiler toolchain to generate ARM code (you can use the precompiled one from the Android source tree)
* A way to package your kernel into a boot image for your device - usually an Android boot image contains a compiled kernel (zImage), a compressed ramdisk for the root filesystem, and probably a device tree binary (dtb). Mediatek may do things differently.
* A way to install that boot image on your device - this requires an unlocked bootloader that allows custom boot images to be installed and started. Most devices use the fastboot tool for this.
Your first step should be to build a working kernel from unmodified sources. When you got that working, you can think about starting actual coding.
Thanks for the Pointer Mate
_that said:
I don't have a tutorial for you but a small checklist. You need:
* Kernel source tree
* A config for your device (e.g. arch/arm/configs/*defconfig*)
* A cross compiler toolchain to generate ARM code (you can use the precompiled one from the Android source tree)
* A way to package your kernel into a boot image for your device - usually an Android boot image contains a compiled kernel (zImage), a compressed ramdisk for the root filesystem, and probably a device tree binary (dtb). Mediatek may do things differently.
* A way to install that boot image on your device - this requires an unlocked bootloader that allows custom boot images to be installed and started. Most devices use the fastboot tool for this.
Your first step should be to build a working kernel from unmodified sources. When you got that working, you can think about starting actual coding.
Click to expand...
Click to collapse
Thanks man. Really appreciate the pointers. I do have some of the checklists done. Like
* Kernel source tree
** A cross compiler toolchain to generate ARM code (using the precompiled one)
* A way to install that boot image on your device
Now the problem is, my device still does not have its source code available. I got the general source tree from google which is not my device's so I dont have the defconfig. Is there a way to rip it out from a compiled kernel? Like using some sort of a decompiler? Also I will look around for zimage packaging tools. Thanks mate. Mediatek is apparently one hell of a problem child XD
syko_kickass said:
Now the problem is, my device still does not have its source code available. I got the general source tree from google which is not my device's so I dont have the defconfig. Is there a way to rip it out from a compiled kernel? Like using some sort of a decompiler? Also I will look around for zimage packaging tools.
Click to expand...
Click to collapse
If you're lucky, your existing kernel exposes its config in the file /proc/config.gz. If not, I don't know how to get a matching config - best is to avoid buying anything from GPL violators.

Porting AOSP issues

Hello,
I'm a beginner with building ROMs, yet I found an interest in build an AOSP for a phone(mi4c). I found the kernel sources released by the vendor, but I am trying to figure out the next steps: creating a device tree and getting the vendor blobs.
As I could check the kernel if for 5.1(managed to build it), and I would like to try to make that - AOSP 5.1.
Is there any way to extract the device tree from kernel(I found some device tree on git, yet I would like to know if there is another way to create it)?
for vendor blobs and which are required I found some information here on xda, but haven't tested so far.
Thanks!

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.

Categories

Resources