From owner-freebsd-drivers@FreeBSD.ORG Sun Sep 23 23:56:57 2007 Return-Path: Delivered-To: freebsd-drivers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 598A316A41A for ; Sun, 23 Sep 2007 23:56:57 +0000 (UTC) (envelope-from michael@askozia.com) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.191]) by mx1.freebsd.org (Postfix) with ESMTP id C983E13C45D for ; Sun, 23 Sep 2007 23:56:56 +0000 (UTC) (envelope-from michael@askozia.com) Received: by nf-out-0910.google.com with SMTP id b2so1048881nfb for ; Sun, 23 Sep 2007 16:56:55 -0700 (PDT) Received: by 10.78.181.13 with SMTP id d13mr1395556huf.1190591815132; Sun, 23 Sep 2007 16:56:55 -0700 (PDT) Received: by 10.78.72.1 with HTTP; Sun, 23 Sep 2007 16:56:55 -0700 (PDT) Message-ID: Date: Mon, 24 Sep 2007 01:56:55 +0200 From: "Michael Iedema" To: "John Baldwin" In-Reply-To: <200709211537.21584.jhb@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200709211537.21584.jhb@freebsd.org> Cc: freebsd-drivers@freebsd.org Subject: Re: first time module dev question: undefined reference to 'memset' X-BeenThere: freebsd-drivers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Writing device drivers for FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2007 23:56:57 -0000 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