Re: How to compile KEXTs?
Re: How to compile KEXTs?
- Subject: Re: How to compile KEXTs?
- From: plumber Idraulico <email@hidden>
- Date: Mon, 7 Aug 2006 11:46:21 +0200
I don't know what u do ?
but it seems that u don't use Xcode
so take a turn here to understand ;
http://plumber.gnu-darwin.org/shared.php?_w2pb=pub/projects/
RTL8150LMEthernet/DarwinSources
http://plumber.gnu-darwin.org/shared.php?_w2pb=pub/projects/
RTL8150LMEthernet/DarwinSources/DerivedSources
#include <mach/mach_types.h>
extern kern_return_t _start(kmod_info_t *ki, void *data);
extern kern_return_t _stop(kmod_info_t *ki, void *data);
KMOD_EXPLICIT_DECL(com.driver.YOURDRIVER, "1.0", _start, _stop)
__private_extern__ kmod_start_func_t *_realmain = 0;
__private_extern__ kmod_stop_func_t *_antimain = 0;
__private_extern__ int _kext_apple_cc = __APPLE_CC__ ;
const unsigned char YOURDRIVERVersionString[] __attribute__ ((used))
= "@(#)PROGRAM: YOURDRIVER PROJECT: YOURDRIVER- DEVELOPER:YOU
BUILT:" __DATE__ " " __TIME__ "" "\n"; const double
YOURDRIVERVersionNumber __attribute__ ((used)) = (double)0.;
|
Best Regards
At 14:39 04.08.2006 +0200, plumber Idraulico wrote:
LDFLAGS = -nostdlib -r -lkmodc++ -lkmod -lcc_kext -lcpp_kext
Thanks; that took me through the compile and link stages.
Loading the thing still doesn't work, though. I worked though
a number of issues reported by kextload -t. I kept getting
an unknown symbol "_kmod_info" --- couldn't figure out what
it wants, so for now I just added a
kmod_info_t kmod_info;
into the driver. It will probably need some initialization, though...
If I take it out I now get a "does not contain kernel extension code"
message; don't remember how I got the unknown symbol thing. In any
case,
if I leave it in I'm getting a bit further ahead.
I'm now at a stage where kextload -t no longer gives real error
messages, but instead I get
kextload: extension /Users/stieber/MacOS-Bundles/WTG.kext appears
to be valid
kld(): Undefined symbols:
.constructors_used
.destructors_used
__ZTI11OSMetaClass
__ZTI9IOService
__ZTVN10__cxxabiv120__si_class_type_infoE
and then it fails again. I grepped through every file in /usr, /
System and
/Developer for the ZTI11OSMetaClass symbol, with no result...
There was another problem before, though: the loader was
complaining about
me using dynamic libaries with rld interface. When I added -static
to the
linker, the linker complained about that being incompatible with -
framework.
So I removed the -framework specifications from the linker, which in
turn might cause the symbols to be missing ("IOService" looks like
it's part of the IOKit framework, for example). It seems I can either
get those missing symbols, or a complaint about the executable format.
I used to have "-framework IOKit -framework System" in the linker
call;
currently the calls are
g++ -arch ppc -c -
DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_3 -I /System/
Library/Frameworks/Kernel.framework/Versions/A/Headers -fapple-kext
-fno-exceptions -static -fconstant-cfstrings -fpascal-strings -
Wall -W -Wfloat-equal -Wshadow -Wpointer-arith -Wcast-align -Wwrite-
strings -Wmissing-noreturn -Wmissing-format-attribute -Wno-
multichar -Wredundant-decls -Winline -Wno-invalid-pch -Werror -
DDEBUG -ggdb -o /tmp/stieber/WTG-Build-Driver/Driver.o.ppc
Driver.cpp;
lipo /tmp/stieber/WTG-Build-Driver/Driver.o.ppc -output /tmp/
stieber/WTG-Build-Driver/Driver.o -create
g++ -macosx_version_min=10.3 -nostdlib -r -lkmodc++ -lkmod -
lcc_kext -lcpp_kext -o /tmp/stieber/WTG-Build-Driver/Driver /tmp/
stieber/WTG-Build-Driver/Driver.o
The lipo call is an old thing in my build environment from when I
tried to
ompile the normal software (not the kext) for both architectures,
which didn't
work (I can only make i386 binaries on the intel mac and ppc
binaries on the
ppc mac). It's still there since it didn't seem to cause problems,
and at some
point I want to look into that again.
Christian
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden