I want to build a kernel moduel which has external symbols to a static library for my BBB using bitbake.
This issues is that my static lib gets not linked into the kernel module and remains with missing symbols.
Using this Makefile sequence:
obj-m += hcsr04.o
hcsr04-src := hcsr04.o
SRC := $(shell pwd)
all:
$(MAKE) -C $(KERNEL_SRC) M=$(SRC)
modules_install:
$(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install
results in a binary which of course has missing symbols as shown by nm
like (just a snippet)
U printk
00000004 b pruData
00000000 b pruDataMem
U prussdrv_exec_program
U prussdrv_exit
U prussdrv_init
U prussdrv_map_prumem
U prussdrv_open
U prussdrv_pru_clear_event
U prussdrv_pru_disable
U prussdrv_pruintc_init
U prussdrv_pru_wait_event
That makes sense for me so far.
Now, if I set my makefile like this (libprussdrv.a is the lib I need to link against):
obj-m += hcsr04.o
hcsr04-src := hcsr04.o
hcsr04-objs := hcsr04.o libprussdrv.a
SRC := $(shell pwd)
all:
$(MAKE) -C $(KERNEL_SRC) M=$(SRC)
modules_install:
$(MAKE) -C $(KERNEL_SRC) M=$(SRC) modules_install
I receive a lot smaller module containing just these symbols:
00000000 d $d
00000000 r $d
00000000 r $d
00000024 r __module_depends
00000000 D __this_module
00000000 r __UNIQUE_ID_srcversion9
0000002d r __UNIQUE_ID_vermagic8
00000000 r ____versions
I tried to specify -l[libpostfix].a
to any rules but no success.
Am I on the wrong track or what am I missing to link the library into my kernel module?