Index: trunk/i386/libsaio/bootstruct.c =================================================================== --- trunk/i386/libsaio/bootstruct.c (revision 2389) +++ trunk/i386/libsaio/bootstruct.c (revision 2390) @@ -125,9 +125,7 @@ void *oldAddr = bootArgs; bootArgs = (boot_args *)AllocateKernelMemory(sizeof(boot_args)); bcopy(oldAddr, bootArgs, sizeof(boot_args)); - } - else - { + } else { void *oldAddr = bootArgsPreLion; bootArgsPreLion = (boot_args_pre_lion *)AllocateKernelMemory(sizeof(boot_args_pre_lion)); bcopy(oldAddr, bootArgsPreLion, sizeof(boot_args_pre_lion)); @@ -156,7 +154,8 @@ bootArgs->MemoryMapDescriptorSize = sizeof(EfiMemoryRange); bootArgs->MemoryMapDescriptorVersion = 0; - for (i = 0; i < memoryMapCount; i++, memoryMap++) { + for (i = 0; i < memoryMapCount; i++, memoryMap++) + { range = &bootInfo->memoryMap[i]; switch(range->type) { case kMemoryRangeACPI: Index: trunk/i386/libsaio/ati.c =================================================================== --- trunk/i386/libsaio/ati.c (revision 2389) +++ trunk/i386/libsaio/ati.c (revision 2390) @@ -1439,7 +1439,7 @@ // { 0x983E, 0x00000000, CHIP_FAMILY_KABINI, "AMD Radeon HD", kNull }, // { 0x983F, 0x00000000, CHIP_FAMILY_KABINI, "AMD Radeon HD", kNull }, - // MULLINS + // MULLINS { 0x9850, 0x00000000, CHIP_FAMILY_MULLINS, "AMD Radeon HD", kNull }, // Mobile { 0x9851, 0x00000000, CHIP_FAMILY_MULLINS, "AMD Radeon HD", kNull }, // Mobile { 0x9852, 0x00000000, CHIP_FAMILY_MULLINS, "AMD Radeon HD", kNull }, // Mobile @@ -1604,7 +1604,7 @@ { 0x6770, 0x00000000, CHIP_FAMILY_CAICOS, "AMD Radeon HD 6400 Series", kBulrushes }, { 0x6772, 0x00000000, CHIP_FAMILY_CAICOS, "AMD Radeon HD 7400A Series", kBulrushes }, { 0x6778, 0x00000000, CHIP_FAMILY_CAICOS, "AMD Radeon HD 7000 Series", kBulrushes }, - { 0x6779, 0x00000000, CHIP_FAMILY_CAICOS, "AMD Radeon HD 7450 Series", kBulrushes }, + { 0x6779, 0x00000000, CHIP_FAMILY_CAICOS, "AMD Radeon HD 6450/7450/8450/R5 230", kBulrushes }, { 0x677B, 0x00000000, CHIP_FAMILY_CAICOS, "AMD Radeon HD 7400 Series", kBulrushes }, /* Southen Islands */ @@ -1619,9 +1619,9 @@ { 0x6790, 0x00000000, CHIP_FAMILY_TAHITI, "AMD Radeon HD 7900 Series", kFutomaki }, { 0x6791, 0x00000000, CHIP_FAMILY_TAHITI, "AMD Radeon HD 7900 Series", kFutomaki }, { 0x6792, 0x00000000, CHIP_FAMILY_TAHITI, "AMD Radeon HD 7900 Series", kFutomaki }, - { 0x6798, 0x00000000, CHIP_FAMILY_TAHITI, "AMD Radeon HD 7970 X-Edition", kFutomaki }, + { 0x6798, 0x00000000, CHIP_FAMILY_TAHITI, "AMD Radeon HD 7970X/8970/R9 280X", kFutomaki }, { 0x6799, 0x00000000, CHIP_FAMILY_TAHITI, "AMD Radeon HD 7990 Series", kAji }, - { 0x679A, 0x00000000, CHIP_FAMILY_TAHITI, "AMD Radeon R9 280", kFutomaki }, + { 0x679A, 0x00000000, CHIP_FAMILY_TAHITI, "AMD Radeon HD 7950/8950/R9 280", kFutomaki }, { 0x679B, 0x00000000, CHIP_FAMILY_TAHITI, "AMD Radeon HD 7900 Series", kFutomaki }, { 0x679E, 0x00000000, CHIP_FAMILY_TAHITI, "AMD Radeon HD 7870 XT", kFutomaki }, { 0x679F, 0x00000000, CHIP_FAMILY_TAHITI, "AMD Radeon HD 7950 Series", kFutomaki }, Index: trunk/i386/libsaio/disk.c =================================================================== --- trunk/i386/libsaio/disk.c (revision 2389) +++ trunk/i386/libsaio/disk.c (revision 2390) @@ -1572,7 +1572,8 @@ const char *val; int len; - if (getValueForKey(kProductVersion, &val, &len, &systemVersion)) { + if (getValueForKey(kProductVersion, &val, &len, &systemVersion)) + { // getValueForKey uses const char for val // so copy it and trim *str = '\0'; @@ -1582,12 +1583,14 @@ } } - if(!valid) { + if(!valid) + { int fh = -1; sprintf(dirSpec, "hd(%d,%d)/.PhysicalMediaInstall", BIOS_DEV_UNIT(bvr), bvr->part_no); fh = open(dirSpec, 0); - if (fh >= 0) { + if (fh >= 0) + { valid = true; bvr->OSisInstaller = true; strcpy(bvr->OSVersion, "10.7"); // 10.7 + Index: trunk/i386/libsaio/smbios.c =================================================================== --- trunk/i386/libsaio/smbios.c (revision 2389) +++ trunk/i386/libsaio/smbios.c (revision 2390) @@ -430,19 +430,23 @@ #define kDefaultMacMiniBoardProduct "Mac-F4208EAA" // MacMini5,1 Mac-8ED6AF5B48C039E1 - MM51.88Z.0077.B0F.1110201309 + // MacMini5,2 Mac-4BC72D62AD45599E + // MacMini5,3 -//#define kDefaultMacMini "Macmini5,3" -//#define kDefaultMacMiniBIOSVersion " MM51.88Z.0077.B10.1201241549" -//#define kDefaultMacMiniBoardProduct "Mac-F65AE981FFA204ED" -//#define kDefaultMacMiniBIOSReleaseDate "01/24/2012" +// Bios: MM51.88Z.0077.B10.1201241549 +// Board: Mac-F65AE981FFA204ED +// Data: 01/24/2012 -// MacMini 6,1 - Mac-F65AE981FFA204ED +// MacMini 6,1 +// Bios: MM61.88Z.0106.B03.1211161202 +// Board: Mac-F65AE981FFA204ED +// Data: 10/14/2012 + // MacMini 6,2 -//#define kDefaultMacMini62 "Macmini6,2" -//#define kDefaultMacMini62BIOSVersion " MM61.88Z.0106.B00.1208091121" -//#define kDefaultMacMini62BoardProduct "Mac-F65AE981FFA204ED" -//#define kDefaultMacMini62BIOSReleaseDate "10/14/2012" +// Bios: MM61.88Z.0106.B03.1211161202 +// Board: Mac-FC02E91DDD3FA6A4 +// Data: 10/14/2012 //=========== MacBook =========== #define kDefaultMacBookFamily "MacBook" @@ -458,14 +462,23 @@ // MacBookAir4,1 - Mac-C08A6BB70A942AC2 // MacBookAir4,2 - Mac-742912EFDBEE19B3 + +// MacBookAir5,2 #define kDefaultMacBookAir "MacBookAir5,2" #define kDefaultMacBookAirBIOSVersion " MBA51.88Z.00EF.B00.1205221442" #define kDefaultMacBookAirBIOSReleaseDate "05/10/12" #define kDefaultMacBookBoardAirProduct "Mac-2E6FAB96566FE58C" -// MacBookAir6,1 - Mac-35C1E88140C3E6CF - MBA61.88Z.0099.B04.1309271229 -// MacBookAir6,2 - Mac-7DF21CB3ED6977E5 - MBA62.88Z.00EF.B00.1205221442 +// MacBookAir6,1 +// Bios: MBA61.88Z.0099.B04.1309271229 +// Board: Mac-35C1E88140C3E6CF +// Data: 24/06/13 +// MacBookAir6,2 +// Bios: MBA62.88Z.00EF.B00.1205221442 +// Board: Mac-7DF21CB3ED6977E5 +// Data: 24/06/13 + //=========== MacBookPro =========== #define kDefaultMacBookProFamily "MacBook Pro" //#define kDefaultMacBookProBoardAssetTagNumber "MacBook-Aluminum" @@ -475,19 +488,25 @@ #define kDefaultMacBookProBIOSReleaseDate "02/27/08" #define kDefaultMacBookProBoardProduct "Mac-F42C89C8" -//#define kDefaultMacBookPro "MacBookPro8,1" -//#define kDefaultMacBookProBIOSVersion " MBP81.88Z.0047.B24.1110141131" -//#define kDefaultMacBookProBoardProduct "Mac-94245B3640C91C81" -//#define kDefaultMacBookProBIOSReleaseDate "10/14/11" +// MacBookPro8,1 +// Bios: MBP81.88Z.0047.B24.1110141131 +// Board: Mac-94245B3640C91C81 +// Data: 10/14/11 -// MacBookPro8,2 - Mac_94245A3940C91C80 -// MacBookPro8,3 - Mac-942459F5819B171B +// MacBookPro8,2 +// Bios: +// Board: Mac_94245A3940C91C80 +// Data: 10/14/11 +// MacBookPro8,3 +// Bios: +// Board: Mac-942459F5819B171B +// Data: 10/31/11 + // MacBookPro10,2 -//#define kDefaultMacBookProIvy "MacBookPro10,2" -//#define kDefaultMacBookProIvyBIOSVersion " MBP102.88Z.0106.B01.1208311637" -//#define kDefaultMacBookProIvyBoardProduct "Mac-AFD8A9D944EA4843" -//#define kDefaultMacBookProIvyBIOSReleaseDate "10/02/2012" +// Bios: MBP102.88Z.0106.B01.1208311637 +// Board: Mac-AFD8A9D944EA4843 +// Data: 10/02/2012 // MacBookPro11,2 - Mac-3CBD00234E554E41 - MBP112.88Z.0138.B03.1310291227 // MacBookPro11,3 - Mac-2BD1B31983FE1663 - MBP112.88Z.0138.B02.1310181745 @@ -506,7 +525,7 @@ // iMac11,1 core i3/i5/i7 #define kDefaultiMacNehalem "iMac11,1" #define kDefaultiMacNehalemBIOSVersion " IM111.88Z.0034.B02.1003171314" -#define kDefaultiMacNehalemBIOSReleaseDate "03/30/10" +#define kDefaultiMacNehalemBIOSReleaseDate "03/17/10" #define kDefaultiMacNehalemBoardProduct "Mac-F2268DAE" // iMac11,2 // iMac11,3 @@ -514,14 +533,13 @@ // iMac12,1 #define kDefaultiMacSandy "iMac12,1" #define kDefaultiMacSandyBIOSVersion " IM121.88Z.0047.B00.1102091756" -#define kDefaultiMacSandyBIOSReleaseDate "01/02/08" +#define kDefaultiMacSandyBIOSReleaseDate "04/22/11" #define kDefaultiMacSandyBoardProduct "Mac-942B5BF58194151B" -// iMac12,2 Mac-942B59F58194171B -//#define kDefaultiMacSandy "iMac12,2" -//#define kDefaultiMacSandyBIOSVersion " IM121.88Z.0047.B1D.1110171110" -//#define kDefaultiMacSandyBIOSReleaseDate "10/17/11" -//#define kDefaultiMacSandyBoardProduct "Mac-942B59F58194171B" +// iMac12,2 +// Bios: IM121.88Z.0047.B1D.1110171110" +// Data: 10/17/11 +// Board: Mac-942B59F58194171B" // iMac13,1 // Bios: IM131.88Z.010A.B05.1211151146 @@ -529,11 +547,18 @@ // Board: Mac-00BE6ED71E35EB86 // iMac13,2 -//#define kDefaultiMacIvy "iMac13,2" -//#define kDefaultiMacIvyBIOSVersion " IM131.88Z.00CE.B00.1203281326" -//#define kDefaultiMacIvyBIOSReleaseDate "03/28/2012" -//#define kDefaultiMacIvyBoardProduct "Mac-FC02E91DDD3FA6A4" +// Bios: IM131.88Z.00CE.B00.1203281326 +// Data: 03/28/2012 +// Board: Mac-FC02E91DDD3FA6A4 +// iMac14,1 +// iMac14,2 +// iMac14,3 +// iMac14,4 +// Bios: IM144.88Z.0179.B03.1405241029 +// Data: 05/20/2014 +// Board: Mac-81E3E92DD6088272 + //=========== MacPro =========== #define kDefaultMacProFamily "MacPro" // MacPro's family = "MacPro" not "Mac Pro" //#define KDefauktMacProBoardAssetTagNumber "Pro-Enclosure" Index: trunk/i386/boot2/drivers.c =================================================================== --- trunk/i386/boot2/drivers.c (revision 2389) +++ trunk/i386/boot2/drivers.c (revision 2390) @@ -529,6 +529,7 @@ if (ret != 0) { break; } + // Allocate memory for the driver path and the plist. module->executablePath = tmpExecutablePath; Index: trunk/i386/boot2/boot.c =================================================================== --- trunk/i386/boot2/boot.c (revision 2389) +++ trunk/i386/boot2/boot.c (revision 2390) @@ -252,9 +252,7 @@ { strlcpy(kernelCacheFile, cacheFile, sizeof(kernelCacheFile)); verbose("Specified kernel cache file path = %s\n", cacheFile); - } - else - { + } else { // Lion, Mountain Lion and Mavericks prelink kernel cache file if ((checkOSVersion("10.7")) || (checkOSVersion("10.8")) || (checkOSVersion("10.9"))) { @@ -332,9 +330,11 @@ // Check if the kernel cache file is more recent (mtime) // than the kernel file or the S/L/E directory ret = GetFileInfo(NULL, bootInfo->bootFile, &flags, &kerneltime); + // Check if the kernel file is more recent than the cache file if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeFlat) - && (kerneltime > cachetime)) { + && (kerneltime > cachetime)) + { DBG("Kernel file (%s) is more recent than Kernel Cache (%s)! Ignoring Kernel Cache.\n", bootInfo->bootFile, kernelCacheFile); return -1; @@ -343,7 +343,8 @@ 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)) { + && (exttime > cachetime)) + { DBG("Folder: '/System/Library/Extensions' is more recent than Kernel Cache file (%s)! Ignoring Kernel Cache.\n", kernelCacheFile); return -1; @@ -669,9 +670,11 @@ // bootFile must start with a / if it not start with a device name if (!bootFileWithDevice && (bootInfo->bootFile)[0] != '/') + { snprintf(bootFile, sizeof(bootFile), "/%s", bootInfo->bootFile); // append a leading / - else + } else { strlcpy(bootFile, bootInfo->bootFile, sizeof(bootFile)); + } // Try to load kernel image from alternate locations on boot helper partitions. ret = -1; @@ -710,7 +713,8 @@ sleep(8); #endif - if (ret <= 0) { + if (ret <= 0) + { printf("Can't find %s\n", bootFile); sleep(1); @@ -761,7 +765,7 @@ } */ -bool checkOSVersion(const char * version) +bool checkOSVersion(const char * version) { return ((gMacOSVersion[0] == version[0]) && (gMacOSVersion[1] == version[1]) && (gMacOSVersion[2] == version[2]) && (gMacOSVersion[3] == version[3])); Index: trunk/i386/boot2/gui.c =================================================================== --- trunk/i386/boot2/gui.c (revision 2389) +++ trunk/i386/boot2/gui.c (revision 2390) @@ -955,9 +955,9 @@ devicetype = (device->flags & kBVFlagBooter ? iDeviceHFSRAID : iDeviceHFS); break; } - + break; - + } case kPartitionTypeHPFS: devicetype = iDeviceNTFS; // Use HPFS / NTFS icon Index: trunk/i386/boot2/lzss.c =================================================================== --- trunk/i386/boot2/lzss.c (revision 2389) +++ trunk/i386/boot2/lzss.c (revision 2390) @@ -65,7 +65,10 @@ }; int -decompress_lzss(u_int8_t *dst, u_int8_t *src, u_int32_t srclen) +decompress_lzss( + u_int8_t * dst, + u_int8_t * src, + u_int32_t srclen) { /* ring buffer of size N, with extra F-1 bytes to aid string comparison */ u_int8_t text_buf[N + F - 1]; @@ -222,22 +225,23 @@ } u_int8_t *compress_lzss( - u_int8_t * dst, + u_int8_t *dst, u_int32_t dstlen, - u_int8_t * src, - u_int32_t srclen) + u_int8_t *src, + u_int32_t srcLen) { - u_int8_t * result = NULL; /* Encoding state, mostly tree but some current match stuff */ struct encode_state *sp; + int i, c, len, r, s, last_match_length, code_buf_ptr; u_int8_t code_buf[17], mask; - u_int8_t * srcend = src + srclen; + u_int8_t *srcend = src + srcLen; u_int8_t *dstend = dst + dstlen; + /* initialize trees */ sp = (struct encode_state *) malloc(sizeof(*sp)); - if (!sp) goto finish; init_state(sp); + /* * code_buf[1..16] saves eight units of code, and code_buf[0] works * as eight flags, "1" representing that the unit is an unencoded @@ -246,13 +250,16 @@ */ code_buf[0] = 0; code_buf_ptr = mask = 1; + /* Clear the buffer with any character that will appear often. */ s = 0; r = N - F; + /* Read F bytes into the last F bytes of the buffer */ for (len = 0; len < F && src < srcend; len++) sp->text_buf[r + len] = *src++; if (!len) - goto finish; + return (void *) 0; /* text of size zero */ + /* * Insert the F strings, each of which begins with one or more * 'space' characters. Note the order in which these strings are @@ -260,6 +267,7 @@ */ for (i = 1; i <= F; i++) insert_node(sp, r - i); + /* * Finally, insert the whole string just read. * The global variables match_length and match_position are set. @@ -286,7 +294,7 @@ if (dst < dstend) *dst++ = code_buf[i]; else - goto finish; + return (void *) 0; code_buf[0] = 0; code_buf_ptr = mask = 1; } @@ -295,20 +303,24 @@ delete_node(sp, s); /* Delete old strings and */ c = *src++; sp->text_buf[s] = c; /* read new bytes */ + /* * If the position is near the end of buffer, extend the buffer * to make string comparison easier. */ if (s < F - 1) sp->text_buf[s + N] = c; + /* Since this is a ring buffer, increment the position modulo N. */ s = (s + 1) & (N - 1); r = (r + 1) & (N - 1); + /* Register the string in text_buf[r..r+F-1] */ insert_node(sp, r); } while (i++ < last_match_length) { delete_node(sp, s); + /* After the end of text, no need to read, */ s = (s + 1) & (N - 1); r = (r + 1) & (N - 1); @@ -317,15 +329,14 @@ insert_node(sp, r); } } while (len > 0); /* until length of string to be processed is zero */ + if (code_buf_ptr > 1) { /* Send remaining code. */ for (i = 0; i < code_buf_ptr; i++) if (dst < dstend) *dst++ = code_buf[i]; else - goto finish; + return (void *) 0; } - result = dst; -finish: - if (sp) free(sp); - return result; + + return dst; } Index: trunk/i386/boot2/options.c =================================================================== --- trunk/i386/boot2/options.c (revision 2389) +++ trunk/i386/boot2/options.c (revision 2390) @@ -1098,27 +1098,29 @@ int len = argLen + cnt + 1; // +1 to account for space if (argName) + { len++; // +1 to account for '=' + } - if (len > *cntRemainingP) { - error("Warning: boot arguments too long, truncating\n"); - return false; - } + if (len > *cntRemainingP) { + error("Warning: boot arguments too long, truncating\n"); + return false; + } - if (argName) { - strncpy( *argP, argName, argLen ); - *argP += argLen; - *argP[0] = '='; - (*argP)++; - } + if (argName) { + strncpy( *argP, argName, argLen ); + *argP += argLen; + *argP[0] = '='; + (*argP)++; + } - strncpy( *argP, val, cnt ); - *argP += cnt; - *argP[0] = ' '; - (*argP)++; + strncpy(*argP, val, cnt); + *argP += cnt; + *argP[0] = ' '; + (*argP)++; - *cntRemainingP -= len; - return true; + *cntRemainingP -= len; + return true; } // @@ -1220,16 +1222,19 @@ // to be used. gOverrideKernel = false; - if (( kernel = extractKernelName((char **)&cp) )) { + if (( kernel = extractKernelName((char **)&cp) )) + { strlcpy( bootInfo->bootFile, kernel, sizeof(bootInfo->bootFile) ); } else { - if ( getValueForKey( kKernelNameKey, &val, &cnt, &bootInfo->bootConfig ) ) { + if ( getValueForKey( kKernelNameKey, &val, &cnt, &bootInfo->bootConfig ) ) + { strlcpy( bootInfo->bootFile, val, cnt+1 ); } else { strlcpy( bootInfo->bootFile, kDefaultKernel, sizeof(bootInfo->bootFile) ); } } - if (strcmp( bootInfo->bootFile, kDefaultKernel ) != 0) { + if (strcmp( bootInfo->bootFile, kDefaultKernel ) != 0) + { gOverrideKernel = true; } @@ -1238,7 +1243,8 @@ // Get config kernel flags, if not ignored. if (getValueForBootKey(cp, kIgnoreBootFileFlag, &val, &cnt) || - !getValueForKey( kKernelFlagsKey, &val, &cnt, &bootInfo->bootConfig )) { + !getValueForKey( kKernelFlagsKey, &val, &cnt, &bootInfo->bootConfig )) + { val = ""; cnt = 0; } @@ -1247,46 +1253,56 @@ // boot-uuid can be set either on the command-line or in the config file if (!processBootArgument(kBootUUIDKey, cp, configKernelFlags, bootInfo->config, - &argP, &cntRemaining, gBootUUIDString, sizeof(gBootUUIDString))) { + &argP, &cntRemaining, gBootUUIDString, sizeof(gBootUUIDString))) + { // // Try an alternate method for getting the root UUID on boot helper partitions. // - if (gBootVolume->flags & kBVFlagBooter) { + if (gBootVolume->flags & kBVFlagBooter) + { // Load the configuration store in the boot helper partition - if (loadHelperConfig(&bootInfo->helperConfig) == 0) { + if (loadHelperConfig(&bootInfo->helperConfig) == 0) + { val = getStringForKey(kHelperRootUUIDKey, &bootInfo->helperConfig); - if (val != NULL) { + if (val != NULL) + { strlcpy(gBootUUIDString, val, sizeof(gBootUUIDString)); } } } /* // Try to get the volume uuid string - if (!strlen(gBootUUIDString) && gBootVolume->fs_getuuid) { + if (!strlen(gBootUUIDString) && gBootVolume->fs_getuuid) + { gBootVolume->fs_getuuid(gBootVolume, gBootUUIDString); } */ // If we have the volume uuid add it to the commandline arguments - if (strlen(gBootUUIDString)) { + if (strlen(gBootUUIDString)) + { copyArgument(kBootUUIDKey, gBootUUIDString, strlen(gBootUUIDString), &argP, &cntRemaining); } // Try to get the volume uuid string - if (!strlen(gBootUUIDString) && gBootVolume->fs_getuuid) { + if (!strlen(gBootUUIDString) && gBootVolume->fs_getuuid) + { gBootVolume->fs_getuuid(gBootVolume, gBootUUIDString); DBG("boot-uuid: %s\n", gBootUUIDString); } } if (!processBootArgument(kRootDeviceKey, cp, configKernelFlags, bootInfo->config, - &argP, &cntRemaining, gRootDevice, ROOT_DEVICE_SIZE)) { + &argP, &cntRemaining, gRootDevice, ROOT_DEVICE_SIZE)) + { cnt = 0; - if ( getValueForKey( kBootDeviceKey, &val, &cnt, &bootInfo->chameleonConfig)) { + if ( getValueForKey( kBootDeviceKey, &val, &cnt, &bootInfo->chameleonConfig)) + { valueBuffer[0] = '*'; cnt++; strlcpy(valueBuffer + 1, val, cnt); val = valueBuffer; } else { /* - if (strlen(gBootUUIDString)) { + if (strlen(gBootUUIDString)) + { val = "*uuid"; cnt = 5; } else { */ @@ -1297,7 +1313,8 @@ /* } */ } - if (cnt > 0) { + if (cnt > 0) + { copyArgument( kRootDeviceKey, val, cnt, &argP, &cntRemaining); } strlcpy( gRootDevice, val, (cnt + 1)); @@ -1307,15 +1324,18 @@ * Removed. We don't need this anymore. * if (!processBootArgument(kPlatformKey, cp, configKernelFlags, bootInfo->config, - &argP, &cntRemaining, gPlatformName, sizeof(gCacheNameAdler))) { + &argP, &cntRemaining, gPlatformName, sizeof(gCacheNameAdler))) + { getPlatformName(gPlatformName); copyArgument(kPlatformKey, gPlatformName, strlen(gPlatformName), &argP, &cntRemaining); } */ if (!getValueForBootKey(cp, kSafeModeFlag, &val, &cnt) && - !getValueForBootKey(configKernelFlags, kSafeModeFlag, &val, &cnt)) { - if (gBootMode & kBootModeSafe) { + !getValueForBootKey(configKernelFlags, kSafeModeFlag, &val, &cnt)) + { + if (gBootMode & kBootModeSafe) + { copyArgument(0, kSafeModeFlag, strlen(kSafeModeFlag), &argP, &cntRemaining); } } @@ -1323,8 +1343,10 @@ // Store the merged kernel flags and boot args. cnt = strlen(configKernelFlags); - if (cnt) { - if (cnt > cntRemaining) { + if (cnt) + { + if (cnt > cntRemaining) + { error("Warning: boot arguments too long, truncating\n"); cnt = cntRemaining; } @@ -1333,26 +1355,30 @@ cntRemaining -= cnt; } userCnt = strlen(cp); - if (userCnt > cntRemaining) { + if (userCnt > cntRemaining) + { error("Warning: boot arguments too long, truncating\n"); userCnt = cntRemaining; } strncpy(&argP[cnt], cp, userCnt); argP[cnt+userCnt] = '\0'; - if(!shouldboot) { + if(!shouldboot) + { gVerboseMode = getValueForKey( kVerboseModeFlag, &val, &cnt, &bootInfo->chameleonConfig ) || getValueForKey( kSingleUserModeFlag, &val, &cnt, &bootInfo->chameleonConfig ); gBootMode = ( getValueForKey( kSafeModeFlag, &val, &cnt, &bootInfo->chameleonConfig ) ) ? kBootModeSafe : kBootModeNormal; - if ( getValueForKey( kIgnoreCachesFlag, &val, &cnt, &bootInfo->chameleonConfig ) ) { + if ( getValueForKey( kIgnoreCachesFlag, &val, &cnt, &bootInfo->chameleonConfig ) ) + { gBootMode = kBootModeSafe; } } - if ( getValueForKey( kMKextCacheKey, &val, &cnt, &bootInfo->bootConfig ) ) { + if ( getValueForKey( kMKextCacheKey, &val, &cnt, &bootInfo->bootConfig ) ) + { strlcpy(gMKextName, val, cnt + 1); } else { gMKextName[0]=0;