[Q] Add driver to kernel - Android Q&A, Help & Troubleshooting

Hi,
I'm building a custom rom and everything works great except one driver!
I made a "make menuconfig" in kernel and the driver is not listed under device drivers. How can I add the driver?
I downloaded the Linux driver and successfully made .ko modules. Should I add the .ko module to kernel or the files "as is"?
After some hours of google this problem I found something about "linux-headers packages" insted of kompiling kernel.
"Reasons for NOT compiling a custom kernel - You merely need to compile a special driver. For this, you only need to install the linux-headers packages" - How?
Please help

Related

[Q] [SOLVED] How to Modify/Recompile/Rebuild a Kernel

Hi everyone.
I'd really like to know the steps to modify, recompile and finally build a kernel zip to flash on our O1.
For instance, I'm downloading the ThunderG Kernel from mik_os here: https://github.com/mik9/ThunderG-Kernel
But I really dont know how to procede.
The programming language seems to be C++, but...
Which compiler should I use to compile it?
The source code is 100+ Mb sized, how can I build the kernel in a simple zip to let me flash it through custom recovery?
I'm really new to all this, I've little experience in C/C++/Java programming, and I'd really like to know how to procede.
An example of initial use I'm interested in, is summing up various fixes from different kernel's and make a unique kernel to flash on my phone.
For the real example:
This: http://forum.xda-developers.com/showthread.php?t=929941
plus this: http://forum.xda-developers.com/showpost.php?p=11166426&postcount=47 (waiting for source from the author)
I'd be really glad to see a newbie (not completely ^^) step-by-step guide doing everything from Windows platform.
I already read other topics on this argument, but none of them had a real guide that could be useful to anyone.
I want to thank you in advance
I'm interested too!
To start with change ur pc os to ubuntu 10.10
ccdreadcc said:
To start with change ur pc os to ubuntu 10.10
Click to expand...
Click to collapse
Couldn't Compiling and building a source code be done from any platform?
As far as I know it should (though I'm not an expert ^^).
I'd like to know if this can be done from Windows, as I'm not planning to change os at the moment
You can always use a Live CD of Ubuntu 10.10.
badeaioan said:
You can always use a Live CD of Ubuntu 10.10.
Click to expand...
Click to collapse
That's not the problem, I already installed Ubuntu other times, but I did a complete format these days and I'm not planning to install it anymore for now.
I still believe that I dont need it to compile a C/C++ source
I'd like to know the steps so I can say it surely.
If Linux is absolutely needed, I just want to know
I thing, that it can be possible compile on other system (cygwin + compilers, library, ...) but you will must download huge dependent software/library/source code. It probably will have same size as whole system :-/
Ok you convinced me, let's say I want to do it on ubuntu, could someone make a guide for everyone?
that would be great!
Sent from my LG-P500 using XDA App
I use gcc for compiling stuff. How to turn the compiled stuff into a package (for flashing) however, is what I don't know
What I would also like to know is how to incorporate a kernel into a ROM. That would shed some light. Thanks to whoever answers this!
The ThunderG package includes a lot of things, do I have to compile the "kernel" folder only to build a kernel for flash?
I really don't know how to procede... ^^
I'm installing Ubuntu 10.10 right now trough wubi..
Sippolo said:
Couldn't Compiling and building a source code be done from any platform?
Click to expand...
Click to collapse
No, especially the kernel source code makes heavily use of filename case sensitivity.
In linux abcd.e and abcD.e are different files- in windows they are not.
Extract a linux Kernel in windows and you will see what I mean.
So even if you got the cross compilers and libs together you will not be able to compile the kernel.
Cygwin is a way- but you could also run XUbuntu with VirtualBox which easier.
The best and fastest is a native linux system.
Sippolo said:
The ThunderG package includes a lot of things, do I have to compile the "kernel" folder only to build a kernel for flash?
Click to expand...
Click to collapse
Get the android ndk, extract it and append the folder with "arm-eabi-gcc" to your system path (export PATH=$PATH:"$NDKPATH/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin").
Extract Thunderg_Kernel.tar.gz, go to the directory and run "make thunderg-perf_defconfig" that will create a .config for the kernel. Or grab your O1 config from /proc/config.gz (per adb, ftp server app, copy with file manager to sd card...) and move it to $kerneldir/.config.
Have a look at "make menuconfig" and then try "make zImage".
Maybe you must install a few dependencies with synaptic (when you are using ubuntu).
kpbotbot said:
I use gcc for compiling stuff. How to turn the compiled stuff into a package (for flashing) however, is what I don't know
What I would also like to know is how to incorporate a kernel into a ROM. That would shed some light. Thanks to whoever answers this!
Click to expand...
Click to collapse
Load mik_os' touchscreen fixed kernel and extract the zip file.
Delete the cert* and manifest* files under META-INF.
Change the zImage under Kernel maybe the kernel modules (system/lib/modules) too.
ZIP it all together again (directory structure must be the same as in mik_os' zip).
To sign read this: http://www.robmcghee.com/android/creating-an-android-update-zip-package/
or this: http://www.londatiga.net/it/how-to-sign-apk-zip-files/
hello, first of all to compile a kernel you need to config this kernel (enabling the drivers you are intersted in, kernel tweaks... and so on)
to do that (on linux) go to your kernel directory and run this command
make menuconfig
this would run the gui config for the kernel where you can configure the kernel.
anyway every board or device has it's own configureations os the kernel can handel the hw on this device you can start gussing what are the right configurations for the P500 which is not an option at all hehehe
or you can use the predefind config included in the Thunderg kernel
to use that config go to the kernel folder and run this command
make thunderg-perf_defconfig
this command will configure the kernel with the predefind configuration
after that you need to compile the kernel using a cross platform compiler, the machine you are working on is x86 but P500 mobile have an ARM cpu so you can't just compile the kernel for your machine and run it on the mobile to do that find a cross compiler on the net (i use the CodeSourcery) then compile your kernel using this command
make CROSS_COMPILE={path to the corss compiler bin}
after finishing the compile process (first time it would take a while) you will find a file called "zImage" which is the kernel for the ARM cpu under the directory arch/arm/boot inside your kernel directory
then to flash that image to your device you need to create your own ROM and sign it then flash it using the coustom recovery.
hopt that this info is useful and sorry for any wrong information
Thanks everyone
I found out that android ndk solution was much easier and straightforward.
Now I've my zImage ready in "ThunderG-Source/arch/arm/boot/" directory (not in the kernel directory as waleedq stated?).
Now I cant understand the meaning of "signing" my kernel to a custom ROM, I'm using the custom recovery from http://forum.xda-developers.com/showthread.php?t=844483
I've read the two articles above about signing an application .apk to your rom and generate an update package.
But here I dont have an apk but a zImage which I really dont know how to use ^^
Isn't there a way to directly create the kernel update zip file and flash it with custom recovery?
P.S. Surfing on the web I found this link, might be useful to someone: part1: http://lazydroid.com/2010/06/how-to-compile-kernel-part-1/ part2: http://lazydroid.com/2010/06/how-to-compile-kernel-part-2/ It just explains what you have already explained though
Sippolo said:
Thanks everyone
I found out that android ndk solution was much easier and straightforward.
Now I've my zImage ready in "ThunderG-Source/arch/arm/boot/" directory (not in the kernel directory as waleedq stated?).
Click to expand...
Click to collapse
Your "kernel" directory has the name "ThunderG-Source"
It is all ok- waleedg didn't mean the "kernel/kernel" directory
Sippolo said:
Isn't there a way to directly create the kernel update zip file and flash it with custom recovery?
Click to expand...
Click to collapse
Read my post more thoroughly (I have edited it)
Yeah I did understand what you wrote in that reply, just was wondering what is "signing" actually, but I found out when doing it
Now I've my signed kernel update to flash
I used the SignApk jar program to do it, it's fast and I've everything already done and ready for future signing (certificate and key must not be remade each time as far as I see, I just need to sign each new zip with the already present certificate/key).
Thank you everyone, now I'm finally done with this request, it's solved
Side Question to waleedq: will you publish the code of your workaround for axis inversion? I'm curious which source file handle these things, should be /drivers/input/touchscreen/mcs6000_ts.c, am I wrong?
Sippolo said:
Yeah I did understand what you wrote in that reply, just was wondering what is "signing" actually, but I found out when doing it
Now I've my signed kernel update to flash
I used the SignApk jar program to do it, it's fast and I've everything already done and ready for future signing (certificate and key must not be remade each time as far as I see, I just need to sign each new zip with the already present certificate/key).
Thank you everyone, now I'm finally done with this request, it's solved
Side Question to waleedq: will you publish the code of your workaround for axis inversion? I'm curious which source file handle these things, should be /drivers/input/touchscreen/mcs6000_ts.c, am I wrong?
Click to expand...
Click to collapse
yes i am publishing the code , today if i got some spare time
and about the mcs6000_ts.c yes this is the driver that handel our screen
here is the workaround source code
https://github.com/waleedq/ThunderG-Kernel/blob/thunderg_oc/drivers/input/touchscreen/mcs6000_ts.c
i just forked nik_os kernel and added my workaround code to it so now all the features are implemented
waleedq said:
here is the workaround source code
https://github.com/waleedq/ThunderG-Kernel/blob/thunderg_oc/drivers/input/touchscreen/mcs6000_ts.c
i just forked nik_os kernel and added my workaround code to it so now all the features are implemented
Click to expand...
Click to collapse
That's perfect, thank you
you are welcome my friend hope that someone will make it better than this stage

[Q] Compile bcm4329 as built-in?

I was following some guide to compile pershoot's kernel, and I compiled everything as built-in and disabled module support. After I installed the new kernel, the wifi can not be turned on. Any suggestions? (I'd really love to have a all-in-one kernel without "modprobe" things)
Thanks in advance.
You may want to check out Clemsyn's kernels. He typically builds his as all in ones.
Thanks. I've tried all Clemsyn's latest kernels (with Calkulin's ROM, if that matters) and none will boot (stucked at the viewsonic birds logo). I am not sure if that is related to OC... but I still need a kernel that has nls-gb2312/utf8 support.
Interestingly, I unzipped Clemsyn's kernel zip and found his /system/ also has bcm4329.ko as a module. Is it true that wifi driver must be compiled as module to work?
I saw my adb logs that Wifiservices is complaining about driver not available. I assume this must be a failure of "modprobe". How can I manually enable the wifi? Is there some equivalent command like "ifup wifi"?
It seems android wifi.c is making a hardwired assumption that wlan0 driver is compiled as kernel module. To support all-built-in kernel, I must recompile android as well. Could someone point a link to HOWTO-style guide for compiling android 2.2 from scratch? Preferably Calkune's ROM.
Thanks!

adding governor to kernel breaks mtp

im compiling 4.4.4 via slimkat source. when i add the governor(s) mtp and file transfer, both windows and ubuntu, breaks. just recieved the device and little to know support for it. steps involved-1. built kernel source and flashed kernel=no problem. 2. added govervor(s) and flashed=no mtp or file transfer. 3. including governors in rom build= not an option. the modules will not build. i edited the defconfig multiple ways, the kernel will build, not adding the new governor(s). adb access is working. any suggestions?

TP-LINK WN722N (ath9k driver) install on Ubuntu touch 15.04 (Nexus 10- Manta)

I've been through all the relevant threads on AskUbuntu and they are either outdated, conflicting and/or dont work.
My Nexus10 sees the atheros AR9271 device on Bus 001 USB but does not create an additional WLAN for it.(wlan0 is the normal integrated wifi) I assume I need the ath9k or ath9k_htc driver? I installed backports 4.4.2-1 and unzipped it. If I try to do a 'make' or 'make clean' I get:'your kernel headers are incomplete/not installed'. I've already got the latest version of build-essential. If I try to install 'firmware-atheros', it cannot find the package. I've been through several other things to no avail.
I've read the driver is installed with 15.x+ anyway, true? and if so how to install it? If someone could do a step-by-step wifi driver install for a U-touch or at least Ubuntu 15.x I'd be very very grateful.
I do not want to bridge the 722n, I want to use it instead of the integrated card. Not even there yet, but just in case it matters.
Thanks!
roninisc said:
I've been through all the relevant threads on AskUbuntu and they are either outdated, conflicting and/or dont work.
My Nexus10 sees the atheros AR9271 device on Bus 001 USB but does not create an additional WLAN for it.(wlan0 is the normal integrated wifi) I assume I need the ath9k or ath9k_htc driver? I installed backports 4.4.2-1 and unzipped it. If I try to do a 'make' or 'make clean' I get:'your kernel headers are incomplete/not installed'. I've already got the latest version of build-essential. If I try to install 'firmware-atheros', it cannot find the package. I've been through several other things to no avail.
I've read the driver is installed with 15.x+ anyway, true? and if so how to install it? If someone could do a step-by-step wifi driver install for a U-touch or at least Ubuntu 15.x I'd be very very grateful.
I do not want to bridge the 722n, I want to use it instead of the integrated card. Not even there yet, but just in case it matters.
Thanks!
Click to expand...
Click to collapse
anyone anyone, Beuller...
Hey, saw this was unanswered and figured I could help. First off, you will not be able to compile or install headers in the Ubuntu Touch system, as /lib/modules/<kernel version> is a bind-mount into the read-only LXC system image, one way to work around this issue on device is to mount the LXC container's system image read-write somewhere, move out the lib/modules directory to someplace else, umount, reboot and then link your moved lib/modules back into /lib/modules. You will need to do this compilation outside of your Nexus 10 in a cross-compilation environment or in an armhf chroot (imho, a chroot running the ARM build of Ubuntu works very well for this).
Once you have that, you can install the kernel package for your device (which I believe are labeled linux-headers-manta and linux-image-manta respectively) and build the driver you seek. However the kernel already comes with backports 4.4.2 in it's tree, so you may be able to apt-get source linux-image-manta and build the driver and/or the kernel itself if you wish. (I believe building the kernel builds the firmware needed for the drivers as well, but I have no way of knowing as I haven't actually rebuilt any drivers with firmware yet in my foray into linux-image-flo's source.)
One piece of advice: Make sure to join together the config.*.ubuntu files under the debian.flo and debian.master folders to get the working .config for your device. The defconfig from arch/arm/configs doesn't have all the needed options for uTouch and won't boot it.
Your 'thanks meter' improved, and big thanks for answering, but this is beyond my level. Was hoping I could run an external wifi stick on a tablet with some flavor of linux, but looks like a no go for mortal users.
roninisc said:
Your 'thanks meter' improved, and big thanks for answering, but this is beyond my level. Was hoping I could run an external wifi stick on a tablet with some flavor of linux, but looks like a no go for mortal users.
Click to expand...
Click to collapse
Sadly at this time, it definitely seems to be. The normal linux way of building drivers doesn't work on here because the modules directory (/lib/modules/3.4.0-5-flo) is read-only, also due to this kernel headers cannot be installed, this can be worked around, but it is definitely not something that the casual user can do easily. I hope this will change so I could start compiling modules and NOT need to rebuild the entire kernel for it.
Glad I could be of help and I love answering questions, I am currently using Ubuntu Touch as my main OS on my Nexus 7 as I'm trying to make it into my own portable workstation. So I'm constantly digging into the system and learning what I can, and I love to share.

Kernel compiled from source breaks wifi

Hi I am new to kernel tweaking. I am trying to compile the kernel for Xiaomi redmi 5a for latest miui stock rom from source located at
https://github.com/MiCode/Xiaomi_Kernel_OpenSource/tree/riva-o-oss
After flashing the boot image created with compiled kernel , everything except wifi works.
Google search revealed that it is a common issue and one suggestion is to put the wil6210.ko (wifi related) file from compiled kernel in to system/lib/modules which doesn't work.
What confuses me even more is that even in if I delete the wil6210.ko from system/lib/module when the stock kernel is running , the wifi still works . It Seems like this kernel module has no effect on wifi.
But deleting the vendor/lib/modules/pronto/pronto_wlan.ko breaks wifi for stock kernel that came with the rom.
But compiling the kernel from source doesn't generate such files.
one related info at https://github.com/Genom-Project/android_kernel_xiaomi_vince-3.18/issues/2
I found a guide at https://github.com/MiCode/Xiaomi_Ke...#download-qualcomm-android-enablement-project that talks about wifi module.
The download seems to be to big and maybe too many unnecessary files will be downloaded. Tried to init and sync the repo. It seems huge. So if nothing else works will try this.
https://github.com/supercairos/android_device_xiaomi_land/issues/1#issuecomment-259458071 seems to provide a shortcut technique. It asks to download the prima folder from https://source.codeaurora.org/quic/...opensource/wlan/prima/tree/?h=LA.UM.5.3_rb1.1 (I can replace the h value to my kernels tag) , merge it into the source and then compile it to generate the prima_wlan.ko . I did so and also added CONFIG_PRONTO_WLAN=m ( m to compile as module) but such file is not being generated after compiling.
So please, if anyone went through something similar , help me with your recommendations.,
try lineage os aarch64 cumpiler and try prima wlan driver
u can use this https://github.com/baunilla/android...mmit/b7e6d4e6aed50d8ae652f292235be1398be5f344

Categories

Resources