2

I have the source code of a kernel. but i don't know whether the kernel is android kernel or Linux kernel. I have searched about it on google but i haven't found any proper answer. As i know ,android kernel is Linux kernel and some patches applied on it. so i think we can identify the kernel is for Linux or android.

1.Can i know this by seeing the source code, or by running any command or by any other method?

2.if it is android kernel, whether will it able to mount the Ubuntu file system?

Jagdish
  • 1,848
  • 3
  • 22
  • 33
  • 1
    Try `System.getProperty("os.name")` – Robert Harvey Jan 10 '14 at 03:34
  • An android kernel *is* a linux kernel, just a special one. Something fairly indicative of Android would be the existence of the Binder driver in the kernel, but that does not necessarily mean there will be a /dev/binder node as that is a file system property, not a kernel one. As there is no specific "ubuntu file system" the possibility of mounting any given one would depend if the kernel has compiled in or available as a module a driver for the particular filesystem of interest. – Chris Stratton Mar 21 '14 at 16:44

2 Answers2

2

A simple method to check if a kernel is for android.

If there is a file named "android.c" in "drivers/usb/gadget" folder, the kernel seems to be a android kernel, otherwise, it is not for android.

Though not very accurate, but very simple

zylx
  • 21
  • 2
  • This is unlikely to be reliable. The gadget framework has been both used, and *not used*, as the basis for Android's device-side USB implementation, at various points in history. – Chris Stratton Mar 21 '14 at 16:41
  • ·@ChrisStratton I guess that means if the file is there it is an Android kernel. If the file is missing, no conclusion can be drawn. – Uwe Geuder Feb 16 '16 at 09:03
0
  1. Look for AndroidKernel.mk in the kernel source root, if it's an Android kernel, it should be there.
  2. The Ubuntu file system is ext4 by default. I'm pretty sure all default kernel configurations include support for this filesystem. What is the motivation behind this?

BTW the presence of binder does NOT mean it is an Android kernel. The binder exists in the staging directory for all Linux kernels

Ishay Peled
  • 2,783
  • 1
  • 23
  • 37