Adding a new system call in Linux kernel 3.3

前端 未结 2 1143
傲寒
傲寒 2020-12-28 23:41

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.

<
相关标签:
2条回答
  • 2020-12-29 00:16

    I think in kernel 3.3 its shifted here

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

    0 讨论(0)
  • 2020-12-29 00:28

    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”

    0 讨论(0)
提交回复
热议问题