Chameleon

View Yosemite.diff

1Index: Make.rules
2===================================================================
3--- Make.rules(revision 2378)
4+++ Make.rules(working copy)
5@@ -17,7 +17,8 @@
6 NASM = $(shell which nasm) -p $(SRCROOT)/autoconf.inc
7
8
9-CFLAGS= $(CONFIG_OPTIMIZATION_LEVEL) -g -Wmost -Werror
10+#CFLAGS= $(CONFIG_OPTIMIZATION_LEVEL) -g -Wmost -Werror
11+CFLAGS= $(CONFIG_OPTIMIZATION_LEVEL) -g -Werror
12 CPPFLAGS = $(MORECPP) -g -Wmost -Werror -fno-exceptions -fno-rtti
13 DEFINES=
14
15Index: i386/boot2/Makefile
16===================================================================
17--- i386/boot2/Makefile(revision 2378)
18+++ i386/boot2/Makefile(working copy)
19@@ -20,7 +20,7 @@
20 include ${SRCROOT}/Make.rules
21
22 OPTIM = -Os -Oz
23-CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Wmost -Werror \
24+CFLAGS= $(RC_CFLAGS) $(OPTIM) $(MORECPP) -arch i386 -g -Werror \
25 -fno-builtin -DSAIO_INTERNAL_USER -static $(OMIT_FRAME_POINTER_CFLAG) -fno-stack-protector \
26 -march=pentium4 -msse2 -msoft-float -nostdinc -include $(SRCROOT)/autoconf.h
27
28Index: i386/boot2/boot.c
29===================================================================
30--- i386/boot2/boot.c(revision 2378)
31+++ i386/boot2/boot.c(working copy)
32@@ -80,8 +80,6 @@
33 longgBootMode; /* defaults to 0 == kBootModeNormal */
34 BVRefbvr, menuBVR, bvChain;
35
36-static boolcheckOSVersion(const char * version);
37-static voidgetOSVersion();
38 static unsigned longAdler32(unsigned char *buffer, long length);
39 //static voidselectBiosDevice(void);
40
41@@ -197,7 +195,7 @@
42 finalizeBootStruct();
43
44 // Jump to kernel's entry point. There's no going back now.
45-if ((checkOSVersion("10.7")) || (checkOSVersion("10.8")) || (checkOSVersion("10.9")))
46+if ((checkOSVersion("10.7")) || (checkOSVersion("10.8")) || (checkOSVersion("10.9")) || (checkOSVersion("10.10")))
47 {
48
49 // Notify modules that the kernel is about to be started
50@@ -243,7 +241,7 @@
51 else
52 {
53 // Lion, Mountain Lion and Mavericks prelink kernel cache file
54-if ((checkOSVersion("10.7")) || (checkOSVersion("10.8")) || (checkOSVersion("10.9")))
55+if ((checkOSVersion("10.7")) || (checkOSVersion("10.8")) || (checkOSVersion("10.9")) || (checkOSVersion("10.10")))
56 {
57 snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%skernelcache", kDefaultCachePathSnow);
58 }
59@@ -533,9 +531,6 @@
60 updateVRAM();
61 }
62
63-// Find out which version mac os we're booting.
64-getOSVersion();
65-
66 if (platformCPUFeature(CPU_FEATURE_EM64T)) {
67 archCpuType = CPU_TYPE_X86_64;
68 } else {
69@@ -655,7 +650,11 @@
70
71 // bootFile must start with a / if it not start with a device name
72 if (!bootFileWithDevice && (bootInfo->bootFile)[0] != '/')
73-snprintf(bootFile, sizeof(bootFile), "/%s", bootInfo->bootFile); // append a leading /
74+ if (checkOSVersion("10.10")) {
75+ snprintf(bootFile, sizeof(bootFile), kDefaultKernelPathForYos"%s", bootInfo->bootFile); // for Yosemite
76+ } else {
77+ snprintf(bootFile, sizeof(bootFile), kDefaultKernelPath"%s", bootInfo->bootFile); // append a leading /
78+ }
79 else
80 strlcpy(bootFile, bootInfo->bootFile, sizeof(bootFile));
81
82@@ -749,15 +748,16 @@
83
84 bool checkOSVersion(const char * version)
85 {
86-return ((gMacOSVersion[0] == version[0]) && (gMacOSVersion[1] == version[1])
87-&& (gMacOSVersion[2] == version[2]) && (gMacOSVersion[3] == version[3]));
88+ if ( (sizeof(version) > 4) && ('.' != version[4]) && ('\0' != version[4])) { //10.10\0
89+ return ((gMacOSVersion[0] == version[0]) && (gMacOSVersion[1] == version[1])
90+ && (gMacOSVersion[2] == version[2]) && (gMacOSVersion[3] == version[3]))
91+ && (gMacOSVersion[4] == version[4]);
92+ } else {
93+ return ((gMacOSVersion[0] == version[0]) && (gMacOSVersion[1] == version[1])
94+ && (gMacOSVersion[2] == version[2]) && (gMacOSVersion[3] == version[3]));
95+ }
96 }
97
98-static void getOSVersion()
99-{
100-strncpy(gMacOSVersion, gBootVolume->OSVersion, sizeof(gMacOSVersion));
101-}
102-
103 #define BASE 65521L /* largest prime smaller than 65536 */
104 #define NMAX 5000
105 // NMAX (was 5521) the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1
106Index: i386/boot2/boot.h
107===================================================================
108--- i386/boot2/boot.h(revision 2378)
109+++ i386/boot2/boot.h(working copy)
110@@ -40,6 +40,10 @@
111 #define kLionInstallerDataFolder "/Mac OS X Install Data/"
112 #define kLionInstallerPlist kLionInstallerDataFolder "com.apple.Boot.plist"
113
114+//kernel path
115+#define kDefaultKernelPath "/"
116+#define kDefaultKernelPathForYos "/System/Library/Kernels/" //for Yosemite
117+
118 /*
119 * Keys used in system Boot.plist
120 */
121@@ -66,6 +70,7 @@
122 #define kScanSingleDriveKey"Scan Single Drive"
123 #define kInstantMenuKey"Instant Menu"
124 #define kDefaultKernel"mach_kernel"
125+#define kDefaultKernelForYos "kernel" //Yosemite
126 #define kGUIKey"GUI"
127 #define kBootBannerKey"Boot Banner"
128 #define kShowInfoKey"ShowInfo"// gui.c
129@@ -302,4 +307,6 @@
130 /* bmdecompress.c */
131 void * DecompressData(void *srcbase, int *dw, int *dh, int *bytesPerPixel);
132
133+bool checkOSVersion(const char * version);
134+
135 #endif /* !__BOOT2_BOOT_H */
136Index: i386/boot2/drivers.c
137===================================================================
138--- i386/boot2/drivers.c(revision 2378)
139+++ i386/boot2/drivers.c(working copy)
140@@ -235,7 +235,7 @@
141 return -1;
142 }
143 } else {
144-if (gMacOSVersion[3] == '9') {
145+if ((checkOSVersion("10.9")) || (checkOSVersion("10.10"))) {
146 strlcpy(gExtensionsSpec, dirSpec, 4087); /* 4096 - sizeof("Library/") */
147 strcat(gExtensionsSpec, "Library/");
148 FileLoadDrivers(gExtensionsSpec, 0);
149Index: i386/boot2/gui.c
150===================================================================
151--- i386/boot2/gui.c(revision 2378)
152+++ i386/boot2/gui.c(working copy)
153@@ -43,6 +43,8 @@
154 iDeviceGeneric_o,
155 iDeviceHFS,
156 iDeviceHFS_o,
157+ iDeviceHFS_yos,
158+ iDeviceHFS_yos_o,
159 iDeviceHFS_mav,
160 iDeviceHFS_mav_o,
161 iDeviceHFS_ML,
162@@ -58,6 +60,8 @@
163
164 iDeviceHFSRAID,
165 iDeviceHFSRAID_o,
166+ iDeviceHFSRAID_yos,
167+ iDeviceHFSRAID_yos_o,
168 iDeviceHFSRAID_mav,
169 iDeviceHFSRAID_mav_o,
170 iDeviceHFSRAID_ML,
171@@ -123,6 +127,8 @@
172 {.name = "device_generic_o", .image = NULL},
173 {.name = "device_hfsplus", .image = NULL},
174 {.name = "device_hfsplus_o", .image = NULL},
175+ {.name = "device_hfsplus_yos", .image = NULL},
176+ {.name = "device_hfsplus_yos_o", .image = NULL},
177 {.name = "device_hfsplus_mav", .image = NULL},
178 {.name = "device_hfsplus_mav_o", .image = NULL},
179 {.name = "device_hfsplus_ml", .image = NULL},
180@@ -138,6 +144,8 @@
181
182 {.name = "device_hfsraid", .image = NULL},
183 {.name = "device_hfsraid_o", .image = NULL},
184+{.name = "device_hfsraid_yos", .image = NULL},
185+{.name = "device_hfsraid_yos_o", .image = NULL},
186 {.name = "device_hfsraid_mav", .image = NULL},
187 {.name = "device_hfsraid_mav_o", .image = NULL},
188 {.name = "device_hfsraid_ml", .image = NULL},
189Index: i386/boot2/options.c
190===================================================================
191--- i386/boot2/options.c(revision 2378)
192+++ i386/boot2/options.c(working copy)
193@@ -1193,6 +1193,9 @@
194 return -1;
195 }
196
197+ // Find out which version mac os we're booting.
198+ strncpy(gMacOSVersion, gBootVolume->OSVersion, sizeof(gMacOSVersion));
199+
200 // Load config table specified by the user, or use the default.
201
202 if (!getValueForBootKey(cp, "config", &val, &cnt)) {
203@@ -1220,10 +1223,14 @@
204 if ( getValueForKey( kKernelNameKey, &val, &cnt, &bootInfo->bootConfig ) ) {
205 strlcpy( bootInfo->bootFile, val, cnt+1 );
206 } else {
207-strlcpy( bootInfo->bootFile, kDefaultKernel, sizeof(bootInfo->bootFile) );
208+ if ((checkOSVersion("10.10"))) {
209+ strlcpy( bootInfo->bootFile, kDefaultKernelForYos, sizeof(bootInfo->bootFile) );
210+ } else {
211+ strlcpy( bootInfo->bootFile, kDefaultKernel, sizeof(bootInfo->bootFile) );
212+ }
213 }
214 }
215-if (strcmp( bootInfo->bootFile, kDefaultKernel ) != 0) {
216+if ((strcmp( bootInfo->bootFile, kDefaultKernel ) != 0) && (strcmp( bootInfo->bootFile, kDefaultKernelForYos ) != 0)) {
217 gOverrideKernel = true;
218 }
219
220Index: i386/libsaio/bootstruct.c
221===================================================================
222--- i386/libsaio/bootstruct.c(revision 2378)
223+++ i386/libsaio/bootstruct.c(working copy)
224@@ -27,6 +27,7 @@
225 */
226
227 #include "libsaio.h"
228+#include "boot.h"
229 #include "bootstruct.h"
230
231 /*==========================================================================
232@@ -109,8 +110,7 @@
233 void
234 reserveKernBootStruct(void)
235 {
236-if ((gMacOSVersion[0] == '1') && (gMacOSVersion[1] == '0')
237-&& (gMacOSVersion[2] == '.') && (gMacOSVersion[3] == '7' || gMacOSVersion[3] == '8' || gMacOSVersion[3] == '9'))
238+if ((checkOSVersion("10.7")) || (checkOSVersion("10.8")) || (checkOSVersion("10.9")) || (checkOSVersion("10.10")))
239 {
240 void *oldAddr = bootArgs;
241 bootArgs = (boot_args *)AllocateKernelMemory(sizeof(boot_args));
242

Archive Download this file

Attachment to issue 375

Created: 10 years 1 month ago by viv xix