printk is not my friend

Charles Brown charles.brown at sensis.com
Mon Apr 5 18:46:03 UTC 2010


my problem seems to be a Makefile issue.  Following LDD3, i had started 
a char driver file (cdev.c), which i planned to add to hello.c, and i'd 
done this in the makefile;

ifneq ($(KERNELRELEASE),)
     obj-m := hello.o
     hello-objs := cdev.o

if i take out that 'cdev.o' it works.  I re-read that section of LDD3, 
"If, instead, you have a module called module.ko that is generated from 
two source files (called, say, file1.c and file2.c), the correct 
incantation would be:

obj-m := module.o
module-objs := file1.o file2.o

So, i tried this;

ifneq ($(KERNELRELEASE),)
     obj-m := module.o
     hello-objs := hello.o cdev.o

but make says, "No rule to make diver.c".

--CB


manoj.iyer at canonical.com wrote:
> 
> So if you ran dmesg it shows you nothing as well?
> 
> On Mon, 5 Apr 2010, Charles Brown wrote:
> 
>  > i'm sorry to bother you with this, but i've been chasing my tail through
>  > LDD3 and forum posts for hours with no luck, so i figure ask some
>  > experts. i have a typical 'hello world' module, on off-the-shelf ubuntu
>  > karmic, and can not get it to printk anything, anywhere, anyhow. i
>  > assume my problem is trivial, but i can't find it.  i've tried;
>  >
>  > static int __init init(void) {
>  >     printk(KERN_DEBUG "Hello, world\n");
>  > }
>  > module_init(init);
>  >
>  > static void __exit exit(void) {
>  >     printk(KERN_DEBUG "Goodbye, cruel world\n");
>  > }
>  > module_exit(exit);
>  >
>  >
>  >
>  > apt-get install klogd,
>  > echo 7 > /proc/sys/kernel/printk
>  > /etc/init.d/sysklogd restart
>  >
>  > every flavor of printk(KERN_DEBUG/CRIT/EMERG/INFO/ALERT
>  >
>  > and more things from various forums posts
>  >
>  > all the while with a tail -f /var/log/kern.log running.
>  >
>  > is there a step-by-step for 'hello world' someplace? suggestions?
>  >
>  > --CB
>  > -
>  > This message is intended only for the addressee and may contain 
> information that is company confidential or privileged.  Any technical 
> data in this message may be exported only in accordance with the U.S. 
> International Traffic in Arms Regulations (22 CFR Parts 120-130) or the 
> Export Administration Regulations (15 CFR Parts 730-774). Unauthorized 
> use is strictly prohibited and may be unlawful. If you are not the 
> intended recipient, or the person responsible for delivering to the 
> intended recipient, you should not read, copy, disclose or otherwise use 
> this message. If you have received this email in error, please delete 
> it, and advise the sender immediately.
>  > -
>  >
>  > --
>  > kernel-team mailing list
>  > kernel-team at lists.ubuntu.com
>  > https://lists.ubuntu.com/mailman/listinfo/kernel-team
>  >
> 

-
This message is intended only for the addressee and may contain information that is company confidential or privileged.  Any technical data in this message may be exported only in accordance with the U.S. International Traffic in Arms Regulations (22 CFR Parts 120-130) or the Export Administration Regulations (15 CFR Parts 730-774). Unauthorized use is strictly prohibited and may be unlawful. If you are not the intended recipient, or the person responsible for delivering to the intended recipient, you should not read, copy, disclose or otherwise use this message. If you have received this email in error, please delete it, and advise the sender immediately. 
-                                                                                                                                                                                                                                                       




More information about the kernel-team mailing list