QUOTE (valv @ Jan 29 2011, 09:00 PM)

I already knew about your two first questions. I did no progress so far. Did you ?
As I said the path is different. But if for Leo/Tiger there are no problem
CODE
Try cache /System/Library/Caches/com.apple.kernelcaches/kernelcache YES
Loading Darwin 10.4
Loading kernel cache /System/Library/Caches/com.apple.kernelcaches/kernelcache
For Snow I can't get good name
CODE
search for kernelcache /System/Library/Caches/com.apple.kext.caches/Startup/kernelcache_i386Try cache /System/Library/Caches/com.apple.kext.caches/Startup/kernelcache_i386 YES
Loading Darwin 10.6
Try cache failed
because Adler32 procedure is wrong applied. I don't know how to do better so I propose a workaround
CODE
if(gMacOSVersion[3] == '6') {
sprintf(gBootKernelCacheFile, "%skernelcache_%s", kDefaultCachePathSnow, (archCpuType == CPU_TYPE_I386) ? "i386" : "x86_64"); //, adler32);
msglog("search for kernelcache %s", gBootKernelCacheFile);
//Slice - TODO
/*
- but the name is longer .adler32 and more...
kernelcache_i386.E102928C.qSs0
so will opendir and scan for some files
*/
char* name;
long flagsC;
long timeC;
struct dirstuff* cacheDir = opendir(kDefaultCachePathSnow);
while(readdir(cacheDir, (const char**)&name, &flagsC, &timeC) >= 0)
{
if(strcmp(&name[0], gBootKernelCacheFile) == 0) //?
{
//char* tmp = malloc(strlen(name) + 1);
//strcpy(tmp, name);
verbose("find kernelcache=%s\n", name);
}
}
}
else //if(gMacOSVersion[3] == '5')
sprintf(gBootKernelCacheFile, "%skernelcache", kDefaultCachePath);
}
But this is only a first attempt. Quirky and not finished. There are may be several files and we should to choose most recent. Your propositions?
Also not sure about strcmp().
QUOTE
Regarding Linux detection, It is working for me. So I don't know where to start analysis from.
If it works for you I should more careful compare what is the difference.
EDITED:
This is also a place to discuss
CODE
// TODO: fix this, the order does matter, and it's not correct now.
// Also try to load Extensions from boot helper partitions.
if (gBootVolume->flags & kBVFlagBooter)
{
strcpy(dirSpecExtra, "/com.apple.boot.P/System/Library/");
if (FileLoadDrivers(dirSpecExtra, 0) != 0)
{
strcpy(dirSpecExtra, "/com.apple.boot.R/System/Library/");
if (FileLoadDrivers(dirSpecExtra, 0) != 0)
{
strcpy(dirSpecExtra, "/com.apple.boot.S/System/Library/");
FileLoadDrivers(dirSpecExtra, 0);
}
}
}
PRS = Paper, Rock, Scissor
Order must be:
1. If P and R then P.
2. If P and S then S.
3. If R and S then R.