Module building on 2.6

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

 



Hi,
I am facing one problem while building module on my SLES m/c with 2.6 kernel. The problem is something like this :-

I made one Makefile which will be used by kbuild and contents are something like this :-

------------------Makefile--------------------------------
INCLUDES=/home/test/Testing/Include
EXTRA_CFLAGS = -I${INCLUDES}
EXTRA_LDFLAGS = /home/test/Testing/Lib/libtest.a

obj-m := test_module.o
OBJS1=  1.o
OBJS2=  2.o
test_module-objs := ${OBJS1} ${OBJS2}
-----------------------------------------------------------

Here, as you can see, the intention is to get test_module.ko...

There are 2 source files involved here named 1.c and 2.c present in the current directory, 1 Library file named libtest.a present in "/home/test/Testing/Lib" and one header file present in "/home/test/Testing/Include"...
For clarification, header file and library [which contains one function definition which has been used in 1.c].

Now, when I do make for building the module [test_module.ko], it says somethine like this :-

make -C /usr/src/linux SUBDIRS=/home/test/Testing/Modules modules
make[1]: Entering directory `/usr/src/linux'
  CC [M]  /home/test/Testing/Modules/1.o
  CC [M]  /home/test/Testing/Modules/2.o
  LD [M]  /home/test/Testing/Modules/sum_module.o
  Building modules, stage 2.
  MODPOST
*** Warning: "test_printf2" [/home/test/Testing/Modules/test_module.ko] undefined!
  CC      /home/test/Testing/Modules/test_module.mod.o
  LD [M]  /home/test/Testing/Modules/test_module.ko

And if you try to do $ insmod test_module.ko, it shows "undefined symbol test_printf2" message.

As mentioned in kbuild docs, that you can use EXTRA_LDFLAGS, LDFLAGS_@ for modifying the linker's options, but doing that also there is no improvement and still this undefined symbol message I am getting.

Anyone please help me...

Thanks in advance.




[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