bd58 Writing modules - FreeBSD 9.1-PRERELEASE - The FreeBSD Forums
The FreeBSD Forums  

Go Back   The FreeBSD Forums > Development > FreeBSD Development

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

Reply
 
Thread Tools Display Modes
  #1  
Old August 13th, 2012, 21:06
Vagner Vagner is offline
Junior Member
 
Join Date: May 2010
Location: Russia, SPb
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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

fclst.c

Last edited by SirDice; August 14th, 2012 at 09:35. Reason: Proper use of [cmd] tags: http://forums.freebsd.org/showthread.php?t=8816#cmd ; Proper use of [code] tags: http://forums.free
Reply With Quote
  #2  
Old August 15th, 2012, 01:26
Maelstorm Maelstorm is offline
Junior Member
 
Join Date: Jul 2012
Location: United States
Posts: 53
Thanks: 3
Thanked 9 Times in 7 Posts
Default

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
__________________
You can't learn by watching. You gotta get out there and do it.
Reply With Quote
  #3  
Old August 15th, 2012, 12:19
Vagner Vagner is offline
Junior Member
 
Join Date: May 2010
Location: Russia, SPb
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, for your reply. Probably, it is because of the version PRERELEASE
Reply With Quote
  #4  
Old August 15th, 2012, 14:42
Maelstorm Maelstorm is offline
Junior Member
 
Join Date: Jul 2012
Location: United States
Posts: 53
Thanks: 3
Thanked 9 Times in 7 Posts
Default

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.
__________________
You can't learn by watching. You gotta get out there and do it.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Yuck - Fatal trap 12 on FreeBSD 8.1-PRERELEASE Rudy Installing & Upgrading 7 January 12th, 2011 10:33
[Solved] FreeBSD 8.2-PRERELEASE ? ahavatar Installing & Upgrading 17 December 24th, 2010 01:51
FreeBSD 8RC2 and ZFS - slow writing freelsd General 20 November 23rd, 2010 16:50
no audio with Realtek ALC260 freebsd 8.1 prerelease unsobill Multimedia 11 July 10th, 2010 17:17
FreeBSD 7.2-PRERELEASE alie Installing & Upgrading 3 March 22nd, 2009 11:34


All times are GMT +1. The time now is 02:10.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.
The mark FreeBSD is a registered trademark of The FreeBSD Foundation and is used by The FreeBSD Project with the permission of The FreeBSD Foundation.
Web protection and acceleration provided by CloudFlare
0