0

I have been trying to cross compile a loadable kernel module and I have been getting warning message that I would like to get help.

Below is the warning message

make[1]: Entering directory `/home/userid/rowboat-android/kernel'
   Building modules, stage 2.
   MODPOST 1 modules
WARNING: "omap_device_build" [/home/userid/myfiles/lcdc_load_device.ko] undefined!
WARNING: "omap_hwmod_lookup" [/home/userid/myfiles/lcdc_load_device.ko] undefined!
make[1]: Leaving directory `/home/userid/rowboat-android/kernel'

Below is the Makefile

obj-m :=lcdc_load_device.o
lcdc_load_device-m := ../rowboat-android/kernel/arch/arm/plat-omap/omap_device.o
lcdc_load_device-m += ../rowboat-android/kernel/arch/arm/mach-omap2/omap_hwmod.o

ccflags-m := -I$(src)/../rowboat-android/kernel/arch/arm/plat-omap/include/plat/

KDIR := /home/userid/rowboat-android/kernel/
PWD := $(shell pwd)

default:
   $(MAKE) ARCH=arm CROSS_COMPILE=/home/userid/rowboat-android/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi- -C $(KDIR) SUBDIRS=$(PWD) modules

clean:
   $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) clean

I am suspecting that the makefile is finding the header file for "omap_device_build" and "omap_hwmod_lookup" functions.

Appreciate your help, and thank you advance.

Mahendra Gunawardena
  • 1,956
  • 5
  • 26
  • 45
  • 1
    Is that the complete makefile? It's calling `make` again with a target that's not in your makefile (`modules`). And what was the `make` command you entered. Was it just `make`? – lurker Oct 03 '13 at 18:31
  • Yes this is the complete makefile. I entered make. Can you clarify the second statement. The rowboat-android/kernel does have a makefile. Looks like my problem might be in the KDIR variable – Mahendra Gunawardena Oct 03 '13 at 18:33
  • 1
    The default target in the makefile calls `$(MAKE)` with a target of `modules` so I wasn't sure where it would pick that target up. But that has nothing to do with the warning. Something is calling those functions and not finding them in the library. – lurker Oct 03 '13 at 18:39
  • Correct! The header files for functions "omap_device_build" and "omap_hwmod_lookup" are located in folder /rowboat-android/kernel/arch/arm/plat-omap/include/plat/. I am not sure how point to the above mentioned folder. I was hoping ccflags-m would do the trick. – Mahendra Gunawardena Oct 03 '13 at 18:46
  • 1
    I think it's picking up the headers, otherwise you'd get an error. It's saying that `/home/userid/myfiles/lcdc_load_device.ko` is referring to those symbols, but the definition isn't found. If you know what module(s) those symbols are actually defined in, then you may need to figure out if that module is being linked in. – lurker Oct 03 '13 at 18:57
  • I am wondering if KDIR is not pointing to the correct kernel that module is compiled against. – Mahendra Gunawardena Oct 03 '13 at 19:21
  • 2
    I think you have this backwards. You don't want to be including the header that is pulling in definitions of `omap_device_build` and `omap_hwmod_lookup`. You have referenced a *macro* that is calling the functions, but they are not `EXPORT_GPL`; or made available to modules. – artless noise Oct 04 '13 at 01:31

1 Answers1

0

Thank you to mbratch and artless noise for their comments

To address the WARNINGS, the symbols need to be exported. For the above question place

EXPORT_SYMBOL(omap_device_build) in omap_device.c 
EXPORT_SYMBOL(omap_hwmod_lookup) in omap_hwmod.c

and compile the kernel. Then compile the loadable kernel module against the compiled kernel. Perform the following to verify if the symbols have been exported

grep omap_device_build /proc/kallsyms
or
grep omap_device_build Module.symvers

For more details reference the following links

Comments are welcome

Thank you

Mahendra Gunawardena
  • 1,956
  • 5
  • 26
  • 45