Quote:
Originally Posted by
fpmurphy
If you provide us with your source code changes, perhaps we can figure out what you are doing wrong. Adding a new "hello world" type of syscall is a fairly trivial exercise.
Ok.
1 I downloaded 2.6.26 kernel. Fedora 9 is my OS with kernel version 2.6.25;
2. I extract the source into /usr/src/linux-2.6.26;
3. Make a directory "/mysyscall" under the source folder;
4. Add two files in "/mysyscall".
(1) mysyscall.c
#include <linux/kernel.h>
#include <linux/linkage.h>
asmlinkage long mysyscall(int i){
printk(KERN_DEBUG "Hello World with number %d \n", i);
return(1);}
(2) mysyscall.h with only one line
obj-y := mysyscall.o
5. Modify Makefile under the source folder.
just add the new folder in the end of this line
core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/
So the change line is
core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ mysyscall/
6. Add an entry for the new syscall by modifying source/arch/x86/kernel/syscall_table_32.S. The new line is
.long sys_mysyscall
7. Add a new #define line in source/include/asm-x86/unistd_32.h with
#define __NR_mysyscall 327
8. I compile the kernel 2.6.26 and get the following error message:
arch/x86/built-in.o: In function `sys_call_table':
(.rodata+0x724): undefined reference to `sys_mysyscall'
make: *** [.tmp_vmlinux1] Error 1
It's all. Please tell me how to implement the syscall successfully. Thank you very much!