9

I am very new to this kernel thing. What I want to do is just add a new system call to the kernel. I was following this guideline: http://hekimian-williams.com/?p=20.

The problem is there used to syscall_table_32.S file under arch/x86/kernel, but I cannot find the file for x86 systems in kernel version 3.3. Do I still need to edit the file and append one more line for the newly added system call? Or do I need to do something else to let the kernel know about my new system call? Any help will be appreciated. Thank you.

NeoJi
  • 245
  • 2
  • 14

2 Answers2

7

How to add a new Linux kernel API in 3.3 version? -- for 64 bits OS

  • get kernel codes from www.kernel.org.

wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.3.1.tar.bz2

  • Upzip it with command ‘tar xvfj XXX” to a folder For example : /root/kernel tar xvfj linux-3.3.1.tar.bz2

  • Edit file “/root/kernel/linux-3.3.1/arch/x86/syscalls/syscall_64.tbl” Add new line

312 64 husky1 sys_husky1

  • Eidt file “/root/kernel/linux-3.3.1/include/linux/syscalls.h” Add new function declaration

asmlinkage long sys_husky1(int fd);

before the line “#endif”

  • Add a new c file under “/root/kernel/linux-3.3.1/arch/x86/kernel” (I am using x86 CPU) Example :

  • Edit “/root/kernel/linux-3.3.1/arch/x86/kernel/Makefile” Add a new line “obj-y += husky.o”

  • goto /root/kernel/linux-3.3.1 folder and run command “make –j8”

libo500k
  • 71
  • 1
6

I think in kernel 3.3 its shifted here

http://lxr.free-electrons.com/source/arch/x86/syscalls/

Pavan Manjunath
  • 27,404
  • 12
  • 99
  • 125