A question about kext development. My IOKit kext has some parameters that could be changed in the runtime. Cannot find any clue, how could I store these parameters in order to retrieve and use them on the next kext run? Like, in a file or maybe nvram (preferred)? Or another persistent storage I am not aware about yet?
A small remark: my kext has OSBundleRequired=Root, so I suppose root fs is available when kernel loads it. But i also think that NVRAM is preferable because it is easier to manage for an end user.
TL;DR My kext has a bool parameter that could be changed during kext's lifecycle in runtime. I need to store this parameter on the kext stop, and retrieve and use it in the kext on the kext's start. I'd like to use NVRAM to store it. How it could be done?
I found the answer here. This is an MVE for an octet (i. e. 8bit byte aka uint8_t, requires euid=0 of course):
For a userspace app:
main.c:
Makefile:
For a kext: