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;␊ |
}␊ |
␊ |
// ␊ |
|
␉// 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;␊ |
␉}␊ |
␊ |
|
␊ |
␉// 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;␊ |
␉}␊ |
|
␊ |
␉// 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 { */␊ |
|
␉␉␉/* } */␊ |
␉␉}␊ |
␊ |
␉␉if (cnt > 0) {␊ |
␉␉if (cnt > 0)␊ |
␉␉{␊ |
␉␉␉copyArgument( kRootDeviceKey, val, cnt, &argP, &cntRemaining);␊ |
␉␉}␊ |
␉␉strlcpy( gRootDevice, val, (cnt + 1));␊ |
|
␉ * 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);␊ |
␉␉}␊ |
␉}␊ |
|
␉// 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;␊ |
␉␉}␊ |
|
␉␉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;␊ |