Chameleon

Chameleon Commit Details

Date:2015-01-26 01:30:09 (4 years 5 months ago)
Author:ErmaC
Commit:2561
Parents: 2560
Message:Remove macros for checkOSVersion(xx) and replace with MacOSVerCurrent and MacOSVer2Int
Changes:
M/trunk/i386/boot2/drivers.c
M/trunk/i386/boot2/boot.c
M/trunk/i386/libsaio/bootstruct.c
M/trunk/i386/libsaio/fake_efi.c
M/trunk/i386/boot2/boot.h
M/trunk/i386/boot2/options.c

File differences

trunk/i386/libsaio/bootstruct.c
119119
120120
121121
122
122
123123
124
125
126
127
128
129124
130125
131126
132127
133128
129
130
131
132
133
134
135
134136
135137
136138
void reserveKernBootStruct(void)
{
if ( TIGER || LEOPARD || SNOW_LEOPARD )
if ( MacOSVerCurrent >= MacOSVer2Int("10.7") ) // OS X 10.7 and newer
{
// for 10.4 10.5 10.6
void *oldAddr = bootArgsPreLion;
bootArgsPreLion = (boot_args_pre_lion *)AllocateKernelMemory(sizeof(boot_args_pre_lion));
bcopy(oldAddr, bootArgsPreLion, sizeof(boot_args_pre_lion));
} else {
// for 10.7 10.8 10.9 10.10
void *oldAddr = bootArgs;
bootArgs = (boot_args *)AllocateKernelMemory(sizeof(boot_args));
bcopy(oldAddr, bootArgs, sizeof(boot_args));
}
else
{
// for 10.4 10.5 10.6
void *oldAddr = bootArgsPreLion;
bootArgsPreLion = (boot_args_pre_lion *)AllocateKernelMemory(sizeof(boot_args_pre_lion));
bcopy(oldAddr, bootArgsPreLion, sizeof(boot_args_pre_lion));
}
}
//==============================================================================
trunk/i386/libsaio/fake_efi.c
724724
725725
726726
727
727
728728
729729
730730
DT__AddProperty(chosenNode, "machine-signature", sizeof(EFI_UINT32), (EFI_UINT32 *)&MachineSig);
if(YOSEMITE)
if (MacOSVerCurrent >= MacOSVer2Int("10.10"))
{
//
// Pike R. Alpha - 12 October 2014
trunk/i386/boot2/drivers.c
249249
250250
251251
252
252
253253
254254
255255
}
else
{
if ( MAVERICKS || YOSEMITE ) // issue 352
if (MacOSVerCurrent >= MacOSVer2Int("10.9")) // issue 352
{
strlcpy(gExtensionsSpec, dirSpec, 4087); /* 4096 - sizeof("Library/") */
strcat(gExtensionsSpec, "Library/");
trunk/i386/boot2/boot.c
219219
220220
221221
222
222
223223
224224
225
226
227
228
229
230
231
232
233225
234226
235227
......
238230
239231
240232
233
234
235
236
241237
238
239
240
242241
243242
244243
......
269268
270269
271270
272
273
271
272
274273
275
276
277
278
279
280
274
275
281276
282277
283
278
284279
285
286
280
281
282
283
287284
288285
289286
......
309306
310307
311308
312
313
314
315
309
310
311
312
313
314
315
316
316317
317318
318319
......
744745
745746
746747
747
748
748749
749
750
750751
751752
752753
753
754
754755
755756
756757
finalizeBootStruct();
// Jump to kernel's entry point. There's no going back now.
if (TIGER || LEOPARD || SNOW_LEOPARD)
if (MacOSVerCurrent >= MacOSVer2Int("10.7"))
{
// Notify modules that the kernel is about to be started
execute_hook("Kernel Start", (void*)kernelEntry, (void*)bootArgsPreLion, NULL, NULL);
startprog( kernelEntry, bootArgsPreLion );
}
else
{
// Notify modules that the kernel is about to be started
execute_hook("Kernel Start", (void *)kernelEntry, (void *)bootArgs, NULL, NULL);
// Masking out so that Lion doesn't doublefault
startprog( kernelEntry, bootArgs );
}
else
{
// Notify modules that the kernel is about to be started
execute_hook("Kernel Start", (void*)kernelEntry, (void*)bootArgsPreLion, NULL, NULL);
startprog( kernelEntry, bootArgsPreLion );
}
// Not reached
return 0;
}
}
else
{
// Leopard prelink kernel cache file
if (TIGER || LEOPARD)
// Lion, Mountain Lion, Mavericks and Yosemite prelink kernel cache file
if (MacOSVerCurrent >= MacOSVer2Int("10.7")) // OSX is Lion (10.7) or newer
{
// Reset cache name.
bzero(gCacheNameAdler + 64, sizeof(gCacheNameAdler) - 64);
snprintf(gCacheNameAdler + 64, sizeof(gCacheNameAdler) - 64, "%s,%s", gRootDevice, bootInfo->bootFile);
adler32 = Adler32((unsigned char *)gCacheNameAdler, sizeof(gCacheNameAdler));
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%s.%08lX", kDefaultCachePathLeo, adler32);
verbose("Reseted kernel cache file path: %s\n", kernelCacheFile);;
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%skernelcache", kDefaultCachePathSnow);
verbose("Kernel Cache file path (Mac OS X 10.7 and newer): %s\n", kernelCacheFile);
}
// Snow Leopard prelink kernel cache file
else if ( SNOW_LEOPARD )
else
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "kernelcache_%s",
(archCpuType == CPU_TYPE_I386) ? "i386" : "x86_64");
if (MacOSVerCurrent >= MacOSVer2Int("10.6")) // OSX is Snow (10.6)
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "kernelcache_%s",
(archCpuType == CPU_TYPE_I386) ? "i386" : "x86_64");
intlnam = strlen(kernelCacheFile) + 9; //with adler32
char*name;
}
else
{
// Lion, Mountain Lion, Mavericks, and Yosemite prelink kernel cache file
// for 10.7 10.8 10.9 10.10
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%skernelcache", kDefaultCachePathSnow);
verbose("Kernel Cache file path (Mac OS X 10.7 and newer): %s\n", kernelCacheFile);;
// Leopard prelink kernel cache file
// Reset cache name.
bzero(gCacheNameAdler + 64, sizeof(gCacheNameAdler) - 64);
snprintf(gCacheNameAdler + 64, sizeof(gCacheNameAdler) - 64, "%s,%s", gRootDevice, bootInfo->bootFile);
adler32 = Adler32((unsigned char *)gCacheNameAdler, sizeof(gCacheNameAdler));
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%s.%08lX", kDefaultCachePathLeo, adler32);
verbose("Reseted kernel cache file path: %s\n", kernelCacheFile);
}
}
}
// bootFile must start with a / if it not start with a device name
if (!bootFileWithDevice && (bootInfo->bootFile)[0] != '/')
{
if ( !YOSEMITE )
if (MacOSVerCurrent >= MacOSVer2Int("10.10")) // OSX is 10.10 or newer
{
snprintf(bootFile, sizeof(bootFile), "/%s", bootInfo->bootFile); // append a leading /
snprintf(bootFile, sizeof(bootFile), kDefaultKernelPathForYos "%s", bootInfo->bootFile); // Yosemite
}
else
{
snprintf(bootFile, sizeof(bootFile), kDefaultKernelPathForYos"%s", bootInfo->bootFile); // Yosemite
snprintf(bootFile, sizeof(bootFile), "/%s", bootInfo->bootFile); // append a leading '/'
}
}
else
trunk/i386/boot2/boot.h
3030
3131
3232
33
34
35
36
37
38
39
33
34
35
36
37
38
39
4040
4141
4242
#include "libsaio.h"
// OS X Versions
#define YOSEMITE checkOSVersion("10.10") // Yosemite
#define MAVERICKS checkOSVersion("10.9") // Mavericks
#define MOUNTAIN_LION checkOSVersion("10.8") // Mountain Lion
#define LION checkOSVersion("10.7") // Lion
#define SNOW_LEOPARD checkOSVersion("10.6") // Snow Leopard
#define LEOPARD checkOSVersion("10.5") // Leopard
#define TIGER checkOSVersion("10.4") // Tiger
//#define YOSEMITE checkOSVersion("10.10") // Yosemite
//#define MAVERICKS checkOSVersion("10.9") // Mavericks
//#define MOUNTAIN_LION checkOSVersion("10.8") // Mountain Lion
//#define LION checkOSVersion("10.7") // Lion
//#define SNOW_LEOPARD checkOSVersion("10.6") // Snow Leopard
//#define LEOPARD checkOSVersion("10.5") // Leopard
//#define TIGER checkOSVersion("10.4") // Tiger
/*
* Paths used by chameleon
trunk/i386/boot2/options.c
13161316
13171317
13181318
1319
1319
13201320
13211321
13221322
13231323
1324
1325
1324
1325
13261326
13271327
13281328
13291329
13301330
1331
1331
13321332
1333
1334
1335
1336
1337
1333
13381334
1339
1340
1341
1342
1343
1344
1345
1346
13471335
13481336
1349
1337
13501338
13511339
13521340
}
else
{
if( YOSEMITE ) // is 10.10
if (MacOSVerCurrent >= MacOSVer2Int("10.10")) // OS X is 10.10 or newer
{
strlcpy( bootInfo->bootFile, kOSXKernel, sizeof(bootInfo->bootFile) );
}
else
{ // OSX is not 10.10
{
// or 10.9 and previous
strlcpy( bootInfo->bootFile, kDefaultKernel, sizeof(bootInfo->bootFile) );
}
}
}
if (!YOSEMITE) // not 10.10 so 10.9 and previus
if ((strcmp( bootInfo->bootFile, kDefaultKernel ) != 0) && (strcmp( bootInfo->bootFile, kOSXKernel ) != 0))
{
if (strcmp( bootInfo->bootFile, kDefaultKernel ) != 0)
{
//printf(HEADER "org.chameleon.Boot.plist found path for custom '%s' found!\n", bootInfo->bootFile);
gOverrideKernel = true;
}
gOverrideKernel = true;
}
else
{ // OSX is 10.10
if (strcmp( bootInfo->bootFile, kOSXKernel ) != 0)
{
//printf(HEADER "org.chameleon.Boot.plist found path for custom '%s' found!\n", bootInfo->bootFile);
gOverrideKernel = true;
}
}
// Ermac : Inject "kext-dev-mode=1" if OS X 10.10 is detected
if( YOSEMITE ) // is 10.10
if (MacOSVerCurrent >= MacOSVer2Int("10.10")) // OS X is 10.10 or newer
{
addBootArg("kext-dev-mode=1");
}

Archive Download the corresponding diff file

Revision: 2561