Chameleon

Chameleon Commit Details

Date:2011-08-26 19:16:40 (9 years 3 months ago)
Author:JrCs
Commit:1461
Parents: 1460
Message:Fix issue where using specific kernel image and kernel cache files
Changes:
M/trunk/i386/boot2/boot.c

File differences

trunk/i386/boot2/boot.c
225225
226226
227227
228
228
229229
230230
231
232
233231
234232
235233
236
237
238
239
240
241
242
243
244
234
235
236
245237
246238
247239
......
498490
499491
500492
501
502493
503494
504
495
496
505497
506498
507499
......
623615
624616
625617
618
619
620
621
622
623
624
625
626
627
628
629
626630
627631
628632
......
636640
637641
638642
639
640
643
644
641645
642646
643647
......
655659
656660
657661
658
662
659663
660664
661665
//==========================================================================
// LoadKernelCache - Try to load Kernel Cache.
// return the length of the loaded cache file or -1 on error
long LoadKernelCache(void **binary) {
long LoadKernelCache(const char* cacheFile, void **binary) {
charkernelCacheFile[512];
charkernelCachePath[512];
const char*val;
int len;
longflags, time, cachetime, kerneltime, exttime, ret=-1;
unsigned long adler32;
// Determine the name of the Kernel Cache
if (getValueForKey(kKernelCacheKey, &val, &len, &bootInfo->bootConfig)) {
if (val[0] == '\\')
{
len--;
val++;
}
strlcpy(kernelCacheFile, val, len + 1);
}
// Use specify kernel cache file if not empty
if (cacheFile[0] != 0)
strlcpy(kernelCacheFile, cacheFile, sizeof(kernelCacheFile));
else {
// Lion prelink kernel cache file
if (checkOSVersion("10.7")) {
longflags, sleeptime, time;
void*binary = (void *)kLoadAddr;
// additional variable for testing alternate kernel image locations on boot helper partitions.
char bootFile[sizeof(bootInfo->bootFile)];
charbootFilePath[512];
charkernelCacheFile[512];
// Initialize globals.
sysConfigValid = false;
gErrors = false;
if (useKernelCache) do {
// Determine the name of the Kernel Cache
if (getValueForKey(kKernelCacheKey, &val, &len, &bootInfo->bootConfig)) {
if (val[0] == '\\')
{
len--;
val++;
}
strlcpy(kernelCacheFile, val, len + 1);
} else {
kernelCacheFile[0] = 0; // Use default kernel cache file
}
// 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")) {
useKernelCache = false;
break;
}
if (gOverrideKernel) {
verbose("Using a non default kernel (%s), KernelCache will not be used\n",
if (gOverrideKernel && kernelCacheFile[0] == 0) {
verbose("Using a non default kernel (%s) without specifying 'Kernel Cache' path, KernelCache will not be used\n",
bootInfo->bootFile);
useKernelCache = false;
break;
do {
if (useKernelCache) {
ret = LoadKernelCache(&binary);
ret = LoadKernelCache(kernelCacheFile, &binary);
if (ret >= 0)
break;
}

Archive Download the corresponding diff file

Revision: 1461