Chameleon

Chameleon Commit Details

Date:2010-08-29 14:19:54 (13 years 7 months ago)
Author:Tamás Kosárszky
Commit:445
Parents: 444
Message:Refactored detecting OS version.
Changes:
M/trunk/i386/boot2/boot.c
M/trunk/i386/boot2/options.c

File differences

trunk/i386/boot2/boot.c
8181
8282
8383
84
8485
85
8686
8787
8888
......
347347
348348
349349
350
351
352350
353351
354352
......
397395
398396
399397
400
401
402
403
404
405
406
398
407399
408400
409401
......
607599
608600
609601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
610634
611635
612636
//static void selectBiosDevice(void);
static unsigned long Adler32(unsigned char *buffer, long length);
static bool getOSVersion(char *str);
static bool gUnloadPXEOnExit = false;
/*
bool tryresumedefault;
bool forceresume;
config_file_t systemVersion;// system.plist of booting partition
// additional variable for testing alternate kernel image locations on boot helper partitions.
char bootFileSpec[512];
}
// Find out which version mac os we're booting.
if (!loadConfigFile("System/Library/CoreServices/SystemVersion.plist", &systemVersion)) {
if (getValueForKey(kProductVersion, &val, &len, &systemVersion)) {
// getValueForKey uses const char for val
// so copy it and trim
strncat(gMacOSVersion, val, MIN(len, 4));
}
}
getOSVersion(gMacOSVersion);
if (platformCPUFeature(CPU_FEATURE_EM64T)) {
archCpuType = CPU_TYPE_X86_64;
}
*/
static bool getOSVersion(char *str)
{
bool valid = false;
config_file_t systemVersion;
const char *val;
int len;
if (!loadConfigFile("System/Library/CoreServices/SystemVersion.plist", &systemVersion))
{
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;
}
#define BASE 65521L /* largest prime smaller than 65536 */
#define NMAX 5000
// NMAX (was 5521) the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1
trunk/i386/boot2/options.c
771771
772772
773773
774
774
775775
776776
777777
if (isCDROM && firstRun) {
const char *val;
char *prompt = NULL;
char *name = NULL;
char *name = NULL;
int cnt;
int optionKey;

Archive Download the corresponding diff file

Revision: 445