I'm a Android application developer. For some reasons, I should change the Android kernel a bit. But I don't know anything about kernel. I will be appreciated if someone introduce me a website who explain android kernel modules and other info about it.
In the standard Android open source distribution the kernel is distributed as a pre-built binary in the mydroid/prebuilt/android-arm/kernel folder and the source code is not included. The kernel source was removed from the default manifest for two reasons as I take it. One is that it takes a lot of bandwith and diskspace for a platform component that most people will not work with much. The other reason is that since the kernel is built with the kernel build system and not as part of the aosp build system it makes sense to keep it separated. The common branch for the kernel is the one used by the emulator. There are also branches for experimental, msm (Qualcomm platforms) and Omap (TI platform) and maybe some more. If you want to use the Android kernel with hardware these may be more interesting to you.
Get the Android kernel either by adding it to your repo manifest or manually by running:
git clone git://android.git.kernel.org/kernel/common.git
The kernel built this way should end up in the arch/arm/boot folder of your kernel tree (where you put the code from git clone)
Note that I have used the default paths in the above description, you need to change them to what applies to your setup. It has been a some time since last time I tested this but I think it should work.
Go through the following sites which will also give u some ideas.
Android Porting, Android Platform, Android-Pdk,
Android porting in real target, Build-compile-linux-kernel-android
I guess that since you are talking about kernel programming you are also looking for ways to hook up new hardware with the platform and expose that functionality using your framework extensions to the applications. Hardware is basically added as a standard Linux driver so getting it to work under Linux is a good first step. How to hook it into the Android framework after that depends on what type of hardware it is. You could either use a native process to control it (compare the camera service or radio daemon in the current platform) or just spawn a thread in the application that uses your framework extension. For hardware that does not require that much attention plugging it in using an Android HAL library could also be an option
Related
I ask a question because I have been trying to solve problems with the keyboard for quite a long time without success. I want to understand how Android kernel modules are compiled. The task is to connect the USB WiFi adapter from Android via OTG and manage the terminal interface. But as an example for teaching fits perfectly. After reading many articles on the subject, I never came close to a solution.
But from what I read, I learned that:
There are two options: build the module into the kernel when compiling, or compile and load it separately (if it is possible that
the kernel will support this property).
The software required for compilation is: Android NDK, SDK.
You need the source kernels for which the modules are compiled (You can use a clean kernel similar in version and architecture, the
version must match up to the second digit after the dot).
Get the kernel assembly file with the device. (/proc/config.gz)
But that's all, I don't know what to do next. The device I use for testing Xiaomi Mi A1 (Android One) i.e. there are no problems with the kernel sources, plus active support for LineageOS, which is currently the main OS. Module sources that I want to build on GitHub marked "Android Support".
I don’t understand the procedure, is there a way to assemble like assembling a PC, i.e. for desktop it's just make, make install?! But I have no idea what to do in my situation.
If anyone has comments on the above, inaccuracies, errors, or any additional information, please let us know. It is also a very important question how to check whether the kernel supports loading modules on the fly or what needs to be corrected for such features, although without a ready-made module this is not so important, but still ?!
I would be glad for any information, I can’t figure it out myself anymore. information in various sources varies and there is no universal assembly method.
I downloaded android device open source from Samsung OSRC.
It was composed with Platform.tar.gz and Kernel.tar.gz
It seems to do with building AOSP, found mk files.
I'm curious whether it can be used(directly or indirectly) to build newer android version for device and whether I have to build new kernel based on this files.
Thank you.
If you want to build for a newer Android version, you do not need to build another kernel. Just use the kernel provided by Samsung for your device (or the prebuilt kernel from your phone).
When porting a device to a newer Android version you need to adjust the init configuration (init.rc files from your product configuration located in device/<vendor>/<your_device>), but not the kernel specific parts of your init.rc files.
You also need to add the hardware specific vendor binaries to your resulting flash image. Therefore you can extract these libraries from your device. Most of them are located in /system/vendor/lib, but there could be also some libraries in /system/lib and all subdirectories.
It is also possible that some vendor binaries does not work within another software stack. Possible reasons are incompatible HAL interfaces and incompatible libraries. The solution for these cases can be very different and should be evaluated individually.
If you are facing such issues you can have a look at the CyanogenMod sources for a hint. There you can find lots of ports. Best place to look is the product configuration of the particular device. You can also look into another of my answers regarding this topic.
How can I use SCTP protocol in Android?
I'm already aware that that Android systems don't support SCTP by default, however it's may be possible to enable it by inserting SCTP kernel module, or rebuilding the kernel with SCTP enabled in modules configuration.
I need some insight on this issue. Is it possible? How to make android support the protocol? How to build kernel module and insert it correctly? If we could succeed in making the system to support it, how we can use the protocol? Does the Java API on android support SCTP?
Going about it with a module is the right way. To answer your questions:
SCTP is already provided as a kernel module in the Linux source tree - "CONFIG_IP_SCTP=m" would enable that module. And you can change that to a "y" to hard link, though that is probably unfeasible, since you'd have to rebuild the entire kernel for that.
The module would have to still be built per kernel version. So basically per vendor, you'd need to get their kernel sources (doable), and then compile your module against it.
To use: In User mode - would create the socket by calling s = socket (AF_INET[6], SOCK_STREAM, IPPROTO_SCTP); From that point, socket APIs work exactly the same, with a few exceptions (namely setsockopt, which is particular for the protocol type).
From Java - does in fact support the protocol in its latest incarnations (JDK7 as of milestone 3), but that Java supports it doesn't mean that Dalvik (the "java vm" of Android) does. Though Android does have SCTP support "in the ready", it's not yet in Dalvik (at least not in 4.2). You could create a Java class, though, as in a package, that would wrap a native library with SCTP calls. It's a bit trickier in Android because of the NET permissions, but still manageable (from experience).
I was inspired by this previous question, but I didn't get the whole picture.
I'm developing a kernel and Android system for a new device which is based on a commercial chipset platform.
The chipset vendor provides me with a 'fixed kernel code zipped','android proprietary sources','modem sources'.
All these parts are paired, E.G., I can't change(to some extent) one of the platform elements(kernel,modem,system) without effecting other parts.
It's also quite limiting, what will happen if there is a need for a newer version? I can't be sure i'll get vendor's sources for it.
So here are some flows I made:
=============================================================
Workflow1: - I don't need newer version, i need release device now!
1.Download the latest public kernel the chipset provider and his system
2.Add my own drivers into the kernel
3.Add proprietary source into the build
4.compile -> everything is already configured
5.debug -> little
6.patch -> little
7.release -> fast
8.give an update? -> fail!? - i need new kernel/system from chipset vendor.
==================================================================
Workflow2: I dont need the vendor
1.Download a clean android system from google/cyanogem etc..
2.Add my drivers to the kernel
3.Get kernel patches from the chipset vendor's sources
3.Build device directory for proprietary files
4.configure/patch the proprietary to compile with the system -> hell
5.face alot of low level bugs -> hell
6.debug/patch
7.miss deadline and get fired
Any idea how this actually works in major mobile device manufacturers?
Thanks!
I'm working for one of chipset vendors. We provide reference kernel and reference android sources for our costumers. But we provide them not as "zipped source", but as git repository, so costumers can see all patches we put in kernel/AFS/etc and merge them into theirs repositories.
So, in your case I recommend you to ask your vendor for access to a git repository. If it is impossible, I reccomend you to use workflow 1. If you need a major update (like switch from GB to ICS), you'll need new vendor's sources anyway. Minor updates can be done on top of existing sources.
Does someone have the source for Android loadable kernel module for libnfc?
If not, can someone tell me how it can be done?
As final option, if you have it build already, can you share its download URL?
On a side lining question, i read that linux kernel 3.1 actually has NFC support in it. Does that mean if kernel 3.1 was ported to android then it would have inbuilt support? If so, do you know anyone who has a kernel 3.1 version for android?
Linux kernel 3.3 has merged the Android kernel features, and therefore now u have Android kernel 3.3 potentially to come out very soon. NFC supports is in the drivers/nfc (kernel source) directory, take a look at the files that. Another resource found is this: http://appelmelk.wordpress.com/2011/02/17/porting-libnfc-to-android/ and another document: https://docs.google.com/open?id=160clTJ-sSgHiNKd-IsFHGzZY8M9HQudYqHnp0mD09NBTPfZmm9mP_NEMV3E3 (not written by me).