Hi all,

I am trying to add a new system call to android kernel, but met the
following errors during compilation:

                  MODPOST vmlinux.o
                  WARNING: modpost: Found 10 section mismatch(es).
                  To see full details build your kernel with:
                  'make CONFIG_DEBUG_SECTION_MISMATCH=y'
                  GEN     .version
                  CHK     include/generated/compile.h
                  UPD     include/generated/compile.h
                  CC      init/version.o
                  LD      init/built-in.o
                  LD      .tmp_vmlinux1
                  arch/arm/kernel/built-in.o: In function `__sys_trace_return':

/home/lwan1/WORKING_DIRECTORY/kernel/arch/arm/kernel/entry-common.S:323:
undefined reference to `sys_myservice'
                  arch/arm/kernel/built-in.o: In function `sys_oabi_readahead':

/home/lwan1/WORKING_DIRECTORY/kernel/arch/arm/kernel/entry-common.S:468:
undefined reference to `sys_myservice'
                  make[1]: *** [.tmp_vmlinux1] Error 1
                  make: *** [sub-make] Error 2
                  make: Leaving directory `/home/lwan1/WORKING_DIRECTORY/kernel'

The following is what I did:
1. Add the following line into "arch/arm/include/asm/inistd.h":
              #define __NR_myservice                    (__NR_SYSCALL_BASE+366)
2. Add the following line into "arch/arm/kernel/call.S":
              /* 366 */ CALL(sys_myservice)
3. Create "myservice.h" in folder "include/linux/":
             #ifndef __LINUX_MYSERVICE_H
             #define __LINUX_MYSERVICE_H
        
             #include <linux/unistd.h>
             #include <linux/linkage.h>
             #include <linux/errno.h>

             _syscall2(int, myservice, int, arg1, char*, arg2);

             #endif
4. Create "myservice.c" in folder "ipc/":
             #include <include/myservice.h>
        
             asmlinkage int sys_myservice (int arg1, char* arg2) {
                     //kernel messages logged to /var/log/kernel/warning        
                     printk(KERN_EMERG “my service is running”);

                     return(1);
              }
5. Add the following line into makefile in folder "ipc/":
             obj -y += myservice.o

May I ask what have I done wrong or miss?

Any hint would be warmly welcomed.

Thank you very much.

Yours
Sincerely

-- 
unsubscribe: [email protected]
website: http://groups.google.com/group/android-kernel

Reply via email to