Adding a new system call in Linux kernel 3.3

梦想的初衷 提交于 2019-11-30 03:59:06

I think in kernel 3.3 its shifted here

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

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”

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!