Android kernel and driver-android kernel Introduction

Source: Internet
Author: User
Tags benchmark inotify

 

Some articles have already introduced the android kernel. This series will analyze the android kernel from the perspective of the Linux kernel, hoping to provide useful information for beginners. This chapter briefly introduces the full picture of the android kernel and plays an interesting role. Starting from the next article, we will detail each android kernel driver and its functions.
The android kernel is based on the Linux 2.6 kernel (the latest version is 2.6.31). It is an enhanced kernel version. Apart from modifying some bugs, it provides device drivers for supporting Android platforms. Its core drivers mainly include:
Android binder, a Driver Based on the openbinder framework, is used to provide inter-process communication (IPC, inter-process communication) on the Android platform ).
The source code is in drivers/staging/Android/binder. c
Android Power Management (PM), a lightweight Android power management Driver Based on the standard Linux power management system, has made many optimizations for embedded devices.
The source code is located in kernel/power/earlysuspend. C.
Kernel/power/consoleearlysuspend. c
Kernel/power/fbearlysuspend. c
Kernel/power/wakelock. c
Kernel/power/userwakelock. c
The low Memory Manager (low memory killer) is more flexible than the Linux Standard OOM (out of memory) mechanism. It can kill processes as needed to release the required memory.
The source code is in drivers/staging/Android/lowmemorykiller. c
The anonymous shared memory (ashmem) provides a large shared memory among processes, and also provides a mechanism for the kernel to reclaim and manage the memory.
The source code is located in mm/ashmem. C.
Android pmem (physical), pmem is used to provide continuous physical memory areas to the user space. DSPs and some devices can only work on continuous physical memory.
The source code is in drivers/MISC/pmem. c
Android logger, a lightweight logging device, is used to capture various logs of the Android system.
The source code is in drivers/staging/Android/logger. c
Android alarm provides a timer to wake up a device from its sleep status. It also provides a clock benchmark that runs even when the device is sleeping,
The source code is in drivers/RTC/alarm. c
USB Gadget driver, a device driver based on the standard Linux USB Gadget driver framework. Android USB driver is based on the gaeget framework,
The source code is in drivers/USB/gadget/
Android Ram Console: To provide debugging functions, Android allows you to write debugging log information to a device called ram console, which is a ram-based buffer.
The source code is in drivers/staging/Android/ram_console.c.
Android timed device provides timed Control for devices. Currently, it supports vibrator and LED devices.
The source code is in drivers/staging/Android/timed_output.c (timed_gpio.c ).
Yaffs2 file system. Android uses yaffs2 as the MTD nandflash file system. The source code is located in the FS/yaffs2/directory. Yaffs2 is a fast and stable cross-platform embedded device file system for NAND and norflash. Compared with other flash file systems, yaffs2 uses smaller memory to save its running status, therefore, it occupies a small amount of memory. The garbage collection of yaffs2 is very simple and fast, so it can achieve better performance. The performance of yaffs2 is particularly significant in large-capacity nandflash, and it is very suitable for large-capacity flash storage.
There are many files added or modified to the android kernel. The following list describes the files of the android emulator kernel:
Drivers/MISC/kernel_debugger.c
Drivers/MISC/pmem. c
Drivers/MISC/qemutrace/qemu_trace_sysfs.c
Drivers/MISC/qemutrace/qemu_trace.c
Drivers/MISC/qemutrace/qemu_trace.h
Drivers/MISC/uid_stat.c
Drivers/staging/Android/lowmemorykiller. c
Drivers/staging/Android/logger. c
Drivers/staging/Android/timed_output.h
Drivers/staging/Android/ram_console.c
Drivers/staging/Android/timed_gpio.c
Drivers/staging/Android/logger. h
Drivers/staging/Android/binder. h
Drivers/staging/Android/binder. c
Drivers/staging/Android/timed_output.c
Drivers/staging/Android/timed_gpio.h
Drivers/RTC/alarm. c
Drivers/RTC/rtc-goldfish.c
Drivers/NET/pppolac. c
Drivers/NET/ppp_mppe.c
Drivers/NET/pppopns. c
Drivers/Video/goldfishfb. c
Drivers/switch/switch_class.c
Drivers/switch/switch_gpio.c
Drivers/Char/dcc_tty.c
Drivers/Char/goldfish_tty.c
Drivers/watchdog/i6300esb. c
Drivers/input/MISC/gpio_event.c
Drivers/input/MISC/gpio_input.c
Drivers/input/MISC/gpio_output.c
Drivers/input/MISC/keychord. c
Drivers/input/MISC/gpio_axis.c
Drivers/input/MISC/gpio_matrix.c
Drivers/input/keyreset. c
Drivers/input/keyboard/goldfish_events.c
Drivers/input/touchscreen/synaptics_i2c_rmi.c
Drivers/USB/gadget/Android. c
Drivers/USB/gadget/f_adb.h
Drivers/USB/gadget/f_mass_storage.h
Drivers/USB/gadget/f_adb.c
Drivers/USB/gadget/f_mass_storage.c
Drivers/MMC/host/goldfish. c
Drivers/power/goldfish_battery.c
Drivers/LEDs/ledtrig-sleep.c
Drivers/MTD/devices/goldfish_nand_reg.h
Drivers/MTD/devices/goldfish_nand.c
Kernel/power/earlysuspend. c
Kernel/power/consoleearlysuspend. c
Kernel/power/fbearlysuspend. c
Kernel/power/wakelock. c
Kernel/power/userwakelock. c
Kernel/cpuset. c
Kernel/cgroup_debug.c
Kernel/cgroup. c
Mm/ashmem. c
Include/Linux/ashmem. h
Include/Linux/switch. h
Include/Linux/keychord. h
Include/Linux/earlysuspend. h
Include/Linux/android_aid.h
Include/Linux/uid_stat.h
Include/Linux/if_pppolac.h
Include/Linux/USB/Android. h
Include/Linux/wifi_tiwlan.h
Include/Linux/android_alarm.h
Include/Linux/keyreset. h
Include/Linux/synaptics_i2c_rmi.h
Include/Linux/android_pmem.h
Include/Linux/kernel_debugger.h
Include/Linux/gpio_event.h
Include/Linux/wakelock. h
Include/Linux/if_pppopns.h
Net/IPv4/sysfs_net_ipv4.c
Net/IPv4/af_inet.c
Net/IPv6/af_inet6.c
Net/Bluetooth/af_rjth.c
Security/commoncap. c
FS/proc/base. c
Android Kernel configuration
Android is based on Linux. For a new device, we first need to compile a kernel that supports Android, so how to make your Kernel
What about Android? In addition to the driver mentioned above, you need to configure your kernel to support the Android platform. For details, refer to the goldfish Kernel configuration file-ARCH/ARM/configs/goldfish_defconfig.

