Chameleon

Chameleon Commit Details

Date:2011-07-12 20:32:22 (8 years 3 months ago)
Author:Azimutz
Commit:1147
Parents: 1146
Message:Sync with trunk (r1145).
Changes:
C/trunk/BLOCKERS → /branches/azimutz/trunkAutoResolution/BLOCKERS
M/branches/azimutz/trunkAutoResolution/i386/libsa/zalloc.c
M/branches/azimutz/trunkAutoResolution/i386/libsaio/saio_internal.h
M/branches/azimutz/trunkAutoResolution/i386/boot2/ramdisk.c
M/branches/azimutz/trunkAutoResolution/i386/boot2/options.c
M/branches/azimutz/trunkAutoResolution/i386/libsaio/xml.c
M/branches/azimutz/trunkAutoResolution/doc/BootHelp.txt
M/branches/azimutz/trunkAutoResolution
M/branches/azimutz/trunkAutoResolution/i386/libsaio/xml.h
M/branches/azimutz/trunkAutoResolution/i386/boot2/boot.c
M/branches/azimutz/trunkAutoResolution/i386/libsaio/nvidia.c
M/branches/azimutz/trunkAutoResolution/i386/boot2/boot.h
M/branches/azimutz/trunkAutoResolution/i386/libsaio/ati.c
M/branches/azimutz/trunkAutoResolution/i386/libsaio/bootstruct.h
M/branches/azimutz/trunkAutoResolution/i386/libsaio/sys.c
M/branches/azimutz/trunkAutoResolution/i386/boot2/drivers.c
M/branches/azimutz/trunkAutoResolution/i386/libsaio/acpi_patcher.c
M/branches/azimutz/trunkAutoResolution/i386/boot2/mboot.c
M/branches/azimutz/trunkAutoResolution/i386/libsaio/platform.c
M/branches/azimutz/trunkAutoResolution/i386/libsaio/spd.c
M/branches/azimutz/trunkAutoResolution/i386/libsaio/cpu.c
M/branches/azimutz/trunkAutoResolution/i386/libsaio/disk.c
M/branches/azimutz/trunkAutoResolution/i386/libsaio/pci_setup.c
M/branches/azimutz/trunkAutoResolution/i386/libsaio/smbios.c
M/branches/azimutz/trunkAutoResolution/doc/User_Guide_src/Chameleon 2 v0.5.docx
M/branches/azimutz/trunkAutoResolution/i386/boot2/graphics.c
M/branches/azimutz/trunkAutoResolution/i386/libsaio/gma.c
M/branches/azimutz/trunkAutoResolution/doc/README
M/branches/azimutz/trunkAutoResolution/TODO
M/branches/azimutz/trunkAutoResolution/i386/libsaio/gma.h
M/branches/azimutz/trunkAutoResolution/i386/boot2/modules.c
M/branches/azimutz/trunkAutoResolution/CHANGES
M/branches/azimutz/trunkAutoResolution/i386/libsaio/pci_root.c
M/branches/azimutz/trunkAutoResolution/i386/libsaio/stringTable.c
M/branches/azimutz/trunkAutoResolution/i386/boot2/gui.c
M/branches/azimutz/trunkAutoResolution/i386/libsaio/fake_efi.c
M/branches/azimutz/trunkAutoResolution/i386/libsaio/usb.c
M/branches/azimutz/trunkAutoResolution/i386/libsaio/device_inject.c

File differences

