Chameleon

Chameleon Commit Details

Date:2014-06-25 18:40:33 (9 years 9 months ago)
Author:ErmaC
Commit:2381
Parents: 2380
Message:Apply patch: (Credits to Thomas Jansen aka tja) - Reading options from all devices during boot. The options for the boot menu are only read from the devices rd(0,0) or bt(0,0). Consequently, boot menu options (e.g. "Quiet Boot", "Timeout", etc.) in plists on other devices (like most users have) are ignored. This patch extends the list of paths to search for the options plist on all devices that can be found.
Changes:
M/trunk/i386/boot2/boot.c
M/trunk/i386/libsaio/disk.c
M/trunk/CHANGES
M/trunk/i386/libsaio/saio_internal.h
M/trunk/i386/boot2/options.c
M/trunk/i386/libsaio/stringTable.c

File differences

trunk/i386/libsaio/disk.c
15911591
15921592
15931593
1594
15941595
15951596
15961597
valid = true;
bvr->OSisInstaller = true;
strcpy(bvr->OSVersion, "10.7"); // 10.7 +
close(fh);
} else {
close(fh);
}
trunk/i386/libsaio/stringTable.c
647647
648648
649649
650
650
651651
652652
653
654653
655
656
657
658654
659
660655
661656
662
657
663658
664659
665
666
667
668
669
670
671
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
672676
673
674
675
676
677
678
679
680
681
682677
683678
684
679
685680
686681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
687714
688715
689716
* Returns 0 - successful.
* -1 - unsuccesful.
*/
int loadChameleonConfig(config_file_t *config)
int loadChameleonConfig(config_file_t *config, BVRef chain)
{
char *dirspec[] = {
"rd(0,0)/Extra/org.chameleon.Boot.plist",
"/Extra/org.chameleon.Boot.plist",
"bt(0,0)/Extra/org.chameleon.Boot.plist",
"rd(0,0)/Extra/com.apple.Boot.plist", /* DEPRECIATED */
"/Extra/com.apple.Boot.plist", /* DEPRECIATED */
"bt(0,0)/Extra/com.apple.Boot.plist", /* DEPRECIATED */
};
int i, fd, count, ret=-1;
int i;
for(i = 0; i< sizeof(dirspec)/sizeof(dirspec[0]); i++) {
if ((fd = open(dirspec[i], 0)) >= 0) {
// Check for depreciated file names and annoy the user about it.
if(strstr(dirspec[i], "com.apple.Boot.plist")) {
printf("%s is depreciated.\n", dirspec[i]);
dirspec[i][strlen(dirspec[i]) - strlen("com.apple.Boot.plist")] = 0;
printf("Please use the file %sorg.chameleon.Boot.plist instead.\n", dirspec[i]);
pause();
if ( loadChameleonConfigForDevice(config, "rd(0,0)", dirspec[i]) == 0 ) {
return 0;
}
if ( loadChameleonConfigForDevice(config, "", dirspec[i]) == 0 ) {
return 0;
}
if ( loadChameleonConfigForDevice(config, "bt(0,0)", dirspec[i]) == 0 ) {
return 0;
}
for ( BVRef bvr = chain; bvr; bvr = bvr->next ) {
char device[256];
getDeviceDescription(bvr, device);
if ( loadChameleonConfigForDevice(config, device, dirspec[i]) == 0 ) {
return 0;
}
// read file
count = read(fd, config->plist, IO_CONFIG_DATA_SIZE);
close(fd);
// build xml dictionary
ParseXMLFile(config->plist, &config->dictionary);
sysConfigValid = true;
ret=0;
break;
}
}
return ret;
return -1;
}
/* loadChameleonConfigForDevice
*
* Returns 0 - successful.
* -1 - unsuccesful.
*/
int loadChameleonConfigForDevice(config_file_t *config, const char *device, const char *path)
{
char full_path[1024];
int fd;
snprintf(full_path, sizeof(full_path), "%s%s", device, path);
if ((fd = open(full_path, 0)) >= 0) {
// Check for depreciated file names and annoy the user about it.
if(strstr(full_path, "com.apple.Boot.plist")) {
printf("%s is depreciated.\n", full_path);
full_path[strlen(full_path) - strlen("com.apple.Boot.plist")] = 0;
printf("Please use the file %sorg.chameleon.Boot.plist instead.\n", full_path);
pause();
}
// read file
read(fd, config->plist, IO_CONFIG_DATA_SIZE);
close(fd);
// build xml dictionary
ParseXMLFile(config->plist, &config->dictionary);
sysConfigValid = true;
return 0;
}
return -1;
}
/* loadHelperConfig
*
* Returns 0 - successful.
trunk/i386/libsaio/saio_internal.h
162162
163163
164164
165
165
166
166167
167168
168169
extern int loadConfigFile(const char *configFile, config_file_t *configBuff);
extern int loadSystemConfig(config_file_t *configBuff);
extern int loadHelperConfig(config_file_t *configBuff);
extern int loadChameleonConfig(config_file_t *configBuff);
extern int loadChameleonConfig(config_file_t *configBuff, BVRef chain);
extern int loadChameleonConfigForDevice(config_file_t *configBuff, const char *device, const char *path);
extern char * newString(const char *oldString);
extern char * getNextArg(char ** ptr, char * val);
extern int ParseXMLFile( char * buffer, TagPtr * dict );
trunk/i386/boot2/boot.c
405405
406406
407407
408
408
409409
410410
411411
setBootGlobals(bvChain);
// Load boot.plist config file
status = loadChameleonConfig(&bootInfo->chameleonConfig);
status = loadChameleonConfig(&bootInfo->chameleonConfig, bvChain);
if (getBoolForKey(kQuietBootKey, &quiet, &bootInfo->chameleonConfig) && quiet) {
gBootMode |= kBootModeQuiet;
trunk/i386/boot2/options.c
12041204
12051205
12061206
1207
1207
12081208
12091209
12101210
// and use its contents to override default bootConfig.
loadSystemConfig(&bootInfo->bootConfig);
loadChameleonConfig(&bootInfo->chameleonConfig);
loadChameleonConfig(&bootInfo->chameleonConfig, NULL);
// Use the kernel name specified by the user, or fetch the name
// in the config table, or use the default if not specified.
trunk/CHANGES
1
12
23
34
- ErmaC : Merge tja's patch http://forum.voodooprojects.org/index.php/topic,5951.0.html
- bitshoveler : Optimized basic string functions strlen, strncmp, strncat, strcat
- ErmaC : Replaced sprintf with snprintf in spd.c.
- bitshoveler : Fixed inadvertent text buffer overflow in getDDRSerial

Archive Download the corresponding diff file

Revision: 2381