Chameleon

Chameleon Commit Details

Date:2014-10-16 17:06:33 (6 years 1 month ago)
Author:MacMan
Commit:2403
Parents: 2402
Message:Merged trunk r2400 LZVN decompression routine by MinusZwei "C Conversion" based on works from Pike R. Alpha and AnV Software (Andy Vandijck) and Yosemite diif by viv xix. Includes additional fixes for Yosemite.
Changes:
M/branches/Chimera/i386/libsaio/bootstruct.c
M/branches/Chimera/Make.rules
M/branches/Chimera/i386/boot2/boot.h
M/branches/Chimera/i386/boot1/boot1h.s
M/branches/Chimera/i386/libsaio/stringTable.c
M/branches/Chimera/i386/libsaio/hfs.c
M/branches/Chimera/i386/boot2/drivers.c
M/branches/Chimera/i386/libsaio/saio_types.h
M/branches/Chimera/i386/boot2/prompt.c
M/branches/Chimera/i386/boot2/gui.c
M/branches/Chimera/i386/libsaio/smbios_getters.c
M/branches/Chimera/i386/libsaio/fake_efi.c
M/branches/Chimera/i386/libsaio/disk.c
M/branches/Chimera/i386/libsaio/spd.h
M/branches/Chimera/i386/libsaio/smbios.c
M/branches/Chimera/i386/libsaio/saio_internal.h
M/branches/Chimera/i386/libsaio/hda.c
M/branches/Chimera/i386/boot2/lzss.c
M/branches/Chimera/i386/boot2/options.c
M/branches/Chimera/i386/boot2/Makefile
M/branches/Chimera/i386/libsaio/hda.h
M/branches/Chimera/i386/libsaio/console.c
M/branches/Chimera/i386/boot2/boot.c

File differences

