Porting drivers to a clean kernel? - Android Q&A, Help & Troubleshooting

How can I port the vendor's kernel drivers for my model phone from their open-source kernel code to a clean kernel of a similar version number?
They are using 4.4.78 perf+ so presumably that would port to a generic android 4.4 kernel?
Is there any books or guides available to provide an overview of which parts of the android kernel get changed during development of a new model?
The reason I need to port the kernel source drivers to a clean kernel is because I cannot replicate the vendor's environment and have failed to make their source code standalone compilable - so it fails to build even some basic modules.

Bump - haven't found any info on how to work the Android Linux kernel in terms of the boot loader and drivers.

Bump!

Bump!

Related

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.

Anyone build a Cyanogenmod Rom or Android also for NanoPi-M2 with 8192cu?

I bought a S5P4418 based NanoPi-M2, the product information and wiki list below. It has a default Android 5.1.1 with sluggish performance ported by FriendlyARM and no USB wifi driver like 8188CUS or 8192CU ported, no AXP228 PMU driver ported.
wiki.friendlyarm.com/wiki/index.php/NanoPi_M2
The kernel source code lists below.
github.com/friendlyarm/linux-3.4.y
Android SDK list below.
github.com/friendlyarm/nexell_platform_s5p4418
github.com/friendlyarm/android_device_friendly-arm_nanopi2
github.com/friendlyarm/android_packages_apps_Settings
github.com/friendlyarm/android_vendor_friendly-arm_apps
github.com/friendlyarm/android_frameworks_base
github.com/friendlyarm/android_vendor_friendly-arm_build
github.com/friendlyarm/uboot_nanopi2
github.com/friendlyarm/android_hardware_samsung_slsi_slsiap
github.com/friendlyarm/android_vendor_nexell_apps
Since it is MicroSD card booted device, a tool is needed to make a bootable firmware.
github.com/friendlyarm/sd-fuse_nanopi2
Anyone here help me build a Cyanogenmod or Android 5.1.1 firmware with 8192cu and Axp228 driver enabled?

Driver development for a stock kernel possible?

Hello,
I've been trying to compile a driver to the stock kernel of my S3. I've ensured that I have the correct kernel version and have done a modinfo on the compiled driver to check the version magic string is correct. However I can't insmod the driver. I am root on the device when I try to do so.
I've managed to do this on other brands of phone which leads me to wonder if the S3 default kernel config from the open source repository correctly reflects .config that was actually used for the release kernel on the phone.
Is it possible to develop drivers for the stock kernel? (3.0.31-2788594, build number JSS15J.I9300XXUGNJ2 in my case). Does anyone have a correct .config for this kernel build?
regards,
Rob

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