Chameleon

Chameleon Commit Details

Date:2014-10-21 20:54:27 (9 years 6 months ago)
Author:ErmaC
Commit:2433
Parents: 2432
Message:Merge Yosemite patch (ready from June 2014) Thanks all involved in the test and develop. Special thanks: Alex J, viv xix, zenith432 from http://forge.voodooprojects.org/p/chameleon/issues/375.
Changes:
M/trunk/i386/boot2/drivers.c
M/trunk/i386/boot2/boot.c
M/trunk/i386/libsaio/bootstruct.c
M/trunk/i386/boot2/boot.h
M/trunk/CHANGES
M/trunk/i386/boot2/options.c

File differences

trunk/i386/libsaio/bootstruct.c
118118
119119
120120
121
121
122122
123
124
125
126
127
128
123129
124130
125131
126
127
128
129
130132
131133
132134
void reserveKernBootStruct(void)
{
if ( LION || MOUNTAIN_LION || MAVERICKS )
if ( TIGER || LEOPARD || SNOW_LEOPARD )
{
// 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 {
void *oldAddr = bootArgsPreLion;
bootArgsPreLion = (boot_args_pre_lion *)AllocateKernelMemory(sizeof(boot_args_pre_lion));
bcopy(oldAddr, bootArgsPreLion, sizeof(boot_args_pre_lion));
}
}
trunk/i386/boot2/drivers.c
915915
916916
917917
918
918
919
920
921
922
923
924
925
926
927
919928
920929
921930
if (uncompressed_size != size)
{
error("ERROR: size mismatch from lzss (found: %x, expected: %x).\n", size, uncompressed_size);
if ( kernel_header->compress_type == OSSwapBigToHostConstInt32('lzvn'))
{
error("ERROR: size mismatch from lzvn (found: %x, expected: %x).\n", size, uncompressed_size);
}
if ( kernel_header->compress_type == OSSwapBigToHostConstInt32('lzss'))
{
error("ERROR: size mismatch from lzss (found: %x, expected: %x).\n", size, uncompressed_size);
}
return -1;
}
trunk/i386/boot2/boot.c
207207
208208
209209
210
210
211211
212
213
212214
215
216
217
213218
214219
215220
......
218223
219224
220225
221
222
223
224
225
226226
227227
228228
......
251251
252252
253253
254
255
254
255
256256
257
258
257
258
259
260
261
262
263
259264
260265
261266
......
280285
281286
282287
283
284
285
286
287
288
289
290
288
289
290
291
291292
292293
293294
......
329330
330331
331332
332
333
334
333
335334
336
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
337355
338
339
356
357
340358
341
342
343
344
345
359
360
361
362
363
346364
347
365
366
348367
349
350368
351369
352370
......
665683
666684
667685
668
686
687
688
689
690
691
692
693
694
695
696
669697
670698
671699
finalizeBootStruct();
// Jump to kernel's entry point. There's no going back now.
if ( LION || MOUNTAIN_LION || MAVERICKS )
if (TIGER || LEOPARD || SNOW_LEOPARD)
{
// 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);
outb(0xa1, 0xff);/* Maskout all interrupts Pic2 */
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
strlcpy(kernelCacheFile, cacheFile, sizeof(kernelCacheFile));
verbose("Specified kernel cache file path = %s\n", cacheFile);
} else {
// Lion, Mountain Lion and Mavericks prelink kernel cache file
if ( LION || MOUNTAIN_LION || MAVERICKS )
// Leopard prelink kernel cache file
if (TIGER || LEOPARD)
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%skernelcache", kDefaultCachePathSnow);
verbose("10.7, 10.8 & 10.9 kernel cache file path = %s\n", kernelCacheFile);}
// 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);
}
// Snow Leopard prelink kernel cache file
else if ( SNOW_LEOPARD ) {
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "kernelcache_%s",
}
closedir(cacheDir);
} else {
// 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);
// 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("10.7, 10.8, 10.9 & 10.10 kernel cache file path = %s\n", kernelCacheFile);
}
}
// than the kernel file or the S/L/E directory
ret = GetFileInfo(NULL, bootInfo->bootFile, &flags, &kerneltime);
// Check if the kernel file is more recent than the cache file
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeFlat)
&& (kerneltime > cachetime))
if (!YOSEMITE)
{
DBG("Kernel file (%s) is more recent than Kernel Cache (%s)! Ignoring Kernel Cache.\n",
// Check if the kernel file is more recent than the cache file
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeFlat) && (kerneltime > cachetime))
{
DBG("Kernel file (%s) is more recent than Kernel Cache (%s)! Ignoring Kernel Cache.\n", bootInfo->bootFile, kernelCacheFile);
return -1;
}
ret = GetFileInfo("/System/Library/", "Extensions", &flags, &exttime);
// Check if the S/L/E directory time is more recent than the cache file
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory) && (exttime > cachetime))
{
DBG("Folder: '/System/Library/Extensions' is more recent than Kernel Cache file (%s)! Ignoring Kernel Cache.\n", kernelCacheFile);
return -1;
}
} else {
// for 10.10
// Check if the kernel file is more recent than the cache file
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeFlat) && (kerneltime > cachetime))
{
DBG("Kernel file (%s) is more recent than Kernel Cache (%s), still loading KernelCache\n",
bootInfo->bootFile, kernelCacheFile);
return -1;
}
return -1;
}
ret = GetFileInfo("/System/Library/", "Extensions", &flags, &exttime);
// Check if the S/L/E directory time is more recent than the cache file
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory) && (exttime > cachetime))
{
DBG("Folder: '/System/Library/Extensions' is more recent than Kernel Cache file (%s)! Ignoring Kernel Cache.\n",
ret = GetFileInfo("/System/Library/", "Extensions", &flags, &exttime);
// Check if the S/L/E directory time is more recent than the cache file
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory) && (exttime > cachetime))
{
DBG("Folder: '/System/Library/Extensions' is more recent than Kernel Cache (%s), still loading KernelCache\n",
kernelCacheFile);
return -1;
return -1;
}
}
// Since the kernel cache file exists and is the most recent try to load it
DBG("Loading kernel cache: '%s'\n", kernelCachePath);
// bootFile must start with a / if it not start with a device name
if (!bootFileWithDevice && (bootInfo->bootFile)[0] != '/')
{
snprintf(bootFile, sizeof(bootFile), "/%s", bootInfo->bootFile); // append a leading /
if (!YOSEMITE)
{
//printf(HEADER " (%s).\n", bootInfo->bootFile);
snprintf(bootFile, sizeof(bootFile), "/%s", bootInfo->bootFile); // append a leading /
//sleep(1);
} else {
//printf(HEADER " (%s).\n", bootInfo->bootFile);
snprintf(bootFile, sizeof(bootFile), kDefaultKernelPathForYos"%s", bootInfo->bootFile); // Yosemite
//sleep(1);
}
} else {
strlcpy(bootFile, bootInfo->bootFile, sizeof(bootFile));
}
trunk/i386/boot2/boot.h
5454
5555
5656
57
58
59
60
5761
5862
5963
......
8084
8185
8286
87
8388
8489
8590
#define kMLionInstallerDataFolder "/OS X Install Data/"
#define kMLionInstallerPlist kMLionInstallerDataFolder "com.apple.Boot.plist"
//kernel path
#define kDefaultKernelPathPreYos"/"
#define kDefaultKernelPathForYos"/System/Library/Kernels/" //for Yosemite
/*
* Keys used in system Boot.plist
*/
#define kScanSingleDriveKey"Scan Single Drive"
#define kInstantMenuKey"Instant Menu"
#define kDefaultKernel"mach_kernel"
#define kOSXKernel"kernel"// Yosemite
#define kGUIKey"GUI"
#define kBootBannerKey"Boot Banner"
#define kShowInfoKey"ShowInfo"/* gui.c */
trunk/i386/boot2/options.c
12381238
12391239
12401240
1241
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
12421253
12431254
1244
1255
1256
12451257
1246
1258
1259
1260
1261
1262
12471263
1264
1265
1266
1267
1268
1269
1270
1271
12481272
12491273
12501274
}
else
{
strlcpy( bootInfo->bootFile, kDefaultKernel, sizeof(bootInfo->bootFile) );
if( YOSEMITE ) // is 10.10
{
strlcpy( bootInfo->bootFile, kOSXKernel, sizeof(bootInfo->bootFile) );
//printf(HEADER "/System/Library/Kernels/%s\n", bootInfo->bootFile);
}
else
{ // OSX is not 10.10
strlcpy( bootInfo->bootFile, kDefaultKernel, sizeof(bootInfo->bootFile) );
//printf(HEADER "/%s\n", bootInfo->bootFile);
}
}
}
if (strcmp( bootInfo->bootFile, kDefaultKernel ) != 0)
if (!YOSEMITE) // not 10.10 so 10.9 and previus
{
gOverrideKernel = true;
if (strcmp( bootInfo->bootFile, kDefaultKernel ) != 0)
{
//printf(HEADER "org.chameleon.Boot.plist found path for custom '%s' found!\n", bootInfo->bootFile);
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;
}
}
cntRemaining = BOOT_STRING_LEN - 2; // save 1 for NULL, 1 for space
argP = bootArgs->CommandLine;
trunk/CHANGES
1
2
3
4
15
26
37
- ErmaC : Merge Yosemite patch (ready from June 2014) Thanks all involved in the test and develop;
Special thanks: Alex J, viv xix, zenith432 from http://forge.voodooprojects.org/p/chameleon/issues/375/
Testing and improvements: Pike R. Alpha, ErmaC, Bungo, blackosx, Micky1979, crazybirdy, oldnapalm, janek202, MinusZwei and Andy Vandijck.
- Pike R. Alpha : dinamic "random-seed" implementation ( http://www.insanelymac.com/forum/topic/301350-lets-make-random-seed-really-random/ )
- ErmaC : getCPUTick() helper function ( http://www.insanelymac.com/forum/topic/301350-lets-make-random-seed-really-random/ )
- ErmaC : Add Yosemite Icons detection for chameleon UI

Archive Download the corresponding diff file

Revision: 2433