

Okay, next, add our directory to kernel’s Makefile.Ĭhange this: core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ it means that you have to wait another long process later for the kernel build aside from your first time build).Ĥ. If you add another syscall later using assignment, it can make the kernel build process to start from the beginning (and you know. However, in my opinion, it is safer to use += here because := or assignment symbol will replace any value which is existed there. If you wonder what obj-y does, it tells the kernel build process that there is an object named myadd2int.o which is created from a source file (e.g. Create a Makefile and fill it with this: obj-y += myadd2int.o Yes, basically what it does is just sum up two integers.ģ. Printk("This is my kernel function, the result: %d\n", num1 + num2) – Create new file: myadd2int.c Fill with this: #include Īsmlinkage void sys_myadd2int(int num1, int num2) – Create new folder “mysyscall” in kernel root directory Extract it to /usr/src/: sudo tar -xvf linux-3.18.8.tar.xz -C/usr/src/

Download the linux kernel from, select the stable one. For example here, I use linux-3.18.8.

#HOW TO ADD A SYSTEM CALL IN LINUX KERNEL UPDATE#
I used Ubuntu 14.10 here, but I think it will also work with other Linux version.įirst, do update and upgrade (just to make sure that you have the latest update of your Linux).ġ. Okay, actually, I just want to share the way which works for me related to syscall installation in Linux kernel here.
