Chameleon

Chameleon Commit Details

Date:2017-08-14 16:49:43 (11 months 4 days ago)
Author:ErmaC
Commit:2897
Parents: 2896
Message:Add ability to upgrade and update to/from H.Sierra (Credits to Micky1979)
Changes:
M/branches/ErmaC/Enoch/i386/boot2/options.c
M/branches/ErmaC/Enoch/i386/boot2/drivers.c
M/branches/ErmaC/Enoch/i386/boot2/boot.c
M/branches/ErmaC/Enoch/i386/libsaio/disk.c

File differences

branches/ErmaC/Enoch/i386/libsaio/disk.c
17121712
17131713
17141714
1715
17151716
17161717
17171718
......
18171818
18181819
18191820
1821
1822
1823
1824
1825
1826
18201827
18211828
18221829
......
19321939
19331940
19341941
1935
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
19361957
1937
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
19381968
19391969
19401970
char *ECPattern = "Install%20OS%20X%20El%20Capitan";
char *SierraPattern = "Install%20macOS%20Sierra";
char *HSierraPattern = "Install%20macOS%20High%20Sierra";
char *HSierraPatternB = "Install%20macOS%2010.13";
/*
* Only look for OS Version on HFS+
fakeOSVersionInt = 13;
valid = true;
}
else if(strstr(val, HSierraPatternB))
{
fakeOSVersion = "10.13";
fakeOSVersionInt = 13;
valid = true;
}
else
{
valid = false;
strncpy( bvr->OSBuildVer, "UPGRADE", strlen("UPGRADE") );
return true;
}
else
}
if (!valid)
{
len = 0; val = 0;
/*
* Not valid? 10.13 and newer use "/macOS Install Data" folder..
* and we have /macOS Install Data/Locked Files/Boot Files/SystemVersion.plist... thanks Apple!
* NOTE: the stage 2 of this installation is already bootable (aug 13 2017)
*/
snprintf(dirSpec, sizeof(dirSpec),
"hd(%d,%d)/macOS Install Data/Locked Files/Boot Files/SystemVersion.plist",
BIOS_DEV_UNIT(bvr),
bvr->part_no);
if (!loadConfigFile(dirSpec, &configFile))
{
valid = false;
if (getValueForKey(kProductVersion, &val, &len, &configFile))
{
// Copy the complete value into OSFullVer
strncpy( bvr->OSFullVer, val, len );
bvr->OSFullVer[len] = '\0'; /* null character manually added */
bvr->OSisOSXUpgrade = true;
strncpy( bvr->OSBuildVer, "UPGRADE", strlen("UPGRADE") );
return true;
}
}
}
branches/ErmaC/Enoch/i386/boot2/drivers.c
12401240
12411241
12421242
1243
1243
1244
12441245
12451246
12461247
required = XMLGetProperty(moduleDict, kPropOSBundleRequired);
// if forceKextToLoad is true, the kext will be force to load even if OSBundleRequired has value set to "Safe Boot" instead of "Root"
if (!forceKextToLoad) {
if (!forceKextToLoad)
{
if ( (required == 0) || (required->type != kTagTypeString) || !strncmp(required->string, "Safe Boot", sizeof("Safe Boot")))
{
XMLFreeTag(moduleDict);
branches/ErmaC/Enoch/i386/boot2/boot.c
489489
490490
491491
492
492
493
494
495
496
497
498
499
500
501
502
503
504
505
493506
494507
495508
......
557570
558571
559572
560
573
574
575
561576
562577
563578
564579
565
580
566581
567582
568
583
569584
570
585
586
587
588
589
590
591
571592
572593
573594
// for 10.10 and 10.11
if (isOSXUpgrade)
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%sprelinkedkernel", "/OS X Install Data/");
if ( MacOSVerCurrent >= MacOSVer2Int("10.13") )
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile),
"%sprelinkedkernel",
"/macOS Install Data/Locked Files/Boot Files/");
}
else
{
snprintf(kernelCacheFile,
sizeof(kernelCacheFile),
"%sprelinkedkernel",
"/OS X Install Data/");
}
}
else if (isInstaller)
{
}
else if (isOSXUpgrade)
{
strncpy(kernelCachePath, "/OS X Install Data/prelinkedkernel", sizeof(kernelCachePath) );
strncpy(kernelCachePath,
"/macOS Install Data/Locked Files/Boot Files/prelinkedkernel",
sizeof(kernelCachePath) );
ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime);
if ((ret == -1) || ((flags & kFileTypeMask) != kFileTypeFlat))
{
strncpy(kernelCachePath, "/OS X Install Data/kernelcache", sizeof(kernelCachePath) );
strncpy(kernelCachePath, "/OS X Install Data/prelinkedkernel", sizeof(kernelCachePath) );
ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime);
if ((flags & kFileTypeMask) != kFileTypeFlat)
if ((ret == -1) || ((flags & kFileTypeMask) != kFileTypeFlat))
{
ret = -1;
strncpy(kernelCachePath, "/OS X Install Data/kernelcache", sizeof(kernelCachePath) );
ret = GetFileInfo(NULL, kernelCachePath, &flags, &cachetime);
if ((flags & kFileTypeMask) != kFileTypeFlat)
{
ret = -1;
}
}
}
}
branches/ErmaC/Enoch/i386/boot2/options.c
14011401
14021402
14031403
1404
1404
1405
1406
1407
14051408
14061409
14071410
......
14161419
14171420
14181421
1419
1422
1423
1424
1425
14201426
14211427
14221428
......
14301436
14311437
14321438
1433
1439
1440
1441
1442
14341443
14351444
14361445
1437
1446
14381447
14391448
14401449
14411450
1451
1452
14421453
1443
1454
1455
1456
1457
14441458
1445
1446
1447
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
14481474
14491475
14501476
loadConfigFile(caBp, &ocBplist);
rval = getStringForKey(kKernelFlagsKey, &ocBplist);
addBootArg(rval);
if (rval) {
addBootArg(rval);
}
}
// Micky1979 (Vanilla Installer)
loadConfigFile(caBp, &ocBplist);
rval = getStringForKey(kKernelFlagsKey, &ocBplist);
addBootArg(rval);
if (rval) {
addBootArg(rval);
}
}
// Micky1979 (old Vanilla upgrade)
loadConfigFile(caBp, &ocBplist);
rval = getStringForKey(kKernelFlagsKey, &ocBplist);
addBootArg(rval);
if (rval) {
addBootArg(rval);
}
}
// Micky1979 (new Vanilla upgrade)
if (gBootVolume->OSisMacOSXUpgrade)
if (gBootVolume->OSisOSXUpgrade)
{
const char*rval = 0;
config_file_t ocBplist;
char caBp[2048];
bool found = false;
snprintf(caBp, sizeof(caBp), "/macOS Install Data/Locked Files/Boot Files/com.apple.Boot.plist");
snprintf(caBp, sizeof(caBp), "/OS X Install Data/com.apple.Boot.plist");
if (!loadConfigFile(caBp, &ocBplist))
{
found = true;
}
loadConfigFile(caBp, &ocBplist);
rval = getStringForKey(kKernelFlagsKey, &ocBplist);
addBootArg(rval);
if (!found) {
snprintf(caBp, sizeof(caBp), "/OS X Install Data/com.apple.Boot.plist");
if (!loadConfigFile(caBp, &ocBplist))
{
found = true;
}
}
if (found) {
rval = getStringForKey(kKernelFlagsKey, &ocBplist);
if (rval) {
addBootArg(rval);
}
}
}
cntRemaining = BOOT_STRING_LEN - 2; // save 1 for NULL, 1 for space

Archive Download the corresponding diff file

Revision: 2897