2
votes

I am trying to write my own system call in linux kernel version 3.8.8. I searched on the internet and there are steps how to do it. Especially this link http://franksthinktank.com/howto/addsyscall/ is good. However. even though I followed all the steps it didn't work. I got an error saying that no rule to make target needed by kernel/built-in.

Then I tried to move the systemcall in one of the .c files in kernel directory, it didn't work either. I am trying to follow the example in the above link as practice. Actually what I want to do is to get the time of the system so I need to access xtime variable of the system. So, I must implement my system call in timekeeping.c file.

I was wondering which files exactly I change in kernel version 3.8.8 in order to implement a system call?

Thank you.

1
Did you find solution for your problem? If so, would you please share it so that others(including me) can learn from it? - xabush

1 Answers

0
votes

My kernel version : 3.8.1

Distribution: Ubuntu 12.04

  1. do some preparation(download source,and some necessary package)
  2. modify "sys.c" in "linux-3.8.1/kernel" to implement the system call function
  3. modify "syscall_32.tbl" in "linux-3.8.1/arch/x86/syscalls/" to add the call number
  4. make mrproper
  5. make menuconfig
  6. make -j4 > /dev/null
  7. make modules_install
  8. make install
  9. update-grub
  10. reboot

You can just leave "unistd.h" untouched