17

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 ?

7

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.

  • 3
    Most 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 Ryan Jun 21 '13 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? – Guerlando OCs Aug 4 '17 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. – Dan Hulme Aug 7 '17 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? – Guerlando OCs Aug 8 '17 at 1:59
5

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.

3

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

enter image description here

  • I don' t understand why people downvote ??? I wrote the answer , within 5 seconds i got downvote !! Nice – chankruze Oct 20 '18 at 8:56
  • +1 for your answer. Drive-by downvoters sucks. – iBug Oct 21 '18 at 11:48
  • +1. Yours is best among others. – Irfan Latif Jul 6 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.