Compiling kernel module out of tree

Kernel development, writing drivers, coding, and questions regarding FreeBSD internals.

Compiling kernel module out of tree

Postby Need4Speed » 24 Nov 2011, 14:18

Hi,

With FreeBSD 8.1 I was able to build a kernel module in my home directory with a Makefile and the C source file. The Makefile contains:

Code: Select all
.PATH: ${.CURDIR}

KMOD=   uslcom
SRCS=   opt_bus.h opt_usb.h device_if.h bus_if.h usb_if.h usbdevs.h uslcom.c

.include <bsd.kmod.mk>



Now, with FreeBSD 8.2, I get this:

Code: Select all
"/sys/conf/kmod.mk", line 199: warning: duplicate script for target "uslcom" ignored
"/sys/conf/kmod.mk", line 203: warning: duplicate script for target "uslcom" ignored
"/sys/conf/kmod.mk", line 210: warning: duplicate script for target "uslcom" ignored
Warning: Object directory not changed from original /usr/home/jdl/projects/cp210x
Graph cycles through uslcom

@ -> /usr/src/sys
machine -> /usr/src/sys/i386/include
:> opt_bus.h
:> opt_usb.h
awk -f @/tools/makeobjops.awk @/kern/device_if.m -h
awk -f @/tools/makeobjops.awk @/kern/bus_if.m -h
awk -f @/tools/makeobjops.awk @/dev/usb/usb_if.m -h
awk -f @/tools/usbdevs2h.awk @/dev/usb/usbdevs -h
cc -O2 -pipe -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -nostdinc   -I. -I@ -I@/contrib/altq -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -fno-common  -mno-align-long-strings -mpreferred-stack-boundary=2  -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -ffreestanding -fstack-protector -std=iso9899:1999 -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef -Wno-pointer-sign -fformat-extensions -c uslcom.c
ld  -d -warn-common -r -d -o .kld uslcom.o
:> export_syms
awk -f /sys/conf/kmod_syms.awk .kld  export_syms | xargs -J% objcopy % .kld
.kldBshareable  -d -warn-common -o .ko uslcom
.kld: No such file: No such file or directory
*** Error code 1


In addition to the new "duplicate script" warnings, the linker seems to want to output an empty filename (.kld instead of uslcom.kld)

Is it still possible to compile a kernel module out of tree?

Thanks
Need4Speed
Junior Member
 
Posts: 3
Joined: 28 Aug 2010, 17:27

Return to FreeBSD Development

Who is online

Users browsing this forum: Yahoo [Bot] and 0 guests