branches/azimutz/trunkAutoResolution/i386/libsaio/xml.c
114114
115115
116116
117
118117
119118
120119
......
149148
150149
151150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
152185
153186
154187
......
169202
170203
171204
172
205
173206
174207
175208
......
266299
267300
268301
269
270
271
272
273
302
303
304
305
306
274307
275308
276309
......
819852
820853
821854
822
855
823856
824857
825858
......
10641097
10651098
10661099
1100
1101
1102
1103
1104
10671105
10681106
10691107
......
10711109
10721110
10731111
1112
1113
1114
1115
1116
1117
10741118
10751119
10761120
......
10781122
10791123
10801124
1125
1126
1127
1128
1129
1130
1131
10811132
10821133
10831134
......
11021153
11031154
11041155
1156
1157
1158
1159
1160
1161
1162
11051163
11061164
11071165
......
11091167
11101168
11111169
1170
1171
1172
1173
1174
11121175
11131176
11141177
11151178
1116
1179
11171180
11181181
11191182
11201183
11211184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
static long ParseTagInteger(char *buffer, TagPtr *tag);
static long ParseTagData(char *buffer, TagPtr *tag);
static long ParseTagDate(char *buffer, TagPtr *tag);
static long ParseTagBoolean(char *buffer, TagPtr *tag, long type);
static long GetNextTag(char *buffer, char **tag, long *start);
static long FixDataMatchingTag(char *buffer, char *tag);
static TagPtr NewTag(void);
return 0;
}
//==========================================================================
// XMLGetProperty
TagPtr
XMLGetKey( TagPtr dict, int id )
{
TagPtr tagList, tag;
if (dict->type != kTagTypeDict) return 0;
tag = 0;
int element = 0;
tagList = dict->tag;
while (tagList && element != id)
{
tag = tagList;
tagList = tag->tagNext;
if ((tag->type != kTagTypeKey) || (tag->string == 0)) continue;
element++;
if(id == element) return tag;
}
return 0;
}
TagPtr XMLGetValueForKey(TagPtr key)
{
if (!key ||
key->type != kTagTypeKey) return 0;
return key->tag;
}
// XMLGetTag(int index)
// XMLTagCount( TagPtr dict )
&& (dict->type != kTagTypeArray)// If we are an array, any element is valid
) continue;
if(tag->type == kTagTypeKey) printf("Located key %s\n", tag->string);
//if(tag->type == kTagTypeKey) printf("Located key %s\n", tag->string);
count++;
}
pos = 0;
char *configBuffer;
configBuffer = malloc(strlen(buffer)+1);
strcpy(configBuffer, buffer);
int strlength = strlen(buffer);
configBuffer = malloc(strlength+1);
bcopy(buffer, configBuffer, strlength);
configBuffer[strlength] = 0;
buffer_start = configBuffer;
while (1)
//==========================================================================
// ParseTagBoolean
static long
long
ParseTagBoolean( char * buffer, TagPtr * tag, long type )
{
TagPtr tmpTag;
}
/*** Cast functions ***/
bool XMLIsArray(TagPtr entry)
{
return entry && (entry->type == kTagTypeArray);
}
TagPtr XMLCastArray(TagPtr dict)
{
if(!dict) return NULL;
else return NULL;
}
bool XMLIsDict(TagPtr entry)
{
return entry && (entry->type == kTagTypeDict);
}
TagPtr XMLCastDict(TagPtr dict)
{
if(!dict) return NULL;
else return NULL;
}
bool XMLIsString(TagPtr entry)
{
return entry &&
((entry->type == kTagTypeString) ||
(entry->type == kTagTypeKey));
}
char* XMLCastString(TagPtr dict)
{
if(!dict) return NULL;
}
}
bool XMLIsBoolean(TagPtr entry)
{
return entry &&
((entry->type == kTagTypeTrue) ||
(entry->type == kTagTypeFalse));
}
bool XMLCastBoolean(TagPtr dict)
{
if(!dict) return false;
return false;
}
bool XMLIsInteger(TagPtr entry)
{
return entry && (entry->type == kTagTypeInteger);
}
int XMLCastInteger(TagPtr dict)
{
if(!dict)
{
printf("XMLCastInteger: null dict\n");
//printf("XMLCastInteger: null dict\n");
return 0;
}
if(dict->type == kTagTypeInteger) return (int)(dict->string);
return 0;
}
bool XMLAddTagToDictionary(TagPtr dict, char* key, TagPtr value)
{
if (!dict || dict->type != kTagTypeDict) return false;
TagPtr tmpTag;
char* string;
tmpTag = NewTag();
if (tmpTag == 0)
{
return false;
}
string = NewSymbol(key);
if (string == 0)
{
XMLFreeTag(tmpTag);
return false;
}
tmpTag->type = kTagTypeKey;
tmpTag->string = string;
tmpTag->tag = value;
tmpTag->offset = 0;
tmpTag->tagNext = 0;
TagPtr tagList = dict->tag;
if(!tagList)
{
// First tag
dict->tag = tmpTag;
return true;
}
while(tagList && tagList->tagNext) tagList = tagList->tagNext;
if(tagList)
{
tagList->tagNext = tmpTag;
return true;
}
return false;
}
branches/azimutz/trunkAutoResolution/i386/libsaio/xml.h
8484
8585
8686
87
88
89
8790
8891
8992
......
9598
9699
97100
101
102
103
104
105
106
107
108
109
98110
99111
100112
......
106118
107119
108120
121
122
123
124
125
109126
TagPtr XMLGetProperty( TagPtr dict, const char * key );
TagPtr XMLGetElement( TagPtr dict, int id );
TagPtr XMLGetKey( TagPtr dict, int id );
TagPtr XMLGetValueForKey(TagPtr key);
int XMLTagCount( TagPtr dict );
bool XMLIsType(TagPtr dict, enum xmltype type);
TagPtr XMLCastDict ( TagPtr dict );
TagPtr XMLCastArray( TagPtr dict );
bool XMLIsBoolean(TagPtr entry);
bool XMLIsString (TagPtr entry);
bool XMLIsInteger(TagPtr entry);
bool XMLIsDict (TagPtr entry);
bool XMLIsArray (TagPtr entry);
bool XMLAddTagToDictionary(TagPtr dict, char* key, TagPtr value);
long XMLParseNextTag(char *buffer, TagPtr *tag);
void XMLFreeTag(TagPtr tag);
char* XMLDecode(const char *in);
//
long XMLParseFile( char * buffer, TagPtr * dict );
//==========================================================================
// ParseTag*
long ParseTagBoolean( char * buffer, TagPtr * tag, long type );
#endif /* __LIBSAIO_XML_H */
branches/azimutz/trunkAutoResolution/i386/libsaio/bootstruct.h
131131
132132
133133
134
135
134
135
136136
137137
138138
char * configEnd; // pointer to end of config files
char config[CONFIG_SIZE];
config_file_t bootConfig; // boot.plist
config_file_t overrideConfig; // additional boot.plist which can override bootConfig keys
config_file_t bootConfig; // com.apple.Boot.plist
config_file_t chameleonConfig; // org.chameleon.Boot.plist which can override bootConfig keys
config_file_t themeConfig; // theme.plist
config_file_t smbiosConfig; // smbios.plist
config_file_t helperConfig; // boot helper partition's boot.plist
branches/azimutz/trunkAutoResolution/i386/libsaio/acpi_patcher.c
237237
238238
239239
240
241
242
240
241
242
243243
244244
245245
......
603603
604604
605605
606
606
607607
608608
609609
......
625625
626626
627627
628
628
629629
630630
631631
......
713713
714714
715715
716
716
717717
718718
719719
......
737737
738738
739739
740
741
742
740
741
742
743743
744744
745745
bool c3_enabled = false;
bool c4_enabled = false;
getBoolForKey(kEnableC2States, &c2_enabled, &bootInfo->bootConfig);
getBoolForKey(kEnableC3States, &c3_enabled, &bootInfo->bootConfig);
getBoolForKey(kEnableC4States, &c4_enabled, &bootInfo->bootConfig);
getBoolForKey(kEnableC2States, &c2_enabled, &bootInfo->chameleonConfig);
getBoolForKey(kEnableC3States, &c3_enabled, &bootInfo->chameleonConfig);
getBoolForKey(kEnableC4States, &c4_enabled, &bootInfo->chameleonConfig);
c2_enabled = c2_enabled | (fadt->C2_Latency < 100);
c3_enabled = c3_enabled | (fadt->C3_Latency < 1000);
// Restart Fix
if (Platform.CPU.Vendor == 0x756E6547) {/* Intel */
fix_restart = true;
getBoolForKey(kRestartFix, &fix_restart, &bootInfo->bootConfig);
getBoolForKey(kRestartFix, &fix_restart, &bootInfo->chameleonConfig);
} else {
verbose ("Not an Intel platform: Restart Fix not applied !!!\n");
fix_restart = false;
memcpy(fadt_mod, fadt, fadt->Length);
}
// Determine system type / PM_Model
if ( (value=getStringForKey(kSystemType, &bootInfo->bootConfig))!=NULL)
if ( (value=getStringForKey(kSystemType, &bootInfo->chameleonConfig))!=NULL)
{
if (Platform.Type > 6)
{
int len = 0;
// Try using the file specified with the DSDT option
if (getValueForKey(kDSDT, &filename, &len, &bootInfo->bootConfig))
if (getValueForKey(kDSDT, &filename, &len, &bootInfo->chameleonConfig))
{
sprintf(dirSpec, filename);
}
// SSDT Options
bool drop_ssdt=false, generate_pstates=false, generate_cstates=false;
getBoolForKey(kDropSSDT, &drop_ssdt, &bootInfo->bootConfig);
getBoolForKey(kGeneratePStates, &generate_pstates, &bootInfo->bootConfig);
getBoolForKey(kGenerateCStates, &generate_cstates, &bootInfo->bootConfig);
getBoolForKey(kDropSSDT, &drop_ssdt, &bootInfo->chameleonConfig);
getBoolForKey(kGeneratePStates, &generate_pstates, &bootInfo->chameleonConfig);
getBoolForKey(kGenerateCStates, &generate_cstates, &bootInfo->chameleonConfig);
{
int i;
branches/azimutz/trunkAutoResolution/i386/libsaio/spd.c
269269
270270
271271
272
272
273273
274274
275275
smbus_dev->vendor_id, smbus_dev->device_id, mmio, base, hostc);
//Azi: no use for this!
// getBoolForKey("DumpSPD", &dump, &bootInfo->bootConfig);
// getBoolForKey("DumpSPD", &dump, &bootInfo->chameleonConfig);
// needed at least for laptops
bool fullBanks = Platform.DMI.MemoryModules == Platform.DMI.CntMemorySlots;
branches/azimutz/trunkAutoResolution/i386/libsaio/gma.c
11
2
2
3
34
45
5
66
77
88
......
2121
2222
2323
24
2425
2526
26
27
28
27
28
29
2930
3031
3132
32
33
34
35
36
37
38
39
40
41
42
43
33
34
35
36
37
38
39
40
41
42
43
44
4445
4546
4647
47
48
4948
49
50
51
5052
51
52
53
54
55
56
57
58
59
60
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
6170
6271
6372
64
65
66
73
74
75
76
77
6778
6879
6980
......
7182
7283
7384
74
75
76
77
78
79
80
81
85
86
87
88
89
90
91
8292
83
93
8494
8595
86
96
8797
88
98
8999
90100
91101
92102
93103
104
94105
95106
96107
97
108
98109
99
100
101
110
111
102112
103113
104114
105115
106116
107
108
117
118
119
120
109121
110122
111123
112
124
125
126
127
113128
114129
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
130
138131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
139158
140159
141
160
142161
143
144
162
163
145164
146165
147166
/*
Original patch by nawcom -> http://forum.voodooprojects.org/index.php/topic,1029.msg4427.html#msg4427
Original patch by Nawcom
http://forum.voodooprojects.org/index.php/topic,1029.msg4427.html#msg4427
*/
//#include "libsaio.h"
#include "libsa.h"
#include "saio_internal.h"
#include "bootstruct.h"
#define DBG(x...)
#endif
uint8_t GMAX3100_vals[22][4] = {
{ 0x01,0x00,0x00,0x00 },
{ 0x01,0x00,0x00,0x00 },
{ 0x01,0x00,0x00,0x00 },
{ 0x00,0x00,0x00,0x08 },
{ 0x01,0x00,0x00,0x00 },
{ 0x01,0x00,0x00,0x00 },
{ 0x00,0x00,0x00,0x08 },
{ 0x64,0x00,0x00,0x00 },
{ 0x00,0x00,0x00,0x08 },
{ 0x01,0x00,0x00,0x00 },
{ 0x20,0x00,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x01,0x00,0x00,0x00 },
{ 0x20,0x03,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x08,0x52,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x01,0x00,0x00,0x00 },
{ 0x01,0x00,0x00,0x00 },
{ 0x20,0x00,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x01,0x00,0x00,0x00 },
{ 0x20,0x03,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x08,0x52,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 },
{ 0x01,0x00,0x00,0x00 },
{ 0x01,0x00,0x00,0x00 },
{ 0x3B,0x00,0x00,0x00 },
{ 0x00,0x00,0x00,0x00 }
};
uint8_t reg_TRUE[] = { 0x01 ,0x00 ,0x00 ,0x00 };
uint8_t reg_FALSE[] = { 0x00,0x00,0x00,0x00 };
uint8_t reg_TRUE[]= { 0x01, 0x00, 0x00, 0x00 };
uint8_t reg_FALSE[] = { 0x00, 0x00, 0x00, 0x00 };
static struct gma_gpu_t KnownGPUS[] = {
{ 0x00000000, "Unknown" },
{ 0x808627A2, "Mobile GMA950" },
{ 0x808627AE, "Mobile GMA950" },
{ 0x808627A6, "Mobile GMA950" },
{ 0x80862772, "Desktop GMA950" },
{ 0x80862776, "Desktop GMA950" },
{ 0x80862A02, "GMAX3100" },
{ 0x80862A03, "GMAX3100" },
{ 0x80862A12, "GMAX3100" },
{ 0x80862A13, "GMAX3100" },
{ 0x00000000, "Unknown"},
{ 0x808627A2, "Mobile GMA950"},
{ 0x808627AE, "Mobile GMA950"},
{ 0x808627A6, "Mobile GMA950"},
{ 0x8086A011, "Mobile GMA3150"},
{ 0x8086A012, "Mobile GMA3150"},
//Azi: i can get QE/CI but no framebuffer... more testing needed.
{ 0x80862772, "Desktop GMA950"},
{ 0x80862776, "Desktop GMA950"},
{ 0x8086A001, "Mobile GMA3150"},
{ 0x8086A002, "Desktop GMA3150" },
{ 0x80862A02, "GMAX3100"},
{ 0x80862A03, "GMAX3100"},
{ 0x80862A12, "GMAX3100"},
{ 0x80862A13, "GMAX3100"},
{ 0x80862A42, "GMAX3100"},
{ 0x80862A43, "GMAX3100"},
};
char *get_gma_model(uint32_t id) {
int i=0;
for(i = 0; i < (sizeof(KnownGPUS) / sizeof(KnownGPUS[0])); i++) {
if(KnownGPUS[i].device == id)
int i = 0;
for (i = 0; i < (sizeof(KnownGPUS) / sizeof(KnownGPUS[0])); i++)
{
if (KnownGPUS[i].device == id)
return KnownGPUS[i].name;
}
return KnownGPUS[0].name;
bool setup_gma_devprop(pci_dt_t *gma_dev)
{
//intlen;
char *devicepath;
volatile uint8_t *regs;
uint32_t bar[7];
char *model;
uint8_t BuiltIn = 0x00;
uint8_t ClassFix[4] = { 0x00, 0x00, 0x03, 0x00 };
char*devicepath;
volatile uint8_t*regs;
uint32_tbar[7];
char*model;
uint8_t BuiltIn =0x00;
uint8_t ClassFix[4] ={ 0x00, 0x00, 0x03, 0x00 };
devicepath = get_pci_dev_path(gma_dev);
bar[0] = pci_config_read32(gma_dev->dev.addr, 0x10);
regs = (uint8_t *) (bar[0] & ~0x0f);
model = get_gma_model((gma_dev->vendor_id << 16) | gma_dev->device_id);
verbose("Intel %s [%04x:%04x] :: %s\n",
model, gma_dev->vendor_id, gma_dev->device_id, devicepath);
if (!string)
string = devprop_create_string();
struct DevPropDevice *device = malloc(sizeof(struct DevPropDevice));
device = devprop_add_device(string, devicepath);
if(!device)
if (!device)
{
printf("Failed initializing dev-prop string dev-entry, press any key...\n");
getchar();
printf("Failed initializing dev-prop string dev-entry.\n");
pause();
return false;
}
devprop_add_value(device, "model", (uint8_t*)model, (strlen(model) + 1));
devprop_add_value(device, "device_type", (uint8_t*)"display", 8);
if (model == (char *)"Mobile GMA950") {
if ((model == (char *)"Mobile GMA950")
|| (model == (char *)"Mobile GMA3150"))
{
devprop_add_value(device, "AAPL,HasPanel", reg_TRUE, 4);
devprop_add_value(device, "built-in", &BuiltIn, 1);
devprop_add_value(device, "class-code", ClassFix, 4);
} else if (model == (char *)"Desktop GMA950") {
}
else if ((model == (char *)"Desktop GMA950")
|| (model == (char *)"Desktop GMA3150"))
{
BuiltIn = 0x01;
devprop_add_value(device, "built-in", &BuiltIn, 1);
} else if (model == (char *)"GMAX3100") {
devprop_add_value(device, "AAPL,HasPanel",GMAX3100_vals[0], 4);
devprop_add_value(device, "AAPL,SelfRefreshSupported",GMAX3100_vals[1], 4);
devprop_add_value(device, "AAPL,aux-power-connected",GMAX3100_vals[2], 4);
devprop_add_value(device, "AAPL,backlight-control",GMAX3100_vals[3], 4);
devprop_add_value(device, "AAPL00,blackscreen-preferences",GMAX3100_vals[4], 4);
devprop_add_value(device, "AAPL01,BacklightIntensity",GMAX3100_vals[5], 4);
devprop_add_value(device, "AAPL01,blackscreen-preferences",GMAX3100_vals[6], 4);
devprop_add_value(device, "AAPL01,DataJustify",GMAX3100_vals[7], 4);
devprop_add_value(device, "AAPL01,Depth",GMAX3100_vals[8], 4);
devprop_add_value(device, "AAPL01,Dither",GMAX3100_vals[9], 4);
devprop_add_value(device, "AAPL01,DualLink",GMAX3100_vals[10], 4);
devprop_add_value(device, "AAPL01,Height",GMAX3100_vals[11], 4);
devprop_add_value(device, "AAPL01,Interlace",GMAX3100_vals[12], 4);
devprop_add_value(device, "AAPL01,Inverter",GMAX3100_vals[13], 4);
devprop_add_value(device, "AAPL01,InverterCurrent",GMAX3100_vals[14], 4);
devprop_add_value(device, "AAPL01,InverterCurrency",GMAX3100_vals[15], 4);
devprop_add_value(device, "AAPL01,LinkFormat",GMAX3100_vals[16], 4);
devprop_add_value(device, "AAPL01,LinkType",GMAX3100_vals[17], 4);
devprop_add_value(device, "AAPL01,Pipe",GMAX3100_vals[18], 4);
devprop_add_value(device, "AAPL01,PixelFormat",GMAX3100_vals[19], 4);
devprop_add_value(device, "AAPL01,Refresh",GMAX3100_vals[20], 4);
devprop_add_value(device, "AAPL01,Stretch",GMAX3100_vals[21], 4);
devprop_add_value(device, "class-code", ClassFix, 4);
}
else if (model == (char *)"GMAX3100")
{
devprop_add_value(device, "AAPL,HasPanel",GMAX3100_vals[0], 4);
devprop_add_value(device, "AAPL,SelfRefreshSupported",GMAX3100_vals[1], 4);
devprop_add_value(device, "AAPL,aux-power-connected",GMAX3100_vals[2], 4);
devprop_add_value(device, "AAPL,backlight-control",GMAX3100_vals[3], 4);
devprop_add_value(device, "AAPL00,blackscreen-preferences", GMAX3100_vals[4], 4);
devprop_add_value(device, "AAPL01,BacklightIntensity",GMAX3100_vals[5], 4);
devprop_add_value(device, "AAPL01,blackscreen-preferences", GMAX3100_vals[6], 4);
devprop_add_value(device, "AAPL01,DataJustify",GMAX3100_vals[7], 4);
devprop_add_value(device, "AAPL01,Depth",GMAX3100_vals[8], 4);
devprop_add_value(device, "AAPL01,Dither",GMAX3100_vals[9], 4);
devprop_add_value(device, "AAPL01,DualLink",GMAX3100_vals[10], 4);
devprop_add_value(device, "AAPL01,Height",GMAX3100_vals[11], 4);
devprop_add_value(device, "AAPL01,Interlace",GMAX3100_vals[12], 4);
devprop_add_value(device, "AAPL01,Inverter",GMAX3100_vals[13], 4);
devprop_add_value(device, "AAPL01,InverterCurrent",GMAX3100_vals[14], 4);
devprop_add_value(device, "AAPL01,InverterCurrency",GMAX3100_vals[15], 4);
devprop_add_value(device, "AAPL01,LinkFormat",GMAX3100_vals[16], 4);
devprop_add_value(device, "AAPL01,LinkType",GMAX3100_vals[17], 4);
devprop_add_value(device, "AAPL01,Pipe",GMAX3100_vals[18], 4);
devprop_add_value(device, "AAPL01,PixelFormat",GMAX3100_vals[19], 4);
devprop_add_value(device, "AAPL01,Refresh",GMAX3100_vals[20], 4);
devprop_add_value(device, "AAPL01,Stretch",GMAX3100_vals[21], 4);
devprop_add_value(device, "class-code",ClassFix, 4);
}
stringdata = malloc(sizeof(uint8_t) * string->length);
if(!stringdata)
if (!stringdata)
{
printf("no stringdata press a key...\n");
getchar();
printf("No stringdata.\n");
pause();
return false;
}
branches/azimutz/trunkAutoResolution/i386/libsaio/gma.h
88
99
1010
11
12
13
11
12
13
1414
1515
1616
char *name;
};
#define REG8(reg) ((volatile uint8_t *)regs)[(reg)]
#define REG16(reg) ((volatile uint16_t *)regs)[(reg) >> 1]
#define REG32(reg) ((volatile uint32_t *)regs)[(reg) >> 2]
#define REG8(reg)((volatile uint8_t *)regs)[(reg)]
#define REG16(reg)((volatile uint16_t *)regs)[(reg) >> 1]
#define REG32(reg)((volatile uint32_t *)regs)[(reg) >> 2]
#endif /* !__LIBSAIO_GMA_H */
branches/azimutz/trunkAutoResolution/i386/libsaio/pci_root.c
5454
5555
5656
57
57
5858
5959
6060
6161
62
62
6363
6464
6565
6666
67
67
6868
6969
7070
71
71
7272
7373
7474
if (rootuid < 10) return rootuid;
rootuid = 0;/* default uid = 0 */
if (getValueForKey(kPCIRootUID, &val, &len, &bootInfo->bootConfig)) {
if (getValueForKey(kPCIRootUID, &val, &len, &bootInfo->chameleonConfig)) {
if (isdigit(val[0])) rootuid = val[0] - '0';
goto out;
}
/* Chameleon compatibility */
else if (getValueForKey("PciRoot", &val, &len, &bootInfo->bootConfig)) {
else if (getValueForKey("PciRoot", &val, &len, &bootInfo->chameleonConfig)) {
if (isdigit(val[0])) rootuid = val[0] - '0';
goto out;
}
/* PCEFI compatibility */
else if (getValueForKey("-pci0", &val, &len, &bootInfo->bootConfig)) {
else if (getValueForKey("-pci0", &val, &len, &bootInfo->chameleonConfig)) {
rootuid = 0;
goto out;
}
else if (getValueForKey("-pci1", &val, &len, &bootInfo->bootConfig)) {
else if (getValueForKey("-pci1", &val, &len, &bootInfo->chameleonConfig)) {
rootuid = 1;
goto out;
}
branches/azimutz/trunkAutoResolution/i386/libsaio/usb.c
6767
6868
6969
70
70
7171
7272
7373
7474
7575
76
77
78
76
77
78
7979
8080
8181
......
207207
208208
209209
210
210
211211
212212
213213
bool fix_ehci, fix_uhci, fix_usb, fix_legacy;
fix_ehci = fix_uhci = fix_usb = fix_legacy = false;
if (getBoolForKey(kUSBBusFix, &fix_usb, &bootInfo->bootConfig))
if (getBoolForKey(kUSBBusFix, &fix_usb, &bootInfo->chameleonConfig))
{
fix_ehci = fix_uhci = fix_legacy = fix_usb;// Disable all if none set
}
else
{
getBoolForKey(kEHCIacquire, &fix_ehci, &bootInfo->bootConfig);
getBoolForKey(kUHCIreset, &fix_uhci, &bootInfo->bootConfig);
getBoolForKey(kLegacyOff, &fix_legacy, &bootInfo->bootConfig);
getBoolForKey(kEHCIacquire, &fix_ehci, &bootInfo->chameleonConfig);
getBoolForKey(kUHCIreset, &fix_uhci, &bootInfo->chameleonConfig);
getBoolForKey(kLegacyOff, &fix_legacy, &bootInfo->chameleonConfig);
}
struct pciList* current = usbList;
boolalwaysHardBIOSReset;
alwaysHardBIOSReset = false;
if (!getBoolForKey(kEHCIhard, &alwaysHardBIOSReset, &bootInfo->bootConfig)) {
if (!getBoolForKey(kEHCIhard, &alwaysHardBIOSReset, &bootInfo->chameleonConfig)) {
alwaysHardBIOSReset = true;
}
branches/azimutz/trunkAutoResolution/i386/libsaio/device_inject.c
5555
5656
5757
58
58
5959
6060
6161
/* Use the static "device-properties" boot config key contents if available,
* otheriwse use the generated one.
*/
if (!getValueForKey(kDeviceProperties, &val, &cnt, &bootInfo->bootConfig) && string)
if (!getValueForKey(kDeviceProperties, &val, &cnt, &bootInfo->chameleonConfig) && string)
{
val = (const char*)string;
cnt = strlength * 2;
branches/azimutz/trunkAutoResolution/i386/libsaio/nvidia.c
11921192
11931193
11941194
1195
1195
11961196
11971197
11981198
......
13101310
13111311
13121312
1313
1313
13141314
13151315
13161316
......
13191319
13201320
13211321
1322
1322
13231323
13241324
13251325
......
13371337
13381338
13391339
1340
1340
13411341
13421342
13431343
......
13781378
13791379
13801380
1381
1381
13821382
13831383
13841384
rom = malloc(NVIDIA_ROM_SIZE);
sprintf(nvFilename, "/Extra/%04x_%04x.rom", (uint16_t)nvda_dev->vendor_id, (uint16_t)nvda_dev->device_id);
if (getBoolForKey(kUseNvidiaROM, &doit, &bootInfo->bootConfig) && doit) {
if (getBoolForKey(kUseNvidiaROM, &doit, &bootInfo->chameleonConfig) && doit) {
verbose("Looking for nvidia video bios file %s\n", nvFilename);
nvBiosOveride = load_nvidia_bios_file(nvFilename, rom, NVIDIA_ROM_SIZE);
if (nvBiosOveride > 0) {
sprintf(biosVersion, "%s", (nvBiosOveride > 0) ? nvFilename : version_str);
sprintf(kNVCAP, "NVCAP_%04x", nvda_dev->device_id);
if (getValueForKey(kNVCAP, &value, &len, &bootInfo->bootConfig) && len == NVCAP_LEN * 2) {
if (getValueForKey(kNVCAP, &value, &len, &bootInfo->chameleonConfig) && len == NVCAP_LEN * 2) {
uint8_tnew_NVCAP[NVCAP_LEN];
if (hex2bin(value, new_NVCAP, NVCAP_LEN) == 0) {
}
}
if (getValueForKey(kdcfg0, &value, &len, &bootInfo->bootConfig) && len == DCFG0_LEN * 2){
if (getValueForKey(kdcfg0, &value, &len, &bootInfo->chameleonConfig) && len == DCFG0_LEN * 2){
uint8_t new_dcfg0[DCFG0_LEN];
}
if (getValueForKey(kdcfg1, &value, &len, &bootInfo->bootConfig) && len == DCFG1_LEN * 2){
if (getValueForKey(kdcfg1, &value, &len, &bootInfo->chameleonConfig) && len == DCFG1_LEN * 2){
uint8_t new_dcfg1[DCFG1_LEN];
// devprop_add_value(device, "@1,connector-type",connector_type_1, 4);
//end Nvidia HDMI Audio
if (getBoolForKey(kVBIOS, &doit, &bootInfo->bootConfig) && doit) {
if (getBoolForKey(kVBIOS, &doit, &bootInfo->chameleonConfig) && doit) {
devprop_add_value(device, "vbios", rom, (nvBiosOveride > 0) ? nvBiosOveride : (rom[2] * 512));
}
branches/azimutz/trunkAutoResolution/i386/libsaio/ati.c
875875
876876
877877
878
878
879879
880880
881881
......
11411141
11421142
11431143
1144
1144
11451145
11461146
11471147
......
11641164
11651165
11661166
1167
1167
11681168
11691169
11701170
char file_name[24];
bool do_load = false;
getBoolForKey(key, &do_load, &bootInfo->bootConfig);
getBoolForKey(key, &do_load, &bootInfo->chameleonConfig);
if (!do_load)
return false;
get_vram_size();
getBoolForKey(kATYbinimage, &add_vbios, &bootInfo->bootConfig);
getBoolForKey(kATYbinimage, &add_vbios, &bootInfo->chameleonConfig);
if (add_vbios)
if (!load_vbios_file(kUseAtiROM, pci_dev->vendor_id, pci_dev->device_id, pci_dev->subsys_id.subsys_id))
atN = 0;
card->cfg_name = getStringForKey(kAtiConfig, &bootInfo->bootConfig);
card->cfg_name = getStringForKey(kAtiConfig, &bootInfo->chameleonConfig);
if (!card->cfg_name)
{
card->cfg_name = card_configs[card->info->cfg_name].name;
branches/azimutz/trunkAutoResolution/i386/libsaio/sys.c
7878
7979
8080
81
82
8183
8284
8385
......
335337
336338
337339
340
338341
339342
340343
......
822825
823826
824827
825
828
826829
827830
828831
......
841844
842845
843846
847
848
849
844850
845851
846852
extern int multiboot_partition;
extern int multiboot_partition_set;
extern int multiboot_skip_partition;
extern int multiboot_skip_partition_set;
struct devsw {
const char * name;
for (idx = len; idx && (name[idx] != '/' && name[idx] != '\\'); idx--) {}
if (idx == 0) {
if(name[idx] == '/' || name[idx] == '\\') ++name; // todo: ensure other functions handel \ properly
gMakeDirSpec[0] = '/';
gMakeDirSpec[1] = '\0';
} else {
* to override the default selection.
* We accept only kBVFlagSystemVolume or kBVFlagForeignBoot volumes.
*/
char *val = XMLDecode(getStringForKey(kDefaultPartition, &bootInfo->bootConfig));
char *val = XMLDecode(getStringForKey(kDefaultPartition, &bootInfo->chameleonConfig));
if (val) {
for ( bvr = chain; bvr; bvr = bvr->next ) {
if (matchVolumeToString(bvr, val, false)) {
*/
for ( bvr = chain; bvr; bvr = bvr->next )
{
if (multiboot_skip_partition_set) {
if (bvr->part_no == multiboot_skip_partition) continue;
}
if ( bvr->flags & kBVFlagPrimary && bvr->biosdev == gBIOSDev ) foundPrimary = true;
// zhell -- Undo a regression that was introduced from r491 to 492.
// if gBIOSBootVolume is set already, no change is required
branches/azimutz/trunkAutoResolution/i386/libsaio/platform.c
4747
4848
4949
50
50
5151
5252
5353
else
bootInfo->memDetect = true;
/* manually */
getBoolForKey(kUseMemDetect, &bootInfo->memDetect, &bootInfo->bootConfig);
getBoolForKey(kUseMemDetect, &bootInfo->memDetect, &bootInfo->chameleonConfig);
if (bootInfo->memDetect) {
if (dram_controller_dev != NULL) {
branches/azimutz/trunkAutoResolution/i386/libsaio/cpu.c
266266
267267
268268
269
269
270270
271271
272272
} else {
cpuFrequency = tscFrequency;
}
if ((getValueForKey(kbusratio, &newratio, &len, &bootInfo->bootConfig)) && (len <= 4)) {
if ((getValueForKey(kbusratio, &newratio, &len, &bootInfo->chameleonConfig)) && (len <= 4)) {
max_ratio = atoi(newratio);
max_ratio = (max_ratio * 10);
if (len >= 3) max_ratio = (max_ratio + 5);
branches/azimutz/trunkAutoResolution/i386/libsaio/disk.c
15681568
15691569
15701570
1571
1571
15721572
15731573
15741574
......
17471747
17481748
17491749
1750
1750
17511751
17521752
17531753
char* val = 0;
int len;
getValueForKey(kHidePartition, &raw, &len, &bootInfo->bootConfig);
getValueForKey(kHidePartition, &raw, &len, &bootInfo->chameleonConfig);
if(raw)
{
val = XMLDecode(raw);
if ( !str || strMaxLen <= 0)
return false;
aliasList = XMLDecode(getStringForKey(kRenamePartition, &bootInfo->bootConfig));
aliasList = XMLDecode(getStringForKey(kRenamePartition, &bootInfo->chameleonConfig));
if ( !aliasList )
return false;
branches/azimutz/trunkAutoResolution/i386/libsaio/pci_setup.c
22
33
44
5
56
67
7
88
99
1010
......
2222
2323
2424
25
26
27
25
26
27
2828
2929
3030
......
5050
5151
5252
53
54
55
53
5654
5755
58
59
60
61
6256
6357
6458
#include "boot.h"
#include "bootstruct.h"
#include "pci.h"
#include "gma.h"
#include "nvidia.h"
#include "modules.h"
#include "gma.h" //Azi:autoresolution
extern bool setup_ati_devprop(pci_dt_t *ati_dev);
do_eth_devprop = do_gfx_devprop = do_enable_hpet = false;
getBoolForKey(kEthernetBuiltIn, &do_eth_devprop, &bootInfo->bootConfig);
getBoolForKey(kGraphicsEnabler, &do_gfx_devprop, &bootInfo->bootConfig);
getBoolForKey(kForceHPET, &do_enable_hpet, &bootInfo->bootConfig);
getBoolForKey(kEthernetBuiltIn, &do_eth_devprop, &bootInfo->chameleonConfig);
getBoolForKey(kGraphicsEnabler, &do_gfx_devprop, &bootInfo->chameleonConfig);
getBoolForKey(kForceHPET, &do_enable_hpet, &bootInfo->chameleonConfig);
while (current)
{
setup_ati_devprop(current);
break;
case PCI_VENDOR_ID_INTEL: // AutoResolution
verbose("Intel Graphics Controller [%04x:%04x] :: %s \n",
current->vendor_id, current->device_id, devicepath);
case PCI_VENDOR_ID_INTEL:
setup_gma_devprop(current);
break;
//message to be removed once support for these cards is added
//verbose("Intel VGA Controller [%04x:%04x] :: %s (currently NOT SUPPORTED)\n",
//current->vendor_id, current->device_id, devicepath);
//break;
case PCI_VENDOR_ID_NVIDIA:
setup_nvidia_devprop(current);
branches/azimutz/trunkAutoResolution/i386/libsaio/smbios.c
723723
724724
725725
726
726
727727
728728
729729
bzero(buffer, SMB_ALLOC_SIZE);
structPtr->new = (SMBStructHeader *)buffer;
getBoolForKey(kSMBIOSdefaults, &setSMB, &bootInfo->bootConfig);
getBoolForKey(kSMBIOSdefaults, &setSMB, &bootInfo->chameleonConfig);
if (setSMB)
setDefaultSMBData();
branches/azimutz/trunkAutoResolution/i386/libsaio/stringTable.c
2828
2929
3030
31
3132
3233
3334
......
496497
497498
498499
499
500
500501
501502
502503
503
504
505
506
504507
505508
506
509
507510
508511
509512
......
607610
608611
609612
610
611
612613
613
614
615
616614
617615
618616
......
639637
640638
641639
642
640
643641
644642
645643
646644
647
645
648646
649647
650
651
652
653
654
655
648
649
650
651
652
653
654
656655
657656
658657
......
661660
662661
663662
663
664
665
666
667
668
669
670
664671
665672
666673
#include "bootstruct.h"
#include "libsaio.h"
#include "boot.h"
#include "xml.h"
extern char *Language;
if (config->canOverride)
{
if (getValueForConfigTableKey(&bootInfo->overrideConfig, key, &overrideVal, &overrideSize))
if (getValueForConfigTableKey(&bootInfo->chameleonConfig, key, &overrideVal, &overrideSize))
{
override = true;
if (ret && (strcmp(key, "Kernel") == 0) && (strcmp(overrideVal, "mach_kernel") == 0))
// NOTE: Values are defined by apple as being in com.apple.Boot.plist
// kHelperRootUUIDKey, kKernelArchKey, kMKextCacheKey, kKernelCacheKey, kKernelNameKey, kKernelFlagsKey
if (ret && (strcmp(key, kKernelNameKey) == 0) && (strcmp(overrideVal, "mach_kernel") == 0))
override = false;
if (ret && (strcmp(key, "Kernel Flags") == 0) && (overrideSize == 0))
if (ret && (strcmp(key, kKernelFlagsKey) == 0) && (overrideSize == 0))
override = false;
if (override)
int loadSystemConfig(config_file_t *config)
{
char *dirspec[] = {
"/Extra/com.apple.Boot.plist",
"bt(0,0)/Extra/com.apple.Boot.plist",
"/Library/Preferences/SystemConfiguration/com.apple.Boot.plist",
"/com.apple.boot.P/Library/Preferences/SystemConfiguration/com.apple.Boot.plist",
"/com.apple.boot.R/Library/Preferences/SystemConfiguration/com.apple.Boot.plist",
"/com.apple.boot.S/Library/Preferences/SystemConfiguration/com.apple.Boot.plist"
};
int i, fd, count, ret=-1;
return ret;
}
/* loadOverrideConfig
/* loadChameleonConfig
*
* Returns 0 - successful.
* -1 - unsuccesful.
*/
int loadOverrideConfig(config_file_t *config)
int loadChameleonConfig(config_file_t *config)
{
char *dirspec[] = {
"rd(0,0)/Extra/com.apple.Boot.plist",
"/Extra/com.apple.Boot.plist",
"/Library/Preferences/SystemConfiguration/com.apple.Boot.plist",
"/com.apple.boot.P/Library/Preferences/SystemConfiguration/com.apple.Boot.plist",
"/com.apple.boot.R/Library/Preferences/SystemConfiguration/com.apple.Boot.plist",
"/com.apple.boot.S/Library/Preferences/SystemConfiguration/com.apple.Boot.plist"
"rd(0,0)/Extra/org.chameleon.Boot.plist",
"bt(0,0)/Extra/org.chameleon.Boot.plist",
"/Extra/org.chameleon.Boot.plist",
"rd(0,0)/Extra/com.apple.Boot.plist", /* DEPRECIATED */
"bt(0,0)/Extra/com.apple.Boot.plist", /* DEPRECIATED */
"/Extra/com.apple.Boot.plist" /* DEPRECIATED */
};
int i, fd, count, ret=-1;
{
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();
}
// read file
count = read(fd, config->plist, IO_CONFIG_DATA_SIZE);
close(fd);
branches/azimutz/trunkAutoResolution/i386/libsaio/fake_efi.c
490490
491491
492492
493
493
494494
495495
496496
......
630630
631631
632632
633
633
634634
635635
636636
// unable to determine UUID for host. Error: 35 fix
// Rek: new SMsystemid option conforming to smbios notation standards, this option should
// belong to smbios config only ...
const char *sysId = getStringForKey(kSystemID, &bootInfo->bootConfig);
const char *sysId = getStringForKey(kSystemID, &bootInfo->chameleonConfig);
EFI_CHAR8*ret = getUUIDFromString(sysId);
if (!sysId || !ret) // try bios dmi info UUID extraction
extern void scan_mem();
// Take in account user overriding
if (getValueForKey(kSMBIOSKey, &override_pathname, &len, &bootInfo->bootConfig) && len > 0)
if (getValueForKey(kSMBIOSKey, &override_pathname, &len, &bootInfo->chameleonConfig) && len > 0)
{
// Specify a path to a file, e.g. SMBIOS=/Extra/macProXY.plist
sprintf(dirSpecSMBIOS, override_pathname);
branches/azimutz/trunkAutoResolution/i386/libsaio/saio_internal.h
162162
163163
164164
165
165
166166
167167
168168
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 loadOverrideConfig(config_file_t *configBuff);
extern int loadChameleonConfig(config_file_t *configBuff);
extern char * newString(const char *oldString);
extern char * getNextArg(char ** ptr, char * val);
extern int ParseXMLFile( char * buffer, TagPtr * dict );
branches/azimutz/trunkAutoResolution/i386/boot2/graphics.c
10551055
10561056
10571057
1058
1058
10591059
10601060
10611061
char * propStr;
unsigned long count = 0;
propStr = newStringForKey( (char *) propKey , &bootInfo->bootConfig );
propStr = newStringForKey( (char *) propKey , &bootInfo->chameleonConfig );
if ( propStr )
{
char * delimiter = propStr;
branches/azimutz/trunkAutoResolution/i386/boot2/drivers.c
8888
8989
9090
91
92
93
94
95
91
92
93
94
95
96
9697
9798
9899
......
102103
103104
104105
105
106
106107
107108
108109
......
209210
210211
211212
212
213
214
213
215214
216
217
215
216
217
218
219
220
221
218222
219
223
220224
221225
222
223
226
227
228
229
230
231
224232
225233
226
227
228
229
230
231
234
235
232236
233
234
237
238
239
240
241
242
235243
244
245
246
247
248
249
250
236251
237
238
239
240
241
242
243252
244253
245254
......
288297
289298
290299
291
300
292301
293302
294303
......
346355
347356
348357
358
349359
350360
351361
352
362
353363
354364
355365
......
385395
386396
387397
388
398
389399
390400
391401
......
431441
432442
433443
434
444
435445
436446
437447
......
445455
446456
447457
448
458
449459
460
461
450462
451463
452464
453465
454
455466
456467
457
468
469
458470
459471
460472
......
464476
465477
466478
467
479
468480
481
482
469483
470484
471485
472
473486
474487
475488
476
477489
478490
479491
480492
481493
482494
483
484495
485496
486497
......
490501
491502
492503
493
494504
495505
496506
......
538548
539549
540550
541
551
542552
543553
544554
......
581591
582592
583593
594
595
596
584597
585598
586599
......
713726
714727
715728
716
729
717730
718731
719732
......
733746
734747
735748
736
737
738
739
749
750
740751
752
741753
742754
743755
756
744757
745758
746759
......
817830
818831
819832
820
833
834
835
836
837
838
839
840
821841
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
842
843
844
845
846
847
848
849
850
851
840852
/*static*/ unsigned long Adler32( unsigned char * buffer, long length );
static long FileLoadDrivers(char *dirSpec, long plugin);
static long NetLoadDrivers(char *dirSpec);
static long LoadDriverMKext(char *fileSpec);
static long LoadDriverPList(char *dirSpec, char *name, long bundleType);
static long LoadMatchedModules(void);
long FileLoadDrivers(char *dirSpec, long plugin);
long NetLoadDrivers(char *dirSpec);
long LoadDriverMKext(char *fileSpec);
long LoadDriverPList(char *dirSpec, char *name, long bundleType);
long LoadMatchedModules(void);
static long MatchPersonalities(void);
static long MatchLibraries(void);
#ifdef NOTDEF
static long ParseXML(char *buffer, ModulePtr *module, TagPtr *personalities);
static long InitDriverSupport(void);
static ModulePtr gModuleHead, gModuleTail;
ModulePtr gModuleHead, gModuleTail;
static TagPtr gPersonalityHead, gPersonalityTail;
static char * gExtensionsSpec;
static char * gDriverSpec;
}
}
}
// Also try to load Extensions from boot helper partitions.
if (gBootVolume->flags & kBVFlagBooter)
if(!gHaveKernelCache)
{
strcpy(dirSpecExtra, "/com.apple.boot.P/System/Library/");
if (FileLoadDrivers(dirSpecExtra, 0) != 0)
// Don't load main driver (from /System/Library/Extentions) if gHaveKernelCache is set.
// since these drivers will already be in the kernel cache.
// NOTE: when gHaveKernelCache, xnu cannot (by default) load *any* extra kexts from the bootloader.
// The /Extra code is not disabled in this case due to a kernel patch that allows for this to happen.
// Also try to load Extensions from boot helper partitions.
if (gBootVolume->flags & kBVFlagBooter)
{
strcpy(dirSpecExtra, "/com.apple.boot.R/System/Library/");
strcpy(dirSpecExtra, "/com.apple.boot.P/System/Library/");
if (FileLoadDrivers(dirSpecExtra, 0) != 0)
{
strcpy(dirSpecExtra, "/com.apple.boot.S/System/Library/");
FileLoadDrivers(dirSpecExtra, 0);
strcpy(dirSpecExtra, "/com.apple.boot.R/System/Library/");
if (FileLoadDrivers(dirSpecExtra, 0) != 0)
{
strcpy(dirSpecExtra, "/com.apple.boot.S/System/Library/");
FileLoadDrivers(dirSpecExtra, 0);
}
}
}
}
if (gMKextName[0] != '\0')
{
verbose("LoadDrivers: Loading from [%s]\n", gMKextName);
if ( LoadDriverMKext(gMKextName) != 0 )
if (gMKextName[0] != '\0')
{
error("Could not load %s\n", gMKextName);
return -1;
verbose("LoadDrivers: Loading from [%s]\n", gMKextName);
if ( LoadDriverMKext(gMKextName) != 0 )
{
error("Could not load %s\n", gMKextName);
return -1;
}
}
else
{
strcpy(gExtensionsSpec, dirSpec);
strcat(gExtensionsSpec, "System/Library/");
FileLoadDrivers(gExtensionsSpec, 0);
}
}
else
{
strcpy(gExtensionsSpec, dirSpec);
strcat(gExtensionsSpec, "System/Library/");
FileLoadDrivers(gExtensionsSpec, 0);
}
}
else
{
//==========================================================================
// FileLoadDrivers
static long
long
FileLoadDrivers( char * dirSpec, long plugin )
{
long ret, length, flags, time, bundleType;
return result;
}
//==========================================================================
//
static long
long
NetLoadDrivers( char * dirSpec )
{
long tries;
//==========================================================================
// loadDriverMKext
static long
long
LoadDriverMKext( char * fileSpec )
{
unsigned long driversAddr, driversLength;
//==========================================================================
// LoadDriverPList
static long
long
LoadDriverPList( char * dirSpec, char * name, long bundleType )
{
long length, executablePathLength, bundlePathLength;
do {
// Save the driver path.
sprintf(gFileSpec, "%s/%s/%s", dirSpec, name,
if(name) sprintf(gFileSpec, "%s/%s/%s", dirSpec, name,
(bundleType == kCFBundleType2) ? "Contents/MacOS/" : "");
else sprintf(gFileSpec, "%s/%s", dirSpec,
(bundleType == kCFBundleType2) ? "Contents/MacOS/" : "");
executablePathLength = strlen(gFileSpec) + 1;
tmpExecutablePath = malloc(executablePathLength);
if (tmpExecutablePath == 0) break;
strcpy(tmpExecutablePath, gFileSpec);
sprintf(gFileSpec, "%s/%s", dirSpec, name);
if(name) sprintf(gFileSpec, "%s/%s", dirSpec, name);
else sprintf(gFileSpec, "%s", dirSpec);
bundlePathLength = strlen(gFileSpec) + 1;
tmpBundlePath = malloc(bundlePathLength);
// Construct the file spec to the plist, then load it.
sprintf(gFileSpec, "%s/%s/%sInfo.plist", dirSpec, name,
if(name) sprintf(gFileSpec, "%s/%s/%sInfo.plist", dirSpec, name,
(bundleType == kCFBundleType2) ? "Contents/" : "");
else sprintf(gFileSpec, "%s/%sInfo.plist", dirSpec,
(bundleType == kCFBundleType2) ? "Contents/" : "");
length = LoadFile(gFileSpec);
if (length == -1) break;
length = length + 1;
buffer = malloc(length);
if (buffer == 0) break;
strlcpy(buffer, (char *)kLoadAddr, length);
// Parse the plist.
ret = ParseXML(buffer, &module, &personalities);
if (ret != 0) { break; }
// Allocate memory for the driver path and the plist.
module->executablePath = tmpExecutablePath;
if ((module->executablePath == 0) || (module->bundlePath == 0) || (module->plistAddr == 0))
break;
// Save the driver path in the module.
//strcpy(module->driverPath, tmpDriverPath);
tmpExecutablePath = 0;
//==========================================================================
// LoadMatchedModules
static long
long
LoadMatchedModules( void )
{
TagPtr prop;
//}
// Make make in the image area.
execute_hook("LoadMatchedModules", module, &length, executableAddr, NULL);
driverLength = sizeof(DriverInfo) + module->plistLength + length + module->bundlePathLength;
driverAddr = AllocateKernelMemory(driverLength);
ParseXML( char * buffer, ModulePtr * module, TagPtr * personalities )
{
long length, pos;
TagPtr moduleDict, required;
TagPtr moduleDict;
ModulePtr tmpModule;
pos = 0;
if (length == -1) return -1;
required = XMLGetProperty(moduleDict, kPropOSBundleRequired);
if ( (required == 0) ||
(required->type != kTagTypeString) ||
!strcmp(required->string, "Safe Boot"))
#if 0 /** remove this check. **/
if (strcmp(XMLCastString(XMLGetProperty(moduleDict, kPropOSBundleRequired)), "Safe Boot") == 0)
{
// Don't load Safe Boot kexts. NOTE: -x should be check too.
XMLFreeTag(moduleDict);
return -2;
}
#endif
tmpModule = malloc(sizeof(Module));
if (tmpModule == 0)
}
}
// Notify modules that the kernel has been decompressed and is about to be decoded
ret = ThinFatFile(&binary, &len);
if (ret == 0 && len == 0 && archCpuType==CPU_TYPE_X86_64)
{
archCpuType=CPU_TYPE_I386;
ret = ThinFatFile(&binary, &len);
}
// Notify modules that the kernel has been decompressed and thinned, is about to be decoded
execute_hook("DecodeKernel", (void*)binary, NULL, NULL, NULL);
ret = ThinFatFile(&binary, &len);
if (ret == 0 && len == 0 && archCpuType==CPU_TYPE_X86_64)
{
archCpuType=CPU_TYPE_I386;
ret = ThinFatFile(&binary, &len);
}
ret = DecodeMachO(binary, rentry, raddr, rsize);
if (ret<0 && archCpuType==CPU_TYPE_X86_64)
{
archCpuType=CPU_TYPE_I386;
ret = DecodeMachO(binary, rentry, raddr, rsize);
}
return ret;
ret = DecodeMachO(binary, rentry, raddr, rsize);
if (ret<0 && archCpuType==CPU_TYPE_X86_64)
{
archCpuType=CPU_TYPE_I386;
ret = DecodeMachO(binary, rentry, raddr, rsize);
}
return ret;
}
branches/azimutz/trunkAutoResolution/i386/boot2/mboot.c
1212
1313
1414
15
16
1517
1618
1719
......
414416
415417
416418
417
419
418420
419421
420422
423
424
425
426
427
428
429
430
431
432
433
421434
422435
423436
int multiboot_timeout_set=0;
int multiboot_partition=0;
int multiboot_partition_set=0;
int multiboot_skip_partition=0;
int multiboot_skip_partition_set=0;
// Global multiboot info, if using multiboot.
struct multiboot_info *gMI;
int intVal = strtol(val, &endptr, 0);
if(*val != '\0' && (*endptr == '\0' || *endptr == ' ' || *endptr == '\t'))
{
printf("Default partition overridden to %d with timeout=%s\n", intVal, val);
printf("Default partition overridden to %d with partno=%s\n", intVal, val);
multiboot_partition = intVal;
multiboot_partition_set = 1;
}
}
if(getValueForBootKey(mi->mi_cmdline, "skip_partno", &val, &size))
{
char *endptr;
int intVal = strtol(val, &endptr, 0);
if(*val != '\0' && (*endptr == '\0' || *endptr == ' ' || *endptr == '\t'))
{
printf("Skipping partition %d with skip_partno=%s\n", intVal, val);
multiboot_skip_partition = intVal;
multiboot_skip_partition_set = 1;
}
}
}
if(doSelectDevice)
branches/azimutz/trunkAutoResolution/i386/boot2/boot.c
9595
9696
9797
98
99
100
101
102
103
10498
10599
106100
......
156150
157151
158152
153
154
159155
160
161
156
157
162158
163
159
160
164161
165162
166163
......
168165
169166
170167
171
172
173
168
174169
175170
176171
......
186181
187182
188183
189
184
190185
191186
192187
......
296291
297292
298293
299
294
300295
301296
302297
......
331326
332327
333328
334
329
335330
336
331
337332
338333
339334
340335
341
336
342337
343338
344339
......
349344
350345
351346
352
347
353348
354349
355350
356351
357352
358
353
359354
360355
361356
362357
363
358
364359
365360
366361
......
387382
388383
389384
390
385
391386
392387
393388
......
465460
466461
467462
468
463
469464
470465
471466
......
525520
526521
527522
528
523
529524
530525
531526
532527
528
529
530
531
532
533
533534
535
536
534537
535538
536539
537
540
538541
539542
540543
541544
542545
543546
544
547
545548
546549
547550
......
553556
554557
555558
556
559
557560
558561
559562
......
577580
578581
579582
580
581
583
584
585
582586
583
587
588
589
590
591
592
584593
585594
586595
......
619628
620629
621630
622
631
623632
624633
625634
......
639648
640649
641650
642
643
644651
645
652
653
646654
647655
648656
657
649658
650659
651660
......
658667
659668
660669
661
670
662671
663672
664
673
665674
666675
667676
......
684693
685694
686695
687
696
688697
689698
690699
*/
#define kBootErrorTimeout 5
/*
* Default path to kernel cache file
*/
//Slice - first one for Leopard
#define kDefaultCachePathLeo "/System/Library/Caches/com.apple.kernelcaches/"
#define kDefaultCachePathSnow "/System/Library/Caches/com.apple.kext.caches/Startup/"
//==========================================================================
// Zero the BSS.
// Notify modules that the kernel has been decoded
execute_hook("DecodedKernel", (void*)binary, NULL, NULL, NULL);
setupFakeEfi();
// Load boot drivers from the specifed root path.
if (!gHaveKernelCache)
LoadDrivers("/");
//if (!gHaveKernelCache)
LoadDrivers("/");
execute_hook("DriversLoaded", (void*)binary, NULL, NULL, NULL);
clearActivityIndicator();
if (gErrors) {
printf("Pausing %d seconds...\n", kBootErrorTimeout);
sleep(kBootErrorTimeout);
}
setupFakeEfi();
md0Ramdisk();
verbose("Starting Darwin %s\n",( archCpuType == CPU_TYPE_I386 ) ? "x86" : "x86_64");
}
bool dummyVal;
if (getBoolForKey(kWaitForKeypressKey, &dummyVal, &bootInfo->bootConfig) && dummyVal) {
if (getBoolForKey(kWaitForKeypressKey, &dummyVal, &bootInfo->chameleonConfig) && dummyVal) {
printf("Press any key to continue...");
getchar();
}
bool firstRun = true;
bool instantMenu;
bool rescanPrompt;
unsigned int allowBVFlags = kBVFlagSystemVolume|kBVFlagForeignBoot;
unsigned int allowBVFlags = kBVFlagSystemVolume | kBVFlagForeignBoot;
unsigned int denyBVFlags = kBVFlagEFISystem;
// Set reminder to unload the PXE base code. Neglect to unload
setBootGlobals(bvChain);
// Load boot.plist config file
status = loadSystemConfig(&bootInfo->bootConfig);
status = loadChameleonConfig(&bootInfo->chameleonConfig);
if (getBoolForKey(kQuietBootKey, &quiet, &bootInfo->bootConfig) && quiet) {
if (getBoolForKey(kQuietBootKey, &quiet, &bootInfo->chameleonConfig) && quiet) {
gBootMode |= kBootModeQuiet;
}
// Override firstRun to get to the boot menu instantly by setting "Instant Menu"=y in system config
if (getBoolForKey(kInsantMenuKey, &instantMenu, &bootInfo->bootConfig) && instantMenu) {
if (getBoolForKey(kInsantMenuKey, &instantMenu, &bootInfo->chameleonConfig) && instantMenu) {
firstRun = false;
}
gEnableCDROMRescan = false;
// Enable it with Rescan=y in system config
if (getBoolForKey(kRescanKey, &gEnableCDROMRescan, &bootInfo->bootConfig) && gEnableCDROMRescan) {
if (getBoolForKey(kRescanKey, &gEnableCDROMRescan, &bootInfo->chameleonConfig) && gEnableCDROMRescan) {
gEnableCDROMRescan = true;
}
// Ask the user for Rescan option by setting "Rescan Prompt"=y in system config.
rescanPrompt = false;
if (getBoolForKey(kRescanPromptKey, &rescanPrompt , &bootInfo->bootConfig) && rescanPrompt && biosDevIsCDROM(gBIOSDev)) {
if (getBoolForKey(kRescanPromptKey, &rescanPrompt , &bootInfo->chameleonConfig) && rescanPrompt && biosDevIsCDROM(gBIOSDev)) {
gEnableCDROMRescan = promptForRescanOption();
}
// Enable touching a single BIOS device only if "Scan Single Drive"=y is set in system config.
if (getBoolForKey(kScanSingleDriveKey, &gScanSingleDrive, &bootInfo->bootConfig) && gScanSingleDrive) {
if (getBoolForKey(kScanSingleDriveKey, &gScanSingleDrive, &bootInfo->chameleonConfig) && gScanSingleDrive) {
gScanSingleDrive = true;
}
useGUI = true;
// Override useGUI default
getBoolForKey(kGUIKey, &useGUI, &bootInfo->bootConfig);
getBoolForKey(kGUIKey, &useGUI, &bootInfo->chameleonConfig);
//autoresolution - default to false
// http://forum.voodooprojects.org/index.php/topic,1227.0.html
bool tryresume;
bool tryresumedefault;
bool forceresume;
bool usecache;
bool usecache = false;//true;
// additional variable for testing alternate kernel image locations on boot helper partitions.
char bootFileSpec[512];
} else {
archCpuType = CPU_TYPE_I386;
}
if (getValueForKey(karch, &val, &len, &bootInfo->bootConfig)) {
if (getValueForKey(karch, &val, &len, &bootInfo->chameleonConfig)) {
if (strncmp(val, "i386", 4) == 0) {
archCpuType = CPU_TYPE_I386;
}
}
if (getValueForKey(kKernelArchKey, &val, &len, &bootInfo->chameleonConfig)) {
if (strncmp(val, "i386", 4) == 0) {
archCpuType = CPU_TYPE_I386;
}
}
//archCpuType = CPU_TYPE_I386;
// Notify moduals that we are attempting to boot
execute_hook("PreBoot", NULL, NULL, NULL, NULL);
if (!getBoolForKey (kWake, &tryresume, &bootInfo->bootConfig)) {
if (!getBoolForKey (kWake, &tryresume, &bootInfo->chameleonConfig)) {
tryresume = true;
tryresumedefault = true;
} else {
tryresumedefault = false;
}
if (!getBoolForKey (kForceWake, &forceresume, &bootInfo->bootConfig)) {
if (!getBoolForKey (kForceWake, &forceresume, &bootInfo->chameleonConfig)) {
forceresume = false;
}
while (tryresume) {
const char *tmp;
BVRef bvr;
if (!getValueForKey(kWakeImage, &val, &len, &bootInfo->bootConfig))
if (!getValueForKey(kWakeImage, &val, &len, &bootInfo->chameleonConfig))
val="/private/var/vm/sleepimage";
// Do this first to be sure that root volume is mounted
HibernateBoot((char *)val);
break;
}
if(getBoolForKey(kUseKernelCache, &usecache, &bootInfo->bootConfig) && usecache) {
getBoolForKey(kUseKernelCache, &usecache, &bootInfo->chameleonConfig);
if(usecache) {
if (getValueForKey(kKernelCacheKey, &val, &len, &bootInfo->bootConfig)) {
strlcpy(gBootKernelCacheFile, val, len+1);
if(val[0] == '\\')
{
len--;
val++;
}
strlcpy(gBootKernelCacheFile, val, len+1);
}
else {
//Lion
// Reset cache name.
bzero(gCacheNameAdler + 64, sizeof(gCacheNameAdler) - 64);
sprintf(gCacheNameAdler + 64, "%s,%s", gRootDevice, bootInfo->bootFile);
sprintf(gCacheNameAdler + 64, "%s,%s", gRootDevice, bootInfo->chameleonConfig);
adler32 = Adler32((unsigned char *)gCacheNameAdler, sizeof(gCacheNameAdler));
verbose("Loading Darwin %s\n", gMacOSVersion);
if (trycache) do {
// if we haven't found the kernel yet, don't use the cache
ret = GetFileInfo(NULL, bootInfo->bootFile, &flags, &kerneltime);
if ((ret != 0) || ((flags & kFileTypeMask) != kFileTypeFlat)) {
if(ret != 0) kerneltime = 0;
else if ((flags & kFileTypeMask) != kFileTypeFlat) {
trycache = 0;
break;
}
ret = GetFileInfo(NULL, gBootKernelCacheFile, &flags, &cachetime);
if ((ret != 0) || ((flags & kFileTypeMask) != kFileTypeFlat)
|| (cachetime < kerneltime)) {
trycache = 0;
break;
}
if (kerneltime > exttime) {
if (ret == 0 && kerneltime > exttime) {
exttime = kerneltime;
}
if (cachetime != (exttime + 1)) {
if (ret == 0 && cachetime != (exttime + 1)) {
trycache = 0;
break;
}
if (ret >= 0)
break;
verbose("Kernel cache did not loaded %s\n ", bootFile);
verbose("Kernel cache did not load %s\n ", bootFile);
}
bootFile = bootInfo->bootFile;
branches/azimutz/trunkAutoResolution/i386/boot2/boot.h
3030
3131
3232
33
34
35
3336
37
38
39
40
41
42
43
44
3445
3546
3647
......
3849
3950
4051
52
4153
4254
4355
#define __BOOT2_BOOT_H
#include "libsaio.h"
/*
* Paths used by chameleon
*/
//kernel cache
#define kDefaultCachePathLeo "/System/Library/Caches/com.apple.kernelcaches/"
#define kDefaultCachePathSnow "/System/Library/Caches/com.apple.kext.caches/Startup/"
// Lion installer
#define kLionInstallerDataFolder "/Mac OS X Install Data/"
#define kLionInstallerPlist kLionInstallerDataFolder "com.apple.Boot.plist"
/*
* Keys used in system Boot.plist
*/
#define kTextModeKey"Text Mode"
#define kQuietBootKey"Quiet Boot"
#define kKernelFlagsKey"Kernel Flags"
#define kKernelArchKey "Kernel Architecture"
#define karch"arch"/* boot.c */
#define kProductVersion"ProductVersion"/* boot.c */
#define kMKextCacheKey"MKext Cache"
branches/azimutz/trunkAutoResolution/i386/boot2/modules.c
177177
178178
179179
180
180
181181
182182
183183
......
210210
211211
212212
213
214
215213
216214
217215
......
223221
224222
225223
226
224
227225
228226
229227
......
457455
458456
459457
458
460459
461460
462461
......
477476
478477
479478
480
479
481480
482481
483482
if(module_start && module_start != (void*)0xFFFFFFFF)
{
// Notify the system that it was laoded
module_loaded(module, NULL, NULL, 0, 0 /*moduleName, moduleVersion, moduleCompat*/);
module_loaded(module, NULL, NULL, 0, 0 /*moduleName, NULL, moduleVersion, moduleCompat*/);
(*module_start)();// Start the module
DBG("Module %s Loaded.\n", module); DBGPAUSE();
}
*/
long long add_symbol(char* symbol, long long addr, char is64)
{
if(is64) return 0xFFFFFFFF; // Fixme
// This only can handle 32bit symbols
symbolList_t* entry;
//DBG("Adding symbol %s at 0x%X\n", symbol, addr);
entry->addr = (UInt32)addr;
entry->symbol = symbol;
if(strcmp(symbol, "start") == 0)
if(!is64 && strcmp(symbol, "start") == 0)
{
return addr;
}
case LC_LOAD_DYLIB:
case LC_LOAD_WEAK_DYLIB ^ LC_REQ_DYLD:
// Required modules
dylibCommand = binary + binaryIndex;
char* module = binary + binaryIndex + ((UInt32)*((UInt32*)&dylibCommand->dylib.name));
// Possible enhancments: verify version
break;
case LC_ID_DYLIB:
dylibCommand = binary + binaryIndex;
//dylibCommand = binary + binaryIndex;
/*moduleName =binary + binaryIndex + ((UInt32)*((UInt32*)&dylibCommand->dylib.name));
moduleVersion =dylibCommand->dylib.current_version;
moduleCompat =dylibCommand->dylib.compatibility_version;
branches/azimutz/trunkAutoResolution/i386/boot2/gui.c
679679
680680
681681
682
682
683683
684684
685685
......
882882
883883
884884
885
885
886886
887887
888888
......
18331833
18341834
18351835
1836
1836
18371837
18381838
18391839
......
18871887
18881888
18891889
1890
1890
18911891
18921892
18931893
intlen;
chardirspec[256];
getValueForKey( "Theme", &theme_name, &len, &bootInfo->bootConfig );
getValueForKey( "Theme", &theme_name, &len, &bootInfo->chameleonConfig );
if ((strlen(theme_name) + 27) > sizeof(dirspec)) {
return 1;
}
drawInfoMenuItems();
//Azi: make this info more accessible.
getBoolForKey(kShowInfoKey, &shoWinfo, &bootInfo->bootConfig);
getBoolForKey(kShowInfoKey, &shoWinfo, &bootInfo->chameleonConfig);
if (shoWinfo && showBootBanner) // no boot banner, no showinfo.
{
bool legacy_logo;
uint16_t x, y;
if (getBoolForKey("Legacy Logo", &legacy_logo, &bootInfo->bootConfig) && legacy_logo) {
if (getBoolForKey("Legacy Logo", &legacy_logo, &bootInfo->chameleonConfig) && legacy_logo) {
usePngImage = false;
} else if (bootImageData == NULL) {
loadBootGraphics();
setVideoMode(GRAPHICS_MODE, 0);
}
if (getValueForKey("-checkers", &dummyVal, &length, &bootInfo->bootConfig)) {
if (getValueForKey("-checkers", &dummyVal, &length, &bootInfo->chameleonConfig)) {
drawCheckerBoard();
} else {
// Fill the background to 75% grey (same as BootX).
branches/azimutz/trunkAutoResolution/i386/boot2/ramdisk.c
2626
2727
2828
29
29
3030
3131
3232
int len;
if(getValueForKey(kMD0Image, &override_filename, &len,
&bootInfo->bootConfig))
&bootInfo->chameleonConfig))
{
// Use user specified md0 file
sprintf(filename, "%s", override_filename);
branches/azimutz/trunkAutoResolution/i386/boot2/options.c
712712
713713
714714
715
715
716716
717717
718718
......
780780
781781
782782
783
783
784784
785785
786786
......
791791
792792
793793
794
794
795795
796796
797797
......
878878
879879
880880
881
881
882882
883883
884884
......
12161216
12171217
12181218
1219
1219
12201220
12211221
12221222
......
12851285
12861286
12871287
1288
12891288
1290
1289
1290
12911291
12921292
12931293
......
13421342
13431343
13441344
1345
1345
13461346
13471347
13481348
13491349
13501350
1351
13511352
13521353
13531354
13541355
1355
1356
13561357
13571358
13581359
......
14121413
14131414
14141415
1415
1416
1416
1417
14171418
1418
1419
14191420
14201421
1421
1422
14221423
14231424
14241425
// Allow user to override default timeout.
if (multiboot_timeout_set) {
timeout = multiboot_timeout;
} else if (!getIntForKey(kTimeoutKey, &timeout, &bootInfo->bootConfig)) {
} else if (!getIntForKey(kTimeoutKey, &timeout, &bootInfo->chameleonConfig)) {
/* If there is no timeout key in the file use the default timeout
which is different for CDs vs. hard disks. However, if not booting
a CD and no config file could be loaded set the timeout
int cnt;
int optionKey;
if (getValueForKey(kCDROMPromptKey, &val, &cnt, &bootInfo->bootConfig)) {
if (getValueForKey(kCDROMPromptKey, &val, &cnt, &bootInfo->chameleonConfig)) {
prompt = malloc(cnt + 1);
strncat(prompt, val, cnt);
} else {
free(name);
}
if (getIntForKey( kCDROMOptionKey, &optionKey, &bootInfo->bootConfig )) {
if (getIntForKey( kCDROMOptionKey, &optionKey, &bootInfo->chameleonConfig )) {
// The key specified is a special key.
} else {
// Default to F8.
if (!(gBootMode & kBootModeQuiet)) {
// Check if "Boot Banner"=N switch is present in config file.
getBoolForKey(kBootBannerKey, &showBootBanner, &bootInfo->bootConfig);
getBoolForKey(kBootBannerKey, &showBootBanner, &bootInfo->chameleonConfig);
if (showBootBanner) {
// Display banner and show hardware info.
gprintf(&gui.screen, bootBanner + 1, (bootInfo->convmem + bootInfo->extmem) / 1024);
} else if (getValueForBootKey(kernelFlags, argName, &val, &cnt)) {
// Don't copy; these values will be copied at the end of argument processing.
found = true;
} else if (getValueForKey(argName, &val, &cnt, &bootInfo->bootConfig)) {
} else if (getValueForKey(argName, &val, &cnt, &bootInfo->chameleonConfig)) {
copyArgument(argName, val, cnt, argP, cntRemainingP);
found = true;
}
// Load com.apple.Boot.plist from the selected volume
// and use its contents to override default bootConfig.
// This is not a mandatory opeartion anymore.
loadOverrideConfig(&bootInfo->overrideConfig);
loadSystemConfig(&bootInfo->bootConfig);
loadChameleonConfig(&bootInfo->chameleonConfig);
// Use the kernel name specified by the user, or fetch the name
// in the config table, or use the default if not specified.
uuidSet = true;
}
}
if (!uuidSet && gBootVolume->fs_getuuid && gBootVolume->fs_getuuid (gBootVolume, uuidStr) == 0) {
verbose("Setting boot-uuid to: %s\n", uuidStr);
copyArgument(kBootUUIDKey, uuidStr, strlen(uuidStr), &argP, &cntRemaining);
uuidSet = true;
}
}
if (!processBootArgument(kRootDeviceKey, cp, configKernelFlags, bootInfo->config, &argP, &cntRemaining, gRootDevice)) {
cnt = 0;
if ( getValueForKey( kBootDeviceKey, &val, &cnt, &bootInfo->bootConfig)) {
if ( getValueForKey( kBootDeviceKey, &val, &cnt, &bootInfo->chameleonConfig)) {
valueBuffer[0] = '*';
cnt++;
strlcpy(valueBuffer + 1, val, cnt);
if(!shouldboot)
{
gVerboseMode = getValueForKey( kVerboseModeFlag, &val, &cnt, &bootInfo->bootConfig ) ||
getValueForKey( kSingleUserModeFlag, &val, &cnt, &bootInfo->bootConfig );
gVerboseMode = getValueForKey( kVerboseModeFlag, &val, &cnt, &bootInfo->chameleonConfig ) ||
getValueForKey( kSingleUserModeFlag, &val, &cnt, &bootInfo->chameleonConfig );
gBootMode = ( getValueForKey( kSafeModeFlag, &val, &cnt, &bootInfo->bootConfig ) ) ?
gBootMode = ( getValueForKey( kSafeModeFlag, &val, &cnt, &bootInfo->chameleonConfig ) ) ?
kBootModeSafe : kBootModeNormal;
if ( getValueForKey( kIgnoreCachesFlag, &val, &cnt, &bootInfo->bootConfig ) ) {
if ( getValueForKey( kIgnoreCachesFlag, &val, &cnt, &bootInfo->chameleonConfig ) ) {
gBootMode = kBootModeSafe;
}
}
branches/azimutz/trunkAutoResolution/i386/libsa/zalloc.c
6060
6161
6262
63
63
6464
6565
6666
size_t zalloced_size;
#endif
#define ZALLOC_NODES16384
#define ZALLOC_NODES32767 /* was 16384 */
static void malloc_error(char *addr, size_t size, const char *file, int line)
{
branches/azimutz/trunkAutoResolution/BLOCKERS
1
2
3
4
5
6
7
8
9
10
11
Memory Allocation Error on boot1 loading /boot: http://forge.voodooprojects.org/p/chameleon/issues/101/
Nvidia GT 540M && 310M : can't find rom to patch : http://forge.voodooprojects.org/p/chameleon/issues/99/
** This is also http://forge.voodooprojects.org/p/chameleon/issues/48/
** GT 440 --> http://forge.voodooprojects.org/p/chameleon/issues/98/
Extra Kext Loading dependency error: http://forge.voodooprojects.org/p/chameleon/issues/94/
AMD reported issues in cpu.c http://forge.voodooprojects.org/p/chameleon/issues/92/
Make Package: http://forge.voodooprojects.org/p/chameleon/issues/82/
SMBus : http://forge.voodooprojects.org/p/chameleon/issues/10/
=== Done ===
Multi Booting: http://forge.voodooprojects.org/p/chameleon/issues/62/
branches/azimutz/trunkAutoResolution/TODO
11
22
3
4
35
46
5
6
7
87
98
109
......
2120
2221
2322
23
24
25
2426
2527
2628
......
5052
5153
5254
53
55
5456
5557
5658
TODO List for Chameleon Boot Loader
====================================
- Fix boot prompt parsing.
- Bring code closer to coding_standards.txt.
- Create a dummy module for any modules that are compiled in. This is needed for linking modules with
dependencies that are not compiled in.
- Fix the module system when booting chameleon with multiboot. Cleanup the xcode 4 fix.
- Integrate Prasys current work on options and quick shortcut modified version of 18seven
DONE
- Create a dummy module for any modules that are compiled in. This is needed for linking modules with
dependencies that are not compiled in.
- Add a more sophisticated acpi loading mechanism to enable loading custom acpi tables when dsdtdrop=y
Here's a specification to think about:
First we must care about if a forced DSDT full path has been specified
The preferred internal behavior of the log info ioreg buffer
would be to store the messages in a consolidated buffer then only write once,
this buffer (i.e just before call the kernel) with flushLogToIOREG();
this buffer (i.e just before call the kernel) with flushLogToIOREG();
The other public function for writing chameleon boot info data would be:
verbose() should incorporate a call to logMessageToIOREG()
branches/azimutz/trunkAutoResolution/doc/User_Guide_src/Chameleon 2 v0.5.docx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
76176
77177
78178
79179
80180
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
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
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
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
713181
714182
715183
716184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
=
@@ -959,1255 +1179,6 @@
"}2
@@ -3266,6 +2237,1035 @@
"}2
branches/azimutz/trunkAutoResolution/doc/BootHelp.txt
4141
4242
4343
44
44
4545
4646
4747
Additional useful command-line options:
config=<file> Use an alternate Boot.plist file.
Options useful in the com.apple.Boot.plist file:
Options useful in the org.chameleon.Boot.plist file:
Wait=Yes|No Prompt for a key press before starting the kernel.
"Quiet Boot"=Yes|No Use quiet boot mode (no messages or prompt).
Timeout=8 Number of seconds to pause at the boot: prompt.
branches/azimutz/trunkAutoResolution/doc/README
1313
1414
1515
16
16
1717
1818
1919
Features
--------
- Device Property Injection via device-properties string in com.apple.Boot.plist
- Device Property Injection via device-properties string in org.chameleon.Boot.plist
- hybrid boot0+boot1h loaders for both MBR and GPT partitioned disks.
- automatic FSB detection code even for recent AMD CPUs.
- Apple Software RAID support.
branches/azimutz/trunkAutoResolution/CHANGES
1
12
23
34
- Renamed com.apple.Boot.plist to org.chameleon.Boot.plist.
- Added "ShowInfo" key (enabled by default for now), which enables/disables the display of
partition and resolution related info, on the Gui.
This info may not play well with some custom themes.

Archive Download the corresponding diff file

Revision: 1147