Chameleon

Chameleon Commit Details

Date:2012-02-17 05:41:24 (12 years 2 months ago)
Author:ErmaC
Commit:1820
Parents: 1819
Message:- Add 10.8 boot support - Added OS X deection for Mountain (Based on cparm's patch) - Added some Ati card : http://forge.voodooprojects.org/p/chameleon/issues/220/
Changes:
M/branches/ErmaC/Trunk/i386/boot0/boot0hfs.s
M/branches/ErmaC/Trunk/i386/boot2/boot.c
M/branches/ErmaC/Trunk/i386/boot2/gui.c
M/branches/ErmaC/Trunk/i386/libsaio/bootstruct.c
M/branches/ErmaC/Trunk/i386/libsaio/ati.c

File differences

branches/ErmaC/Trunk/i386/libsaio/bootstruct.c
110110
111111
112112
113
113
114114
115115
116116
reserveKernBootStruct(void)
{
if ((gMacOSVersion[0] == '1') && (gMacOSVersion[1] == '0')
&& (gMacOSVersion[2] == '.') && (gMacOSVersion[3] == '7'))
&& (gMacOSVersion[2] == '.') && ((gMacOSVersion[3] == '7') || (gMacOSVersion[3] == '8')))
{
void *oldAddr = bootArgs;
bootArgs = (boot_args *)AllocateKernelMemory(sizeof(boot_args));
branches/ErmaC/Trunk/i386/libsaio/ati.c
492492
493493
494494
495
495
496496
497497
498498
......
676676
677677
678678
679
679680
680681
681682
......
687688
688689
689690
691
692
690693
691
692
693694
694695
695696
{ 0x6899,0xE140174B, CHIP_FAMILY_CYPRESS,"ATI Radeon HD 5850",kUakari},
{ 0x6899,0xE174174B, CHIP_FAMILY_CYPRESS,"ATI Sapphire Radeon HD 5850",kUakari},
{ 0x6899,0xE174174B, CHIP_FAMILY_CYPRESS,"ATI Sapphire Radeon HD 5850",kUakari},
{ 0x6899,0x200A1787, CHIP_FAMILY_CYPRESS,"ATI Radeon HD 5850",kUakari},
{ 0x6899,0x22901787, CHIP_FAMILY_CYPRESS,"ATI Radeon HD 5850",kUakari},
{ 0x6758,0xE1941746, CHIP_FAMILY_TURKS,"AMD Radeon HD 6670",kBulrushes},
{ 0x6759,0x20121787, CHIP_FAMILY_TURKS,"AMD Radeon HD 6570",kPithecia}, // ErmaC
{ 0x6759,0xE193174B, CHIP_FAMILY_TURKS,"AMD Radeon HD 6570",kNull},
{ 0x6760,0x04CC1028, CHIP_FAMILY_CAICOS,"AMD Radeon HD 6490M",kNull},
{ 0x6760,0x1CB21043, CHIP_FAMILY_CAICOS,"AMD Radeon HD 6470M",kNull},
{ 0x6779,0x64501092, CHIP_FAMILY_CAICOS,"AMD Radeon HD 6450",kBulrushes},
{ 0x6779,0xE164174B, CHIP_FAMILY_CAICOS,"AMD Radeon HD 6450",kBulrushes},
{ 0x6779,0xE180174B, CHIP_FAMILY_CAICOS,"AMD Radeon HD 6450",kPithecia}, // ErmaC
{ 0x6779,0xE164174B, CHIP_FAMILY_CAICOS,"AMD Radeon HD 6450",kBulrushes},
/* standard/default models */
{ 0x9400,0x00000000, CHIP_FAMILY_R600,"ATI Radeon HD 2900 XT",kNull},
{ 0x9405,0x00000000, CHIP_FAMILY_R600,"ATI Radeon HD 2900 GT",kNull},
branches/ErmaC/Trunk/i386/boot0/boot0hfs.s
6060
6161
6262
63
64
65
66
67
6368
6469
6570
......
230235
231236
232237
238
239
240
241
233242
234243
235244
......
619628
620629
621630
622
631
623632
624633
625634
......
758767
759768
760769
761
770
762771
772
773
774
775
776
777
778
779
780
781
782
783
763784
764785
765786
766787
767788
789
790
791
792
768793
769794
770795
VERBOSEEQU CONFIG_BOOT0_VERBOSE
;
; Set to 1 to enable unstretch mode
;
UNSTRETCHEQU CONFIG_BOOT0_UNSTRETCH
;
; Various constants.
;
kBoot0SegmentEQU 0x0000
call print_hex
%endif
%if UNSTRETCH
call disable_scaler
%endif
;
; Since this code may not always reside in the MBR, always start by
; loading the MBR to kMBRBuffer and LBA1 to kGPTBuffer.
; DS:SI = pointer to Disk Address Packet
;
; Returns:
; AH = return status (sucess is 0)
; AH = return status (success is 0)
; carry = 0 success
; 1 error
;
ret
%endif ;DEBUG
%if UNSTRETCH
;--------------------------------------------------------------------------
; Disable On-Chip Scaling for nVidia Cards
;
disable_scaler:
mov ax,4F14h ;VESA VBE OEM function
mov bl,2 ;Subfunction 02 = Set Panel Expansion/Centering
mov bh,1 ;00 = Return Current Setting, 01 = Set Centering/Expansion
mov cx,0001h ;Exp. mode: 00 = Scaled, 01 = Centered 1:1, 02 = Left Corner 1:1
int 10h ;call VGA/VBE service
LogString(nv_scaler_str)
ret
%endif
;--------------------------------------------------------------------------
; NULL terminated strings.
;
log_title_strdb 10, 13, 'boot0: ', 0
boot_error_str db 'error', 0
%if UNSTRETCH
nv_scaler_strdb 'Unstretch', 0
%endif ;DEBUG
%if VERBOSE
gpt_strdb 'GPT', 0
test_strdb 'test', 0
branches/ErmaC/Trunk/i386/boot2/boot.c
196196
197197
198198
199
199
200200
201201
202202
......
230230
231231
232232
233
234
233
234
235235
236
236
237237
238238
239239
......
330330
331331
332332
333
333
334334
335335
336336
......
605605
606606
607607
608
608
609609
610
610
611611
612612
613613
finalizeBootStruct();
// Jump to kernel's entry point. There's no going back now.
if (checkOSVersion("10.7")) {
if ((checkOSVersion("10.7")) || (checkOSVersion("10.8"))) {
// 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 {
// Lion prelink kernel cache file
if (checkOSVersion("10.7")) {
// Mountain Lion and Lion prelink kernel cache file
if ((checkOSVersion("10.7")) || (checkOSVersion("10.8"))) {
sprintf(kernelCacheFile, "%skernelcache", kDefaultCachePathSnow);
}
}
// Snow Leopard prelink kernel cache file
else if (checkOSVersion("10.6")) {
sprintf(kernelCacheFile, "kernelcache_%s", (archCpuType == CPU_TYPE_I386)
// Since the kernel cache file exists and is the most recent try to load it
verbose("Loading kernel cache %s\n", kernelCachePath);
if (checkOSVersion("10.7")) {
if ((checkOSVersion("10.7")) || (checkOSVersion("10.8"))) {
ret = LoadThinFatFile(kernelCachePath, binary);
} else {
ret = LoadFile(kernelCachePath);
verbose("Loading Darwin %s\n", gMacOSVersion);
// If boot from boot helper partitions and OS is Lion use prelink kernel.
// If boot from boot helper partitions and OS is Mountain Lion or Lion use prelink kernel.
// We need to find a solution to load extra mkext with a prelink kernel.
if (gBootVolume->flags & kBVFlagBooter && checkOSVersion("10.7"))
if (gBootVolume->flags & kBVFlagBooter && ((checkOSVersion("10.7")) || (checkOSVersion("10.8"))))
useKernelCache = true;
else
useKernelCache = false; // by default don't use prelink kernel cache
branches/ErmaC/Trunk/i386/boot2/gui.c
4343
4444
4545
46
47
4648
4749
4850
......
5355
5456
5557
58
59
5660
5761
5862
......
116120
117121
118122
123
124
119125
120126
121127
......
125131
126132
127133
128
129
130
131
132
133
134
135
134
135
136
137
138
139
140
141
142
143
136144
137145
138146
......
366374
367375
368376
377
378
369379
370380
371381
......
377387
378388
379389
390
391
380392
381393
382394
......
893905
894906
895907
908
909
910
896911
897912
898913
......
915930
916931
917932
933
934
935
918936
919937
920938
iDeviceGeneric_o,
iDeviceHFS,
iDeviceHFS_o,
iDeviceHFS_Mountain,
iDeviceHFS_Mountain_o,
iDeviceHFS_Lion,
iDeviceHFS_Lion_o,
iDeviceHFS_SL,
iDeviceHFS_Tiger_o,
iDeviceHFSRAID,
iDeviceHFSRAID_o,
iDeviceHFSRAID_Mountain,
iDeviceHFSRAID_Mountain_o,
iDeviceHFSRAID_Lion,
iDeviceHFSRAID_Lion_o,
iDeviceHFSRAID_SL,
{.name = "device_hfsplus_o", .image = NULL},
{.name = "device_hfsplus_lion", .image = NULL},
{.name = "device_hfsplus_lion_o", .image = NULL},
{.name = "device_hfsplus_mountain", .image = NULL},
{.name = "device_hfsplus_mountain_o", .image = NULL},
{.name = "device_hfsplus_sl", .image = NULL},
{.name = "device_hfsplus_sl_o", .image = NULL},
{.name = "device_hfsplus_leo", .image = NULL},
{.name = "device_hfsraid", .image = NULL},
{.name = "device_hfsraid_o", .image = NULL},
{.name = "device_hfsraid_lion", .image = NULL},
{.name = "device_hfsraid_lion_o", .image = NULL},
{.name = "device_hfsraid_sl", .image = NULL},
{.name = "device_hfsraid_sl_o", .image = NULL},
{.name = "device_hfsraid_leo", .image = NULL},
{.name = "device_hfsraid_leo_o", .image = NULL},
{.name = "device_hfsraid_tiger", .image = NULL},
{.name = "device_hfsraid_tiger_o", .image = NULL},
{.name = "device_hfsraid_lion", .image = NULL},
{.name = "device_hfsraid_lion_o", .image = NULL},
{.name = "device_hfsraid_mountain", .image = NULL},
{.name = "device_hfsraid_mountain_o", .image = NULL},
{.name = "device_hfsraid_sl", .image = NULL},
{.name = "device_hfsraid_sl_o", .image = NULL},
{.name = "device_hfsraid_leo", .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_hfsplus_o, iDeviceHFS);
LOADPNG(device_hfsplus_lion, iDeviceHFS_Lion);
LOADPNG(device_hfsplus_lion_o, iDeviceHFS_Lion_o);
LOADPNG(device_hfsplus_mountain, iDeviceHFS_Mountain);
LOADPNG(device_hfsplus_mountain_o, iDeviceHFS_Mountain_o);
LOADPNG(device_hfsplus_sl, iDeviceHFS_SL);
LOADPNG(device_hfsplus_sl_o, iDeviceHFS_SL_o);
LOADPNG(device_hfsplus_leo, iDeviceHFS_Leo);
LOADPNG(device_hfsraid_o, iDeviceHFSRAID);
LOADPNG(device_hfsraid_lion, iDeviceHFSRAID_Lion);
LOADPNG(device_hfsraid_lion_o, iDeviceHFSRAID_Lion_o);
LOADPNG(device_hfsraid_mountain, iDeviceHFSRAID_Mountain);
LOADPNG(device_hfsraid_mountain_o, iDeviceHFSRAID_Mountain_o);
LOADPNG(device_hfsraid_sl, iDeviceHFSRAID_SL);
LOADPNG(device_hfsraid_sl_o, iDeviceHFSRAID_SL_o);
LOADPNG(device_hfsraid_leo, iDeviceHFSRAID_Leo);
if (device->flags & kBVFlagBooter) {
switch (device->OSVersion[3]) {
case '8':
devicetype = is_image_loaded(iDeviceHFSRAID_Mountain) ? iDeviceHFSRAID_Mountain : is_image_loaded(iDeviceHFSRAID) ? iDeviceHFSRAID : iDeviceGeneric;
break;
case '7':
devicetype = is_image_loaded(iDeviceHFSRAID_Lion) ? iDeviceHFSRAID_Lion : is_image_loaded(iDeviceHFSRAID) ? iDeviceHFSRAID : iDeviceGeneric;
break;
{
switch (device->OSVersion[3]) {
case '8':
devicetype = is_image_loaded(iDeviceHFS_Mountain) ? iDeviceHFS_Mountain : is_image_loaded(iDeviceHFS) ? iDeviceHFS : iDeviceGeneric;
break;
case '7':
devicetype = is_image_loaded(iDeviceHFS_Lion) ? iDeviceHFS_Lion : is_image_loaded(iDeviceHFS) ? iDeviceHFS : iDeviceGeneric;
break;

Archive Download the corresponding diff file

Revision: 1820