You can do this using various vnode KPIs. Start with
vnode_open
in
<sys/vnode.h>
in the Kernel framework.
However, there are some things to consider here:
We generally recommend that kernel code not read configuration files directly. Rather, it should start with a default configuration and then allow for dynamic reconfiguration based from a daemon as the system boots.
For large read-only files, like firmware images, you can load the file using OSKextRequestResource (
<libkern/OSKextLib.h>
).If your KEXT is on the boot path — and Ethernet drivers can be on the boot path when the system is configured to netboot — you have to avoid deadlocking. In that case you want to get your configuration from NVRAM, using
IODTNVRAM
.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"