Add drivers and ueventd.rc modifications to the Android kernel

Source: Internet
Author: User

Reprint!

Adding drivers to the Android kernel is actually adding drivers to the Linux kernel. Mainly in two files add point information, one is the Kconfig file, and the other is a makefile file. For example, you add the driver of your code into the drivers directory under the XXX directory, then repair in the directory of Kconfig files and makefile files.

Specific methods of modification:

For example I now modify the Kconfig file under Drivers/staging/android/.

Config Android_logger

TriState "Android Log Driver"

Default n

Config Android_ram_console

BOOL "Android RAM buffer Console"

Default n

Config Android_ram_console_enable_verbose

BOOL "Enable verbose console messages on Android RAM console"

Default Y

Depends on Android_ram_console

If I want to add a driver with a driver name of Somedrv, then add it in this file:

Config android_demuxer

BOOL "Android somedrv Driver"

Default n

That's all you can do. So when the kernel is compiled, the make Menuconfig command, there will be

Android somedrv driver Selection, select it can be the driver into the kernel.

Then add a sentence obj-$ (config_android_somedrv) + + SOMEDRV.O in makefile.

This will be modified as well.

This compiles the kernel when the driver is compiled, the premise of the pre-compilation to select the driver.

Now the kernel I compiled is used on the emulator, which means running the kernel on QEMU. Then compile the config to use goldfish_defconfig, so that before compiling does not execute the make Menuconfig command but execute

Make Goldfish_defconfig (provided that the code has been switched to the goldfish branch).

This automatically generates a. config file without having to choose it yourself. But such a. config file does not contain the driver you added, to manually modify the. config file, open the file, search for the field "Somedrv", you will see:

# Config_android_somedrv is not set

Config_android_binder_ipc=y

Somedrv is not included in the compilation, manually modify it, modify it to config_android_somedrv=y, as in the following sentence, this will be the driver into the kernel.

This compiled kernel already contains the Somedrv driver.

However, this driver is mounted under/dev only with owner permissions, and there is no way for the program to access the device. This time to modify a file, the home directory /system/core/rootdir directory under the ueventd.rc file, this file can set the driver to mount to the/dev directory when the permissions and owners. Add this sentence

/dev/demuxer 0666 Root root

That's all you can do. It looks like this is going to recompile.

Add drivers and ueventd.rc modifications to the Android kernel

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.