* Module building oddities with <module>-objs under Kernel 2.6.8.1
@ 2004-10-02 5:13 Andre Bonin
2004-10-02 9:04 ` Sam Ravnborg
0 siblings, 1 reply; 2+ messages in thread
From: Andre Bonin @ 2004-10-02 5:13 UTC (permalink / raw)
To: Linux Kernel Mailing List
Hey all,
I have a simple module in datasim.c and several service functions in
another file status.c
The module compiles fine (no warnings) with the following Makefile, but
the printk function doesn't seem to output anything. The output doesn't
show with dmesg, tail -f /var/message and everything else I tried.
The same code works fine if copy-pasted inside the datasim.c module (and
not compiled using datasim-objs: in the makefile). It also works fine
if i do the ugly thing of (*shudder*) #include "status.c"
/usr/bin/nm datasim.ko yields "U printk".
I know the entry points get called properly because the module is
loaded, and functions after the printk's that set up sysfs attributes
are successfull (and appear under sysfs).
I find it odd that if i compile with the datasim-objs stuff that i can't
view the printk, but if i comment it out and do #include "datasim.c" it
works fine.
Thanks
Here is the Makefile.
----------------------------------------------------
KDIR := /usr/src/linux
PWD := $(shell pwd)
obj-m += datasim.o
datasim-objs := status.o
all:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD)
clean:
rm -rf *.o
rm -rf *.ko
rm -rf *.mod.c
rm -rf .datasim*
rm -rf .built-in.o.cmd
rm -rf *~
rm -rf *.cache
sudo rm -rf .tmp_versions
install:
sudo /sbin/insmod datasim.ko
uninstall:
sudo /sbin/rmmod datasim.ko
TAGS:
etags *.c
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Module building oddities with <module>-objs under Kernel 2.6.8.1
2004-10-02 5:13 Module building oddities with <module>-objs under Kernel 2.6.8.1 Andre Bonin
@ 2004-10-02 9:04 ` Sam Ravnborg
0 siblings, 0 replies; 2+ messages in thread
From: Sam Ravnborg @ 2004-10-02 9:04 UTC (permalink / raw)
To: Andre Bonin; +Cc: Linux Kernel Mailing List
On Sat, Oct 02, 2004 at 01:13:54AM -0400, Andre Bonin wrote:
> Here is the Makefile.
It is preferred to guard the kbuild specific stuff inside
ifeq ($(KERNELRELEASE),)
Normal stuff
else
kbuild stuff
endif
> ----------------------------------------------------
> KDIR := /usr/src/linux
> PWD := $(shell pwd)
>
> obj-m += datasim.o
> datasim-objs := status.o
This is wrong, you cannot use same name for a .o file and the final module.
Name your .c file datasim_core.c or similar and use:
obj-m := datasim.o
datasim-objs := datasim_core.o status.o
Sam
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-10-02 7:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-02 5:13 Module building oddities with <module>-objs under Kernel 2.6.8.1 Andre Bonin
2004-10-02 9:04 ` Sam Ravnborg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox