title: undefined reference to system call added to kernel
body: <p>After adding the system call to kernel I tried to compile the kernel.<br />
  It ran for 2 hours and at the end threw</p>
  <blockquote>
  <p>undefined reference to &lt;system call added by me&gt;</p>
  </blockquote>
  <p><img src="https://i.stack.imgur.com/xu1Co.png" alt="system call added by me" /></p>
  <p>Any idea what had happened.</p>
  <p><strong>Kernel 3.9.3</strong></p>
  <p><strong>Steps followed are -</strong></p>
  <ol>
  <li><p>Get kernel codes from <a href="http://www.kernel.org" rel="nofollow noreferrer">www.kernel.org</a>.
  <code>wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.3.1.tar.bz2</code></p>
  </li>
  <li><p>Upzip it with command <code>tar xvfj XXX</code> to a folder example :
  <code>/root/kernel tar xvfj linux-3.3.1.tar.bz2</code></p>
  </li>
  <li><p>Edit file <code>/root/kernel/linux-3.3.1/arch/x86/syscalls/syscall_64.tbl</code> and add new line <code>312 64 husky1 sys_husky1</code></p>
  </li>
  <li><p>Edit file <code>/root/kernel/linux-3.3.1/include/linux/syscalls.h</code> Add new function before the line <code>#endif</code> declaration
  <code>asmlinkage long sys_husky1(int fd);</code></p>
  </li>
  <li><p>Add a new c file under <code>/root/kernel/linux-3.3.1/arch/x86/kernel</code> (I am using x86 CPU) Example :</p>
  <p><strong>Edit</strong> <code>/root/kernel/linux-3.3.1/arch/x86/kernel/Makefile</code> Add a new line
  <code> obj-y += husky.o</code></p>
  </li>
  <li><p>Go to <code>/root/kernel/linux-3.3.1</code> folder and run command <code>make –j8</code></p>
  </li>
  </ol>