Chameleon

Chameleon Commit Details

Date:2010-08-30 03:16:48 (13 years 8 months ago)
Author:Azimutz
Commit:448
Parents: 447
Message:Trunk it, revs 438, 444 & 445.
Changes:
M/branches/azimutz/CleanCut/i386/boot2/options.c
M/branches/azimutz/Chazileon/i386/boot2/graphics.c
M/branches/azimutz/CleanCut/i386/boot2/graphics.c
M/branches/azimutz/Chazileon/i386/libsaio/disk.c
M/branches/azimutz/CleanCut/i386/libsaio/disk.c
M/branches/azimutz/Chazileon/i386/boot2/options.c

File differences

branches/azimutz/Chazileon/i386/libsaio/disk.c
16041604
16051605
16061606
1607
1607
16081608
16091609
16101610
......
16991699
17001700
17011701
1702
1702
17031703
17041704
17051705
......
17291729
17301730
17311731
1732
1732
17331733
1734
1734
17351735
17361736
17371737
......
17701770
17711771
17721772
1773
1773
17741774
17751775
17761776
......
18051805
18061806
18071807
1808
1808
1809
18091810
18101811
18111812
/* Looking for "Hide Partition" entries in 'hd(x,y)|uuid|"label" hd(m,n)|uuid|"label"' format
* to be able to hide foreign partitions from the boot menu.
*/
if ( (newBVR->flags & kBVFlagForeignBoot) )
if ( (newBVR->flags & kBVFlagForeignBoot) ) //Azi: enable hiding native boot?
{
char *start, *next = val;
long len = 0;
bool matchVolumeToString( BVRef bvr, const char* match, long matchLen)
{
char testStr[128];
if ( !bvr || !match || !*match)
return 0;
return false;
}
/* If Rename Partition has defined an alias, then extract it for description purpose
/* If Rename Partition has defined an alias, then extract it for description purpose.
* The format for the rename string is the following:
* hd(x,y)|uuid|"label" "alias";hd(m,n)|uuid|"label" etc; ...
* hd(x,y)|uuid|"label" "alias";hd(m,n)|uuid|"label" "alias";etc...
*/
bool getVolumeLabelAlias(BVRef bvr, char* str, long strMaxLen)
if ( matchVolumeToString(bvr, volStart, volLen) )
{
strncpy(str, aliasStart, min(strMaxLen, aliasLen));
strncat(str, aliasStart, min(strMaxLen, aliasLen));
free(aliasList);
return true;
/* See if a partition rename is preferred */
if(getVolumeLabelAlias(bvr, p, strMaxLen)) {
//verbose("Renamed: %s\n", p); Azi:remove??
//verbose("Renamed: %s\n", p); Azi:remove??
strncpy(bvr->label, p, strMaxLen);
return; // we're done here no need to seek for real name
}
branches/azimutz/Chazileon/i386/boot2/graphics.c
12341234
12351235
12361236
1237
1237
1238
12381239
12391240
12401241
......
12431244
12441245
12451246
1246
1247
1248
12471249
12481250
12491251
{
currentIndicator = 0;
}
printf("%c\b", indicator[currentIndicator++]);
putc(indicator[currentIndicator++]);
putc('\b');
}
}
{
if ( getVideoMode() == VGA_TEXT_MODE )
{
printf(" \b");
putc(' ');
putc('\b');
}
}
branches/azimutz/Chazileon/i386/boot2/options.c
4444
4545
4646
47
47
48
4849
4950
5051
......
117118
118119
119120
120
121
121122
122123
123124
......
776777
777778
778779
779
780
780
781
781782
782783
783784
784785
785
786
787
786
787
788788
789789
790
790
791791
792792
793793
794
795794
796795
797796
798797
799
800
801798
802799
803800
......
812809
813810
814811
815
812
816813
817814
818815
......
864861
865862
866863
867
864
868865
869866
870867
......
12671264
12681265
12691266
1270
1271
12721267
12731268
12741269
......
12771272
12781273
12791274
1280
12811275
12821276
12831277
......
13091303
13101304
13111305
1312
1306
13131307
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1308
13241309
13251310
13261311
......
14761461
14771462
14781463
1464
1465
1466
1467
1468
1469
14791470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
14801496
14811497
14821498
//extern intmenucount;
extern intgDeviceCount;
chargMacOSVersion[8];
chargMacOSVersion[8]; //Azi: moved from boot.c
static bool getOSVersion(char *str); //||
intselectIndex = 0;
MenuItem * menuItems = NULL;
position_t p = pos( gui.screen.width / 2 + 1 , ( gui.devicelist.pos.y + 3 ) + ( ( gui.devicelist.height - gui.devicelist.iconspacing ) / 2 ) );
char dummy[80];
getBootVolumeDescription( gBootVolume, dummy, 80, true );
getBootVolumeDescription( gBootVolume, dummy, sizeof(dummy) - 1, true );
drawDeviceIcon( gBootVolume, gui.screen.pixmap, p, true );
drawStrCenteredAt( (char *) msg, &font_small, gui.screen.pixmap, gui.countdown.pos );
// When booting from CD, default to hard drive boot when possible.
if (isCDROM && firstRun) {
const char *val;
char *prompt;
char *name;
char *prompt = NULL;
char *name = NULL;
int cnt;
int optionKey;
if (getValueForKey(kCDROMPromptKey, &val, &cnt, &bootInfo->bootConfig)) {
cnt += 1;
prompt = malloc(cnt);
strlcpy(prompt, val, cnt);
prompt = malloc(cnt + 1);
strncat(prompt, val, cnt);
} else {
name = malloc(80);
getBootVolumeDescription(gBootVolume, name, 80, false);
getBootVolumeDescription(gBootVolume, name, 79, false);
prompt = malloc(256);
sprintf(prompt, "Press any key to start up from %s, or press F8 to enter startup options.", name);
free(name);
cnt = 0;
}
if (getIntForKey( kCDROMOptionKey, &optionKey, &bootInfo->bootConfig )) {
// The key specified is a special key.
} else if (getValueForKey( kCDROMOptionKey, &val, &cnt, &bootInfo->bootConfig ) && cnt >= 1) {
optionKey = val[0];
} else {
// Default to F8.
optionKey = 0x4200;
key = optionKey;
}
if (cnt) {
if (prompt != NULL) {
free(prompt);
}
// Associate a menu item for each BVRef.
for (bvr=bvChain, i=gDeviceCount-1, selectIndex=0; bvr; bvr=bvr->next) {
if (bvr->visible) {
getBootVolumeDescription(bvr, menuItems[i].name, 80, true);
getBootVolumeDescription(bvr, menuItems[i].name, sizeof(menuItems[i].name) - 1, true);
menuItems[i].param = (void *) bvr;
if (bvr == menuBVR) {
selectIndex = i;
const char * cp = gBootArgs;
const char * val = 0;
const char * kernel;
const char*value;
int len;
int cnt;
int userCnt;
int cntRemaining;
bool uuidSet = false;
char * configKernelFlags;
char * valueBuffer;
config_file_t systemVersion;
valueBuffer = malloc(VALUE_SIZE);
else
return -1;
// Needed here to enable search for override Boot.plist on OS specific folders.
// Moved here to enable search for override Boot.plist on OS specific folders.
// Find out which Mac OS version we're booting.
if (!loadConfigFile("/System/Library/CoreServices/SystemVersion.plist", &systemVersion))
{
if (getValueForKey(kProductVersion, &value, &len, &systemVersion))
{
// getValueForKey uses const char for val
// so copy it and trim
strncpy(gMacOSVersion, value, MIN(len, 4));
gMacOSVersion[MIN(len, 4)] = '\0';
}
}
getOSVersion(gMacOSVersion);
//Azi: implemented at loadOverrideConfig.
// Load config table specified by the user, or use the default.
return 0;
}
static bool getOSVersion(char *str) //Azi: moved from boot.c
{
bool valid = false;
config_file_t systemVersion;
const char *val;
int len;
if (!loadConfigFile("/System/Library/CoreServices/SystemVersion.plist", &systemVersion))
{ //Azi: so, is this path on selected or current volume??
valid = true;
}
else if (!loadConfigFile("/System/Library/CoreServices/ServerVersion.plist", &systemVersion))
{
valid = true;
}
if (valid)
{
if (getValueForKey(kProductVersion, &val, &len, &systemVersion))
{
// getValueForKey uses const char for val
// so copy it and trim
*str = '\0';
strncat(str, val, min(len, 4));
}
else
valid = false;
}
return valid;
}
//==========================================================================
// Load the help file and display the file contents on the screen.
branches/azimutz/CleanCut/i386/libsaio/disk.c
16991699
17001700
17011701
1702
1702
17031703
17041704
17051705
......
17291729
17301730
17311731
1732
1732
17331733
1734
1734
17351735
17361736
17371737
......
17701770
17711771
17721772
1773
1773
17741774
17751775
17761776
bool matchVolumeToString( BVRef bvr, const char* match, long matchLen)
{
char testStr[128];
if ( !bvr || !match || !*match)
return 0;
return false;
}
/* If Rename Partition has defined an alias, then extract it for description purpose
/* If Rename Partition has defined an alias, then extract it for description purpose.
* The format for the rename string is the following:
* hd(x,y)|uuid|"label" "alias";hd(m,n)|uuid|"label" etc; ...
* hd(x,y)|uuid|"label" "alias";hd(m,n)|uuid|"label" "alias";etc...
*/
bool getVolumeLabelAlias(BVRef bvr, char* str, long strMaxLen)
if ( matchVolumeToString(bvr, volStart, volLen) )
{
strncpy(str, aliasStart, min(strMaxLen, aliasLen));
strncat(str, aliasStart, min(strMaxLen, aliasLen));
free(aliasList);
return true;
branches/azimutz/CleanCut/i386/boot2/graphics.c
12091209
12101210
12111211
1212
1212
1213
12131214
12141215
12151216
......
12181219
12191220
12201221
1221
1222
1223
12221224
12231225
12241226
{
currentIndicator = 0;
}
printf("%c\b", indicator[currentIndicator++]);
putc(indicator[currentIndicator++]);
putc('\b');
}
}
{
if ( getVideoMode() == VGA_TEXT_MODE )
{
printf(" \b");
putc(' ');
putc('\b');
}
}
branches/azimutz/CleanCut/i386/boot2/options.c
4040
4141
4242
43
43
44
4445
4546
4647
......
113114
114115
115116
116
117
117118
118119
119120
......
772773
773774
774775
775
776
776
777
777778
778779
779780
780781
781
782
783
782
783
784784
785785
786
786
787787
788788
789789
790
791790
792791
793792
794793
795
796
797794
798795
799796
......
808805
809806
810807
811
808
812809
813810
814811
......
860857
861858
862859
863
860
864861
865862
866863
......
11361133
11371134
11381135
1139
1140
11411136
11421137
11431138
......
11461141
11471142
11481143
1149
11501144
11511145
11521146
......
11801174
11811175
11821176
1183
1177
11841178
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1179
11951180
11961181
11971182
......
13271312
13281313
13291314
1330
1315
13311316
13321317
13331318
1334
1319
13351320
13361321
1337
1338
1339
1340
1322
1323
1324
1325
13411326
13421327
13431328
13441329
13451330
13461331
1347
1332
13481333
13491334
13501335
13511336
13521337
13531338
1339
1340
1341
1342
1343
1344
13541345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
13551371
13561372
13571373
//extern intmenucount;
extern intgDeviceCount;
chargMacOSVersion[8];
chargMacOSVersion[8]; //Azi: moved from boot.c
static bool getOSVersion(char *str); //||
intselectIndex = 0;
MenuItem * menuItems = NULL;
position_t p = pos( gui.screen.width / 2 + 1 , ( gui.devicelist.pos.y + 3 ) + ( ( gui.devicelist.height - gui.devicelist.iconspacing ) / 2 ) );
char dummy[80];
getBootVolumeDescription( gBootVolume, dummy, 80, true );
getBootVolumeDescription( gBootVolume, dummy, sizeof(dummy) - 1, true );
drawDeviceIcon( gBootVolume, gui.screen.pixmap, p, true );
drawStrCenteredAt( (char *) msg, &font_small, gui.screen.pixmap, gui.countdown.pos );
// When booting from CD, default to hard drive boot when possible.
if (isCDROM && firstRun) {
const char *val;
char *prompt;
char *name;
char *prompt = NULL;
char *name = NULL;
int cnt;
int optionKey;
if (getValueForKey(kCDROMPromptKey, &val, &cnt, &bootInfo->bootConfig)) {
cnt += 1;
prompt = malloc(cnt);
strlcpy(prompt, val, cnt);
prompt = malloc(cnt + 1);
strncat(prompt, val, cnt);
} else {
name = malloc(80);
getBootVolumeDescription(gBootVolume, name, 80, false);
getBootVolumeDescription(gBootVolume, name, 79, false);
prompt = malloc(256);
sprintf(prompt, "Press any key to start up from %s, or press F8 to enter startup options.", name);
free(name);
cnt = 0;
}
if (getIntForKey( kCDROMOptionKey, &optionKey, &bootInfo->bootConfig )) {
// The key specified is a special key.
} else if (getValueForKey( kCDROMOptionKey, &val, &cnt, &bootInfo->bootConfig ) && cnt >= 1) {
optionKey = val[0];
} else {
// Default to F8.
optionKey = 0x4200;
key = optionKey;
}
if (cnt) {
if (prompt != NULL) {
free(prompt);
}
// Associate a menu item for each BVRef.
for (bvr=bvChain, i=gDeviceCount-1, selectIndex=0; bvr; bvr=bvr->next) {
if (bvr->visible) {
getBootVolumeDescription(bvr, menuItems[i].name, 80, true);
getBootVolumeDescription(bvr, menuItems[i].name, sizeof(menuItems[i].name) - 1, true);
menuItems[i].param = (void *) bvr;
if (bvr == menuBVR) {
selectIndex = i;
const char * cp = gBootArgs;
const char * val = 0;
const char * kernel;
const char*value;
int len;
int cnt;
int userCnt;
int cntRemaining;
bool uuidSet = false;
char * configKernelFlags;
char * valueBuffer;
config_file_t systemVersion;
valueBuffer = malloc(VALUE_SIZE);
else
return -1;
// Needed here to enable search for override Boot.plist on OS specific folders.
// Moved here to enable search for override Boot.plist on OS specific folders.
// Find out which Mac OS version we're booting.
if (!loadConfigFile("/System/Library/CoreServices/SystemVersion.plist", &systemVersion))
{
if (getValueForKey(kProductVersion, &value, &len, &systemVersion))
{
// getValueForKey uses const char for val
// so copy it and trim
strncpy(gMacOSVersion, value, MIN(len, 4));
gMacOSVersion[MIN(len, 4)] = '\0';
}
}
getOSVersion(gMacOSVersion);
//Azi: implemented at loadOverrideConfig.
// Load config table specified by the user, or use the default.
strncpy(&argP[cnt], cp, userCnt);
argP[cnt+userCnt] = '\0';
if(!shouldboot)
if(!shouldboot)
{
gVerboseMode = getValueForKey( kVerboseModeFlag, &val, &cnt, &bootInfo->bootConfig ) ||
getValueForKey( kSingleUserModeFlag, &val, &cnt, &bootInfo->bootConfig );
gBootMode = ( getValueForKey( kSafeModeFlag, &val, &cnt, &bootInfo->bootConfig ) ) ?
kBootModeSafe : kBootModeNormal;
if ( getValueForKey( kIgnoreCachesFlag, &val, &cnt, &bootInfo->bootConfig ) ) {
gBootMode = kBootModeSafe;
}
if ( getValueForKey( kIgnoreCachesFlag, &val, &cnt, &bootInfo->bootConfig ) ) {
gBootMode = kBootModeSafe;
}
}
if ( getValueForKey( kMKextCacheKey, &val, &cnt, &bootInfo->bootConfig ) )
{
strlcpy(gMKextName, val, cnt + 1);
}
free(configKernelFlags);
free(valueBuffer);
return 0;
}
static bool getOSVersion(char *str) //Azi: moved from boot.c
{
bool valid = false;
config_file_t systemVersion;
const char *val;
int len;
if (!loadConfigFile("/System/Library/CoreServices/SystemVersion.plist", &systemVersion))
{ //Azi: so, is this path on selected or current volume??
valid = true;
}
else if (!loadConfigFile("/System/Library/CoreServices/ServerVersion.plist", &systemVersion))
{
valid = true;
}
if (valid)
{
if (getValueForKey(kProductVersion, &val, &len, &systemVersion))
{
// getValueForKey uses const char for val
// so copy it and trim
*str = '\0';
strncat(str, val, min(len, 4));
}
else
valid = false;
}
return valid;
}
//==========================================================================
// Load the help file and display the file contents on the screen.

Archive Download the corresponding diff file

Revision: 448