Chameleon

Chameleon Commit Details

Date:2014-10-23 00:45:00 (6 years 1 month ago)
Author:ErmaC
Commit:2436
Parents: 2435
Message:Removed duplicated check.
Changes:
M/trunk/i386/boot2/drivers.c
M/trunk/i386/boot2/boot.c

File differences

trunk/i386/boot2/drivers.c
776776
777777
778778
779
779
780
780781
781782
782783
......
802803
803804
804805
805
806
807
806808
807809
808810
809811
810812
811
813
814
812815
813816
814
817
818
815819
816820
817821
818822
819823
820
824
825
821826
822827
823828
......
830835
831836
832837
833
838
839
834840
835841
836842
......
888894
889895
890896
897
891898
892899
893900
{
prop = GetProperty(module->dict, kPropCFBundleIdentifier);
if ((prop != 0) && !strcmp(name, prop->string)) {
if ((prop != 0) && !strcmp(name, prop->string))
{
break;
}
while (1)
{
length = XMLParseNextTag(buffer + pos, &moduleDict);
if (length == -1) {
if (length == -1)
{
break;
}
pos += length;
if (moduleDict == 0) {
if (moduleDict == 0)
{
continue;
}
if (moduleDict->type == kTagTypeDict) {
if (moduleDict->type == kTagTypeDict)
{
break;
}
XMLFreeTag(moduleDict);
}
if (length == -1) {
if (length == -1)
{
return -1;
}
}
tmpModule = malloc(sizeof(Module));
if (tmpModule == 0) {
if (tmpModule == 0)
{
XMLFreeTag(moduleDict);
return -1;
}
{
return -1;
}
if (kernel_header->root_path[0] && strcmp(gBootFile, kernel_header->root_path))
{
return -1;
trunk/i386/boot2/boot.c
166166
167167
168168
169
169
170
170171
171172
172173
......
176177
177178
178179
179
180
180
181
182
183
181184
182185
183186
184187
185188
186189
187
190
191
188192
189193
190194
......
193197
194198
195199
196
200
201
197202
198
203
204
205
199206
200207
201208
......
214221
215222
216223
217
224
225
226
218227
219228
220229
......
296305
297306
298307
299
308
309
300310
301311
302
312
313
314
303315
304316
305
317
318
319
306320
307321
308
322
323
324
309325
310326
311327
312328
313329
330
314331
315
332
333
316334
317335
318
336
337
338
319339
320340
321341
322342
323343
324
344
345
325346
326347
327348
......
330351
331352
332353
333
354
355
334356
335
336
337
338
339
340
357
358
359
341360
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
361
358362
359
360
361
362
363
364
365
366
363
364
365
366
367
367368
369
368370
369371
370372
......
440442
441443
442444
443
445
446
444447
445448
446449
447450
448
451
452
449453
450454
451455
......
456460
457461
458462
459
460
463
464
461465
462466
463467
464468
465469
466
467
470
468471
469472
470473
471474
472475
473
474
476
477
475478
476479
477480
478481
479
482
483
480484
481
485
486
487
482488
483489
484490
clearActivityIndicator();
if (gErrors) {
if (gErrors)
{
printf("Errors encountered while starting up the computer.\n");
printf("Pausing %d seconds...\n", kBootErrorTimeout);
sleep(kBootErrorTimeout);
// Cleanup the PXE base code.
if ( (gBootFileType == kNetworkDeviceType) && gUnloadPXEOnExit ) {
if ( (ret = nbpUnloadBaseCode()) != nbpStatusSuccess ) {
if ( (gBootFileType == kNetworkDeviceType) && gUnloadPXEOnExit )
{
if ( (ret = nbpUnloadBaseCode()) != nbpStatusSuccess )
{
printf("nbpUnloadBaseCode error %d\n", (int) ret);
sleep(2);
}
}
bool dummyVal;
if (getBoolForKey(kWaitForKeypressKey, &dummyVal, &bootInfo->chameleonConfig) && dummyVal) {
if (getBoolForKey(kWaitForKeypressKey, &dummyVal, &bootInfo->chameleonConfig) && dummyVal)
{
showTextBuffer(msgbuf, strlen(msgbuf));
}
// If we were in text mode, switch to graphics mode.
// This will draw the boot graphics unless we are in
// verbose mode.
if (gVerboseMode) {
if (gVerboseMode)
{
setVideoMode( GRAPHICS_MODE, 0 );
} else {
}
else
{
drawBootGraphics();
}
startprog( kernelEntry, bootArgsPreLion );
} else {
}
else
{
// Notify modules that the kernel is about to be started
execute_hook("Kernel Start", (void*)kernelEntry, (void*)bootArgs, NULL, NULL);
ret = -1;
// If boot from a boot helper partition check the kernel cache file on it
if (gBootVolume->flags & kBVFlagBooter) {
if (gBootVolume->flags & kBVFlagBooter)
{
snprintf(kernelCachePath, sizeof(kernelCachePath), "com.apple.boot.P%s", kernelCacheFile);
ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime);
if ((ret == -1) || ((flags & kFileTypeMask) != kFileTypeFlat)) {
if ((ret == -1) || ((flags & kFileTypeMask) != kFileTypeFlat))
{
snprintf(kernelCachePath, sizeof(kernelCachePath), "com.apple.boot.R%s", kernelCacheFile);
ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime);
if ((ret == -1) || ((flags & kFileTypeMask) != kFileTypeFlat)) {
if ((ret == -1) || ((flags & kFileTypeMask) != kFileTypeFlat))
{
snprintf(kernelCachePath, sizeof(kernelCachePath), "com.apple.boot.S%s", kernelCacheFile);
ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime);
if ((flags & kFileTypeMask) != kFileTypeFlat) {
if ((flags & kFileTypeMask) != kFileTypeFlat)
{
ret = -1;
}
}
}
}
// If not found, use the original kernel cache path.
if (ret == -1) {
if (ret == -1)
{
strlcpy(kernelCachePath, kernelCacheFile, sizeof(kernelCachePath));
ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime);
if ((flags & kFileTypeMask) != kFileTypeFlat) {
if ((flags & kFileTypeMask) != kFileTypeFlat)
{
ret = -1;
}
}
// Exit if kernel cache file wasn't found
if (ret == -1) {
if (ret == -1)
{
DBG("No Kernel Cache File '%s' found\n", kernelCacheFile);
return -1;
}
// than the kernel file or the S/L/E directory
ret = GetFileInfo(NULL, bootInfo->bootFile, &flags, &kerneltime);
if (!YOSEMITE)
// Check if the kernel file is more recent than the cache file
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeFlat) && (kerneltime > cachetime))
{
// 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;
}
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;
}
ret = GetFileInfo("/System/Library/", "Extensions", &flags, &exttime);
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;
}
// 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;
}
// Since the kernel cache file exists and is the most recent try to load it
DBG("Loading kernel cache: '%s'\n", kernelCachePath);
// Load boot.plist config file
status = loadChameleonConfig(&bootInfo->chameleonConfig, bvChain);
if (getBoolForKey(kQuietBootKey, &quiet, &bootInfo->chameleonConfig) && quiet) {
if (getBoolForKey(kQuietBootKey, &quiet, &bootInfo->chameleonConfig) && quiet)
{
gBootMode |= kBootModeQuiet;
}
// Override firstRun to get to the boot menu instantly by setting "Instant Menu"=y in system config
if (getBoolForKey(kInstantMenuKey, &instantMenu, &bootInfo->chameleonConfig) && instantMenu) {
if (getBoolForKey(kInstantMenuKey, &instantMenu, &bootInfo->chameleonConfig) && instantMenu)
{
firstRun = false;
}
gEnableCDROMRescan = false;
// Enable it with Rescan=y in system config
if (getBoolForKey(kRescanKey, &gEnableCDROMRescan, &bootInfo->chameleonConfig)
&& gEnableCDROMRescan) {
if (getBoolForKey(kRescanKey, &gEnableCDROMRescan, &bootInfo->chameleonConfig)&& gEnableCDROMRescan)
{
gEnableCDROMRescan = true;
}
// Ask the user for Rescan option by setting "Rescan Prompt"=y in system config.
rescanPrompt = false;
if (getBoolForKey(kRescanPromptKey, &rescanPrompt , &bootInfo->chameleonConfig)
&& rescanPrompt && biosDevIsCDROM(gBIOSDev))
if (getBoolForKey(kRescanPromptKey, &rescanPrompt , &bootInfo->chameleonConfig) && rescanPrompt && biosDevIsCDROM(gBIOSDev))
{
gEnableCDROMRescan = promptForRescanOption();
}
// Enable touching a single BIOS device only if "Scan Single Drive"=y is set in system config.
if (getBoolForKey(kScanSingleDriveKey, &gScanSingleDrive, &bootInfo->chameleonConfig)
&& gScanSingleDrive) {
if (getBoolForKey(kScanSingleDriveKey, &gScanSingleDrive, &bootInfo->chameleonConfig) && gScanSingleDrive)
{
gScanSingleDrive = true;
}
// Create a list of partitions on device(s).
if (gScanSingleDrive) {
if (gScanSingleDrive)
{
scanBootVolumes(gBIOSDev, &bvCount);
} else {
}
else
{
scanDisks(gBIOSDev, &bvCount);
}

Archive Download the corresponding diff file

Revision: 2436