branches/Chimera/i386/libsaio/console.c
9191
9292
9393
94
94
95
9596
9697
9798
......
246247
247248
248249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
249269
250270
251271
msgbuf = malloc(BOOTER_LOG_SIZE);
bzero(msgbuf, BOOTER_LOG_SIZE);
cursor = msgbuf;
msglog("%s\n", "Chimera 3.0.1 Branch of " "Chameleon " I386BOOT_CHAMELEONVERSION " (svn-r" I386BOOT_CHAMELEONREVISION ")" " [" I386BOOT_BUILDDATE "]");
//msglog("%s\n", "Chimera 4.0.0 Branch of " "Chameleon " I386BOOT_CHAMELEONVERSION " (svn-r" I386BOOT_CHAMELEONREVISION ")" " [" I386BOOT_BUILDDATE "]");
msglog("%s\n", "Chimera 4.0.0 Branch of Chameleon" " [" I386BOOT_BUILDDATE "]");
}
void msglog(const char * fmt, ...)
} else {
vprf(fmt, ap);
}
{
// Kabyl: BooterLog
struct putc_info pi;
if (!msgbuf) {
return 0;
}
if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE))) {
return 0;
}
pi.str = cursor;
pi.last_str = 0;
prf(fmt, ap, sputc, &pi);
cursor += strlen((char *)cursor);
}
va_end(ap);
return(0);
}
branches/Chimera/i386/libsaio/bootstruct.c
2727
2828
2929
30
3031
3132
3233
......
109110
110111
111112
112
113
114
113
114
115115
116116
117117
*/
#include "libsaio.h"
#include "boot.h"
#include "bootstruct.h"
/*==========================================================================
void
reserveKernBootStruct(void)
{
if ((gMacOSVersion[0] == '1') && (gMacOSVersion[1] == '0')
&& (gMacOSVersion[2] == '.') && (gMacOSVersion[3] == '7' || gMacOSVersion[3] == '8' || gMacOSVersion[3] == '9'))
{
if ((checkOSVersion("10.7")) || (checkOSVersion("10.8")) || (checkOSVersion("10.9")) || (checkOSVersion("10.10")))
{
void *oldAddr = bootArgs;
bootArgs = (boot_args *)AllocateKernelMemory(sizeof(boot_args));
bcopy(oldAddr, bootArgs, sizeof(boot_args));
branches/Chimera/i386/libsaio/hfs.c
304304
305305
306306
307
307
308308
309309
310310
......
370370
371371
372372
373
373
374374
375375
376376
......
435435
436436
437437
438
438
439439
440440
441441
}
dirID = kHFSRootFolderID;
// Skip a lead '\'. Start in the system folder if there are two.
// Skip a lead '/'. Start in the system folder if there are two.
if (filePath[0] == '/')
{
if (filePath[1] == '/')
if (*dirIndex == -1) return -1;
dirID = kHFSRootFolderID;
// Skip a lead '\'. Start in the system folder if there are two.
// Skip a lead '/'. Start in the system folder if there are two.
if (dirPath[0] == '/') {
if (dirPath[1] == '/') {
if (gIsHFSPlus) dirID = SWAP_BE32(((long *)gHFSPlus->finderInfo)[5]);
if (HFSInitPartition(ih) == -1) return -1;
dirID = kHFSRootFolderID;
// Skip a lead '\'. Start in the system folder if there are two.
// Skip a lead '/'. Start in the system folder if there are two.
if (filePath[0] == '/') {
if (filePath[1] == '/') {
if (gIsHFSPlus) dirID = SWAP_BE32(((long *)gHFSPlus->finderInfo)[5]);
branches/Chimera/i386/libsaio/spd.h
118118
119119
120120
121
122
121123
122124
123125
#define SPD_MEMORY_TYPE_SGRAM_DDR6
#define SPD_MEMORY_TYPE_SDRAM_DDR7
#define SPD_MEMORY_TYPE_SDRAM_DDR28
#define SPD_MEMORY_TYPE_SDRAM_FB_DDR2 9
#define SPD_MEMORY_TYPE_SDRAM_FBP_DDR2 0xa
#define SPD_MEMORY_TYPE_SDRAM_DDR30xb
/* SPD_MODULE_VOLTAGE values. */
branches/Chimera/i386/libsaio/hda.c
9292
9393
9494
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
114116
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
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
152154
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
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
179181
180
182
181183
182
184
183185
184
186
185187
186
188
187189
188
189
190
191
192
193
190
191
192
193
194
195
194196
195197
196198
......
581583
582584
583585
586
584587
585588
586589
......
595598
596599
597600
601
598602
599603
600604
......
614618
615619
616620
617
618
619
621
622
623
624
625
626
627
620628
621629
622630
static hda_controller_devices know_hda_controller[] = {
//8086 Intel Corporation
{ HDA_INTEL_HASWELL, "Haswell" },
{ HDA_INTEL_CRYSTAL, "Crystal Well" },
{ HDA_INTEL_CPT, "6 Series/C200 Series Chipset Family" },
{ HDA_INTEL_PATSBURG,"C600/X79 series chipset" },
{ HDA_INTEL_PPT1, "7 Series/C210 Series Chipset Family" },
{ HDA_INTEL_82801F, "82801FB/FBM/FR/FW/FRW (ICH6 Family)" },
{ HDA_INTEL_63XXESB, "631x/631xESB/632xESB" },
{ HDA_INTEL_82801G, "NM10/ICH7 Family" },
{ HDA_INTEL_82801H, "82801H (ICH8 Family)" },
{ HDA_INTEL_82801I, "82801I (ICH9 Family)" },
{ HDA_INTEL_82801JI, "82801JI (ICH10 Family)" },
{ HDA_INTEL_82801JD, "82801JD/DO (ICH10 Family) " },
{ HDA_INTEL_PCH, "5 Series/3400 Series" },
{ HDA_INTEL_PCH2, "5 Series/3400 Series" },
{ HDA_INTEL_SCH, "System Controller Hub (SCH Poulsbo)" },
{ HDA_INTEL_LPT1, "Lynx Point" },
{ HDA_INTEL_LPT2, "Lynx Point" },
{ HDA_INTEL_LYNX, "Lynx Point-LP" },
{ HDA_INTEL_LYNX2, "Lynx Point-LP" },
{ HDA_INTEL_HASWELL, "Haswell-ULT" },
{ HDA_INTEL_HASWELL2, "Haswell" },
{ HDA_INTEL_CRYSTAL, "Crystal Well" },
{ HDA_INTEL_CPT, "6 Series/C200 Series Chipset Family" },
{ HDA_INTEL_PATSBURG, "C600/X79 series chipset" },
{ HDA_INTEL_PPT1, "7 Series/C210 Series Chipset Family" },
{ HDA_INTEL_82801F, "82801FB/FBM/FR/FW/FRW (ICH6 Family)" },
{ HDA_INTEL_63XXESB, "631x/631xESB/632xESB" },
{ HDA_INTEL_82801G, "NM10/ICH7 Family" },
{ HDA_INTEL_82801H, "82801H (ICH8 Family)" },
{ HDA_INTEL_82801I, "82801I (ICH9 Family)" },
{ HDA_INTEL_82801JI, "82801JI (ICH10 Family)" },
{ HDA_INTEL_82801JD, "82801JD/DO (ICH10 Family) " },
{ HDA_INTEL_PCH, "5 Series/3400 Series" },
{ HDA_INTEL_PCH2, "5 Series/3400 Series" },
{ HDA_INTEL_SCH, "System Controller Hub (SCH Poulsbo)" },
{ HDA_INTEL_SCH2, "9 Series" },
{ HDA_INTEL_LPT1, "Lynx Point" },
{ HDA_INTEL_LPT2, "Lynx Point" },
{ HDA_INTEL_LYNX, "Lynx Point-LP" },
{ HDA_INTEL_LYNX2, "Lynx Point-LP" },
//10de NVIDIA Corporation
{ HDA_NVIDIA_MCP51, "MCP51" },
{ HDA_NVIDIA_MCP55, "MCP55" },
{ HDA_NVIDIA_MCP61_1, "MCP61" },
{ HDA_NVIDIA_MCP61_2, "MCP61" },
{ HDA_NVIDIA_MCP65_1, "MCP65" },
{ HDA_NVIDIA_MCP65_2, "MCP65" },
{ HDA_NVIDIA_MCP67_1, "MCP67" },
{ HDA_NVIDIA_MCP67_2, "MCP67" },
{ HDA_NVIDIA_MCP73_1, "MCP73" },
{ HDA_NVIDIA_MCP73_2, "MCP73" },
{ HDA_NVIDIA_MCP78_1, "MCP78" },
{ HDA_NVIDIA_MCP78_2, "MCP78" },
{ HDA_NVIDIA_MCP78_3, "MCP78" },
{ HDA_NVIDIA_MCP78_4, "MCP78" },
{ HDA_NVIDIA_MCP79_1, "MCP79" },
{ HDA_NVIDIA_MCP79_2, "MCP79" },
{ HDA_NVIDIA_MCP79_3, "MCP79" },
{ HDA_NVIDIA_MCP79_4, "MCP79" },
{ HDA_NVIDIA_MCP89_1, "MCP89" },
{ HDA_NVIDIA_MCP89_2, "MCP89" },
{ HDA_NVIDIA_MCP89_3, "MCP89" },
{ HDA_NVIDIA_MCP89_4, "MCP89" },
{ HDA_NVIDIA_0BE2, "(0x0be2)" },
{ HDA_NVIDIA_0BE3, "(0x0be3)" },
{ HDA_NVIDIA_0BE4, "(0x0be4)" },
{ HDA_NVIDIA_GT100, "GT100" },
{ HDA_NVIDIA_GT104, "GT104" },
{ HDA_NVIDIA_GT106, "GT106" },
{ HDA_NVIDIA_GT108, "GT108" },
{ HDA_NVIDIA_GT116, "GT116" },
{ HDA_NVIDIA_GF119, "GF119" },
{ HDA_NVIDIA_GF110, "GF110" },
{ HDA_NVIDIA_GF114, "GF114" }, // HDMi
{ HDA_NVIDIA_GK110, "GK110" },
{ HDA_NVIDIA_GK106, "GK106" },
{ HDA_NVIDIA_GK107, "GK107" },
{ HDA_NVIDIA_GK104, "GK104" },
{ HDA_NVIDIA_MCP51, "MCP51" },
{ HDA_NVIDIA_MCP55, "MCP55" },
{ HDA_NVIDIA_MCP61_1, "MCP61" },
{ HDA_NVIDIA_MCP61_2, "MCP61" },
{ HDA_NVIDIA_MCP65_1, "MCP65" },
{ HDA_NVIDIA_MCP65_2, "MCP65" },
{ HDA_NVIDIA_MCP67_1, "MCP67" },
{ HDA_NVIDIA_MCP67_2, "MCP67" },
{ HDA_NVIDIA_MCP73_1, "MCP73" },
{ HDA_NVIDIA_MCP73_2, "MCP73" },
{ HDA_NVIDIA_MCP78_1, "MCP78" },
{ HDA_NVIDIA_MCP78_2, "MCP78" },
{ HDA_NVIDIA_MCP78_3, "MCP78" },
{ HDA_NVIDIA_MCP78_4, "MCP78" },
{ HDA_NVIDIA_MCP79_1, "MCP79" },
{ HDA_NVIDIA_MCP79_2, "MCP79" },
{ HDA_NVIDIA_MCP79_3, "MCP79" },
{ HDA_NVIDIA_MCP79_4, "MCP79" },
{ HDA_NVIDIA_MCP89_1, "MCP89" },
{ HDA_NVIDIA_MCP89_2, "MCP89" },
{ HDA_NVIDIA_MCP89_3, "MCP89" },
{ HDA_NVIDIA_MCP89_4, "MCP89" },
{ HDA_NVIDIA_0BE2, "(0x0be2)" },
{ HDA_NVIDIA_0BE3, "(0x0be3)" },
{ HDA_NVIDIA_0BE4, "(0x0be4)" },
{ HDA_NVIDIA_GT100, "GT100" },
{ HDA_NVIDIA_GT104, "GT104" },
{ HDA_NVIDIA_GT106, "GT106" },
{ HDA_NVIDIA_GT108, "GT108" },
{ HDA_NVIDIA_GT116, "GT116" },
{ HDA_NVIDIA_GF119, "GF119" },
{ HDA_NVIDIA_GF110, "GF110" },
{ HDA_NVIDIA_GF114, "GF114" }, // HDMi
{ HDA_NVIDIA_GK110, "GK110" },
{ HDA_NVIDIA_GK106, "GK106" },
{ HDA_NVIDIA_GK107, "GK107" },
{ HDA_NVIDIA_GK104, "GK104" },
//1002 Advanced Micro Devices [AMD] nee ATI Technologies Inc
{ HDA_ATI_SB450, "IXP SB4x0" },
{ HDA_ATI_SB600, "SB600" },
{ HDA_ATI_RS600, "RS600" },
{ HDA_ATI_RS690, "RS690" },
{ HDA_ATI_RS780, "RS780" },
{ HDA_ATI_RS880, "RS880" },
{ HDA_ATI_TRINITY, "Trinity" },
{ HDA_ATI_R600, "R600" },
{ HDA_ATI_RV610, "RV610" },
{ HDA_ATI_RV620, "RV620" },
{ HDA_ATI_RV630, "RV630" },
{ HDA_ATI_RV635, "RV635" },
{ HDA_ATI_RV710, "RV710" },
{ HDA_ATI_RV730, "RV730" },
{ HDA_ATI_RV740, "RV740" },
{ HDA_ATI_RV770, "RV770" },
{ HDA_ATI_RV810, "RV810" },
{ HDA_ATI_RV830, "RV830" },
{ HDA_ATI_RV840, "RV840" },
{ HDA_ATI_RV870, "RV870" },
{ HDA_ATI_RV910, "Caicos" },
{ HDA_ATI_RV930, "RV930" },
{ HDA_ATI_RV940, "RV940" },
{ HDA_ATI_RV970, "RV970" },
{ HDA_ATI_R1000, "Tahiti XT" }, // HDMi
{ HDA_ATI_VERDE, "Cape Verde" }, // HDMi
{ HDA_ATI_SB450, "IXP SB4x0" },
{ HDA_ATI_SB600, "SB600" },
{ HDA_ATI_RS600, "RS600" },
{ HDA_ATI_RS690, "RS690" },
{ HDA_ATI_RS780, "RS780" },
{ HDA_ATI_RS880, "RS880" },
{ HDA_ATI_TRINITY, "Trinity" },
{ HDA_ATI_R600, "R600" },
{ HDA_ATI_RV610, "RV610" },
{ HDA_ATI_RV620, "RV620" },
{ HDA_ATI_RV630, "RV630" },
{ HDA_ATI_RV635, "RV635" },
{ HDA_ATI_RV710, "RV710" },
{ HDA_ATI_RV730, "RV730" },
{ HDA_ATI_RV740, "RV740" },
{ HDA_ATI_RV770, "RV770" },
{ HDA_ATI_RV810, "RV810" },
{ HDA_ATI_RV830, "RV830" },
{ HDA_ATI_RV840, "RV840" },
{ HDA_ATI_RV870, "RV870" },
{ HDA_ATI_RV910, "Caicos" },
{ HDA_ATI_RV930, "RV930" },
{ HDA_ATI_RV940, "RV940" },
{ HDA_ATI_RV970, "RV970" },
{ HDA_ATI_R1000, "Tahiti XT" }, // HDMi
{ HDA_ATI_VERDE, "Cape Verde" }, // HDMi
//17f3 RDC Semiconductor, Inc.
{ HDA_RDC_M3010, "M3010" },
{ HDA_RDC_M3010, "M3010" },
//1106 VIA Technologies, Inc.
{ HDA_VIA_VT82XX, "VT8251/8237A" },
{ HDA_VIA_VT82XX, "VT8251/8237A" },
//1039 Silicon Integrated Systems [SiS]
{ HDA_SIS_966, "966" },
{ HDA_SIS_966, "966" },
//10b9 ULi Electronics Inc.(Split off ALi Corporation in 2003)
{ HDA_ULI_M5461, "M5461" },
{ HDA_ULI_M5461, "M5461" },
/* Unknown */
{ HDA_INTEL_ALL, "Unknown Intel device" },
{ HDA_NVIDIA_ALL, "Unknown NVIDIA device" },
{ HDA_ATI_ALL, "Unknown ATI device" },
{ HDA_VIA_ALL, "Unknown VIA device" },
{ HDA_SIS_ALL, "Unknown SiS device" },
{ HDA_ULI_ALL, "Unknown ULI device" },
{ HDA_INTEL_ALL, "Unknown Intel device" },
{ HDA_NVIDIA_ALL, "Unknown NVIDIA device" },
{ HDA_ATI_ALL, "Unknown ATI device" },
{ HDA_VIA_ALL, "Unknown VIA device" },
{ HDA_SIS_ALL, "Unknown SiS device" },
{ HDA_ULI_ALL, "Unknown ULI device" },
};
#define HDAC_DEVICES_LEN (sizeof(know_hda_controller) / sizeof(know_hda_controller[0]))
* The above case are intended as for HDEF device at address 0x001B0000
***********************************************************************/
case HDA_INTEL_HASWELL:
case HDA_INTEL_HASWELL2:
case HDA_INTEL_CRYSTAL:
case HDA_INTEL_CPT:
case HDA_INTEL_PATSBURG:
case HDA_INTEL_PCH:
case HDA_INTEL_PCH2:
case HDA_INTEL_SCH:
case HDA_INTEL_SCH2:
case HDA_INTEL_LPT1:
case HDA_INTEL_LPT2:
case HDA_INTEL_LYNX:
verbose("Using default HDEF layout-id: 0x%02x, 0x%02x, 0x%02x, 0x%02x\n",
default_HDEF_layout_id[0], default_HDEF_layout_id[1], default_HDEF_layout_id[2], default_HDEF_layout_id[3]);
}
devprop_add_value(device, "layout-id", default_HDEF_layout_id, HDEF_LEN);
devprop_add_value(device, "built-in", &BuiltIn, 1);
devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10);
devprop_add_value(device, "layout-id", default_HDEF_layout_id, HDEF_LEN);
devprop_add_value(device, "AAPL,slot-name", (uint8_t *)"Built-in", 9); // 0x09
devprop_add_value(device, "name", (uint8_t *)"audio", 6); // 0x06
devprop_add_value(device, "device_type", (uint8_t *)"High Definition Audio", 22); // 0x16
devprop_add_value(device, "built-in", &BuiltIn, 1);
devprop_add_value(device, "hda-gfx", (uint8_t *)"onboard-1", 10); // 0x0a
// "AFGLowPowerState" = <03000000>
break;
/****************************************************************************************************************
branches/Chimera/i386/libsaio/hda.h
9090
9191
9292
93
93
94
9495
9596
9697
......
105106
106107
107108
109
108110
109111
110112
/* Intel */
#define INTEL_VENDORID0x8086
#define HDA_INTEL_HASWELLHDA_MODEL_CONSTRUCT(INTEL, 0x0c0c)
#define HDA_INTEL_HASWELLHDA_MODEL_CONSTRUCT(INTEL, 0x0a0c)
#define HDA_INTEL_HASWELL2HDA_MODEL_CONSTRUCT(INTEL, 0x0c0c)
#define HDA_INTEL_CRYSTALHDA_MODEL_CONSTRUCT(INTEL, 0x0d0c)
#define HDA_INTEL_CPTHDA_MODEL_CONSTRUCT(INTEL, 0x1c20)
#define HDA_INTEL_PATSBURGHDA_MODEL_CONSTRUCT(INTEL, 0x1d20)
#define HDA_INTEL_PCHHDA_MODEL_CONSTRUCT(INTEL, 0x3b56)
#define HDA_INTEL_PCH2HDA_MODEL_CONSTRUCT(INTEL, 0x3b57)
#define HDA_INTEL_SCHHDA_MODEL_CONSTRUCT(INTEL, 0x811b)
#define HDA_INTEL_SCH2HDA_MODEL_CONSTRUCT(INTEL, 0x8ca0)
#define HDA_INTEL_LPT1HDA_MODEL_CONSTRUCT(INTEL, 0x8d20)
#define HDA_INTEL_LPT2HDA_MODEL_CONSTRUCT(INTEL, 0x8d21)
#define HDA_INTEL_LYNX HDA_MODEL_CONSTRUCT(INTEL, 0x9c20)
branches/Chimera/i386/libsaio/disk.c
15761576
15771577
15781578
1579
1579
1580
15801581
15811582
15821583
// getValueForKey uses const char for val
// so copy it and trim
*str = '\0';
strncat(str, val, MIN(len, 4));
//strncat(str, val, MIN(len, 4)); // removed since it breaks any OS X version greater than 10.9 i.e. Yosemite 10.10
strncat(str, val, len); // just copy the whole version number instead
} else {
valid = false;
}
branches/Chimera/i386/libsaio/smbios.c
694694
695695
696696
697
697698
698699
699700
case CPU_MODEL_WESTMERE_EX:// Intel Xeon E7
case CPU_MODEL_JAKETOWN:// Intel Core i7, Xeon E5 LGA2011 (32nm)
case CPU_MODEL_IVYBRIDGE_XEON: // Intel Core i7, Xeon E5 v2 LGA2011 (22nm) MacMan moved to proper location
case CPU_MODEL_HASWELL_SVR: // Intel Core i7, Xeon E5 v3 LGA2011v3 (22nm)
defaultBIOSInfo.version= kDefaultMacProWestmereBIOSVersion;
defaultBIOSInfo.releaseDate= kDefaultMacProWestmereBIOSReleaseDate;
defaultSystemInfo.productName= kDefaultMacProWestmere;
branches/Chimera/i386/libsaio/stringTable.c
6060
6161
6262
63
63
6464
6565
6666
......
647647
648648
649649
650
650
651651
652652
653
654653
655
656
657
658654
659
660655
661656
662
657
663658
664659
665
666
667
668
669
670
671
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
672676
673
674
675
676
677
678
679
680
681
682677
683678
684
679
685680
686681
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
713
687714
688715
689716
break;
}
} else if (c == '\"') {
/* Premature end of key */
// Premature end of key
return 1;
}
if (c != *str++) {
* Returns 0 - successful.
* -1 - unsuccesful.
*/
int loadChameleonConfig(config_file_t *config)
int loadChameleonConfig(config_file_t *config, BVRef chain)
{
char *dirspec[] = {
"rd(0,0)/Extra/org.chameleon.Boot.plist",
"/Extra/org.chameleon.Boot.plist",
"bt(0,0)/Extra/org.chameleon.Boot.plist",
"rd(0,0)/Extra/com.apple.Boot.plist", /* DEPRECIATED */
"/Extra/com.apple.Boot.plist", /* DEPRECIATED */
"bt(0,0)/Extra/com.apple.Boot.plist", /* DEPRECIATED */
};
int i, fd, count, ret=-1;
int i;
for(i = 0; i< sizeof(dirspec)/sizeof(dirspec[0]); i++) {
if ((fd = open(dirspec[i], 0)) >= 0) {
// Check for depreciated file names and annoy the user about it.
if(strstr(dirspec[i], "com.apple.Boot.plist")) {
printf("%s is depreciated.\n", dirspec[i]);
dirspec[i][strlen(dirspec[i]) - strlen("com.apple.Boot.plist")] = 0;
printf("Please use the file %sorg.chameleon.Boot.plist instead.\n", dirspec[i]);
pause();
if ( loadChameleonConfigForDevice(config, "rd(0,0)", dirspec[i]) == 0 ) {
return 0;
}
if ( loadChameleonConfigForDevice(config, "", dirspec[i]) == 0 ) {
return 0;
}
if ( loadChameleonConfigForDevice(config, "bt(0,0)", dirspec[i]) == 0 ) {
return 0;
}
BVRef bvr;
for ( bvr = chain; bvr; bvr = bvr->next ) { /* C99 Error */
char device[256];
getDeviceDescription(bvr, device);
if ( loadChameleonConfigForDevice(config, device, dirspec[i]) == 0 ) {
return 0;
}
// read file
count = read(fd, config->plist, IO_CONFIG_DATA_SIZE);
close(fd);
// build xml dictionary
ParseXMLFile(config->plist, &config->dictionary);
sysConfigValid = true;
ret=0;
break;
}
}
return ret;
return -1;
}
/* loadChameleonConfigForDevice
*
* Returns 0 - successful.
* -1 - unsuccesful.
*/
int loadChameleonConfigForDevice(config_file_t *config, const char *device, const char *path)
{
char full_path[1024];
int fd;
snprintf(full_path, sizeof(full_path), "%s%s", device, path);
if ((fd = open(full_path, 0)) >= 0) {
// Check for depreciated file names and annoy the user about it.
if(strstr(full_path, "com.apple.Boot.plist")) {
printf("%s is depreciated.\n", full_path);
full_path[strlen(full_path) - strlen("com.apple.Boot.plist")] = 0;
printf("Please use the file %sorg.chameleon.Boot.plist instead.\n", full_path);
pause();
}
// read file
read(fd, config->plist, IO_CONFIG_DATA_SIZE);
close(fd);
// build xml dictionary
ParseXMLFile(config->plist, &config->dictionary);
sysConfigValid = true;
return 0;
}
return -1;
}
/* loadHelperConfig
*
* Returns 0 - successful.
branches/Chimera/i386/libsaio/saio_types.h
7070
7171
7272
73
73
7474
7575
7676
......
151151
152152
153153
154
155
156
157
154
155
156
157
158158
159159
160160
......
212212
213213
214214
215
215
216
216217
217218
218219
......
225226
226227
227228
228
229
230
231
232
233
234
235
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
236244
237245
238246
typedef struct {
charplist[IO_CONFIG_DATA_SIZE];// buffer for plist
TagPtrdictionary; // buffer for xml dictionary
TagPtrdictionary;// buffer for xml dictionary
boolcanOverride;// flag to mark a dictionary can be overriden
} config_file_t;
typedef void (*BVFree)(CICell ih);
struct iob {
unsigned int i_flgs;/* see F_* below */
unsigned int i_offset;/* seek byte offset in file */
int i_filesize;/* size of file */
char * i_buf;/* file load address */
char * i_buf; /* file load address */
unsigned int i_flgs; /* see F_* below */
unsigned int i_offset; /* seek byte offset in file */
int i_filesize; /* size of file */
};
#define BPS 512/* sector size of the device */
kBVFlagBootable= 0x08,
kBVFlagEFISystem= 0x10,
kBVFlagBooter= 0x20,
kBVFlagSystemVolume= 0x40
kBVFlagSystemVolume= 0x40,
kBVFlagInstallVolume= 0x80
};
enum {
};
enum {
kPartitionTypeHFS= 0xAF,
kPartitionTypeHPFS= 0x07,
kPartitionTypeFAT16= 0x06,
kPartitionTypeFAT32= 0x0c,
kPartitionTypeEXT3= 0x83,
kPartitionTypeBEFS= 0xEB,
kPartitionTypeFreeBSD= 0xa5,
kPartitionTypeOpenBSD= 0xa6
//KPartitionTypeFAT12= 0x01, // FAT12
kPartitionTypeHPFS= 0x07, // Mac OS X
kPartitionTypeFAT16= 0x06, // FAT16
kPartitionTypeFAT32= 0x0C, // FAT32
kPartitionTypeEXT3= 0x83, // Linux
kPartitionTypeOSXBoot= 0xAB, // Mac OS X Boot partition
kPartitionTypeFreeBSD= 0xA5, // FreeBSD
kPartitionTypeOpenBSD= 0xA6, // OpenBSD
//kPartitionTypeNeXTSTEP= 0xA7 // NeXTSTEP
//kPartitionTypeNetBSD= 0xA9 // NetBSD
kPartitionTypeHFS= 0xAF, // Mac OS X
//kPartitionTypeSolaris= 0xBE, // Solaris
kPartitionTypeBEFS= 0xEB, // BeOS BFS
//kPartitionTypeBeOS= 0xEB, // BeOS BFS
//kPartitionTypeSkyOS= 0xEC, // SkyOS
};
//#define BIOS_DEV_TYPE(d)((d) & kBIOSDevTypeMask)
branches/Chimera/i386/libsaio/fake_efi.c
7474
7575
7676
77
78
7977
78
79
80
8081
8182
8283
......
436437
437438
438439
439
440
440441
442
441443
442444
443445
444446
445447
446448
447
449
450
448451
449452
450453
......
567570
568571
569572
570
571
572
573
574
575
576
573
574
575
576
577
578
579
580
581
577582
578583
579584
......
598603
599604
600605
606
607
608
609
610
601611
602612
603613
......
618628
619629
620630
621
631
622632
623633
624634
......
669679
670680
671681
682
683
684
685
686
687
688
689
690
691
672692
673693
674694
675695
676696
677
678
697
698
679699
680
700
681701
702
703
704
705
706
707
708
709
682710
683711
684712
/* Identify ourselves as the EFI firmware vendor */
static EFI_CHAR16 const FIRMWARE_VENDOR[] = {'C','h','a','m','e','l','e','o','n','_','2','.','2', 0};
static EFI_UINT32 const FIRMWARE_REVISION = 132; /* FIXME: Find a constant for this. */
// Bungo
//static EFI_UINT32 const FIRMWARE_REVISION = 132; /* FIXME: Find a constant for this. */
static EFI_UINT32 const FIRMWARE_REVISION = 0x0001000a; // got from real MBP6,1
// Bungo
/* Default platform system_id (fix by IntVar)
static EFI_CHAR8 const SYSTEM_ID[] = "0123456789ABCDEF"; //random value gen by uuidgen
*/
static const char FIRMWARE_REVISION_PROP[] = "firmware-revision";
static const char FIRMWARE_ABI_PROP[] = "firmware-abi";
static const char FIRMWARE_VENDOR_PROP[] = "firmware-vendor";
static const char FIRMWARE_ABI_32_PROP_VALUE[] = "EFI32";
//static const char FIRMWARE_ABI_32_PROP_VALUE[] = "EFI32";
static const char FIRMWARE_ABI_64_PROP_VALUE[] = "EFI64";
static const char EFI_MODE_PROP[] = "efi-mode"; //Bungo
static const char SYSTEM_ID_PROP[] = "system-id";
static const char SYSTEM_SERIAL_PROP[] = "SystemSerialNumber";
static const char SYSTEM_TYPE_PROP[] = "system-type";
static const char MODEL_PROP[] = "Model";
static const char BOARDID_PROP[] = "board-id";
static const char DEV_PATH_SUP[] = "DevicePathsSupported";
static uint32_t DevPathSup = 1;
static EFI_UINT32 DevPathSup = 1;
static EFI_UINT32 MachineSig = 0; //Bungo
/*
* Get an smbios option string option to convert to EFI_CHAR16 string
*/
// But I think eventually we want to fill stuff in the efi node
// too so we might as well create it so we have a pointer for it too.
node = DT__AddChild(node, "efi");
if (archCpuType == CPU_TYPE_I386) {
DT__AddProperty(node, FIRMWARE_ABI_PROP, sizeof(FIRMWARE_ABI_32_PROP_VALUE), (char*)FIRMWARE_ABI_32_PROP_VALUE);
} else {
DT__AddProperty(node, FIRMWARE_ABI_PROP, sizeof(FIRMWARE_ABI_64_PROP_VALUE), (char*)FIRMWARE_ABI_64_PROP_VALUE);
}
/* Bungo
if (archCpuType == CPU_TYPE_I386) {
DT__AddProperty(node, FIRMWARE_ABI_PROP, sizeof(FIRMWARE_ABI_32_PROP_VALUE), (char*)FIRMWARE_ABI_32_PROP_VALUE);
} else { */
DT__AddProperty(node, FIRMWARE_ABI_PROP, sizeof(FIRMWARE_ABI_64_PROP_VALUE), (char *)FIRMWARE_ABI_64_PROP_VALUE);
//}
DT__AddProperty(node, EFI_MODE_PROP, sizeof(EFI_UINT8), (EFI_UINT8 *)&bootArgs->efiMode);
DT__AddProperty(node, FIRMWARE_REVISION_PROP, sizeof(FIRMWARE_REVISION), (EFI_UINT32*)&FIRMWARE_REVISION);
DT__AddProperty(node, FIRMWARE_VENDOR_PROP, sizeof(FIRMWARE_VENDOR), (EFI_CHAR16*)FIRMWARE_VENDOR);
// all of the configuration tables needed by various kernel extensions.
gEfiConfigurationTableNode = DT__AddChild(node, "configuration-table");
// New node: /efi/kernel-compatibility
Node *efiKernelComNode = DT__AddChild(node, "kernel-compatibility");
len = 1;
DT__AddProperty(efiKernelComNode, "x86_64", sizeof(uint32_t), (EFI_UINT32 *)&len);
// Now fill in the /efi/platform Node
Node *efiPlatformNode = DT__AddChild(node, "platform");
DT__AddProperty(efiPlatformNode, CPU_Frequency_prop, sizeof(uint64_t), &Platform.CPU.CPUFrequency);
}
DT__AddProperty(efiPlatformNode,DEV_PATH_SUP, sizeof(uint32_t), &DevPathSup);
DT__AddProperty(efiPlatformNode,DEV_PATH_SUP, sizeof(EFI_UINT32), &DevPathSup);
// Bungo
/* Export system-id. Can be disabled with SystemId=No in com.apple.Boot.plist
{
Node *chosenNode;
chosenNode = DT__FindNode("/chosen", false);
static EFI_UINT8 const RANDOM_SEED[] =
{
0x40, 0x00, 0x50, 0x00, 0x5c, 0x00, 0x53, 0x00, 0x79, 0x00, 0x73, 0x00, 0x74, 0x00, 0x65, 0x00,
0x6d, 0x00, 0x5c, 0x00, 0x4c, 0x00, 0x69, 0x00, 0x62, 0x00, 0x72, 0x00, 0x61, 0x00, 0x72, 0x00,
0x79, 0x00, 0x5c, 0x00, 0x43, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x65, 0x00, 0x53, 0x00, 0x65, 0x00,
0x72, 0x00, 0x76, 0x00, 0x69, 0x00, 0x63, 0x00, 0x65, 0x00, 0x73, 0x00, 0x5c, 0x00, 0x62, 0x00
};
DT__AddProperty(chosenNode, "random-seed", sizeof(RANDOM_SEED), (EFI_UINT8*) &RANDOM_SEED);
if (chosenNode == 0)
{
stop("Couldn't get chosen node");
}
int bootUUIDLength = strlen(gBootUUIDString);
if (bootUUIDLength)
int length = strlen(gBootUUIDString);
if (length)
{
DT__AddProperty(chosenNode, "boot-uuid", bootUUIDLength + 1, gBootUUIDString);
DT__AddProperty(chosenNode, "boot-uuid", length + 1, gBootUUIDString);
}
length = strlen(bootArgs->CommandLine);
DT__AddProperty(chosenNode, "boot-args", length + 1, bootArgs->CommandLine);
length = strlen(bootInfo->bootFile);
DT__AddProperty(chosenNode, "boot-file", length + 1, bootInfo->bootFile);
DT__AddProperty(chosenNode, "machine-signature", sizeof(EFI_UINT32), (EFI_UINT32 *)&MachineSig);
}
/*
branches/Chimera/i386/libsaio/smbios_getters.c
125125
126126
127127
128
128129
129130
130131
......
162163
163164
164165
165
166
166167
167168
168169
// MacMan the following CPUs have fixed DMI2 speeds
case CPU_MODEL_IVYBRIDGE_XEON: // Intel Core i7, Xeon E5 v2 LGA2011 (22nm)
case CPU_MODEL_JAKETOWN: // Intel Core i7, Xeon E5 LGA2011 (32nm)
case CPU_MODEL_HASWELL_SVR: // Intel Core i7, Xeon E5 LGA2011v3
{
unsigned long dmi2speed;
dmi2speed = 5000;
if (Platform.CPU.Vendor == CPUID_VENDOR_INTEL) { // Intel
if (!done) {
verbose("CPU is %s, family 0x%x, model 0x%x\n", Platform.CPU.BrandString, (uint32_t)Platform.CPU.Family, (uint32_t)Platform.CPU.Model);
/*verbose("CPU is %s, family 0x%x, model 0x%x\n", Platform.CPU.BrandString, (uint32_t)Platform.CPU.Family, (uint32_t)Platform.CPU.Model); */
done = true;
}
// Bungo: fixes Oem Processor Type - better matching IMHO
branches/Chimera/i386/libsaio/saio_internal.h
162162
163163
164164
165
165
166
166167
167168
168169
extern int loadConfigFile(const char *configFile, config_file_t *configBuff);
extern int loadSystemConfig(config_file_t *configBuff);
extern int loadHelperConfig(config_file_t *configBuff);
extern int loadChameleonConfig(config_file_t *configBuff);
extern int loadChameleonConfig(config_file_t *configBuff, BVRef chain);
extern int loadChameleonConfigForDevice(config_file_t *configBuff, const char *device, const char *path);
extern char * newString(const char *oldString);
extern char * getNextArg(char ** ptr, char * val);
extern int ParseXMLFile( char * buffer, TagPtr * dict );
branches/Chimera/i386/boot1/boot1h.s
7474
7575
7676
77
77
7878
7979
8080
kBoot1Sector1AddrEQUkBoot1RelocAddr + kSectorBytes; boot1 load address for sector 1
kHFSPlusBufferEQUkBoot1Sector1Addr + kSectorBytes; HFS+ Volume Header address
kBoot2SectorsEQU(448 * 1024 - 512) / kSectorBytes; max size of 'boot' file in sectors
kBoot2SectorsEQU(480 * 1024 - 512) / kSectorBytes; max size of 'boot' file in sectors
kBoot2SegmentEQU0x2000; boot2 load segment
kBoot2AddressEQUkSectorBytes; boot2 load address
branches/Chimera/i386/boot2/drivers.c
235235
236236
237237
238
238
239239
240240
241241
......
523523
524524
525525
526
526527
527528
528529
......
837838
838839
839840
840
841
841
842
843
842844
843
844
845
846
847
845
846
847
848
849
848850
849851
850852
......
858860
859861
860862
861
863
864
862865
863
866
867
864868
865869
870
871
872
873
874
866875
867876
868877
......
873882
874883
875884
876
877885
878886
879887
880
881
882
883
884
885
886
887
888
889
890
891
892
893
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
894917
895918
896919
......
899922
900923
901924
925
926
927
928
929
930
931
902932
903933
904934
return -1;
}
} else {
if (gMacOSVersion[3] == '9') {
if ((checkOSVersion("10.9")) || (checkOSVersion("10.10"))) {
strlcpy(gExtensionsSpec, dirSpec, 4087); /* 4096 - sizeof("Library/") */
strcat(gExtensionsSpec, "Library/");
FileLoadDrivers(gExtensionsSpec, 0);
if (ret != 0) {
break;
}
// Allocate memory for the driver path and the plist.
module->executablePath = tmpExecutablePath;
static char gPlatformName[64];
#endif
long
DecodeKernel(void *binary, entry_t *rentry, char **raddr, int *rsize)
char *gDarwinBuildVerStr = "Darwin Kernel Version"; // Bungo
long DecodeKernel(void *binary, entry_t *rentry, char **raddr, int *rsize)
{
long ret;
compressed_kernel_header * kernel_header = (compressed_kernel_header *) binary;
u_int32_t uncompressed_size, size;
void *buffer;
unsigned long len;
long ret = 0;
compressed_kernel_header * kernel_header = (compressed_kernel_header *) binary;
u_int32_t uncompressed_size = 0, size = 0, adler32 = 0;
void *buffer = NULL;
unsigned long len = 0;
#if 0
printf("kernel header:\n");
if (kernel_header->signature == OSSwapBigToHostConstInt32('comp'))
{
if (kernel_header->compress_type != OSSwapBigToHostConstInt32('lzss'))
if ((kernel_header->compress_type != OSSwapBigToHostConstInt32('lzss')) &&
(kernel_header->compress_type != OSSwapBigToHostConstInt32('lzvn')))
{
error("kernel compression is bad\n");
verbose ("Decompressing Kernel\n");
error("ERROR: Invalid kernel compression\n");
return -1;
}
if (kernel_header->compress_type == OSSwapBigToHostConstInt32('lzss'))
verbose ("Decompressing Kernel Using lzss\n");
else
if (kernel_header->compress_type == OSSwapBigToHostConstInt32('lzvn'))
verbose ("Decompressing Kernel Using lzvn\n");
#if NOTDEF
if (kernel_header->platform_name[0] && strcmp(gPlatformName, kernel_header->platform_name))
{
return -1;
}
#endif
uncompressed_size = OSSwapBigToHostInt32(kernel_header->uncompressed_size);
binary = buffer = malloc(uncompressed_size);
size = decompress_lzss((u_int8_t *) binary, &kernel_header->data[0],
OSSwapBigToHostInt32(kernel_header->compressed_size));
if (uncompressed_size != size) {
error("size mismatch from lzss: %x\n", size);
return -1;
}
if (OSSwapBigToHostInt32(kernel_header->adler32) !=
Adler32(binary, uncompressed_size))
{
printf("adler mismatch\n");
return -1;
}
}
// MinusZwei
size = 0;
switch (kernel_header->compress_type)
{
case OSSwapBigToHostConstInt32('lzvn'):
size = decompress_lzvn( binary, uncompressed_size, &kernel_header->data[0], OSSwapBigToHostInt32(kernel_header->compressed_size));
break;
case OSSwapBigToHostConstInt32('lzss'):
size = decompress_lzss( (u_int8_t *)binary, uncompressed_size, &kernel_header->data[0], OSSwapBigToHostInt32(kernel_header->compressed_size));
break;
default:
break;
}
// MinusZwei
if (uncompressed_size != size) {
error("ERROR: size mismatch from lzss (found: %x, expected: %x).\n", size, uncompressed_size);
return -1;
}
adler32 = Adler32(binary, uncompressed_size);
if (OSSwapBigToHostInt32(kernel_header->adler32) != adler32)
{
error("ERROR: adler mismatch (found: %x, expected: %x).\n", adler32, OSSwapBigToHostInt32(kernel_header->adler32));
return -1;
}
}
ret = ThinFatFile(&binary, &len);
if (ret == 0 && len == 0 && archCpuType==CPU_TYPE_X86_64)
ret = ThinFatFile(&binary, &len);
}
// Bungo: no range checking, sorry
size = 0;
while (memcmp((uint8_t *)binary + size, (uint8_t *)gDarwinBuildVerStr, 21)) {
size++;
}
gDarwinBuildVerStr = (char *)binary + size;
// Notify modules that the kernel has been decompressed, thinned and is about to be decoded
execute_hook("DecodeKernel", (void*)binary, NULL, NULL, NULL);
branches/Chimera/i386/boot2/prompt.c
2828
2929
3030
31
31
3232
3333
3434
#include <vers.h>
char bootBanner[] = "\nDarwin/x86 boot v" I386BOOT_VERSION " - Chameleon v" I386BOOT_CHAMELEONVERSION " r" I386BOOT_CHAMELEONREVISION "\n"
char bootBanner[] = "\nDarwin/x86 boot v" I386BOOT_VERSION " - Chameleon v" I386BOOT_CHAMELEONVERSION " r" I386BOOT_CHAMELEONREVISION "\n"
"Build date: " I386BOOT_BUILDDATE "\n"
"%dMB memory\n";
branches/Chimera/i386/boot2/Makefile
4242
4343
4444
45
45
4646
4747
4848
# The ordering is important;
# boot2.o must be first.
OBJS = boot2.o boot.o graphics.o drivers.o prompt.o options.o lzss.o mboot.o \
OBJS = boot2.o boot.o graphics.o drivers.o prompt.o options.o lzss.o lzvn.o mboot.o \
ramdisk.o picopng.o resume.o bmdecompress.o graphic_utils.o gui.o modules.o \
modules_support.o boot_modules.o
# button.o browser.o scrollbar.o == NOTYET
branches/Chimera/i386/boot2/boot.c
8080
8181
8282
83
84
8583
8684
8785
......
197195
198196
199197
200
198
201199
202
203200
204201
205202
......
239236
240237
241238
242
243
244
239
240
245241
246
242
247243
248244
245
249246
250247
251248
......
266263
267264
268265
266
269267
270268
271269
......
309307
310308
311309
312
310
313311
314312
315313
......
328326
329327
330328
331
329
332330
333331
334332
......
379377
380378
381379
380
381
382
382383
383384
384385
385386
386
387
388387
389388
390389
......
405404
406405
407406
408
407
409408
410409
411410
......
533532
534533
535534
536
537
538
539535
540536
541537
......
603599
604600
605601
606
602
607603
608604
609605
......
623619
624620
625621
626
627
622
628623
629624
630625
631626
632
633
627
634628
635629
636630
......
655649
656650
657651
658
659
652
653
654
655
656
657
658
660659
660
661661
662662
663663
......
675675
676676
677677
678
678
679
679680
680681
681682
......
749750
750751
751752
752
753
753
754
755
756
757
758
759
760
754761
755762
756
757
758
759
760
761763
762764
763765
longgBootMode; /* defaults to 0 == kBootModeNormal */
BVRefbvr, menuBVR, bvChain;
static boolcheckOSVersion(const char * version);
static voidgetOSVersion();
static unsigned longAdler32(unsigned char *buffer, long length);
//static voidselectBiosDevice(void);
finalizeBootStruct();
// Jump to kernel's entry point. There's no going back now.
if ((checkOSVersion("10.7")) || (checkOSVersion("10.8")) || (checkOSVersion("10.9")))
if ((checkOSVersion("10.7")) || (checkOSVersion("10.8")) || (checkOSVersion("10.9")) || (checkOSVersion("10.10")))
{
// Notify modules that the kernel is about to be started
execute_hook("Kernel Start", (void*)kernelEntry, (void*)bootArgs, NULL, NULL);
if (cacheFile[0] != 0)
{
strlcpy(kernelCacheFile, cacheFile, sizeof(kernelCacheFile));
}
else
{
verbose("Specified kernel cache file path = %s\n", cacheFile);
} else {
// Lion, Mountain Lion and Mavericks prelink kernel cache file
if ((checkOSVersion("10.7")) || (checkOSVersion("10.8")) || (checkOSVersion("10.9")))
if ((checkOSVersion("10.7")) || (checkOSVersion("10.8")) || (checkOSVersion("10.9")) || (checkOSVersion("10.10")))
{
snprintf(kernelCacheFile, sizeof(kernelCacheFile), "%skernelcache", kDefaultCachePathSnow);
verbose("Kernel cache file path = %s\n", kernelCacheFile);
}
// Snow Leopard prelink kernel cache file
else if (checkOSVersion("10.6")) {
prev_time = time;
}
}
verbose("Snow Leopard Kernel cache file path = %s\n", kernelCacheFile);
}
closedir(cacheDir);
} else {
// Exit if kernel cache file wasn't found
if (ret == -1) {
verbose("No Kernel Cache File '%s' found\n", kernelCacheFile);
verbose("Kernel Cache File '%s' not found\n", kernelCacheFile);
return -1;
}
// Check if the S/L/E directory time is more recent than the cache file
if ((ret == 0) && ((flags & kFileTypeMask) == kFileTypeDirectory)
&& (exttime > cachetime)) {
verbose("/System/Library/Extensions is more recent than KernelCache (%s), ignoring KernelCache\n",
verbose("Contents of /System/Library/Extensions is more recent than KernelCache (%s), ignoring KernelCache\n",
kernelCacheFile);
return -1;
}
// Record the device that the booter was loaded from.
gBIOSDev = biosdev & kBIOSDevMask;
// Initialize boot-log
initBooterLog();
// Initialize boot info structure.
initKernBootStruct();
initBooterLog();
// Setup VGA text mode.
// Not sure if it is safe to call setVideoMode() before the
// config table has been loaded. Call video_mode() instead.
setBootGlobals(bvChain);
// Load boot.plist config file
status = loadChameleonConfig(&bootInfo->chameleonConfig);
status = loadChameleonConfig(&bootInfo->chameleonConfig, bvChain);
if (getBoolForKey(kQuietBootKey, &quiet, &bootInfo->chameleonConfig) && quiet) {
gBootMode |= kBootModeQuiet;
updateVRAM();
}
// Find out which version mac os we're booting.
getOSVersion();
if (platformCPUFeature(CPU_FEATURE_EM64T)) {
archCpuType = CPU_TYPE_X86_64;
} else {
HibernateBoot((char *)val);
break;
}
verbose("Loading Darwin %s\n", gMacOSVersion);
getBoolForKey(kUseKernelCache, &useKernelCache, &bootInfo->chameleonConfig);
}
if (gOverrideKernel && kernelCacheFile[0] == 0) {
verbose("Using a non default kernel (%s) without specifying 'Kernel Cache' path, KernelCache will not be used\n",
bootInfo->bootFile);
verbose("Using a non default kernel (%s) without specifying 'Kernel Cache' path, KernelCache will not be used\n", bootInfo->bootFile);
useKernelCache = false;
break;
}
if (gMKextName[0] != 0) {
verbose("Using a specific MKext Cache (%s), KernelCache will not be used\n",
gMKextName);
verbose("Using a specific MKext Cache (%s), KernelCache will not be used\n", gMKextName);
useKernelCache = false;
break;
}
// 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
{
if (checkOSVersion("10.10")) {
snprintf(bootFile, sizeof(bootFile), kDefaultKernelPathYosemite"%s", bootInfo->bootFile); // for Yosemite
} else {
snprintf(bootFile, sizeof(bootFile), kDefaultKernelPath"%s", bootInfo->bootFile); // append a leading /
}
} else {
strlcpy(bootFile, bootInfo->bootFile, sizeof(bootFile));
}
// Try to load kernel image from alternate locations on boot helper partitions.
ret = -1;
}
}
}
if (ret == -1) {
if (ret == -1)
{
// No alternate location found, using the original kernel image path.
strlcpy(bootFilePath, bootFile, sizeof(bootFilePath));
}
bool checkOSVersion(const char * version)
{
return ((gMacOSVersion[0] == version[0]) && (gMacOSVersion[1] == version[1])
&& (gMacOSVersion[2] == version[2]) && (gMacOSVersion[3] == version[3]));
if ( (sizeof(version) > 4) && ('.' != version[4]) && ('\0' != version[4])) {
return ((gMacOSVersion[0] == version[0]) && (gMacOSVersion[1] == version[1])
&& (gMacOSVersion[2] == version[2]) && (gMacOSVersion[3] == version[3]))
&& (gMacOSVersion[4] == version[4]);
} else {
return ((gMacOSVersion[0] == version[0]) && (gMacOSVersion[1] == version[1])
&& (gMacOSVersion[2] == version[2]) && (gMacOSVersion[3] == version[3]));
}
}
static void getOSVersion()
{
strncpy(gMacOSVersion, gBootVolume->OSVersion, sizeof(gMacOSVersion));
}
#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
branches/Chimera/i386/boot2/boot.h
3232
3333
3434
35
36
37
38
3539
36
37
40
41
3842
3943
40
41
44
45
4246
47
48
49
50
4351
4452
4553
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
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
7382
7483
7584
......
253262
254263
255264
265
256266
257267
258268
......
286296
287297
288298
289
299
300
290301
302
303
304
305
306
307
291308
292309
293310
......
307324
308325
309326
327
328
310329
* Paths used by chameleon
*/
//kernel path
#define kDefaultKernelPath "/"
#define kDefaultKernelPathYosemite "/System/Library/Kernels/"
//kernel cache
#define kDefaultCachePathLeo "/System/Library/Caches/com.apple.kernelcaches/"
#define kDefaultCachePathSnow "/System/Library/Caches/com.apple.kext.caches/Startup/"
#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"
#define kLionInstallerDataFolder "/Mac OS X Install Data/"
#define kLionInstallerPlist kLionInstallerDataFolder "com.apple.Boot.plist"
// Mountain Lion installer
#define kMLionInstallerDataFolder "/OS X Install Data/"
#define kMLionInstallerPlist kMLionInstallerDataFolder "com.apple.Boot.plist"
/*
* Keys used in system Boot.plist
*/
#define kGraphicsModeKey"Graphics Mode"
#define kTextModeKey"Text Mode"
#define kQuietBootKey"Quiet Boot"
#define kKernelFlagsKey"Kernel Flags"
#define kKernelArchKey"Kernel Architecture"
#define kMKextCacheKey"MKext Cache"
#define kKernelNameKey"Kernel"
#define kKernelCacheKey"Kernel Cache"
#define kUseKernelCache"UseKernelCache"/* boot.c */
#define kBootDeviceKey"Boot Device"
#define kTimeoutKey "Timeout"
#define kRootDeviceKey"rd"
#define kBootUUIDKey"boot-uuid"
#define kHelperRootUUIDKey"Root UUID"
#define kPlatformKey"platform"
#define kACPIKey "acpi"
#define kCDROMPromptKey"CD-ROM Prompt"
#define kCDROMOptionKey"CD-ROM Option Key"
#define kRescanPromptKey"Rescan Prompt"
#define kRescanKey "Rescan"
#define kScanSingleDriveKey"Scan Single Drive"
#define kInstantMenuKey"Instant Menu"
#define kDefaultKernel"mach_kernel"
#define kGUIKey "GUI"
#define kBootBannerKey"Boot Banner"
#define kShowInfoKey"ShowInfo" /* gui.c */
#define kWaitForKeypressKey"Wait"
#define kGraphicsModeKey "Graphics Mode"
#define kTextModeKey "Text Mode"
#define kQuietBootKey "Quiet Boot"
#define kKernelFlagsKey "Kernel Flags"
#define kKernelArchKey "Kernel Architecture"
#define kMKextCacheKey "MKext Cache"
#define kKernelNameKey "Kernel"
#define kKernelCacheKey "Kernel Cache"
#define kUseKernelCache "UseKernelCache"/* boot.c */
#define kBootDeviceKey "Boot Device"
#define kTimeoutKey "Timeout"
#define kRootDeviceKey "rd"
#define kBootUUIDKey "boot-uuid"
#define kHelperRootUUIDKey "Root UUID"
#define kPlatformKey "platform"
#define kACPIKey "acpi"
#define kCDROMPromptKey "CD-ROM Prompt"
#define kCDROMOptionKey "CD-ROM Option Key"
#define kRescanPromptKey "Rescan Prompt"
#define kRescanKey "Rescan"
#define kScanSingleDriveKey "Scan Single Drive"
#define kInstantMenuKey "Instant Menu"
#define kDefaultKernel "mach_kernel"
#define kDefaultKernelYosemite "kernel"
#define kGUIKey "GUI"
#define kBootBannerKey "Boot Banner"
#define kShowInfoKey "ShowInfo" /* gui.c */
#define kWaitForKeypressKey "Wait"
/* AsereBLN: added these keys */
#define kUseAtiROM "UseAtiROM" /* ati.c */
/*
* drivers.c
*/
extern char *gDarwinBuildVerStr; // Bungo
extern long LoadExtraDrivers(char * dirSpec);
extern long LoadDrivers(char * dirSpec);
extern long DecodeKernel(void *binary, entry_t *rentry, char **raddr, int *rsize);
/*
* lzss.c
*/
extern int decompress_lzss(u_int8_t *dst, u_int8_t *src, u_int32_t srclen);
extern int decompress_lzss(u_int8_t *dst, u_int32_t dstlen, u_int8_t *src, u_int32_t srclen);
extern u_int8_t *compress_lzss(u_int8_t *dst, u_int32_t dstlen, u_int8_t *src, u_int32_t srcLen);
/*
* lzvn.c
*/
extern size_t decompress_lzvn(void * _dest, size_t _dest_size, void * _src, size_t _src_size);
// extern u_int8_t *compress_lzvn(u_int8_t *dst, u_int32_t dstlen, u_int8_t *src, u_int32_t srcLen);
struct compressed_kernel_header {
u_int32_t signature;
u_int32_t compress_type;
/* bmdecompress.c */
void * DecompressData(void *srcbase, int *dw, int *dh, int *bytesPerPixel);
bool checkOSVersion(const char * version);
#endif /* !__BOOT2_BOOT_H */
branches/Chimera/i386/boot2/gui.c
4343
4444
4545
46
46
47
48
4749
4850
4951
......
5860
5961
6062
63
64
6165
6266
6367
......
7074
7175
7276
77
7378
7479
7580
......
123128
124129
125130
126
131
132
133
127134
128135
129136
......
138145
139146
140147
148
149
141150
142151
143152
......
150159
151160
152161
162
153163
154164
155165
......
351361
352362
353363
364
365
354366
355367
356368
......
366378
367379
368380
381
382
369383
370384
371385
......
933947
934948
935949
950
951
952
953
954
936955
937956
938957
iDeviceGeneric_o,
iDeviceHFS,
iDeviceHFS_o,
iDeviceHFS_mav,
iDeviceHFS_yos,
iDeviceHFS_yos_o,
iDeviceHFS_mav,
iDeviceHFS_mav_o,
iDeviceHFS_ML,
iDeviceHFS_ML_o,
iDeviceHFSRAID,
iDeviceHFSRAID_o,
iDeviceHFSRAID_yos,
iDeviceHFSRAID_yos_o,
iDeviceHFSRAID_mav,
iDeviceHFSRAID_mav_o,
iDeviceHFSRAID_ML,
iDeviceHFSRAID_Leo_o,
iDeviceHFSRAID_Tiger,
iDeviceHFSRAID_Tiger_o,
iDeviceEXT3,
iDeviceEXT3_o,
iDeviceFreeBSD, /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */
{.name = "device_generic_o", .image = NULL},
{.name = "device_hfsplus", .image = NULL},
{.name = "device_hfsplus_o", .image = NULL},
{.name = "device_hfsplus_mav", .image = NULL},
{.name = "device_hfsplus_yos", .image = NULL},
{.name = "device_hfsplus_yos_o", .image = NULL},
{.name = "device_hfsplus_mav", .image = NULL},
{.name = "device_hfsplus_mav_o", .image = NULL},
{.name = "device_hfsplus_ml", .image = NULL},
{.name = "device_hfsplus_ml_o", .image = NULL},
{.name = "device_hfsraid", .image = NULL},
{.name = "device_hfsraid_o", .image = NULL},
{.name = "device_hfsraid_yos", .image = NULL},
{.name = "device_hfsraid_yos_o", .image = NULL},
{.name = "device_hfsraid_mav", .image = NULL},
{.name = "device_hfsraid_mav_o", .image = NULL},
{.name = "device_hfsraid_ml", .image = NULL},
{.name = "device_hfsraid_leo_o", .image = NULL},
{.name = "device_hfsraid_tiger", .image = NULL},
{.name = "device_hfsraid_tiger_o", .image = NULL},
{.name = "device_ext3", .image = NULL},
{.name = "device_ext3_o", .image = NULL},
{.name = "device_freebsd", .image = NULL}, /* FreeBSD/OpenBSD detection,nawcom's code by valv, Icon credits to blackosx */
LOADPNG(device_generic_o, iDeviceGeneric);
LOADPNG(device_hfsplus, iDeviceGeneric);
LOADPNG(device_hfsplus_o, iDeviceHFS);
LOADPNG(device_hfsplus_yos, iDeviceHFS);
LOADPNG(device_hfsplus_yos_o, iDeviceHFS_yos);
LOADPNG(device_hfsplus_mav, iDeviceHFS);
LOADPNG(device_hfsplus_mav_o, iDeviceHFS_mav);
LOADPNG(device_hfsplus_ml, iDeviceHFS);
LOADPNG(device_hfsraid, iDeviceHFS);
LOADPNG(device_hfsraid_o, iDeviceHFSRAID);
LOADPNG(device_hfsraid_yos, iDeviceHFSRAID);
LOADPNG(device_hfsraid_yos_o, iDeviceHFSRAID_yos);
LOADPNG(device_hfsraid_mav, iDeviceHFSRAID);
LOADPNG(device_hfsraid_mav_o, iDeviceHFSRAID_mav);
LOADPNG(device_hfsraid_ml, iDeviceHFSRAID);
{
// Use HFS or HFSRAID icon depending on bvr flags. Fallbacks are handled by alt_image above.
switch (device->OSVersion[3]) {
case '1':
if ((device->OSVersion[4]) == '0') {
devicetype = (device->flags & kBVFlagBooter ? iDeviceHFSRAID_yos : iDeviceHFS_yos);
break;
}
case '9':
devicetype = (device->flags & kBVFlagBooter ? iDeviceHFSRAID_mav : iDeviceHFS_mav);
break;
branches/Chimera/i386/boot2/lzss.c
6464
6565
6666
67
68
67
6968
7069
7170
7271
72
7373
7474
7575
......
8888
8989
9090
91
92
93
9194
9295
9396
......
98101
99102
100103
104
105
106
101107
102108
103109
104110
105111
106
112
107113
108114
109115
......
221227
222228
223229
224
225
226
227
228
230
229231
230
231232
232233
234
233235
234236
235
237
236238
239
237240
238241
239
240242
243
241244
242245
243246
......
246249
247250
248251
252
249253
250254
255
251256
252257
253258
254259
255
260
261
256262
257263
258264
......
260266
261267
262268
269
263270
264271
265272
......
286293
287294
288295
289
296
290297
291298
292299
......
295302
296303
297304
305
298306
299307
300308
301309
302310
303311
312
304313
305314
306315
316
307317
308318
309319
310320
311321
322
312323
313324
314325
......
317328
318329
319330
331
320332
321333
322334
323335
324336
325
337
326338
327
328
329
330
339
331340
int match_position, match_length;
};
int
decompress_lzss(u_int8_t *dst, u_int8_t *src, u_int32_t srclen)
int decompress_lzss( u_int8_t *dst, u_int32_t dstlen, 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];
u_int8_t *dststart = dst;
u_int8_t *dstend = dst + dstlen;
u_int8_t *srcend = src + srclen;
int i, j, k, r, c;
unsigned int flags;
if (flags & 1) {
if (src < srcend) c = *src++; else break;
*dst++ = c;
if (dst >= dstend) {
goto finish;
}
text_buf[r++] = c;
r &= (N - 1);
} else {
for (k = 0; k <= j; k++) {
c = text_buf[(i + k) & (N - 1)];
*dst++ = c;
if (dst >= dstend) {
goto finish;
}
text_buf[r++] = c;
r &= (N - 1);
}
}
}
finish:
return dst - dststart;
}
sp->parent[p] = NIL;
}
u_int8_t *compress_lzss(
u_int8_t * dst,
u_int32_t dstlen,
u_int8_t * src,
u_int32_t srclen)
u_int8_t *compress_lzss( u_int8_t *dst, u_int32_t dstlen, 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
*/
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
*/
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.
if (dst < dstend)
*dst++ = code_buf[i];
else
goto finish;
return (void *) 0;
code_buf[0] = 0;
code_buf_ptr = mask = 1;
}
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);
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;
}
branches/Chimera/i386/boot2/options.c
3232
3333
3434
35
36
37
38
39
40
3541
3642
3743
......
10931099
10941100
10951101
1102
10961103
1104
10971105
10981106
10991107
......
11931201
11941202
11951203
1196
1204
1205
1206
1207
1208
11971209
11981210
11991211
......
12051217
12061218
12071219
1208
1220
12091221
12101222
12111223
......
12151227
12161228
12171229
1218
1230
1231
12191232
12201233
1221
1234
1235
12221236
12231237
1224
1238
1239
1240
1241
1242
12251243
12261244
1227
1245
1246
12281247
12291248
12301249
......
12331252
12341253
12351254
1236
1255
1256
12371257
12381258
12391259
......
12421262
12431263
12441264
1245
1265
1266
12461267
12471268
12481269
1249
1270
1271
12501272
1251
1273
1274
12521275
1253
1276
1277
12541278
12551279
12561280
12571281
1258
1282
12591283
1260
1284
1285
12611286
12621287
1263
1288
12641289
1265
1290
1291
12661292
12671293
1294
1295
1296
1297
1298
1299
12681300
12691301
12701302
1271
1303
1304
12721305
1273
1306
1307
12741308
12751309
12761310
12771311
1278
1279
1312
1313
1314
12801315
12811316
1282
1317
12831318
12841319
12851320
12861321
1287
1288
1289
1322
1323
1324
1325
1326
12901327
12911328
12921329
......
12961333
12971334
12981335
1299
1336
1337
13001338
13011339
13021340
13031341
13041342
13051343
1306
1307
1344
1345
1346
1347
13081348
13091349
13101350
......
13121352
13131353
13141354
1315
1316
1355
1356
1357
1358
13171359
13181360
13191361
......
13221364
13231365
13241366
1325
1367
1368
13261369
13271370
13281371
13291372
13301373
13311374
1332
1375
1376
13331377
13341378
13351379
13361380
13371381
13381382
1339
1383
1384
13401385
13411386
13421387
13431388
1344
1389
1390
13451391
13461392
13471393
#include "pci.h"
#include "modules.h"
#if DEBUG
#define DBG(x...)printf(x)
#else
#define DBG(x...)msglog(x)
#endif
bool showBootBanner = true; //Azi:showinfo
static bool shouldboot = false;
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");
else {
return -1;
}
// Find out which version mac os we're booting.
strlcpy(gMacOSVersion, gBootVolume->OSVersion, sizeof(gMacOSVersion));
// printf("OS Version Booted %s\n", gBootVolume->OSVersion);
// Load config table specified by the user, or use the default.
if (!getValueForBootKey(cp, "config", &val, &cnt)) {
// and use its contents to override default bootConfig.
loadSystemConfig(&bootInfo->bootConfig);
loadChameleonConfig(&bootInfo->chameleonConfig);
loadChameleonConfig(&bootInfo->chameleonConfig, NULL);
// Use the kernel name specified by the user, or fetch the name
// in the config table, or use the default if not specified.
// 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 ((checkOSVersion("10.10"))) {
strlcpy( bootInfo->bootFile, kDefaultKernelYosemite, sizeof(bootInfo->bootFile) );
} else {
strlcpy( bootInfo->bootFile, kDefaultKernel, sizeof(bootInfo->bootFile) );
}
}
}
if (strcmp( bootInfo->bootFile, kDefaultKernel ) != 0) {
if ((strcmp( bootInfo->bootFile, kDefaultKernel ) != 0) && (strcmp( bootInfo->bootFile, kDefaultKernelYosemite ) != 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)
{
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)) {
} else { /*
if (strlen(gBootUUIDString))
{
val = "*uuid";
cnt = 5;
} else {
} else { */
// Don't set "rd=.." if there is no boot device key
// and no UUID.
val = "";
cnt = 0;
}
}
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;
branches/Chimera/Make.rules
1717
1818
1919
20
20
2121
2222
2323
NASM = $(shell which nasm) -p $(SRCROOT)/autoconf.inc
CFLAGS= $(CONFIG_OPTIMIZATION_LEVEL) -g -Wmost -Werror -Wno-unused-function
CFLAGS= $(CONFIG_OPTIMIZATION_LEVEL) -g -Wmost -Werror -Wno-unused-function -Wno-int-conversion
CPPFLAGS = $(MORECPP) -g -Wmost -Werror -fno-exceptions -fno-rtti -ffreestanding
DEFINES=

Archive Download the corresponding diff file

Revision: 2403