Here is a loadable kernel module for HTC Sensation XL (runnymede- crc-2.6.35).
/* * mydebug.c * System Call sys_open dubugging */ #include <linux/kernel.h> /* Needed for KERN_INFO */ #include <linux/module.h> /* Needed by all modules */ #include <linux/init.h> /* Needed for macros */ #include <asm/unistd.h> #include <linux/linkage.h> #include <generated/autoconf.h> #include <linux/in.h> #include <linux/init_task.h> #include <linux/ip.h> #include <linux/kernel.h> #include <linux/kmod.h> #include <linux/mm.h> #include <linux/skbuff.h> #include <linux/workqueue.h> #include <linux/sched.h> #include <linux/stddef.h> #include <linux/string.h> #include <linux/syscalls.h> #include <linux/tcp.h> #include <linux/types.h> #include <linux/version.h> asmlinkage ssize_t (*orig_open)(const char *pathname, int flags); asmlinkage ssize_t hooked_open(const char *pathname, int flags) { printk(KERN_INFO "SYS_OPEN: %s\n", pathname); return orig_open(pathname, flags); } static int __init root_start(void) { unsigned long sys_addr = 0xc003b104; /* System.map */ unsigned long *sys_call_table= (unsigned long *)sys_addr; orig_open = sys_call_table[__NR_open]; sys_call_table[__NR_open] = hooked_open; return 0; } static void __exit root_stop(void) { unsigned long sys_addr = 0xc003b104; unsigned long *sys_call_table= (unsigned long *)sys_addr; sys_call_table[__NR_open] = &orig_open; } module_init(root_start); module_exit(root_stop); ------- When I buid it, the error shows below, make -C /home/scott/runnymede-crc-2.6.35/ M=`pwd` ARCH=arm CROSS_COMPILE=~/android-ndk-r7b/toolchains/arm-linux-androideabi-4.4.3/ prebuilt/linux-x86/bin/arm-linux-androideabi- modules make[1]: Entering directory `<home>/runnymede-crc-2.6.35' CC [M] /<home>/workspace/debugkit/mydebug.o cc1: warnings being treated as errors /<home>/workspace/debugkit/mydebug.c: In function 'root_start': /<home>/workspace/debugkit/mydebug.c:44: error: assignment makes pointer from integer without a cast /<home>/workspace/debugkit/mydebug.c:45: error: assignment makes integer from pointer without a cast /<home>/workspace/debugkit/mydebug.c: In function 'root_stop': /<home>/workspace/debugkit/mydebug.c:55: error: assignment makes integer from pointer without a cast make[2]: *** [/<home>/workspace/debugkit/mydebug.o] Error 1 make[1]: *** [_module_/<home>/workspace/debugkit] Error 2 make[1]: Leaving directory `/home/scott/runnymede-crc-2.6.35' make: *** [default] Error 2 Anyone can give me a help for it? -- unsubscribe: android-kernel+unsubscr...@googlegroups.com website: http://groups.google.com/group/android-kernel