Hello,
I'm currently developing a kext on Catalina 10.15.7 on a SIP disabled system (for easy building, loading, and unloading of kexts).
When I printf
"foo", build, then load the kext on my SIP disabled system, the console shows "foo" as expected. If I then unload, delete the kext, change the string to "bar", build, then reload the kext again, the message unexpectedly prints "foo" instead of the new message "bar". The only way I've been able to print "bar" is if I restart the system and load the kext again.
I suspect this is a kext cache issue which I admittedly know little about. However, after trying the following commands after removing and deleting the old kext :
kextcache -invalidate /
kextcache -u /
kextcache -U / -Boot
touch /Library/Extensions
It still does not update with the new "bar" message.
To be more specific, here is the exact steps I use:
sudo kextunload /Library/Extensions/mykext.kext
sudo rm -rf /Library/Extensions/mykext.kext
# Uncomment one or more of the four cache updaters below
# sudo touch /Library/Extensions
# sudo kextcache -system-caches
# sudo kextcache -invalidate /
# sudo kextcache -u /
sudo cp -r /Users/user/Library/Developer/Xcode/DerivedData/mykext-gaytpunjlfqfxygmrplhwibgikie/Build/Products/Debug/mykext.kext /Library/Extensions
sudo chown -R root:wheel /Library/Extensions/mykext.kext
sudo chmod -R go-rwx /Library/Extensions/mykext.kext
sudo kextload /Library/Extensions/mykext.kext
How can I test new kext builds without having to restart my virtual machine?