Hi, I tried what you suggested, but when I run that command it gives a lot of linking errors saying multiple definations of functions. I looked for the same on net and found one simple makefile containing the following command for linking: ld -m elf_i386 -r -o pipe.c fifo.c msg_q.c main.c When I include this linking command in my Makefile, it does not give any error and creates the corresponding .o file for each .c file but does not create the single relocatable object file through which I can load or unload the module. I do not get any error with following makefile, but at the same time it does not link the .o file to make final module. Please let me know what the problem is Also please explain me about -m option of 'ld', whats the use of this option ? I am pasting below my Makefile for your reference ****************************************** Makefile - Starts ****************************************** KERNELDIR = /usr/src/linux-2.4 CC = gcc include $(KERNELDIR)/include/linux/config.h CFLAGS = -I$(KERNELDIR)/include -D__KERNEL__ -DMODULE \ -O -Wall -c LFLAGS = -m elf_i386 -r -o ifdef CONFIG_SMP CFLAGS += -DSMP endif all: driver.o driver.o: main.o pipe.o fifo.o msg_q.o ld $(LFLAGS) main.o pipe.o fifo.o msg_q.o main.o: main.c $(CC) $(CFLAGS) main.c fifo.o: fifo.c $(CC) $(CFLAGS) fifo.c pipe.o: pipe.c $(CC) $(CFLAGS) pipe.c msg_q.o: msg_q.c $(CC) $(CFLAGS) msg_q.c #all: main.o pipe.o fifo.o msg_q.o # $(CC) $(CFLAGS) main.c pipe.c fifo.c msg_q.c clean: rm -f *.o *~ core ****************************************** Makefile - Ends ****************************************** Regards, GD. -----Original Message----- From: kernelnewbies-bounce@nl.linux.org [mailto:kernelnewbies-bounce@nl.linux.org] On Behalf Of Vishwas Raman Sent: Monday, June 21, 2004 10:02 PM To: Gaurav Dhiman Cc: Kernel Newbies Subject: Re: How to link the module ? ld -r *.o -o complete_module.o and then do an insmod on complete_module.o to insert the module in the running kernel. this should work. -Vishwas. On Mon, 2004-06-21 at 07:43, Gaurav Dhiman wrote: > Hi, > > I have made the multi source file module and compiled it sucssufully > with following comand: > > gcc - c main.c pipe.c fifo.c msg_q.c > > Now I have the corresponding .o file with me. Can someone tell me how > can I link it to each other to form one file of module. How can we > resolve the internal reference (reference to our own variable and > functions) without getting any errors or warninng for kernel symbols. > I know kernel symbols are resolved at load time by 'insmod'. > Please let me know how to resolve the internal symbols and get one > file for module which we can load using 'insmod'. Please let me know > the command. > > Regards, > Gaurav. > > > > ______________________________________________________________________ > Do you Yahoo!? > New and Improved Yahoo! Mail - 100MB free storage! -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/ -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/