Hi everybody, as you can guess, I need your help! First of all, I'm using a linux montavista pro 3.1 (kernel 2.4.20) for a cross compilation. For my project, I had to develop some new system calls. This done, I wrote a C/C++ proj that uses this new features. Everything is ok during compile time but when linking, I get the following error messages. Below you'll find only one link error cause the message is the same for each new system call used. I don't understand what goes wrong... So I give you what I modified in the linux montavista sources and the changes in the target file system. Do I need to add a library for the compile time? /**************/ /* LINK ERROR /**************/ ppc_405-g++ -static -L/myWorks/en-cours/target/usr/lib -o ssc.exe libSsc.a -lpthread -lposixtime libSsc.a(ppcbsos2.o)(.text+0x0): In function `prs_sysClkUtils': /myWorks/en-cours/target/usr/include/sys/user_prs_sysclkutils.h:6: définitions multiples de « prs_sysClkUtils » libSsc.a(ppcbsos1.o)(.text+0x6c):/myWorks/en-cours/target/usr/include/sys/user_prs_sysclkutils.h:6: défini pour la première fois ici /*******************************************/ /* "montavista/arch/ppc/prs/prs_sysClkUtils.c": /* this is the system call source file added in /* montavista src /*******************************************/ #include <linux/prs_sysclkutils.h> static int sysClkRunning = FALSE; static unsigned int pitCountVal = -1; /* PIT counter value */ static int sysClkTicksPerSecond = 100; /* default 100 ticks/second */ static int sysTimerClkFreq = 200000000; /* Timer clock frequency */ static short isInited = -1; static long previousJiffiesVal; static long virtualTickCounter; asmlinkage long sys_prs_sysClkUtils(char * todo , int arg) { long rc = -1; /* Test if the counters have been inited or not. These ones must be inited with jiffies value * but we can't do that at compile time cause jiffies is not a constant. Furthermore, we do not * protect these values with a semaphore cause only the sscManager uses it once. So there is * no concurrent access to them. */ if(isInited == -1) { previousJiffiesVal = jiffies; virtualTickCounter = jiffies; isInited = 0; } /* We want to make a sysClkDisable */ if(my_strcmp(todo,"sysClkDisable")==0) { if(sysClkRunning) { /* disable the PIT interrupt and auto-reload capability */ mtspr(SPRN_TCR ,mfspr(SPRN_TCR ) & ~ (TCR_PIE | TCR_ARE)); /* clear the PIT counter */ mtspr(SPRN_PIT,0); /* clear the pending PIT interrupt */ mtspr(SPRN_TSR,SPRN_TSR | TSR_PIS); /* reset the running flag */ sysClkRunning =FALSE; rc = 0; } else rc = -1; } if(my_strcmp(todo,"sysClkRateSet")==0) { if( (arg < SYS_CLK_RATE_MIN) || (arg > SYS_CLK_RATE_MAX) ) rc = -1; else { /* save the new value for the system clock rate */ sysClkTicksPerSecond = arg; pitCountVal = sysTimerClkFreq / sysClkTicksPerSecond ; mtspr(SPRN_PIT,pitCountVal); rc = 0; } } /* Bad use of this system call */ return rc; } /********************************************/ /* "montavista/include/linux/prs_sysClkUtils.h" /* this is the header file for our system call /* source file /********************************************/ #ifndef __LINUX_PRS_SYSCLKUTILS_H #define __LINUX_PRS_SYSCLKUTILS_H /* We need the compiler to recognize the word "asmlinkage" */ #include <linux/linkage.h> /* We need to access to powerPC registers */ #include <asm/processor.h> #include <linux/sched.h> #endif /* __LINUX_PRS_SYSCLKUTILS_H */ /*********************************************/ /* montavista/arch/ppc/kernel/misc.S /********************************************/ [...] .long sys_clock_gettime .long sys_clock_getres .long sys_clock_nanosleep /* 240 */ .long sys_prs_sysClkUtils /*********************************************/ /* montavista/include/linux/unistd.h /********************************************/ [...] #define __NR_io_cancel 231 #define __NR_timer_create 232 #define __NR_timer_settime (__NR_timer_create+1) #define __NR_timer_gettime (__NR_timer_create+2) #define __NR_timer_getoverrun (__NR_timer_create+3) #define __NR_timer_delete (__NR_timer_create+4) #define __NR_clock_settime (__NR_timer_create+5) #define __NR_clock_gettime (__NR_timer_create+6) #define __NR_clock_getres (__NR_timer_create+7) #define __NR_clock_nanosleep (__NR_timer_create+8) #define __NR_prs_sysClkUtils 241 /***********************************************************/ /* "targetFileSystem/usr/include/sys/user_prs_sysclkutils.h" /* this is the file added in the target file system to allow /* user space progs to use the nex sys call /***********************************************************/ #ifndef __USER_PRS_SYSCLKUTILS_H #define __USER_PRS_SYSCLKUTILS_H #include <linux/unistd.h> _syscall2(long,prs_sysClkUtils,char *,todo,int,arg); #endif /*********************************/ /* User space program /********************************/ #include <sys/user_prs_sysclkutils.h> int sysTickGet(void) { return(prs_sysClkUtils("sysClkRateSet",0)); } Tks a lot -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/