After adding the system call to kernel I tried to compile the kernel.
It ran for 2 hours and at the end threw
undefined reference to <system call added by me>
Any idea what had happened.
Kernel 3.9.3
Steps followed are –
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 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
and add new line312 64 husky1 sys_husky1
Edit file
/root/kernel/linux-3.3.1/include/linux/syscalls.h
Add new function before the line#endif
declarationasmlinkage long sys_husky1(int fd);
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 lineobj-y += husky.o
Go to
/root/kernel/linux-3.3.1
folder and run commandmake –j8
Advertisement
Answer
Search your syscall_64.tbl file for “sys_hello_rana”. I am guessing you named your syscall as “sys_hello_rana” in syscall table but you used a different name(sys_husky1) when you defined it.