===================================================
To cross compile your own driver in the arm architecture you have to follow some steps as mentioned below.
===================================================
- Create a directory like my_drvr inside drivers(which is in the Linux
source code) for your driver and put your driver (my_driver.c) file
inside this directory. It will looks like
/linux_source_code/drivers/my_drvr/my_driver.c
- Create one Makefile inside your driver directory (using vi any editor) and inside this put
obj-$((CONFIG_MY_DRIVER) += my_driver.o
and save this file. This will appears like/linux_source_code/drivers/my_drvr/Makefile
- Create one
Kconfig
file inside your driver directory (using vi any editor) and inside this put
config MY_DRIVER tristate "my driver" //gives your driver description like vendor name etc. depends on ARM default y if ARM help my driver module.
- Save this file, this will appears like
/linux_source_code/drivers/my_drvr/Kconfig
- Add both
Makefile
andKconfig
file in the Linux source driversMakefile
andKconfig
file which are at/linux_source_code/drivers/Makefile
and/linux_source_code/drivers/Kconfig
- In the Makefile add below in last line
obj-y += my_drvr/
or
obj-$((CONFIG_MY_DRIVER) += my_drvr/
- In Kconfig file add below in last line
source "drivers/my_drvr/Kconfig"
- Finally have to add
Kconfig
file into architecture specific config file which will be atkernel_source/arch/arm/configs/--defconfig
in this add below line in the last
CONFIG_MY_DRIVER=y
===================================================
沒有留言:
張貼留言