https://github.com/leiless/generic_kext
Makefile for generic kernel extension
https://github.com/leiless/generic_kext
c kext makefile
Last synced: about 1 year ago
JSON representation
Makefile for generic kernel extension
- Host: GitHub
- URL: https://github.com/leiless/generic_kext
- Owner: leiless
- License: bsd-2-clause
- Created: 2018-08-31T00:59:34.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-03-16T03:10:15.000Z (over 7 years ago)
- Last Synced: 2025-04-15T07:18:57.330Z (about 1 year ago)
- Topics: c, kext, makefile
- Language: Makefile
- Size: 46.9 KB
- Stars: 5
- Watchers: 0
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README
- License: LICENSE
Awesome Lists containing this project
README
Makefile for macOS generic kernel extension
Summary:
Makefile is a GNU makefile used to build macOS generic kernel extension without heavy XCode intervention.
Basic Requirements:
As of macOS 10.10(Yosemite), unsigned(or ad-hoc signed) kernel extension cannot load by default.
You can specify kext-dev-mode=1 to boot-args of nvram:
1. $ sudo nvram boot-args="kext-dev-mode=1"
2. $ sudo reboot
As of macOS 10.11(El Capitan), kext-dev-mode was deprecated.
Instead, you need to disable System Integrity Protection(SIP) in order to load a kernel extension:
1. Boot into recovery mode(via Command + R) when booting
2. $ csrutil enable --without kext
3. $ reboot
Build variables:
[Mandatary]
KEXTNAME - Short name for the kext(e.g. example)
KEXTVERSION - Version number, see TN2420(e.g. 1.0.0)
KEXTBUILD - Build number, see TN2420(e.g. 1.0.0d1)
BUNDLEDOMAIN - Reverse DNS notation prefix(e.g. com.example)
[Optional]
COMPATIBLE_VERSION - Compatible version(if you intended to implement a library kext)
COPYRIGHT - Human-readable copyright; default empty string
SIGNCERT - Label of Developer ID cert in keyring for code signing; for ad-hoc signing use single hyphen(e.g. -)
ARCHFLAGS - Architecture flags(x86_64, i386, arm, ppc, ...)
PREFIX - Install/uninstall location; default /Library/Extensions
BUNDLEID - KEXT bundle ID; default $(BUNDLEDOMAIN).kext.$(KEXTNAME)
KEXTMACHO - Name of kext Mach-O executable; default $(KEXTNAME)
MACOSX_VERSION_MIN - Minimal version of macOS to target, if you don't know, specify 10.4; default set to current system version
SDKROOT - Apple Xcode SDK root directory to use
CPPFLAGS - Additional precompiler flags
CFLAGS - Additional compiler flags; example: -g, -Wunknown-warning-option, -msoft-float
LDFLAGS - Additional linker flags
LIBS - Additional libraries to link against
KLFLAGS - Additional kextlibs flags; example: -unsupported
Joke:
com.apple.kpi.private is for Apple internal use only, if you want to use private KPIs, please specify
BUNDLEDOMAIN=com.apple and
COPYRIGHT="Copyright © XXXX Apple Inc. All rights reserved."
Which XXXX is a year number.
References:
https://github.com/droe/example.kext
https://developer.apple.com/library/archive/technotes/tn2420/_index.html
https://developer.apple.com/library/archive/technotes/tn2459/_index.html
https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/KEXTConcept/Articles/infoplist_keys.html
https://support.apple.com/en-us/HT204904
https://clang.llvm.org/docs/ClangCommandLineReference.html
https://opensource.apple.com/source/IOKitUser/IOKitUser-1445.40.1/kext.subproj/OSKext.c.auto.html
http://www.goodbits.ca/index.php/2017/09/25/building-an-apple-osx-kernel-module-with-cmake-cc