I have taken Headset Driver as a use case.
1. Create a folder headset_lg at location: ~/gt540_2.1/kernel/arch/arm/mach-msm/headset_LG
2. Copy board-swift-headset.c from ~/gt540_2.1/kernel/arch/arm/mach-msm/swift to headset_LG folder and make changes to it below
change //static int __init lge_hsd_init(void) to static int lge_hsd_init(void)
change // actuall call is static void __exit lge_hsd_exit(void) to static void lge_hsd_exit(void)
also comment this line
//device_initcall(hsd_debug_init);
write make file to compile the .c file
makefile
#
# Makefile for the swift specific files
#
#obj-y += board-swift-bl-rt9393.o
obj-m = board-swift-headset.o // replace obj-y to obj-m // were m stand for Module
3. also change need to be made inside /home/br/gt540_2.1/kernel/arch/arm/mach-msm/rpc_server_misc.c
comment the global variable "headset_inserted" which is used to udpate the status of actual hardware
4. change to root folder of the kernel and run make. you shall see the .ko file at location given below
Kernel: arch/arm/boot/Image is ready
Kernel: arch/arm/boot/zImage is ready
Building modules, stage 2.
MODPOST 16 modules
LD [M] arch/arm/mach-msm/headset_LG/board-swift-headset.ko
Installing Kernel Module
~/arch/arm/mach-msm/headset_LG/$adb push /sdcard/board-swift-headset.ko
~/arch/arm/mach-msm/headset_LG/$adb shell
$su
# insmod /sdcard/board-swift-headset.ko //dont panic, filesystem should restart after executing insmod stmt
# lsmod // to verify the driver
# rmmod board-swift-headset.ko // to remove kernel module
[...] Complete example: How to get LG headset sources compile in to kernel module(.ko) [...]
ReplyDelete