first time module dev question: undefined reference to 'memset'

Michael Iedema michael at askozia.com
Sun Sep 23 16:56:57 PDT 2007


John,

> > The code I'm porting is OSLEC[1] a line echo canceller module that is
> > used by Zaptel and Asterisk. My current problem is an undefined
> > reference to 'memset' when I attempt to load the cleanly compiled
> > module.

> I think you need to add a memset() function in your module.  The kernel
> doesn't include memset() in 6.x.  You can backport the one in 7.x (look in
> sys/libkern) if you want.

First, thanks for the response. I now have a patch for 6.2's libkern.h
and am defining memset in my module. Everything is building cleanly
now.

Now I have a basic kernel module Makefile question. I want to automate
the libkern.h patching / unpatching project process. What I have so
far is included below and is probably a very basic Makefile question.

Can anyone see where I've gone wrong here?

Regards,
-Michael I.



###########

SRCS=oslec_wrap.c echo.c
KMOD=oslec
CFLAGS+=-I$(PWD)/../spandsp-0.0.3/src/spandsp
WERROR=	-Wall
SRCS+=oslec.h

# XXX this doesn't work, what's the proper module build target
# so I can automate patching/building/unpatching ?
#all: patchmemset oslec unpatchmemset

patchmemset:
	patch -d /sys/sys < $(PWD)/libkern_memset.patch

unpatchmemset:
	patch -R -d /sys/sys < $(PWD)/libkern_memset.patch

echo.c: $(PWD)/../spandsp-0.0.3/src/echo.c
	$(CC) -c $(PWD)/../spandsp-0.0.3/src/echo.c

load: oslec.ko
	kldload ./oslec.ko

unload:
	kldunload oslec

reload: unload load

.include <bsd.kmod.mk>


More information about the freebsd-drivers mailing list