Chameleon

View Yosemite.diff.txt

1diff --git a/i386/boot2/boot.c b/i386/boot2/boot.c
2index 2f772fd..1496e80 100644
3--- a/i386/boot2/boot.c
4+++ b/i386/boot2/boot.c
5@@ -91,8 +91,6 @@ intbvCount = 0, gDeviceCount = 0;
6 longgBootMode; /* defaults to 0 == kBootModeNormal */
7 BVRefbvr, menuBVR, bvChain;
8
9-static boolcheckOSVersion(const char * version);
10-static voidgetOSVersion();
11 static unsigned longAdler32(unsigned char *buffer, long length);
12 //static voidselectBiosDevice(void);
13
14@@ -209,7 +207,7 @@ static int ExecKernel(void *binary)
15 finalizeBootStruct();
16
17 // Jump to kernel's entry point. There's no going back now.
18-if ((checkOSVersion("10.7")) || (checkOSVersion("10.8")) || (checkOSVersion("10.9")))
19+if ((checkOSVersion("10.7")) || (checkOSVersion("10.8")) || (checkOSVersion("10.9")) || (checkOSVersion("10.10")))
20 {
21
22 // Notify modules that the kernel is about to be started
23@@ -254,7 +252,7 @@ long LoadKernelCache(const char* cacheFile, void **binary)
24 verbose("Specified kernel cache file path = %s\n", cacheFile);
25 } else {
26 // Lion, Mountain Lion and Mavericks prelink kernel cache file
27-if ((checkOSVersion("10.7")) || (checkOSVersion("10.8")) || (checkOSVersion("10.9")))
28+if ((checkOSVersion("10.7")) || (checkOSVersion("10.8")) || (checkOSVersion("10.9")) || (checkOSVersion("10.10")))
29 {
30 snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%skernelcache", kDefaultCachePathSnow);
31 verbose("10.7, 10.8 & 10.9 kernel cache file path = %s\n", kernelCacheFile);}
32@@ -551,9 +549,6 @@ void common_boot(int biosdev)
33 updateVRAM();
34 }
35
36-// Find out which version mac os we're booting.
37-getOSVersion();
38-
39 if (platformCPUFeature(CPU_FEATURE_EM64T)) {
40 archCpuType = CPU_TYPE_X86_64;
41 } else {
42@@ -671,7 +666,11 @@ void common_boot(int biosdev)
43 // bootFile must start with a / if it not start with a device name
44 if (!bootFileWithDevice && (bootInfo->bootFile)[0] != '/')
45 {
46-snprintf(bootFile, sizeof(bootFile), "/%s", bootInfo->bootFile); // append a leading /
47+if (checkOSVersion("10.10")) {
48+snprintf(bootFile, sizeof(bootFile), kDefaultKernelPathYosemite"%s", bootInfo->bootFile); // for Yosemite
49+} else {
50+snprintf(bootFile, sizeof(bootFile), kDefaultKernelPath"%s", bootInfo->bootFile); // append a leading /
51+}
52 } else {
53 strlcpy(bootFile, bootInfo->bootFile, sizeof(bootFile));
54 }
55@@ -767,13 +766,14 @@ static void selectBiosDevice(void)
56
57 bool checkOSVersion(const char * version)
58 {
59-return ((gMacOSVersion[0] == version[0]) && (gMacOSVersion[1] == version[1])
60-&& (gMacOSVersion[2] == version[2]) && (gMacOSVersion[3] == version[3]));
61-}
62-
63-static void getOSVersion()
64-{
65-strncpy(gMacOSVersion, gBootVolume->OSVersion, sizeof(gMacOSVersion));
66+ if ( (sizeof(version) > 4) && ('.' != version[4]) && ('\0' != version[4])) { //10.10\0
67+ return ((gMacOSVersion[0] == version[0]) && (gMacOSVersion[1] == version[1])
68+ && (gMacOSVersion[2] == version[2]) && (gMacOSVersion[3] == version[3]))
69+ && (gMacOSVersion[4] == version[4]);
70+ } else {
71+ return ((gMacOSVersion[0] == version[0]) && (gMacOSVersion[1] == version[1])
72+ && (gMacOSVersion[2] == version[2]) && (gMacOSVersion[3] == version[3]));
73+ }
74 }
75
76 #define BASE 65521L /* largest prime smaller than 65536 */
77diff --git a/i386/boot2/boot.h b/i386/boot2/boot.h
78index 00c6f9d..5860529 100644
79--- a/i386/boot2/boot.h
80+++ b/i386/boot2/boot.h
81@@ -32,6 +32,10 @@
82 * Paths used by chameleon
83 */
84
85+//kernel path
86+#define kDefaultKernelPath"/"
87+#define kDefaultKernelPathYosemite"/System/Library/Kernels/"
88+
89 //kernel cache
90 #define kDefaultCachePathLeo "/System/Library/Caches/com.apple.kernelcaches/"
91 #define kDefaultCachePathSnow "/System/Library/Caches/com.apple.kext.caches/Startup/"
92@@ -70,6 +74,7 @@
93 #define kScanSingleDriveKey"Scan Single Drive"
94 #define kInstantMenuKey"Instant Menu"
95 #define kDefaultKernel"mach_kernel"
96+#define kDefaultKernelYosemite"kernel"
97 #define kGUIKey"GUI"
98 #define kBootBannerKey"Boot Banner"
99 #define kShowInfoKey"ShowInfo"// gui.c
100@@ -314,4 +319,6 @@ void HibernateBoot(char *boot_device);
101 /* bmdecompress.c */
102 void * DecompressData(void *srcbase, int *dw, int *dh, int *bytesPerPixel);
103
104+bool checkOSVersion(const char * version);
105+
106 #endif /* !__BOOT2_BOOT_H */
107diff --git a/i386/boot2/drivers.c b/i386/boot2/drivers.c
108index 709e93e..576b695 100644
109--- a/i386/boot2/drivers.c
110+++ b/i386/boot2/drivers.c
111@@ -241,7 +241,7 @@ long LoadDrivers( char * dirSpec )
112 return -1;
113 }
114 } else {
115-if (gMacOSVersion[3] == '9') {
116+if ((checkOSVersion("10.9")) || (checkOSVersion("10.10"))) {
117 strlcpy(gExtensionsSpec, dirSpec, 4087); /* 4096 - sizeof("Library/") */
118 strcat(gExtensionsSpec, "Library/");
119 FileLoadDrivers(gExtensionsSpec, 0);
120diff --git a/i386/boot2/gui.c b/i386/boot2/gui.c
121index be13191..d854f4e 100644
122--- a/i386/boot2/gui.c
123+++ b/i386/boot2/gui.c
124@@ -44,6 +44,8 @@ enum {
125 iDeviceGeneric_o,
126 iDeviceHFS,
127 iDeviceHFS_o,
128+iDeviceHFS_yos,
129+iDeviceHFS_yos_o,
130 iDeviceHFS_mav,
131 iDeviceHFS_mav_o,
132 iDeviceHFS_ML,
133@@ -59,6 +61,8 @@ enum {
134
135 iDeviceHFSRAID,
136 iDeviceHFSRAID_o,
137+iDeviceHFSRAID_yos,
138+iDeviceHFSRAID_yos_o,
139 iDeviceHFSRAID_mav,
140 iDeviceHFSRAID_mav_o,
141 iDeviceHFSRAID_ML,
142@@ -126,6 +130,8 @@ image_t images[] = {
143 {.name = "device_generic_o", .image = NULL},
144 {.name = "device_hfsplus", .image = NULL},
145 {.name = "device_hfsplus_o", .image = NULL},
146+{.name = "device_hfsplus_yos", .image = NULL},
147+{.name = "device_hfsplus_yos_o", .image = NULL},
148 {.name = "device_hfsplus_mav", .image = NULL},
149 {.name = "device_hfsplus_mav_o", .image = NULL},
150 {.name = "device_hfsplus_ml", .image = NULL},
151@@ -141,6 +147,8 @@ image_t images[] = {
152
153 {.name = "device_hfsraid", .image = NULL},
154 {.name = "device_hfsraid_o", .image = NULL},
155+{.name = "device_hfsraid_yos", .image = NULL},
156+{.name = "device_hfsraid_yos_o", .image = NULL},
157 {.name = "device_hfsraid_mav", .image = NULL},
158 {.name = "device_hfsraid_mav_o", .image = NULL},
159 {.name = "device_hfsraid_ml", .image = NULL},
160@@ -966,6 +974,12 @@ void drawDeviceIcon(BVRef device, pixmap_t *buffer, position_t p, bool isSelecte
161 {
162 // Use HFS or HFSRAID icon depending on bvr flags. Fallbacks are handled by alt_image above.
163 switch (device->OSVersion[3]) {
164+case '1':
165+if ((device->OSVersion[4]) == '0')
166+devicetype = (device->flags & kBVFlagBooter ? iDeviceHFSRAID_yos : iDeviceHFS_yos);
167+else
168+devicetype = (device->flags & kBVFlagBooter ? iDeviceHFSRAID : iDeviceHFS);
169+break;
170 case '9':
171 devicetype = (device->flags & kBVFlagBooter ? iDeviceHFSRAID_mav : iDeviceHFS_mav);
172 break;
173diff --git a/i386/boot2/options.c b/i386/boot2/options.c
174index da9dfbb..0089320 100644
175--- a/i386/boot2/options.c
176+++ b/i386/boot2/options.c
177@@ -1201,6 +1201,9 @@ processBootOptions()
178 return -1;
179 }
180
181+// Find out which version mac os we're booting.
182+strncpy(gMacOSVersion, gBootVolume->OSVersion, sizeof(gMacOSVersion));
183+
184 // Load config table specified by the user, or use the default.
185
186 if (!getValueForBootKey(cp, "config", &val, &cnt)) {
187@@ -1230,10 +1233,14 @@ processBootOptions()
188 {
189 strlcpy( bootInfo->bootFile, val, cnt+1 );
190 } else {
191-strlcpy( bootInfo->bootFile, kDefaultKernel, sizeof(bootInfo->bootFile) );
192+if ((checkOSVersion("10.10"))) {
193+strlcpy( bootInfo->bootFile, kDefaultKernelYosemite, sizeof(bootInfo->bootFile) );
194+} else {
195+strlcpy( bootInfo->bootFile, kDefaultKernel, sizeof(bootInfo->bootFile) );
196+}
197 }
198 }
199-if (strcmp( bootInfo->bootFile, kDefaultKernel ) != 0)
200+if ((strcmp( bootInfo->bootFile, kDefaultKernel ) != 0) && (strcmp( bootInfo->bootFile, kDefaultKernelYosemite ) != 0))
201 {
202 gOverrideKernel = true;
203 }
204diff --git a/i386/libsaio/bootstruct.c b/i386/libsaio/bootstruct.c
205index ed83594..fd95a79 100644
206--- a/i386/libsaio/bootstruct.c
207+++ b/i386/libsaio/bootstruct.c
208@@ -27,6 +27,7 @@
209 */
210
211 #include "libsaio.h"
212+#include "boot.h"
213 #include "bootstruct.h"
214
215 #ifndef DEBUG_BOOTSTRUCT
216@@ -119,8 +120,7 @@ void initKernBootStruct( void )
217 void
218 reserveKernBootStruct(void)
219 {
220-if ((gMacOSVersion[0] == '1') && (gMacOSVersion[1] == '0')
221-&& (gMacOSVersion[2] == '.') && (gMacOSVersion[3] == '7' || gMacOSVersion[3] == '8' || gMacOSVersion[3] == '9'))
222+if ((checkOSVersion("10.7")) || (checkOSVersion("10.8")) || (checkOSVersion("10.9")) || (checkOSVersion("10.10")))
223 {
224 void *oldAddr = bootArgs;
225 bootArgs = (boot_args *)AllocateKernelMemory(sizeof(boot_args));
226

Archive Download this file

Attachment to issue 375

Created: 9 years 5 months ago by zenith432