Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-22-2005, 06:12 AM   #1
LQ Newbie
Registered: Oct 2005
Posts: 3

Rep: Reputation: 0
Question Adding a system call to SuSE Linux


We are trying to add a simple system call of our own to a SuSE build. We have got so far but are having trouble with the following:

So far we have sucessfuly edited the (/include/asm-i386/) unistd.h and (/arch/i386/kernel/) entry.S files to contain our system call name.

Being linux n00bs were having some trouble on the next bit, which is where to put the systemcall.h, systemcall.c and which makefile needs to be edited to make sure these changes are picked up on recompilation (we have done a 'find' on makefile and there are a multitude to pick from).

So far the guides we have found on the net are based on other distros, so we are a little lost in the folder hierarchy.

Many thanks for all your help

niT & cake
Old 10-22-2005, 08:03 AM   #2
LQ Guru
Registered: Jul 2003
Location: VA
Distribution: Slack 10.1
Posts: 2,194

Rep: Reputation: 46
You will probably need to get the kernel source and recompile the entire kernel.
Old 10-22-2005, 09:19 AM   #3
LQ Newbie
Registered: Oct 2005
Posts: 3

Original Poster
Rep: Reputation: 0
Originally posted by aaa
You will probably need to get the kernel source and recompile the entire kernel.
Sorry, I don't follow / understand what you mean.

we have a copy of our kernel source taken from /usr/src/ I made a copy of this directory to my own directory (in this instance 'banana' so I knew I definately wasn't messing with the original source).

here is a process of exactly what we are doing and where we are up to:

**our procedure**

copy kernal source in /usr/src/linux-2.6.4-52/ to /usr/src/banana

in banana edit the unistd.h file (located in banana/include/asm-i386/ )
added a line at base of syscalls table: #define __NR_banana 274

edit the entry.S file (located in banana/arch/i386/kernel/ )
added a line at base of sys calls table: .long sys_banana /* 274 */

then we created a c file (located in /banana/fs/ )

goes like this:

asmlinkage int sys_banana (void) {
printk("banana called\n");

NOTE: *do we need a header for this? if head file is needed what would it look like? is this code correct? are we barking up the wrong tree?*

then edit the makefile (located in /banana/fs/ )
we added 'banana.o' to the line of code starting 'obj-y = ...'

NOTE: *Have nfi if that is correct or not *

run 'make' from /banana/

we are getting an error on 'banana.o' -> "no rule to make target... needed by 'arch/i386/kernel/built-in.o'

what is going on?

All I want is to put a simple sys call in that when run will write to the console "banana run"

what am I missing?


niT et cake

Last edited by khcm8jw; 10-22-2005 at 09:21 AM.
Old 10-23-2005, 04:36 AM   #4
LQ Newbie
Registered: Oct 2005
Posts: 3

Original Poster
Rep: Reputation: 0
Can anyone help with this?


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with adding a system call newcat Programming 17 04-08-2006 06:50 AM
Adding system call in linux guam Programming 2 12-04-2004 01:38 PM
Adding system call dumb82 Linux - Newbie 0 07-20-2004 02:25 AM
Adding new System Call to Kernel kurt_ram Linux - General 1 10-22-2002 03:59 PM
adding system call in linux udayan Programming 1 05-02-2002 03:26 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:42 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration