Hi Linux Lover, In the make file you change the source directory, because I included the /usr/src/linux-2.4/include in Makefile. In your case it should be like /usr/src/linux-2.... I don't know exactly. So please see in your kernel sources and change in the Makefile and compile. It should work. Thanks and regards, Srinivas G > -----Original Message----- > From: linux lover [mailto:linux_lover2004@xxxxxxxxx] > Sent: Tuesday, February 22, 2005 11:12 AM > To: Shyamjithe; Srinivas G.; bulb@xxxxxx; amith@xxxxxxxxxxxxxxx; > karthik301176@xxxxxxxxx; gauravd_linux@xxxxxxxxx; > godepankaj@xxxxxxxxxxxxxx; J.A.K.Mouw@xxxxxxxxxxxxxxxxx > Cc: kernelnewbies@xxxxxxxxxxxx > Subject: Re: Creating a file in kernel Module -- working fine > > Hello Shyamjithe, > The same way Srinivas compile with his > Makefile. I uses that Makefile and compile it without > error. I also check /proc/ksyms and disnot find any > sys_open and sys_write exported functions symbol > there. > What should i do now? how to insmod it > without unresolved error? > regards, > Linux_lover. > > --- Shyamjithe <shyamjithe@xxxxxxxxxxxxxxx> wrote: > > > HI LIN LOVER > > I THINK YOUR KERNEL IS NOT EXPORTING > > THOSE SYMBOLS . HOW DID > > YOU COMPILE THE FILE. > > SHYAM > > > > shyamjithe.c.s > > Networking & Communications Group > > Tata Elxsi Ltd. > > (Ph) +91-471-2527214 > > (Fax) +91-471-2527215 > > ____________________________________ > > > > ----- Original Message ----- > > From: "linux lover" <linux_lover2004@xxxxxxxxx> > > To: "Srinivas G." <srinivasg@xxxxxxxxxxxxxxxxxxxxx>; > > > > <shyamjithe@xxxxxxxxxxxxxxx>; <bulb@xxxxxx>; > > <amith@xxxxxxxxxxxxxxx>; > > <karthik301176@xxxxxxxxx>; > > <gauravd_linux@xxxxxxxxx>; > > <godepankaj@xxxxxxxxxxxxxx>; > > <J.A.K.Mouw@xxxxxxxxxxxxxxxxx> > > Cc: <kernelnewbies@xxxxxxxxxxxx> > > Sent: Tuesday, February 22, 2005 10:44 AM > > Subject: Re: Creating a file in kernel Module -- > > working fine > > > > > > > Hello Srinivas, > > > I am using RedHat 9 with its kernel > > > 2.4.20-8 . When i make your program it compiled > > > successfully but i am getting following errors > > while i > > > insmod > > > insmod cf.o > > > cf.o: unresolved symbol sys_open > > > cf.o: unresolved symbol sys_write > > > > > > regards, > > > linux_lover. > > > > > > --- "Srinivas G." > > <srinivasg@xxxxxxxxxxxxxxxxxxxxx> > > > wrote: > > > > > >> Dear All, > > >> > > >> I have gone through your mails. Based on those > > mail > > >> messages I have > > >> created a test module in the kernel to create a > > >> file. It was compiled > > >> fine with out any error messages and working > > fine. > > >> > > >> I am using Red Hat 7.3 with 2.4.18-3 kernel > > version. > > >> Please fine the > > >> code below. > > >> > > >> cre_fil.c > > >> > > > > > > ------------------------------------------------------------------ > > >> #include <linux/kernel.h> > > >> #include <linux/module.h> > > >> #include <asm/fcntl.h> /* for O_WRONLY */ > > >> #include <linux/syscall.h> /* for sys_ functions > > */ > > >> #include <asm/uaccess.h> /* for set_fs(), > > get_fs() > > >> etc. */ > > >> #include <linux/string.h> /* for string length */ > > >> #include <linux/slab.h> /* for kmalloc */ > > >> > > >> MODULE_LICENSE("GPL"); > > >> > > >> typedef struct tagWRITE_TEST > > >> { > > >> unsigned long fd; > > >> unsigned long x; > > >> > > >> }WRITE_TEST, *PWRITE_TEST; > > >> > > >> PWRITE_TEST ptest; > > >> > > >> void SysPrint(char * pString, ...) > > >> { > > >> static char buff[1024]; > > >> va_list ap; > > >> > > >> va_start(ap,pString); > > >> vsprintf((char *)buff, pString, ap); > > >> va_end(ap); > > >> > > >> sys_write(ptest->fd,(char *)buff,strlen(buff)); > > >> } > > >> > > >> int init_module(void) > > >> { > > >> > > >> printk("<%s> invoked!\n",__FUNCTION__); > > >> printk("File Creation Testing in Kernel > > >> Module!\n"); > > >> > > >> set_fs(get_ds()); > > >> > > >> /* allocate the memory for structre */ > > >> ptest = > > >> > > (PWRITE_TEST)kmalloc(sizeof(WRITE_TEST),GFP_KERNEL); > > >> if(ptest == NULL) > > >> { > > >> printk("Structure Memory Allocation Fails!\n"); > > >> return -ENOMEM; > > >> } > > >> > > >> ptest->fd = sys_open("srcdebug.txt", O_CREAT | > > >> O_WRONLY, 644); > > >> if (ptest->fd == 0) > > >> { > > >> printk("File Creation Error!!!\n"); > > >> return 1; > > >> } > > >> > > >> SysPrint("File Creation Testing in Kernel > > >> Module!\n"); > > >> SysPrint("Srinivas Testing the File Creation\n"); > > >> > > >> /* close the file here */ > > >> sys_close(ptest->fd); > > >> > > >> return 0; > > >> } > > >> > > >> void cleanup_module(void) > > >> { > > >> printk("Good bye!\n"); > > >> > > >> /* free the allocated memory */ > > >> kfree(ptest); > > >> > > >> } > > >> > > >> Makefile > > >> ------------------------------------------------ > > >> INCDIR=/usr/src/linux-2.4/include > > >> > > >> CFLAGS=-DMODULE -D__KERNEL__ -I$(INCDIR) -O2 > > -Wall > > >> > > >> OBJS=cre_fil.o > > >> TARGET=cf.o > > >> > > >> $(TARGET): $(OBJS) > > >> $(LD) -r -o $(TARGET) $(OBJS) > > >> > > >> clean: > > >> $(RM) -f $(TARGET) $(OBJS) > > >> > > >> > > > > > > ------------------------------------------------------------------------ > > >> -- > > >> > > >> I need some information. Where can I get the > > >> information for sys_create, > > >> sys_write, sys_read, set_fs, get_fs, get_ds etc > > >> calls? > > >> > > >> Please provide any links which are related to > > that > > >> calls or any books. > > >> > > >> Thanks and regards, > > >> Srinivas G > > >> > > > > > > > > > > > > > > > __________________________________ > > > Do you Yahoo!? > > > All your favorites on one personal page - Try My > > Yahoo! > > > http://my.yahoo.com > > > > > > > > > __________________________________ > Do you Yahoo!? > The all-new My Yahoo! - What will yours do? > http://my.yahoo.com -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/