Hi All
I have my API source code files (at least 12 of them) sitting in the kernel as Kernel module. This source code needs to be fast in responses and so sits in Kernel. Other application code accesses these API files from User Space. I am using a Char Driver (ioctl commands from user space application) to access the API inside the kernel. I wanted to compile my source files along with Char Driver file as single Kernel module. Attaching for your reference my Makefile. I am able to compile all the source code files and using “ld” to make a single “.o” file (ent_api_mod.o) as you can see from the Makefile.

When I try to load this module using “/sbin/insmod ent_api_mod.o”, I am getting unresolved symbols for POSIX semaphore calls (sem_init,sem_wait,sem_post,sem_timedwait) and system call “msleep”. How shall I deal with these unresolved symbols?

Please help me in this.

Regards
Yogi
-------------------------------- Makefile -------------------------------------------------------
# set to your kernel tree
KERNEL = /usr/src/linux-2.4.20-8

# get the Linux architecture.
# Needed to find proper include file for CFLAGS
ARCH=$(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/)
# set default flags to compile module
CFLAGS = -D__KERNEL__ -DMODULE -I$(KERNEL)/include
#CFLAGS = -D__KERNEL__ -DMODULE
#CFLAGS+= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -fno-strict-aliasing
CFLAGS+= -Wall

all: ent_api_mod.o

# get configuration of kernel
#include $(KERNEL)/.config
# modify CFLAGS with architecture specific flags
include $(KERNEL)/arch/${ARCH}/Makefile

# enable the module versions, if configured in kernel source tree
ifdef CONFIG_MODVERSIONS
CFLAGS+= -DMODVERSIONS -include $(KERNEL)/include/linux/modversions.h
endif
# enable SMP, if configured in kernel source tree
ifdef CONFIG_SMP
CFLAGS+= -D__SMP__
endif

# note: we are compiling the driver object file and then linking
# we link it into the module. With just one object file as in
# this example this is not needed. We can just load the object
# file produced by gcc
# link the thread driver module
ent_api_mod.o: char_driver.o Ent_oal.o Ent_cfg_annc.o
ld -r -o ent_api_mod.o char_driver.o Ent_oal.o Ent_cfg_annc.o
# compile the char_driver object file
char_driver.o: char_driver.c chardev.h Ent_os_adapt.h Ent_api_cfg.h
Ent_api_info.h Ent_credit.h Ent_hwdef.h Ent_sysdef.h
gcc $(CFLAGS) -c char_driver.c
# compile the Ent_oal object file
Ent_oal.o: Ent_oal.c Ent_oal.h
gcc $(CFLAGS) -c Ent_oal.c