Index: trunk/i386/libsaio/disk.c =================================================================== --- trunk/i386/libsaio/disk.c (revision 2380) +++ trunk/i386/libsaio/disk.c (revision 2381) @@ -1591,6 +1591,7 @@ valid = true; bvr->OSisInstaller = true; strcpy(bvr->OSVersion, "10.7"); // 10.7 + + close(fh); } else { close(fh); } Index: trunk/i386/libsaio/stringTable.c =================================================================== --- trunk/i386/libsaio/stringTable.c (revision 2380) +++ trunk/i386/libsaio/stringTable.c (revision 2381) @@ -647,43 +647,70 @@ * 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. Index: trunk/i386/libsaio/saio_internal.h =================================================================== --- trunk/i386/libsaio/saio_internal.h (revision 2380) +++ trunk/i386/libsaio/saio_internal.h (revision 2381) @@ -162,7 +162,8 @@ 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 ); Index: trunk/i386/boot2/boot.c =================================================================== --- trunk/i386/boot2/boot.c (revision 2380) +++ trunk/i386/boot2/boot.c (revision 2381) @@ -405,7 +405,7 @@ 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; Index: trunk/i386/boot2/options.c =================================================================== --- trunk/i386/boot2/options.c (revision 2380) +++ trunk/i386/boot2/options.c (revision 2381) @@ -1204,7 +1204,7 @@ // 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. Index: trunk/CHANGES =================================================================== --- trunk/CHANGES (revision 2380) +++ trunk/CHANGES (revision 2381) @@ -1,3 +1,4 @@ +- 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