Giter VIP home page Giter VIP logo

generic_kext's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.