1# XNU Version Number # 2 3The first line of the generated file `$(OBJROOT)/xnuVersion` contains the 4version number for the kernel being built. All other instances of the kernel 5version in xnu are derived from that file. 6 7## Generating the XNU version number ## 8 9The buildsystem (`makedefs/MakeInc.kernel`) generates the `xnuVersion` file by 10deriving the xnu version from the SDK or KDK that xnu is being built against. 11The xnu version number is read from the `CFBundleVersion` property of 12the `System/Library/Extensions/System.kext/Info.plist` file in the SDK or KDK. 13 14### Customizing the XNU version number ### 15 16The derivation above can be bypassed and the xnu version customized by setting 17the `RC_DARWIN_KERNEL_VERSION` variable in the environment or overriding it on 18the `make` command line. 19 20 21## Format of the XNU version number ## 22 23The format of the version number must conform to the version resource format 24as described in [TN1132] 25(https://web.archive.org/web/20090330032438/http://developer.apple.com/technotes/tn/tn1132.html). 26 27In particular, the string is formatted as: `J[.N[.R[S[L]]]]`, where: 28 29* `J` represents the kernel major version number (integer) 30* `N` represents the kernel minor version number (integer) 31* `R` represents the kernel revision number (integer) 32* `S` represents the kernel build stage (one of `d`, `a`, `b`, or `r`) 33* `L` represents the kernel pre-release level (integer) 34 35## Using the XNU version number ## 36 37The correct way to make use of the kernel version within kernel code or a 38kext is to include `<libkern/version.h>`. This header contains defines that 39can be used for build-time version logic and prototypes for variables that can 40be used for run-time version logic. 41 42