<div dir="ltr">Hi Iker Pedrosa,<div><br></div><div>Please look at how to write the Kconfig files. We need to write a new Kconfig file for our own implementation.</div><div><br></div><div>Regards,</div><div>Srinivas G.</div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 23, 2013 at 3:15 PM, Iker Pedrosa <span dir="ltr"><<a href="mailto:ikerpedrosam@gmail.com" target="_blank">ikerpedrosam@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Srinivas Ganji,<br>
<br>
I've already done it. It wasn't very difficult as I have already worked with makefiles. Have you got any other suggestion of an exercise I can do?<br>
<br>
Thanks you very much again<br>
<br>
On Tue, 23 Jul 2013 11:11:16 +0530<br>
<div class="HOEnZb"><div class="h5">Srinivas Ganji <<a href="mailto:srinivasganji.kernel@gmail.com">srinivasganji.kernel@gmail.com</a>> wrote:<br>
<br>
> Hi Iker Pedrosa,<br>
><br>
> Have you completed with your own directory implementation? If you see any<br>
> issues, please let me know.<br>
><br>
> Regards,<br>
> Srinivas.<br>
><br>
><br>
> On Sat, Jul 20, 2013 at 4:13 PM, Iker Pedrosa <<a href="mailto:ikerpedrosam@gmail.com">ikerpedrosam@gmail.com</a>>wrote:<br>
><br>
> > Thank you very much to everybody. I've tried Sudip Mukherjee's approach<br>
> > and it has worked (the table is in arch/x86/syscalls/syscall_32.tbl). Now,<br>
> > I'm going to try to create my own directory in kernel source which contains<br>
> > my system call implementation files as Srinivas Ganji has proposed.<br>
> ><br>
> > On Fri, 19 Jul 2013 12:15:44 +0530<br>
> > Srinivas Ganji <<a href="mailto:srinivasganji.kernel@gmail.com">srinivasganji.kernel@gmail.com</a>> wrote:<br>
> ><br>
> > > Hi Iker Pedrosa,<br>
> > ><br>
> > > In old versions of Linux kernels like 2.6.xx, the approach was different<br>
> > > from Linux version 3.3 on wards.<br>
> > ><br>
> > > There are two different approaches to implement own system call. Each<br>
> > > approach involves several steps. The difference between two approaches<br>
> > is,<br>
> > > in one approach, we implement our system call in already existing file of<br>
> > > kernel sources. In another approach, we created our own directory in<br>
> > kernel<br>
> > > source which contains our system call implementation files. Ans in this<br>
> > > second approach, we need to modify the Kernel Makefiles and Configuration<br>
> > > files to include our newly created directory and its contents. First let<br>
> > us<br>
> > > implement using the first approach.<br>
> > ><br>
> > > The following approach was successfully tested in Linux kernel 3.5.7<br>
> > > version sources for x86 32-bit architecture.<br>
> > ><br>
> > > Here are the steps to create our own system call in the existing kernel<br>
> > > sources. The paths given below are relative paths from /usr/src/linux.<br>
> > ><br>
> > > 1. Generally, add the function (system call) definition in kernel/sys.c<br>
> > > file.<br>
> > ><br>
> > > /* this is the implementation of our system call */<br>
> > > asmlinkage long sys_helloworld(void) {<br>
> > > printk(KERN_EMERG "Hello, world!\n");<br>
> > > return 0;<br>
> > > }<br>
> > ><br>
> > > 2. Add the function prototype in the header file include/linux/syscalls.h<br>
> > ><br>
> > > asmlinkage long sys_helloworld(void);<br>
> > ><br>
> > > 3. Create an entry in system call table in the<br>
> > > file arch/x86/syscalls/syscall_32.tbl<br>
> > ><br>
> > > 350 i386 helloworld sys_helloworld<br>
> > ><br>
> > > Note: In my case already table had 349 offsets, so I added it as 350.<br>
> > ><br>
> > > 4. If we want to create our own kernel images, then change the<br>
> > EXTRAVERSION<br>
> > > in the main Makefile available at /usr/src/linux<br>
> > ><br>
> > > EXTRAVERSION = .ownsyscall<br>
> > ><br>
> > > 5. Then, build the modules from the main directory with the following.<br>
> > ><br>
> > > make menuconfig --- Just save and exit.<br>
> > > make modules<br>
> > > make modules_install<br>
> > > make install<br>
> > ><br>
> > > 6. Now, reboot with our own image.<br>
> > ><br>
> > > 7. Write a simple C application for calling the our own system call.<br>
> > ><br>
> > > #include <stdio.h><br>
> > ><br>
> > > /* sys_helloworld 350 */<br>
> > > int main ()<br>
> > > {<br>
> > > syscall(350); /* 350 is our system calls offset number */<br>
> > > return 0;<br>
> > > }<br>
> > ><br>
> > > I hope, you understand it clearly and it helps you. Based on this, you<br>
> > can<br>
> > > practice the second approach. It needs of creating our own directory and<br>
> > > files (C, Makefile, Kconfig) and modifications required in architecture<br>
> > > specific Kconfig.<br>
> > ><br>
> > > Regards,<br>
> > > Srinivas.<br>
> > ><br>
> > ><br>
> > > On Thu, Jul 18, 2013 at 2:34 PM, Iker Pedrosa <<a href="mailto:ikerpedrosam@gmail.com">ikerpedrosam@gmail.com</a><br>
> > >wrote:<br>
> > ><br>
> > > > Hi Guys,<br>
> > > ><br>
> > > > I am a newbie to linux kernel and I am trying to do some of the<br>
> > > > exercises/examples of the Linux Kernel Development book by Robert<br>
> > Love. For<br>
> > > > the moment I'm trying to create a system call (Chapter 5) but I am<br>
> > unable<br>
> > > > to do the first step which states the following:<br>
> > > > "Add an entry to the end of the system call table.This needs to be done<br>
> > > > for each architecture that supports the system call (which, for most<br>
> > calls,<br>
> > > > is all the architectures).The position of the syscall in the table,<br>
> > > > starting at zero, is its system call number. For example, the tenth<br>
> > entry<br>
> > > > in the list is assigned syscall number nine."<br>
> > > ><br>
> > > > My problem is that I am unable to find the file that holds the table.<br>
> > In<br>
> > > > the book the file that needs to be changed is the entry.S but it no<br>
> > longers<br>
> > > > exists in v3.9. In an example that I have found on the internet, which<br>
> > is<br>
> > > > done using v3.0, the file to change is syscall_table_32.S. But I've<br>
> > got the<br>
> > > > same problem, it doesn't exist. So anybody can help me to find the<br>
> > table? I<br>
> > > > know that I should be using v2.6 of the kernel but I don't know if that<br>
> > > > version will work with the distribution that I'm using.<br>
> > > ><br>
> > > > The question is also in stackoverflow so if someone wants to answer<br>
> > there<br>
> > > > I won't have any problem. The link to the page is the following:<br>
> > > ><br>
> > <a href="http://stackoverflow.com/questions/17652555/where-is-the-system-call-table-in-linux-kernel-v3-9" target="_blank">http://stackoverflow.com/questions/17652555/where-is-the-system-call-table-in-linux-kernel-v3-9</a><br>
> > > ><br>
> > > > --<br>
> > > > Iker Pedrosa <<a href="mailto:ikerpedrosam@gmail.com">ikerpedrosam@gmail.com</a>><br>
> > > ><br>
> > > > _______________________________________________<br>
> > > > Kernelnewbies mailing list<br>
> > > > <a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
> > > > <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
> > > ><br>
> ><br>
> ><br>
> > --<br>
> > Iker Pedrosa <<a href="mailto:ikerpedrosam@gmail.com">ikerpedrosam@gmail.com</a>><br>
> ><br>
<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Iker Pedrosa <<a href="mailto:ikerpedrosam@gmail.com">ikerpedrosam@gmail.com</a>><br>
</font></span></blockquote></div><br></div>