Loading...
--- xnu/xnu-201.42.3/README
+++ xnu/xnu-2050.22.13/README
@@ -1,73 +1,55 @@
-How to build XNU:
-
-1) Setup your environment:
-
- Create and go to your sandbox directory </sandbox/my_xnu>
-
- $ cd </sandbox/my_xnu>
-
- Extract the xnu project from cvs:
-
- $ cvs co -r <xnu-tag> xnu
-
- where <xnu-tag> must be replaced by the matching xnu tag for
- the xnu project level.
+Table of contents:
+A. How to build XNU
+B. How to install a new header file from XNU
+
+=============================================
+A. How to build XNU:
+
+1) Type: "make"
+
+ This builds all the components for kernel, architecture, and machine
+ configurations defined in TARGET_CONFIGS. Additionally, we also support
+ architectures defined in ARCH_CONFIGS and kernel configurations defined in
+ KERNEL_CONFIGS. Note that TARGET_CONFIGS overrides any configurations defined
+ in ARCH_CONFIGS and KERNEL_CONFIGS.
+
+ By default, architecture defaults to the build machine
+ architecture, and the kernel configuration is set to build for DEVELOPMENT.
+
+ This will also create a bootable image, mach_kernel, and a kernel binary
+ with symbols, mach_kernel.sys.
+
+
+ /* this is all you need to do to build with RELEASE kernel configuration */
+ make TARGET_CONFIGS="release x86_64 default" SDKROOT=/path/to/SDK
+
+ or the following is equivalent (ommitted SDKROOT will use /)
+
+ make ARCH_CONFIGS=X86_64
+
+2) Building a Component
Go to the top directory in your XNU project.
- $ cd </sandbox/my_xnu>/xnu
-
If you are using a sh-style shell, run the following command:
- $ . SETUP/setup.sh
+ $ . SETUP/setup.sh
If you are using a csh-style shell, run the following command:
- % source SETUP/setup.csh
+ % source SETUP/setup.csh
This will define the following environmental variables:
SRCROOT, OBJROOT, DSTROOT, SYMROOT
-2) Export the Component Header Files
-
- From the top directory, run:
-
- $ make exporthdrs
-
- This exports the component header files in the $OBJROOT/EXPORT_HDRS
- directory.
-
-3) Build all the Components
-
- From the top directory. run:
+ From a component top directory:
$ make all
- This builds all the components for all architectures defined in
- ARCH_CONFIGS and for all kernel configurations defined in KERNEL_CONFIGS.
- By default, ARCH_CONFIGS contains one architecture, the build machine
- architecture, and KERNEL_CONFIGS is set to build for RELEASE.
- This will also create a bootable image, mach_kernel, and a kernel binary
- with symbols, mach_kernel.sys.
-
+ This builds a component for all architectures, kernel configurations, and
+ machine configurations defined in TARGET_CONFIGS (or alternately ARCH_CONFIGS
+ and KERNEL_CONFIGS).
+
Example:
- $(OBJROOT)/RELEASE_PPC/osfmk/RELEASE/osfmk.o: pre-linked object for osfmk component
- $(OBJROOT)/RELEASE_PPC/mach_kernel: bootable image
-
-4) Building a Component
-
- From a component top directory:
-
- $ make all
-
- This builds a component for all architectures defined in ARCH_CONFIGS
- and for all kernel configurations defined in KERNEL_CONFIGS.
- By default, ARCH_CONFIGS contains one architecture, the build machine
- architecture, and KERNEL_CONFIGS is set to build for RELEASE .
-
- WARNING: If a component header file has been modified, you will have to do
- the above procedures 3 and 4.
-
- Example:
- $(OBJROOT)/RELEASE_PPC/osfmk/RELEASE/osfmk.o: pre-linked object for osfmk component
+ $(OBJROOT)/RELEASE_X86_64/osfmk/RELEASE/osfmk.filelist: list of objects in osfmk component
From the component top directory:
@@ -76,39 +58,84 @@
This includes your component in the bootable image, mach_kernel, and
in the kernel binary with symbols, mach_kernel.sys.
-5) Building DEBUG
-
- Define KERNEL_CONFIGS to DEBUG in your environment or when running a
+ WARNING: If a component header file has been modified, you will have to do
+ the above procedure 1.
+
+3) Building DEBUG
+
+ Define kernel configuration to DEBUG in your environment or when running a
make command. Then, apply procedures 4, 5
- $ make KERNEL_CONFIGS=DEBUG all
-
- or
-
- $ export KERNEL_CONFIGS=DEBUG
+ $ make TARGET_CONFIGS="DEBUG X86_64 DEFAULT" all
+
+ or
+
+ $ make KERNEL_CONFIGS=DEBUG ARCH_CONFIGS=X86_64 all
+
+ or
+
+ $ export TARGET_CONFIGS="DEBUG X86_64 DEFAULT"
+ $ export SDKROOT=/path/to/SDK
$ make all
Example:
- $(OBJROOT)/DEBUG_PPC/osfmk/DEBUG/osfmk.o: pre-linked object for osfmk component
- $(OBJROOT)/DEBUG_PPC/mach_kernel: bootable image
-
-6) Building fat
-
- Define ARCH_CONFIGS in your environment or when running a make command.
+ $(OBJROOT)/DEBUG_X86_64/osfmk/DEBUG/osfmk.filelist: list of objects in osfmk component
+ $(OBJROOT)/DEBUG_X86_64/mach_kernel: bootable image
+
+4) Building fat
+
+ Define architectures in your environment or when running a make command.
Apply procedures 3, 4, 5
- $ make ARCH_CONFIGS="PPC I386" exporthdrs all
-
- or
-
- $ export ARCH_CONFIGS="PPC I386"
+ $ make TARGET_CONFIGS="RELEASE I386 DEFAULT RELEASE X86_64 DEFAULT" exporthdrs all
+
+ or
+
+ $ make ARCH_CONFIGS="I386 X86_64" exporthdrs all
+
+ or
+
+ $ export ARCH_CONFIGS="I386 X86_64"
$ make exporthdrs all
+5) Verbose make
+ To display complete tool invocations rather than an abbreviated version,
+ $ make VERBOSE=YES
+
+6) Debug information formats
+ By default, a DWARF debug information repository is created during the install phase; this is a "bundle" named mach_kernel.dSYM
+ To select the older STABS debug information format (where debug information is embedded in the mach_kernel.sys image), set the BUILD_STABS environment variable.
+ $ export BUILD_STABS=1
+ $ make
+
7) Build check before integration
From the top directory, run:
- $ ~rc/bin/buildit . -arch ppc -arch i386 -noinstallsrc -nosum
+ $ ~rc/bin/buildit . -arch i386 -arch x86_64 -arch armv7 -arch ppc -noinstallsrc -nosum
+
+
+ xnu supports a number of XBS build aliases, which allow B&I to build
+ the same source submission multiple times in different ways, to
+ produce different results. Each build alias supports the standard
+ "clean", "install", "installsrc", "installhdrs" targets, but
+ conditionalize their behavior on the RC_ProjectName make variable
+ which is passed as the -project argument to ~rc/bin/buildit, which
+ can be one of:
+
+ -project xnu # the default, builds /mach_kernel, kernel-space
+ # headers, user-space headers, man pages,
+ # symbol-set kexts
+
+ -project xnu_debug # a DEBUG kernel in /AppleInternal with dSYM
+
+ -project libkxld # user-space version of kernel linker
+
+ -project libkmod # static library automatically linked into kexts
+
+ -project Libsyscall # automatically generate BSD syscall stubs
+
+
8) Creating tags and cscope
@@ -116,7 +143,135 @@
From the top directory, run:
- $ make tags # this will build ctags and etags
+ $ make tags # this will build ctags and etags on a case-sensitive
+ # volume, only ctags on case-insensitive
+
+ $ make TAGS # this will build etags
$ make cscope # this will build cscope database
+9) Other makefile options
+
+ $ make MAKEJOBS=-j8 # this will use 8 processes during the build. The default is 2x the number of active cores
+
+ $ make -w # trace recursive make invocations. Useful in combination with VERBOSE=YES
+
+ $ make BUILD_LTO=1 # build with LLVM Link Time Optimization (experimental)
+
+ $ make BUILD_INTEGRATED_ASSEMBLER=1 # build with LLVM integrated assembler (experimental)
+
+=============================================
+B. How to install a new header file from XNU
+
+[Note: This does not cover installing header files in IOKit framework]
+
+1) XNU installs header files at the following locations -
+ a. $(DSTROOT)/System/Library/Frameworks/Kernel.framework/Headers
+ b. $(DSTROOT)/System/Library/Frameworks/Kernel.framework/PrivateHeaders
+ c. $(DSTROOT)/System/Library/Frameworks/System.framework/Headers
+ d. $(DSTROOT)/System/Library/Frameworks/System.framework/PrivateHeaders
+ e