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