How to compile KEXTs?
How to compile KEXTs?
- Subject: How to compile KEXTs?
- From: Christian Stieber <email@hidden>
- Date: Fri, 04 Aug 2006 10:38:47 +0200
Hi,
I'm having a few problems with a piece of hardware that's "grabbed"
by a MacOS driver (an USB modem), but that driver doesn't correctly
access the card. So I'm now trying to setup a simple KEXT that I
can configure as driver for that particular vendor/product to prevent
the standard MacOS driver from getting it, and I hope that the card
can be accessed with my userspace "driver" then that I use for some
other cards.
Going through the developer website I came up with the HelloKExt
example code. I copied that, adjusted the names, and now I'm trying
to compile it. I don't use XCode, for a number of reasons, and
I've figured out a number of options that I need to set (or remove,
as they would trigger warnings on system header bugs, which doesn't
work well with -Werror...) to make it compile, but I still get a ton
of undefined symbols on linking.
Currently, the compiler is invoked like this:
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;
This does not produce errors, but of course something could still be wrong.
The linking is done like this ATM:
g++ -framework IOKit -framework System -macosx_version_min=10.3
-fapple-kext -fno-exceptions -o Driver /tmp/stieber/WTG-Build-Driver/Driver.o
/usr/bin/ld: Undefined symbols:
_main
.constructors_used
.destructors_used
_IOLog
OSMetaClass::_RESERVEDOSMetaClass0()
...
IORegistryEntry::detachAbove(IORegistryPlane const*)
...
and so on.
From the looks of it, it seems that I need to link with something else,
but so far I've been unable to find out what is missing.
If I add -static to the linker call, I only get one error about
not being able to find the file for -lcrt0.o, but I assume that
it just doesn't get to the undefined symbols :-)
If I set up X-Code on one of the boxes, can I see the options it uses
to compile something and other stuff that it might add into the code
before compiling?
Thanks for any hints,
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