Writing modules - FreeBSD 9.1-PRERELEASE

Hi all!
I started to write test kernel module, but when compiling I get error:

Code:
# make
"/sys/conf/kmod.mk", line 116: Malformed conditional (${MK_CLANG_IS_CC} == "no" && ${CC:T:Mclang} != "clang") 
"/sys/conf/kmod.mk", line 120: if-less endif 
"/sys/conf/kern.mk", line 18: Malformed conditional (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang") 
"/sys/conf/kern.mk", line 32: if-less endif "/sys/conf/kern.mk", line 102: Malformed conditional (${MK_CLANG_IS_CC} != "no" || ${CC:T:Mclang} == "clang") 
"/sys/conf/kern.mk", line 108: if-less endif 
make: fatal errors encountered -- cannot continue

Once I added to the make.conf line:

Code:
MK_CLANG_IS_CC=no

building finished, but when trying to load module, I get error:

Code:
# kldload ./fclst.ko
kldload: can't load ./fclst.ko: Exec format error

Help me please understand what I'm doing wrong.

Code:
# uname -a
FreeBSD vagner-wrk.bsdway.ru 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #0: Sun Jul 29 18:34:18 MSK 2012     root@vagner-wrk.bsdway.ru:/usr/obj/usr/src/sys/GENERIC  amd64

Code:
# file -s ./fclst.ko
./fclst.ko: ELF 64-bit LSB relocatable, x86-64, version 1 (FreeBSD), not stripped

Code:
# grep -v ^# /etc/make.conf
WITH_NEW_XORG=true
WITH_KMS=true
PERL_VERSION=5.14.2
MK_CLANG_IS_CC=no

Code:
# grep -v ^# Makefile | grep -v ^$
KMOD    = fclst 
SRCS    = fclst.c
KO	= ${KMOD}.ko
.include <bsd.kmod.mk>

Source for module attached. Thanks

View attachment fclst.c
 
It works just fine for me when I build your code on my system and load it. I even used your make options in make.conf and still no errors.

Code:
FreeBSD strata.xxxxxxxx.org 9.0-RELEASE-p3 FreeBSD 9.0-RELEASE-p3 #9: Wed Aug  1 15:34:14 PDT 2012     root@strata:/usr/obj/usr/src/sys/STRATA  i386
 
Furthermore, I went and looked on my system for those files that make flagged errors in and the contents of those lines are very different. Furthermore, I went into the code repository and looked they they are different there as well. So the only thing that I can conclude from this is that someone else identified the problem and corrected it.
 
Back
Top