Adding a driver to the android kernel is actually adding a driver to the Linux kernel. It mainly adds vertex information to two files, one is the kconfig file and the other is the MAKEFILE file. For example, if the driver you added is placed in the xxx directory under the DRIVERS directory, the kconfig and makefile files under the directory will be repaired.
Specific modification method:
For example, I want to 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_lele_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 named somedrv, add:
Config android_demuxer
Bool "android somedrv driver"
Default n
In this way, you can. In this way, after the make menuconfig command
Choose Android somedrv driver and select it to compile the driver into the kernel.
Then add an obj-$ (config_android_somedrv) + = somedrv. O in the makefile.
In this way, the modification is completed.
In this way, the driver is compiled when the kernel is compiled, and the driver is selected before compilation.
Now all the compiled kernels are used on the simulator, that is, the kernel is run on qemu. In this case, the configuration during compilation uses goldfish_defconfig, so that the make menuconfig command is not executed before compilation.
Make goldfish_defconfig (provided that the code has been switched to the goldfish branch ).
In this way, the. config file is automatically generated, and you do not need to select it yourself. However, such a. config file does not contain a self-added driver. You need to manually modify the. config file, open the file, search for the field "somedrv", and you will see:
# Config_android_somedrv is not set
Config_android_binder_ipc = y
Somedrv is not included and compiled. manually modify it to config_android_somedrv = Y, which is the same as the following sentence. Then, the driver is compiled into the kernel.
The compiled kernel already contains the somedrv driver.
However, this driver is mounted to/dev with only the owner permission, so that the program still cannot access this device. Modify the ueventd. RC file in the \ System \ core \ rootdir directory of the main directory. You can set the permission and owner when the driver is mounted to the/dev directory. Add this sentence
/Dev/demuxer 0666 Root
In this way, you can. It seems that this should be re-compiled ..
Copy search
Copy search