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 ?
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.
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.
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).