In general, we will configure the android kernel based on a standard Kernel configuration option. You can select the android Kernel configuration option based on the specific hardware platform. refer to the following Android Kernel configuration list:
General kernel options to be supported
Android_paranoid_network
Ashmem
Config_fb_mode_helpers
Config_font_8x16
Config_font_8x8
Config_yaffs_short_names_in_ram
Dab
Earlysuspend
FB
Fb_cfb_copyarea
Fb_cfb_fillrect
Fb_cfb_imageb.pdf
Fb_deferred_io
Fb_tileblitting
High_res_timers
Inotify
Inotify_user
Input_evdev
Input_gpio
Input_misc
Leds_class
Leds_gpio
Lock_kernel
Lkogger
Low_memory_killer
Misc_devices
New_leds
No_hz
Power_Supply
Preempt
Ramfs
Rtc_class
Rtc_lib
Switch
Switch_gpio
Tmpfs
Uid_stat
Uid16
Usb_function
Usb_function_adb
User_wakelock
Video_output_control
Wakelock
Yaffs_auto_yaffs2
Yaffs_fs
Yaffs_yaffs1
Yaffs_yaffs2
However, Android does not support the following two features:
Config_yaffs_disable_lazy_load
Dnotify
After configuration, you can use toolchain to compile the kernel. It is relatively simple to compile the kernel. Take the emulator's kernel as an example:
-Git clone git: // android.kernel.org/kernel/common.git kernel-emulator
-CD kernel-emulator
-Export arch = arm
-Export cross_compile = arm-Eabi-
-Export Path = path
-Make goldfish_defconfig
-Make has some articles about the android kernel. This series of articles will analyze the android kernel from the perspective of the Linux kernel and hope to provide useful information for beginners. This chapter briefly introduces the full picture of the android kernel and plays an interesting role. Starting from the next article, we will detail each android kernel driver and its functions.
The android kernel is based on the Linux 2.6 kernel (the latest version is 2.6.31). It is an enhanced kernel version. Apart from modifying some bugs, it provides device drivers for supporting Android platforms. Its core drivers mainly include:
Android binder, a Driver Based on the openbinder framework, is used to provide inter-process communication (IPC, inter-process communication) on the Android platform ).
The source code is in drivers/staging/Android/binder. c
Android Power Management (PM), a lightweight Android power management Driver Based on the standard Linux power management system, has made many optimizations for embedded devices.
The source code is located in kernel/power/earlysuspend. C.
Kernel/power/consoleearlysuspend. c
Kernel/power/fbearlysuspend. c
Kernel/power/wakelock. c
Kernel/power/userwakelock. c
The low Memory Manager (low memory killer) is more flexible than the Linux Standard OOM (out of memory) mechanism. It can kill processes as needed to release the required memory.
The source code is in drivers/staging/Android/lowmemorykiller. c
The anonymous shared memory (ashmem) provides a large shared memory among processes, and also provides a mechanism for the kernel to reclaim and manage the memory.
The source code is located in mm/ashmem. C.
Android pmem (physical), pmem is used to provide continuous physical memory areas to the user space. DSPs and some devices can only work on continuous physical memory.
The source code is in drivers/MISC/pmem. c
Android logger, a lightweight logging device, is used to capture various logs of the Android system.
The source code is in drivers/staging/Android/logger. c
Android alarm provides a timer to wake up a device from its sleep status. It also provides a clock benchmark that runs even when the device is sleeping,
The source code is in drivers/RTC/alarm. c
USB Gadget driver, a device driver based on the standard Linux USB Gadget driver framework. Android USB driver is based on the gaeget framework,
The source code is in drivers/USB/gadget/
Android Ram Console: To provide debugging functions, Android allows you to write debugging log information to a device called ram console, which is a ram-based buffer.
The source code is in drivers/staging/Android/ram_console.c.
Android timed device provides timed Control for devices. Currently, it supports vibrator and LED devices.
The source code is in drivers/staging/Android/timed_output.c (timed_gpio.c ).
Yaffs2 file system. Android uses yaffs2 as the MTD nandflash file system. The source code is located in the FS/yaffs2/directory. Yaffs2 is a fast and stable cross-platform embedded device file system for NAND and norflash. Compared with other flash file systems, yaffs2 uses smaller memory to save its running status, therefore, it occupies a small amount of memory. The garbage collection of yaffs2 is very simple and fast, so it can achieve better performance. The performance of yaffs2 is particularly significant in large-capacity nandflash, and it is very suitable for large-capacity flash storage.
There are many files added or modified to the android kernel. The following list describes the files of the android emulator kernel:
Drivers/MISC/kernel_debugger.c
Drivers/MISC/pmem. c
Drivers/MISC/qemutrace/qemu_trace_sysfs.c
Drivers/MISC/qemutrace/qemu_trace.c
Drivers/MISC/qemutrace/qemu_trace.h
Drivers/MISC/uid_stat.c
Drivers/staging/Android/lowmemorykiller. c
Drivers/staging/Android/logger. c
Drivers/staging/Android/timed_output.h
Drivers/staging/Android/ram_console.c
Drivers/staging/Android/timed_gpio.c
Drivers/staging/Android/logger. h
Drivers/staging/Android/binder. h
Drivers/staging/Android/binder. c
Drivers/staging/Android/timed_output.c
Drivers/staging/Android/timed_gpio.h
Drivers/RTC/alarm. c
Drivers/RTC/rtc-goldfish.c
Drivers/NET/pppolac. c
Drivers/NET/ppp_mppe.c
Drivers/NET/pppopns. c
Drivers/Video/goldfishfb. c
Drivers/switch/switch_class.c
Drivers/switch/switch_gpio.c
Drivers/Char/dcc_tty.c
Drivers/Char/goldfish_tty.c
Drivers/watchdog/i6300esb. c
Drivers/input/MISC/gpio_event.c
Drivers/input/MISC/gpio_input.c
Drivers/input/MISC/gpio_output.c
Drivers/input/MISC/keychord. c
Drivers/input/MISC/gpio_axis.c
Drivers/input/MISC/gpio_matrix.c
Drivers/input/keyreset. c
Drivers/input/keyboard/goldfish_events.c
Drivers/input/touchscreen/synaptics_i2c_rmi.c
Drivers/USB/gadget/Android. c
Drivers/USB/gadget/f_adb.h
Drivers/USB/gadget/f_mass_storage.h
Drivers/USB/gadget/f_adb.c
Drivers/USB/gadget/f_mass_storage.c
Drivers/MMC/host/goldfish. c
Drivers/power/goldfish_battery.c
Drivers/LEDs/ledtrig-sleep.c
Drivers/MTD/devices/goldfish_nand_reg.h
Drivers/MTD/devices/goldfish_nand.c
Kernel/power/earlysuspend. c
Kernel/power/consoleearlysuspend. c
Kernel/power/fbearlysuspend. c
Kernel/power/wakelock. c
Kernel/power/userwakelock. c
Kernel/cpuset. c
Kernel/cgroup_debug.c
Kernel/cgroup. c
Mm/ashmem. c
Include/Linux/ashmem. h
Include/Linux/switch. h
Include/Linux/keychord. h
Include/Linux/earlysuspend. h
Include/Linux/android_aid.h
Include/Linux/uid_stat.h
Include/Linux/if_pppolac.h
Include/Linux/USB/Android. h
Include/Linux/wifi_tiwlan.h
Include/Linux/android_alarm.h
Include/Linux/keyreset. h
Include/Linux/synaptics_i2c_rmi.h
Include/Linux/android_pmem.h
Include/Linux/kernel_debugger.h
Include/Linux/gpio_event.h
Include/Linux/wakelock. h
Include/Linux/if_pppopns.h
Net/IPv4/sysfs_net_ipv4.c
Net/IPv4/af_inet.c
Net/IPv6/af_inet6.c
Net/Bluetooth/af_rjth.c
Security/commoncap. c
FS/proc/base. c
Android Kernel configuration
Android is based on Linux. For a new device, we first need to compile a kernel that supports Android, so how to make your Kernel
What about Android? In addition to the driver mentioned above, you need to configure your kernel to support the Android platform. For details, refer to the goldfish Kernel configuration file-ARCH/ARM/configs/goldfish_defconfig.

