Skip to content
Advertisement

undefined reference to system call added to kernel

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>

system call added by me

Any idea what had happened.

Kernel 3.9.3

Steps followed are –

  1. Get kernel codes from www.kernel.org. wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.3.1.tar.bz2

  2. Upzip it with command tar xvfj XXX to a folder example : /root/kernel tar xvfj linux-3.3.1.tar.bz2

  3. Edit file /root/kernel/linux-3.3.1/arch/x86/syscalls/syscall_64.tbl and add new line 312 64 husky1 sys_husky1

  4. Edit file /root/kernel/linux-3.3.1/include/linux/syscalls.h Add new function before the line #endif declaration asmlinkage long sys_husky1(int fd);

  5. 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

  6. Go to /root/kernel/linux-3.3.1 folder and run command make –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.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement