X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/b0d623f7f2ae71ed96e60569f61f9a9a27016e80..3e170ce000f1506b7b5d2c5c7faec85ceabb573d:/README diff --git a/README b/README index 2040c2cee..1294b6726 100644 --- a/README +++ b/README @@ -15,130 +15,97 @@ A. How to build XNU: By default, architecture defaults to the build machine architecture, and the kernel configuration is set to build for DEVELOPMENT. - The machine configuration defaults to S5L8900X for arm and default for i386 and ppc. This will also create a bootable image, mach_kernel, and a kernel binary with symbols, mach_kernel.sys. - - Examples: - /* make a debug kernel for H1 arm board */ - make TARGET_CONFIGS="debug arm s5l8900x" SDKROOT=/path/to/SDK - - $(OBJROOT)/DEBUG_ARM_S5L8900X/osfmk/DEBUG/osfmk.o: pre-linked object for osfmk component - $(OBJROOT)/DEBUG_ARM_S5L8900X/mach_kernel: bootable image - /* make debug and development kernels for H1 arm board */ - make TARGET_CONFIGS="debug arm s5l8900x development arm s5l8900x" SDKROOT=/path/to/SDK - - $(OBJROOT)/DEBUG_ARM_S5L8900X/osfmk/DEBUG/osfmk.o: pre-linked object for osfmk component - $(OBJROOT)/DEBUG_ARM_S5L8900X/mach_kernel: bootable image - $(OBJROOT)/DEVELOPMENT_ARM_S5L8900X/osfmk/DEVELOPMENT/osfmk.o: pre-linked object for osfmk component - $(OBJROOT)/DEVELOPMENT_ARM_S5L8900X/mach_kernel: bootable image - /* this is all you need to do to build H1 arm with DEVELOPMENT kernel configuration */ - make TARGET_CONFIGS="default arm default" SDKROOT=/path/to/SDK + /* 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=ARM - -2) Building a Component - - Go to the top directory in your XNU project. - - If you are using a sh-style shell, run the following command: - $ . SETUP/setup.sh + make ARCH_CONFIGS=X86_64 - If you are using a csh-style shell, run the following command: - % source SETUP/setup.csh - - This will define the following environmental variables: - SRCROOT, OBJROOT, DSTROOT, SYMROOT - - From a component top directory: - - $ make all - - 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 - - From the component top directory: - - $ make mach_kernel - - This includes your component in the bootable image, mach_kernel, and - in the kernel binary with symbols, mach_kernel.sys. - - WARNING: If a component header file has been modified, you will have to do - the above procedure 1. - -3) Building DEBUG +2) Building DEBUG Define kernel configuration to DEBUG in your environment or when running a make command. Then, apply procedures 4, 5 - $ make TARGET_CONFIGS="DEBUG PPC DEFAULT" all + $ make TARGET_CONFIGS="DEBUG X86_64 DEFAULT" all or - $ make KERNEL_CONFIGS=DEBUG all + $ make KERNEL_CONFIGS=DEBUG ARCH_CONFIGS=X86_64 all or - $ export TARGET_CONFIGS="DEBUG ARM MX31ADS" + $ 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 + $(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 +3) Building fat Define architectures in your environment or when running a make command. Apply procedures 3, 4, 5 - $ make TARGET_CONFIGS="RELEASE PPC default RELEASE I386 default" exporthdrs all + $ make TARGET_CONFIGS="RELEASE I386 DEFAULT RELEASE X86_64 DEFAULT" exporthdrs all or - $ make ARCH_CONFIGS="PPC I386" exporthdrs all + $ make ARCH_CONFIGS="I386 X86_64" exporthdrs all or - $ export ARCH_CONFIGS="PPC I386" + $ export ARCH_CONFIGS="I386 X86_64" $ make exporthdrs all -5) Verbose make +4) Verbose make To display complete tool invocations rather than an abbreviated version, $ make VERBOSE=YES -6) Debug information formats +5) 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 +6) Build check before integration From the top directory, run: - $ ~rc/bin/buildit . -arch ppc -arch i386 -noinstallsrc -nosum - - or for multiple arm builds - - $ ~rc/bin/buildit . -noinstallsrc -nosum -- TARGET_CONFIGS="release arm MX31ADS release arm LN2410SBC" - - or for default arm build (kernel config DEVELOPMENT and machine config MX31ADS) - - $ ~rc/bin/buildit . -arch arm -noinstallsrc -nosum -- TARGET_CONFIGS="release arm MX31ADS release arm LN2410SBC" + $ ~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 -buildAlias argument to ~rc/bin/buildit, which + can be one of: + + -buildAlias xnu # the default, builds /mach_kernel, kernel-space + # headers, user-space headers, man pages, + # symbol-set kexts + + -buildAlias xnu_debug # a DEBUG kernel in /AppleInternal with dSYM + + -buildAlias libkxld # user-space version of kernel linker + + -buildAlias libkmod # static library automatically linked into kexts -8) Creating tags and cscope + -buildAlias Libsyscall # automatically generate BSD syscall stubs + + -buildAlias xnu_quick_test # install xnu unit tests + + + +7) Creating tags and cscope Set up your build environment as per instructions in 2a @@ -151,23 +118,40 @@ A. How to build XNU: $ make cscope # this will build cscope database +8) Reindenting files + + Source files can be reindented using clang-format setup in .clang-format. XNU follow a variant of WebKit style for source code formatting. Please refer to format styles at http://www.webkit.org/coding/coding-style.html. Further options about style options is available at http://clang.llvm.org/docs/ClangFormatStyleOptions.html + + Note: clang-format binary may not be part of base installation. It can be compiled from llvm clang sources and is reachable in $PATH. + + From the top directory, run: + + $ make reindent # reindent all source files using clang format. + + 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 MAKEJOBS=-j8 # this will use 8 processes during the build. The default is 2x the number of active CPUS. + $ make -j8 # the standard command-line option is also accepted $ make -w # trace recursive make invocations. Useful in combination with VERBOSE=YES + $ make BUILD_LTO=0 # build without LLVM Link Time Optimization + + $ make REMOTEBUILD=user@remotehost # perform build on remote host + + $ make BUILD_JSON_COMPILATION_DATABASE=1 # Build Clang JSON Compilation Database + ============================================= B. How to install a new header file from XNU -[Note: This does not cover installing header files in IOKit framework] +[To install IOKit headers, see additional comments in iokit/IOKit/Makefile.] 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 + c. $(DSTROOT)/usr/include/ d. $(DSTROOT)/System/Library/Frameworks/System.framework/PrivateHeaders - e. $(DSTROOT)/usr/include/ Kernel.framework is used by kernel extensions. System.framework and /usr/include are used by user level applications. The header @@ -184,9 +168,7 @@ B. How to install a new header file from XNU from each file list are - a. DATAFILES : To make header file available in user level - - $(DSTROOT)/System/Library/Frameworks/System.framework/Headers - $(DSTROOT)/System/Library/Frameworks/System.framework/PrivateHeaders - $(DSTROOT)/usr/include/ + $(DSTROOT)/usr/include b. PRIVATE_DATAFILES : To make header file available to Apple internal in user level - @@ -207,20 +189,19 @@ B. How to install a new header file from XNU by adding the appropriate file lists. The default install lists, its member file lists and their default location are described below - - a. INSTALL_MI_LIST : Installs header file to location that is available to + a. INSTALL_MI_LIST : Installs header file to a location that is available to everyone in user level. Locations - - $(DSTROOT)/System/Library/Frameworks/System.framework/Headers - $(DSTROOT)/usr/include/ + $(DSTROOT)/usr/include Definition - INSTALL_MI_LIST = ${DATAFILES} - b. INSTALL_MI_LCL_LIST : Installs header file to location that is available + b. INSTALL_MI_LCL_LIST : Installs header file to a location that is available for Apple internal in user level. Locations - $(DSTROOT)/System/Library/Frameworks/System.framework/PrivateHeaders Definition - - INSTALL_MI_LCL_LIST = ${DATAFILES} ${PRIVATE_DATAFILES} + INSTALL_MI_LCL_LIST = ${PRIVATE_DATAFILES} c. INSTALL_KF_MI_LIST : Installs header file to location that is available to everyone for kernel extensions.