What are the modifications done in linux kernel to make it an android kernel ? By this question I mean what are the differences between linux kernel and android kernel ?
3 Answers
I think this Android Source is a great documentation for understanding it.
And here is a list of changes done from mainline kernel for android kernel 4.14.
The largest features include:
- 19.8% Energy Aware Scheduling (kernel/sched)
- 13.8% Networking (net/netfilter)
- 13.5% Sdcardfs (fs/sdcardfs)
- 9.4% USB (drivers/usb)
- 7.2% SoC (arch/arm64, arch/x86)
- 6.2% f2fs (fs/f2fs -- backports from upstream)
- 6.1% Input (drivers/input/misc)
- 5.4% FIQ Debugger (drivers/staging/android/fiq_debugger)
- 3.6% Goldfish Emulator (drivers/platform/goldfish)
- 3.4% Verity (drivers/md)
- 11.6% Other
Differences from LTS
When compared to LTS (4.14.0), the Android common kernel has 355 changes, 32266 insertions, and 1546 deletions (as of February 2018).
-
1
The differences change from version to version (both of Linux and of Android), and the exact kernel is different for each device. A kernel for Android is a mainstream Linux kernel, with additional drivers for the specific device, and other additional functionality, such as enhanced power management or faster graphics support.
Many features in the Android kernel are later added to upstream Linux after the open-source community has accepted (and perhaps modified) them, but others are never upstreamed, either because they're not acceptable to the Linux kernel developers, or because they're only applicable to Android or to specific hardware.
-
3Most drivers for android specific hardware was accepted into mainline kernel; but some features, such as the wake lock which caused a huge controversy some time ago, remains problematic because mainline and android kernel developer disagree whether it's a good idea.– Lie RyanCommented Jun 21, 2013 at 0:57
-
" A kernel for Android is a mainstream Linux kernel, with additional drivers for the specific device, and other additional functionality, such as enhanced power management or faster graphics support", so it's mainly drivers? No source code changed? Commented Aug 4, 2017 at 8:12
-
@GuerlandoOCs I'm not sure what you think drivers are if not a source code change, but regardless, the "other additional functionality" I mentioned is quite big these days. There are many source code changes. Commented Aug 7, 2017 at 9:29
-
@DanHulme are the source changes patches or just code changed by hand? How can I see things that changed? I've read that you can patch your linux kernel to be compatible with android, but where are those patches so I can read them? Commented Aug 8, 2017 at 1:59
Beside the device specific differences and wake lock that Dan Hulme and Lie Ryan mentions, Android removed System V IPC features (message queues, shared memory segments, semaphores) that could lead to resource leaks (http://www.kandroid.org/ndk/docs/system/libc/SYSV-IPC.html). This probably is just a matter of configuring the kernel build. Also the Android IPC of choice, called Binder, has some support in the kernel that to my knowledge is not included in standard Linux kernels.