In general, we will configure the android kernel based on a standard Kernel configuration option. You can select the android Kernel configuration option based on the specific hardware platform. refer to the following Android Kernel configuration list:
General kernel options to be supported
Android_paranoid_network
Ashmem
Config_fb_mode_helpers
Config_font_8x16
Config_font_8x8
Config_yaffs_short_names_in_ram
Dab
Earlysuspend
FB
Fb_cfb_copyarea
Fb_cfb_fillrect
Fb_cfb_imageb.pdf
Fb_deferred_io
Fb_tileblitting
High_res_timers
Inotify
Inotify_user
Input_evdev
Input_gpio
Input_misc
Leds_class
Leds_gpio
Lock_kernel
Lkogger
Low_memory_killer
Misc_devices
New_leds
No_hz
Power_Supply
Preempt
Ramfs
Rtc_class
Rtc_lib
Switch
Switch_gpio
Tmpfs
Uid_stat
Uid16
Usb_function
Usb_function_adb
User_wakelock
Video_output_control
Wakelock
Yaffs_auto_yaffs2
Yaffs_fs
Yaffs_yaffs1
Yaffs_yaffs2
However, Android does not support the following two features:
Config_yaffs_disable_lazy_load
Dnotify
After configuration, you can use toolchain to compile the kernel. It is relatively simple to compile the kernel. Take the emulator's kernel as an example:
-Git clone git: // android.kernel.org/kernel/common.git kernel-emulator
-CD kernel-emulator
-Export arch = arm
-Export cross_compile = arm-Eabi-
-Export Path = path
-Make goldfish_defconfig
-Make

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.