This is the system call my_foo().
The system call file my_foo.c should be placed in the
subdirectory kernel of the source root.
The Makefile is a replacement for the one that is there;
it just add my_foo.o to the list of objects.
You need also to change arch/i386/kernel/entry.S and
include/asm/unistd.h appropriately: I used the
sys_call number 198 for my_foo as i found that they were
used up to 197 although entry.S does not bother above 191.
The user test program in test.c contains the user-space declaration of the system call my_foo() in both possible ways: using _syscallX() or with syscall( FOO_NR, ... ). Compile the test program with gcc -o test test.c.
If you need a simple and useful example have a look at kernel/info.c.
kernel/Makefile
kernel/my_foo.c the system call file
test.c a user test program