Chameleon

Chameleon Commit Details

Date:2011-08-22 15:22:51 (9 years 3 months ago)
Author:JrCs
Commit:1448
Parents: 1447
Message:Print informations if KernelCache file can't be used
Changes:
M/trunk/i386/boot2/boot.c

File differences

trunk/i386/boot2/boot.c
325325
326326
327327
328
328
329
330
329331
332
330333
331334
332335
333336
334
337
338
339
335340
341
336342
337343
338344
......
612618
613619
614620
615
616
617
618
619
620
621
622
623
624
625
626
627
628
621
622
629623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
630656
631657
632658
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))
&& (kerneltime > cachetime)) {
verbose("Kernel file (%s) is more recent than KernelCache (%s), ignoring KernelCache\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))
&& (exttime > cachetime)) {
verbose("/System/Library/Extensions is more recent than KernelCache (%s), ignoring KernelCache\n",
kernelCacheFile);
return -1;
}
// Since the kernel cache file exists and is the most recent try to load it
verbose("Loading kernel cache %s\n", kernelCachePath);
verbose("Loading Darwin %s\n", gMacOSVersion);
// If boot from boot helper partitions and OS is Lion use prelink kernel.
// We need to find a solution to load extra mkext with a prelink kernel.
if (gBootVolume->flags & kBVFlagBooter && checkOSVersion("10.7")) {
verbose("Booting from Lion RAID volume so forcing to use KernelCache\n");
useKernelCache = true;
} else {
bool useKernelCacheConfig = false; // by default don't use prelink kernel cache
getBoolForKey(kUseKernelCache, &useKernelCacheConfig, &bootInfo->chameleonConfig);
useKernelCache = (useKernelCacheConfig &&
((gBootMode & kBootModeSafe) == 0) &&
!gOverrideKernel &&
(gMKextName[0] == 0) &&
(gBootFileType == kBlockDeviceType));
}
useKernelCache = false; // by default don't use prelink kernel cache
getBoolForKey(kUseKernelCache, &useKernelCache, &bootInfo->chameleonConfig);
if (useKernelCache) do {
// If boot from boot helper partitions and OS is Lion use prelink kernel.
// We need to find a solution to load extra mkext with a prelink kernel.
if (gBootVolume->flags & kBVFlagBooter && checkOSVersion("10.7")) {
verbose("Booting from Lion RAID volume so forcing to use KernelCache\n");
useKernelCache = true;
break;
}
if ((gBootMode & kBootModeSafe) == 1) {
verbose("Booting in 'Boot Safe' mode, KernelCache will not be used\n");
useKernelCache = false;
break;
}
if (gOverrideKernel) {
verbose("Using a non default kernel (%s), KernelCache will not be used\n",
bootInfo->bootFile);
useKernelCache = false;
break;
}
if (gMKextName[0] != 0) {
verbose("Using a specific MKext Cache (%s), KernelCache will not be used\n",
gMKextName);
useKernelCache = false;
break;
}
if (gBootFileType != kBlockDeviceType)
useKernelCache = false;
} while(0);
do {
if (useKernelCache) {
ret = LoadKernelCache(&binary);

Archive Download the corresponding diff file

Revision: 1448