├── .gitignore ├── README.md └── setupXNU.sh /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .git 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | XCPM 2 | ---- 3 | 4 | The project goal is to add XCPM support for self compiled XNU kernels. 5 | 6 | The first step is to write a script (setupXNU.sh) to download and install the required tools (99% completed). 7 | 8 | The next step is to write a helper script to construct the xcpm_library. 9 | 10 | The next step is to patch the XNU makefiles and source code so that it calls the xcpm functions from the xcpm_library. 11 | 12 | 13 | PROJECT DEVELOPMENT 14 | ------------------- 15 | 16 | This project is maintained by Pike R. Alpha (https://pikeralpha.wordpress.com) 17 | 18 | 19 | DOWNLOADS 20 | --------- 21 | 22 | Currently there is no download available. 23 | -------------------------------------------------------------------------------- /setupXNU.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Version control (latest versions for Yosemite) 5 | # 6 | DTRACE_VERSION="147" 7 | AVAILABILITY_VERSION="9" 8 | XNU_VERSION="2782.1.97" 9 | 10 | # 11 | # Path and filename setup. 12 | # 13 | gHome=$(echo $HOME) 14 | gProjectDirectory="${gHome}/Projects/Apple" 15 | 16 | # 17 | # Check project directory 18 | # 19 | if [[ ! "${gProjectDirectory}" ]]; 20 | then 21 | mkdir "${gProjectDirectory}" 22 | else 23 | cd "${gProjectDirectory}" 24 | fi 25 | 26 | echo "Checking dtrace-${DTRACE_VERSION} setup ..." 27 | 28 | if [[ ! "dtrace-${DTRACE_VERSION}.tar.gz" ]]; 29 | then 30 | # 31 | # Not there. Get (latest) tarball from Apple. 32 | # 33 | curl -O "http://opensource.apple.com/tarballs/dtrace/dtrace-${DTRACE_VERSION}.tar.gz" 34 | fi 35 | 36 | if [[ ! "dtrace-${DTRACE_VERSION}" ]]; 37 | then 38 | # 39 | # Unpack the downloaded tarball. 40 | # 41 | tar zxf "dtrace-${DTRACE_VERSION}.tar.gz" 42 | fi 43 | 44 | if [[ "dtrace-${DTRACE_VERSION}" ]]; 45 | then 46 | cd "dtrace-${DTRACE_VERSION}" 47 | 48 | if [[ ! dst ]]; 49 | then 50 | mkdir -p obj sym dst 51 | fi 52 | 53 | xcodebuild install -target ctfconvert -target ctfdump -target ctfmerge ARCHS="x86_64" SRCROOT=$PWD OBJROOT=$PWD/obj SYMROOT=$PWD/sym DSTROOT=$PWD/dst 54 | # 55 | # Check return status. 56 | # 57 | if [[ $? -eq 0 ]]; 58 | then 59 | sudo ditto dst/usr/local /usr/local 60 | else 61 | exit 1 62 | fi 63 | fi 64 | 65 | cd .. 66 | 67 | echo "Checking AvailabilityVersions-${AVAILABILITY_VERSION} setup ..." 68 | 69 | if [[ ! "AvailabilityVersions-${AVAILABILITY_VERSION}.tar.gz" ]]; 70 | then 71 | # 72 | # Not there. Get (latest) tarball from Apple. 73 | # 74 | curl -O "http://opensource.apple.com/tarballs/AvailabilityVersions/AvailabilityVersions-${AVAILABILITY_VERSION}.tar.gz" 75 | fi 76 | 77 | if [[ ! "AvailabilityVersions-${AVAILABILITY_VERSION}" ]]; 78 | then 79 | # 80 | # Unpack the downloaded tarball. 81 | # 82 | tar zxf "AvailabilityVersions-${AVAILABILITY_VERSION}.tar.gz" 83 | fi 84 | 85 | if [[ "AvailabilityVersions-${AVAILABILITY_VERSION}" ]]; 86 | then 87 | cd "AvailabilityVersions-${AVAILABILITY_VERSION}" 88 | 89 | if [[ ! dst ]]; 90 | then 91 | mkdir -p dst 92 | fi 93 | 94 | make install SRCROOT=$PWD DSTROOT=$PWD/dst 95 | # 96 | # Check return status. 97 | # 98 | if [[ $? -eq 0 ]]; 99 | then 100 | printf "Installing AvailabilityVersions ... " 101 | sudo ditto $PWD/dst/usr/local `xcrun -sdk macosx -show-sdk-path`/usr/local 102 | printf "Done\n" 103 | else 104 | printf "Error!\n" 105 | exit 1 106 | fi 107 | else 108 | echo "Error: ${PROJECT_DIR}/AvailabilityVersions-${AVAILABILITY_VERSION} not found!" 109 | exit 1 110 | fi 111 | 112 | cd .. 113 | 114 | echo "Checking xnu-${XNU_VERSION} source code setup ..." 115 | 116 | if [[ ! "xnu-${XNU_VERSION}.tar.gz" ]]; 117 | then 118 | # 119 | # Not there. Get (latest) tarball from Apple. 120 | # 121 | curl -O "http://opensource.apple.com/tarballs/xnu/xnu-${XNU_VERSION}.tar.gz" 122 | fi 123 | 124 | if [[ ! "xnu-${AVAILABILITY_VERSION}" ]]; 125 | then 126 | # 127 | # Unpack the downloaded tarball. 128 | # 129 | tar zxf “xnu-${XNU_VERSION}.tar.gz” 130 | fi 131 | 132 | if [[ "xnu-${AVAILABILITY_VERSION}" ]]; 133 | then 134 | cd "xnu-${XNU_VERSION}" 135 | # 136 | # Haswell target (note the "H") 137 | # 138 | printf "Compiling XNU source code ... " 139 | make SDKROOT=macosx ARCH_CONFIGS=X86_64H KERNEL_CONFIGS=RELEASE 140 | # 141 | # Check return status. 142 | # 143 | if [[ $? -eq 0 ]]; 144 | then 145 | printf "Done\n" 146 | else 147 | printf "Error\n" 148 | fi 149 | 150 | fi 151 | 152 | exit 0 153 | --------------------------------------------------------------------------------