how to include a header from an other module?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

I am writing a module (kmacrt.ko) which need to use some headers and
functions from another external module (madwifi modules, wlan.ko,
etc).  The following is my make file:

------------------------------------------------------------------------------
### ifneq ($(KERNELRELEASE),)

obj-m           := kmacrt.o
kmacrt-objs     := hook.o xmit.o rt_table.o

### else

KERNELPATH ?= /lib/modules/$(shell uname -r)/build

INSTALLPATH = /lib/modules/$(shell uname -r)/net

INCS += -I/home/zwh/macrt/madwifi

COPTS += -Werror

CFLAGS += $(INCS) $(COPTS)

modules:
        $(MAKE) -C $(KERNELPATH) SUBDIRS=$(shell pwd) modules

install:
        test -d $(INSTALLPATH) || exit 1
        cp  $(basename ${obj-m}).ko $(INSTALLPATH)

clean:
        rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions

### endif
------------------------------------------------------------------------------

If I do not comment out the conditions on `KERNELRELEASE',  make can
not find the madwifi header files that I am using in my module.  If I
comment them out, make succeeds.  Why? Normally should I use the
`KERNELRELEASE' conditions in make file?

Another question is that if I use relative path for the include path,
make cannot find header files. Why?

Then I succeed compiling my `macrt.ko' module, although during make,
it complains:
------------------------------------------------------------------------------
MODPOST 1 modules
WARNING: "register_tx_hook" [/home/zwh/macrt/kmacrt/kmacrt.ko] undefined!
WARNING: "unregister_tx_hook" [/home/zwh/macrt/kmacrt/kmacrt.ko] undefined!
------------------------------------------------------------------------------

When I first insert my mode, there is a message
------------------------------------------------------------------------------
no version for "register_tx_hook" found, kernel tainted
------------------------------------------------------------------------------
The message does not appear when I re-insert the module (during one boot).

Although the module works fine,  why there are these messages?


Thanks for your help.

Wenhua

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux