Let's say we've written the driver: xxx.c, and it works (Init match probe and so on are OK)
First look at the case of the driver compiled into the kernel , the main focus on the following several files:
In the drive folder, there is a sentence in the makefile:
obj-$(CONFIG_XXX) += xxx.o
The kconfig under the Drive folder (for example, my kconfig.x86) are:
config XXX "ABCD" depens on YYYY help ...
There is a sentence in Arch/x86/configs/kkkk_defconfig:
CONFIG_XXX=y
(Do not leave blank spaces on both sides of the equals sign)
The driver is then compiled into module:
Makefile not change
Change the Kconfig to:
config XXX "ABCD" depends on YYYY help ...
In Defconfig, change to:
CONFIG_XXX=m
After the compilation is successful, the compiled module can be found in the directory android/out/target/product/your_image_name/obj/kernel/directory.
After the system is started, use ADB to view the/system/lib/modules/directory, you can also find the corresponding module.
Now that the driver has been included in our system, it is only in the form of Moudle, and the next task is to use the script to insmod the module when the system is started. The call to the script at system startup remains to be researched ...
Compile the Android driver into Moudle and start automatically after booting