Hi, I am using the default level of printk. That is printk without any level. Even I tried using "KERN_DEBUG" but the result is the same. I think the problem is not with printk as it works if I use only one C file for compilation. Instead, the problem could be in either Makefile or Ubuntu7.10 configuration. Thanks, Regards Pintu -----Original Message----- From: Thomas Rega [mailto:mail@xxxxxxxxxx] Sent: Monday, July 07, 2008 7:12 PM To: Pintu Agarwal Cc: kernelnewbies@xxxxxxxxxxxx Subject: Re: linux - 2.6 - driver compilation - Makefile Hi Pintu, which 'printk-level' are you using? Try something like 'printk(KERN_DEBUG ...' Further informations can be found here: http://www.xml.com/ldd/chapter/book/ch04.html have fun ... TR On Mon, 2008-07-07 at 11:23 +0530, Pintu Agarwal wrote: > Hi, > > I have written a simple char driver(mychar) for linux 2.6.22 kernel. > I have split my driver code into 2 C files. > - mychar.c (main file where __init is present) > - test1.c (some user defined function) > > I am using Makefile for compilation. > My makefile looks like this - > ------------------------------------------------------------ > EXTRA_CFLAGS += -I. -ITEST > > obj-m += mychar.o > mychar-objs += TEST/test1.o > > KDIR := /lib/modules/$(shell uname -r)/build PWD := $(shell pwd) > > all: > $(MAKE) -C $(KDIR) M=$(PWD) modules > > clean: > $(MAKE) -C $(KDIR) M=$(PWD) clean > --------------------------------------------------------------- > > I am interested in building only mychar.ko and no the whole kernel. > I am doing my development on Ubuntu 7.10 with kernel version > 2.6.22-14-generic > > Although this Makefile works and I could able to generate "mychar.ko". > Also when I do "insmod mychar.ko" the module installs successfully, > and I could see "mychar" in "lsmod" output. > I have added some printk in my module_init function but after doing > insmod I am not able to see any output in /var/log/messages > > If I put everything in single C file(only mychar.c), I could able to > see all the output in /var/log/messages. > > Please let me know what am I doing wrong while including the 2 C files > and how should the makefile be modified. > ( I have referred Documentation/kbuild makefiles.txt for creating my > makefile) > > > Thanks, Regards > Pintu > > SASKEN BUSINESS DISCLAIMER > ------------------------- > This message may contain confidential, proprietary or legally > privileged information. In case you are not the original intended > Recipient of the message, you must not, directly or indirectly, use, > Disclose, distribute, print, or copy any part of this message and you > are requested to delete it and inform the sender. Any views expressed > in this message are those of the individual sender unless otherwise > stated. Nothing contained in this message shall be construed as an > offer or acceptance of any offer by Sasken Communication Technologies > Limited ("Sasken") unless sent with that express intent and with due > authority of Sasken. Sasken has taken enough precautions to prevent > the spread of viruses. However the company accepts no liability for > any damage caused by any virus transmitted by this email SASKEN BUSINESS DISCLAIMER ------------------------- This message may contain confidential, proprietary or legally privileged information. In case you are not the original intended Recipient of the message, you must not, directly or indirectly, use, Disclose, distribute, print, or copy any part of this message and you are requested to delete it and inform the sender. Any views expressed in this message are those of the individual sender unless otherwise stated. Nothing contained in this message shall be construed as an offer or acceptance of any offer by Sasken Communication Technologies Limited ("Sasken") unless sent with that express intent and with due authority of Sasken. Sasken has taken enough precautions to prevent the spread of viruses. However the company accepts no liability for any damage caused by any virus transmitted by this email -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