Chameleon

Chameleon Commit Details

Date:2010-08-18 06:11:26 (13 years 8 months ago)
Author:Azimutz
Commit:380
Parents: 379
Message:Returning some stuff from CleanCut commits, for my sanity sake... Changed DisplayInfo key to DebugInfo and don't let it draw when Boot Banner=n is set.
Changes:
M/branches/azimutz/Chazileon/i386/boot2/drivers.c
M/branches/azimutz/Chazileon/i386/libsaio/acpi_patcher.c
M/branches/azimutz/Chazileon/doc/BootHelp.txt
M/branches/azimutz/Chazileon/i386/boot2/graphics.c
M/branches/azimutz/Chazileon/i386/libsaio/saio_types.h
M/branches/azimutz/Chazileon/i386/libsaio/msdos.c
M/branches/azimutz/Chazileon/i386/boot2/boot.c
M/branches/azimutz/Chazileon/i386/boot2/gui.c
M/branches/azimutz/Chazileon/i386/libsaio/fake_efi.c
M/branches/azimutz/Chazileon/i386/libsaio/disk.c
M/branches/azimutz/Chazileon/i386/boot2/boot.h
M/branches/azimutz/Chazileon/i386/libsaio/pci_setup.c
M/branches/azimutz/Chazileon/i386/libsaio/ati.c
M/branches/azimutz/Chazileon/i386/boot2/options.c
M/branches/azimutz/Chazileon/i386/libsaio/stringTable.c

File differences

branches/azimutz/Chazileon/doc/BootHelp.txt
4444
4545
4646
47
47
48
4849
4950
5051
?norescan Leaves optical drive rescan mode.
Additional useful command-line options:
config=<file> Use an alternate Boot.plist file.
config=<file> Use an alternate Boot.plist file.
kext=<folder> Use an alternate folder with drivers, kext or mkext.
Options useful in the com.apple.Boot.plist file:
Wait=Yes|No Prompt for a key press before starting the kernel.
branches/azimutz/Chazileon/i386/libsaio/acpi_patcher.c
9292
9393
9494
95
95
9696
97
98
97
98
99
99100
100101
101102
102
103
103
104
105
104106
105
107
106108
107109
108110
109111
110112
111
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
112138
139
140
113141
114142
115143
116144
145
117146
118147
119148
120149
121
122
150
123151
124152
125153
126154
127
128
129
130
155
131156
132157
133158
134159
135160
136
137
161
162
163
138164
139
140165
166
141167
142168
143169
170
144171
145172
146173
......
591618
592619
593620
594
595
596
597
621
622
623
624
625
626
627
628
598629
599630
600631
}
/** The following ACPI Table search algo, should be reused anywhere needed: */
int search_and_get_acpi_fd(const char * filename, const char ** outDirspec) //Azi:searchalgo
int search_and_get_acpi_fd(const char * filename, const char ** outDirspec)
{
chardirSpecDSDT[128] = ""; //Azi:alloc - was 512
const char *override_pathname = NULL;
static bool first_time = true;
static chardirSpecDSDT[128] = "";
const char *override_pathname = NULL; // full path to a file.
intlen = 0, fd = 0;
extern char gMacOSVersion;
// Take in account user overriding
if (getValueForKey(kDSDTKey, &override_pathname, &len, &bootInfo->bootConfig))
// Take in account user overriding if it's DSDT only
if (strstr(filename, "DSDT") &&
getValueForKey(kDSDTKey, &override_pathname, &len, &bootInfo->bootConfig))
{
// Specify a path to a file, e.g. /Extra/test.aml
// Specify a path to a file, e.g. DSDT=/Extra/test.aml
sprintf(dirSpecDSDT, override_pathname);
fd = open(dirSpecDSDT, 0);
if (fd >= 0) goto success_fd;
}
// Check drivers.c, LoadDrivers, for more comments on these.
// Check that dirSpecDSDT is not already assigned with a path
if (!first_time && *dirSpecDSDT)
{ // it is so start searching this cached patch first
//extract path
for (len = strlen(dirSpecDSDT)-1; len; len--)
{
if (dirSpecDSDT[len] == '/' || len == 0)
{
dirSpecDSDT[len] = '\0';
break;
}
}
// now concat with the filename
strncat(dirSpecDSDT, "/", sizeof(dirSpecDSDT));
strncat(dirSpecDSDT, filename, sizeof(dirSpecDSDT));
// and test to see if we don't have our big boy here:
fd = open(dirSpecDSDT,0);
if (fd >= 0)
{
printf("ACPI file search cache hit: file found at %s\n", dirSpecDSDT);
goto success_fd;
}
}
// Start searching any potential location for ACPI Table
// Check rd's root.
sprintf(dirSpecDSDT, "rd(0,0)/%s", filename);
fd = open(dirSpecDSDT, 0);
if (fd >= 0) goto success_fd;
// Check booter volume/rdbt for OS specific folders.
sprintf(dirSpecDSDT, "bt(0,0)/Extra/%s/%s", &gMacOSVersion, filename);
fd = open(dirSpecDSDT, 0);
if (fd >= 0) goto success_fd;
// Removed /Extra path from search algo. If needed can be specified on override key!
// Check booter volume/rdbt Extra.
sprintf(dirSpecDSDT, "bt(0,0)/Extra/%s", filename);
fd = open(dirSpecDSDT, 0);
if (fd >= 0) goto success_fd;
// Add helper partitions??
// Azi: ok, one gone.. let's kill this one too?
// All "config" files go in Extra!
//Azi: All loaded files stay in Extra.. please!? :)
//sprintf(dirspec, "/%s", filename); // search root
//fd=open (dirspec,0);
//if (fd>=0) goto success_fd;
// NOT FOUND:
//Azi: handling this only on pci_root.c, getPciRootUID() (it's enough to check if .aml file exists),
// to reduce number of printed messages and the confusion caused by them on users.
//Azi: a reminder - handling this verbose only on pci_root.c, getPciRootUID()
// (it's enough to check if *.aml file exists), to reduce number of printed messages
// and the confusion caused by them on users.
//verbose("ACPI Table not found: %s\n", filename);
if (outDirspec) *outDirspec = "";
first_time = false;
return -1;
// FOUND
success_fd:
first_time = false;
if (outDirspec) *outDirspec = dirSpecDSDT;
return fd;
}
const char * value;
// Restart Fix
if (Platform.CPU.Vendor == 0x756E6547) {/* Intel */
fix_restart = false; //Azi: I'm on Intel and i don't need this enabled by default!?
getBoolForKey(kRestartFixKey, &fix_restart, &bootInfo->bootConfig);
} else {
if (Platform.CPU.Vendor == 0x756E6547) // Intel
{
fix_restart = false; //Azi: think this should be false by default!?
// On the other hand, i could use a shutdown fix now and then :)
getBoolForKey(kRestartFix, &fix_restart, &bootInfo->bootConfig);
}
else
{
verbose ("Not an Intel platform: Restart Fix not applied !!!\n");
fix_restart = false;
}
branches/azimutz/Chazileon/i386/libsaio/ati.c
432432
433433
434434
435
435
436436
437437
438438
......
637637
638638
639639
640
640
641641
642642
643643
......
662662
663663
664664
665
665
666666
667667
668668
......
739739
740740
741741
742
742
743743
744744
745745
746746
747747
748
748
749749
750750
751751
......
758758
759759
760760
761
761
762762
763763
764764
if (!device || !ati_dev) {
return 0;
}
printf("dumping pci config space, 256 bytes\n");
printf("dumping pci config space, 256 bytes\n"); //Azi:ATI
config_space = malloc(256);
for (i=0; i<=255; i++) {
config_space[i] = pci_config_read8( ati_dev->dev.addr, i);
devicepath = get_pci_dev_path(ati_dev);
cmd = pci_config_read8(ati_dev->dev.addr, 4);
verbose("old pci command - %x\n", cmd);
verbose("old pci command - %x\n", cmd); //Azi:ATI - old pci command - 7
if (cmd == 0) {
pci_config_write8(ati_dev->dev.addr, 4, 6);
cmd = pci_config_read8(ati_dev->dev.addr, 4);
} else {
boot_display = 0;
}
verbose("boot display - %x\n", boot_display);
verbose("boot display - %x\n", boot_display); //Azi:ATI - boot display - 1
devprop_add_value(device, "@0,AAPL,boot-display", (uint8_t*)&boot_display, 4);
if((framebuffer[0] == 'M' && framebuffer[1] == 'o' && framebuffer[2] == 't') ||
if (bios == NULL) {
bios = (uint8_t *)0x000C0000;
toFree = false;
verbose("Not going to use bios image file\n");
verbose("Not going to use bios image file\n"); //Azi: No bios image provided by user!?
} else {
toFree = true;
}
if (bios[0] == 0x55 && bios[1] == 0xaa) {
printf("Found bios image\n");
printf("Found bios image\n"); //Azi: found image on card.
bios_size = bios[2] * 512;
struct pci_rom_pci_header_t *rom_pci_header;
if (toFree) {
verbose("Adding binimage to card %x from mmio space with size %x\n", ati_dev->device_id, bios_size);
} else {
verbose("Adding binimage to card %x from legacy space with size %x\n", ati_dev->device_id, bios_size);
verbose("Adding binimage to card %x from legacy space with size %x\n", ati_dev->device_id, bios_size); //Azi:ATI
}
devprop_add_value(device, "ATY,bin_image", bios, bios_size);
}
branches/azimutz/Chazileon/i386/libsaio/disk.c
7777
7878
7979
80
8180
8281
8382
#include "efi.h"
#include "efi_tables.h"
#define BPS 512 /* sector size of the device */
#define PROBEFS_SIZE BPS * 4 /* buffer size for filesystem probe */
#define CD_BPS 2048 /* CD-ROM block size */
#define N_CACHE_SECS (BIOS_LEN / BPS) /* Must be a multiple of 4 for CD-ROMs */
branches/azimutz/Chazileon/i386/libsaio/pci_setup.c
4545
4646
4747
48
48
4949
5050
5151
{
case PCI_VENDOR_ID_ATI:
verbose("ATI VGA Controller [%04x:%04x] :: %s \n",
current->vendor_id, current->device_id, devicepath);
current->vendor_id, current->device_id, devicepath); //Azi:ATI - correct.
setup_ati_devprop(current);
break;
branches/azimutz/Chazileon/i386/libsaio/stringTable.c
611611
612612
613613
614
615
616614
617615
618616
......
654652
655653
656654
657
655
658656
659
660
657
658
661659
662660
663661
664
665
666
667
668
669
670
671
672
662
673663
674
664
675665
676
677
678
666
667
668
679669
680670
681
682
683
684
685
671
672
673
674
686675
687
688
689
690
676
677
678
679
691680
692
693
694
681
682
683
695684
696
697
698
699
700
685
686
687
688
689
690
701691
692
702693
703694
704695
705696
706697
707
698
708699
709700
710701
......
715706
716707
717708
718
719709
720710
721711
*/
int loadSystemConfig(config_file_t *config) //Azi:searchalgo???
{
//Azi: Called from boot.c, commonBoot (firstrun).
// DEFAULT Boot.plist paths. These are checked before getting to boot prompt.
char *dirspec[] = {
//"/Extra/com.apple.Boot.plist", removed in favor of bt(0,0) - review? only needed to load it from selected volume.
"bt(0,0)/Extra/com.apple.Boot.plist",
* Returns 0 - successful.
* -1 - unsuccesful.
*/
int loadOverrideConfig(config_file_t *config) //Azi:searchalgo
int loadOverrideConfig(config_file_t *config)
{
char dirSpecExtraBplist[128] = ""; //Azi:alloc
const char*override_pathfile = NULL;
char dirSpecBplist[128] = "";
const char*override_pathname = NULL;
const char*filename = "com.apple.Boot.plist";
int count, ret, fd, len = 0;
extern char gMacOSVersion;
//Azi: This Override stuff messed with my mind a lot of times; was totally unaware of it. Payback time!! :)
// Called from options.c, processBootOptions and boot.c, commonBoot (secondrun).
// OVERRIDE Boot.plist paths. These are checked after we press Enter to boot a System; a Boot.plist found
// on these paths is parsed and keys on it are compared with the ones on the default Boot.plist.
// Keys that have different values, will override the default ones.
// Keys that are not present on the default Boot.plist will be used with existing ones.
// Take in account user overriding the override :P
if (getValueForKey(kTestConfigKey, &override_pathfile, &len, &bootInfo->bootConfig))
if (getValueForKey(kTestConfigKey, &override_pathname, &len, &bootInfo->bootConfig))
{
// Specify a path to a file, e.g. /Extra/test.plist
strcpy(dirSpecExtraBplist, override_pathfile);
fd = open(dirSpecExtraBplist, 0);
// Specify a path to a file, e.g. config=/Extra/test.plist
strcpy(dirSpecBplist, override_pathname);
fd = open(dirSpecBplist, 0);
if (fd >= 0) goto success_fd;
}
// Check drivers.c, LoadDrivers, for more comments on these.
sprintf(dirSpecExtraBplist, "rd(0,0)/%s", filename);
fd = open(dirSpecExtraBplist, 0);
// Check rd's root for override config.
sprintf(dirSpecBplist, "rd(0,0)/%s", filename);
fd = open(dirSpecBplist, 0);
if (fd >= 0) goto success_fd;
// gMacOSVersion "wasn't" set at this point; check function call on boot.c/options.c.
sprintf(dirSpecExtraBplist, "bt(0,0)/Extra/%s/%s", &gMacOSVersion, filename);
fd = open(dirSpecExtraBplist, 0);
// Check OS specific folders.
sprintf(dirSpecBplist, "bt(0,0)/Extra/%s/%s", &gMacOSVersion, filename);
fd = open(dirSpecBplist, 0);
//if (fd >= 0) goto success_fd;
// These will just reload the DEFAULT Boot.plist!! Maybe we should use a diff name for this override plist??
// "/Extra/com.apple.Boot.plist",
//Azi: i really don't like these two!
// "/Extra/com.apple.Boot.plist"
// "/Library/Preferences/SystemConfiguration/com.apple.Boot.plist"
// I have no way to test these; need advice!
// "/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);
// These i have no way to test, need advice.
// "/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)
success_fd:
if (fd >= 0)
{
// read file
count = read(fd, config->plist, IO_CONFIG_DATA_SIZE);
close(fd);
// build xml dictionary
ParseXMLFile(config->plist, &config->dictionary);
sysConfigValid = true;
printf("No override config provided!\n");
ret = -1;
}
return ret;
}
branches/azimutz/Chazileon/i386/libsaio/saio_types.h
148148
149149
150150
151
151152
152153
153154
char * i_buf; /* file load address */
};
#define BPS 512 /* sector size of the device */
#define F_READ 0x1 /* file opened for reading */
#define F_WRITE 0x2 /* file opened for writing */
#define F_ALLOC 0x4 /* buffer allocated */
branches/azimutz/Chazileon/i386/libsaio/msdos.c
5454
5555
5656
57
58
57
5958
6059
6160
......
152151
153152
154153
155
154
156155
157156
158157
......
222221
223222
224223
225
226
224
225
227226
228227
229228
230229
231230
232
231
233232
234
235
236
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
237250
238
239
240
241
242
243
251
244252
245253
246254
......
279287
280288
281289
282
290
291
283292
284293
285294
......
289298
290299
291300
292
301
293302
294303
295304
#include "msdos.h"
#define LABEL_LENGTH11
#define MAX_DOS_BLOCKSIZE2048
#define MAX_CACHE_BLOCKSIZE 32768
#define MSDOS_CACHE_BLOCKSIZE BPS * 2
#defineCLUST_FIRST2/* reserved cluster range */
#defineCLUST_RSRVD320x0ffffff8/* reserved cluster range */
if (msdoscurrent == ih)
{
CacheInit(ih, msdosclustersize);
CacheInit(ih, MSDOS_CACHE_BLOCKSIZE);
return 0;
}
msdosclustersize = msdosbps * spc;
msdoscurrent = ih;
CacheInit(ih, msdosclustersize);
CacheInit(ih, MSDOS_CACHE_BLOCKSIZE);
free (buf);
return 0;
}
static int
readSectorAligned(CICell ih, off_t readOffset, char *buf, int size)
readSector(CICell ih, off_t readOffset, char *buf, int size)
{
long long sectorOffset = (uint64_t)readOffset / msdosclustersize * msdosclustersize;
long relOffset = readOffset % msdosclustersize;
char *cacheBuffer;
// Caching only FAT entries (4 bytes) by utlizing the cache with sector aligned read requests.
if (size < BPS)
{
long long sectorOffset = (uint64_t)readOffset / BPS * BPS;
long relOffset = readOffset % BPS;
char *cacheBuffer;
cacheBuffer = malloc(MSDOS_CACHE_BLOCKSIZE);
CacheRead(ih, cacheBuffer, sectorOffset, MSDOS_CACHE_BLOCKSIZE, true);
bcopy(cacheBuffer + relOffset, buf, size);
free(cacheBuffer);
}
else
{
Seek(ih, readOffset);
Read(ih, (long)buf, size);
}
cacheBuffer = malloc(msdosclustersize);
CacheRead(ih, cacheBuffer, sectorOffset, msdosclustersize, true);
bcopy(cacheBuffer + relOffset, buf, size);
free(cacheBuffer);
return 0;
return 0;
}
static int
/* Read in "cluster" */
if (buf)
{
readSectorAligned(ih, readOffset, (char *)buf, size);
Seek(ih, readOffset);
Read(ih, (long)buf, size);
}
/* Find first sector of FAT */
readOffset += ((uint64_t)*cluster * (uint64_t)msdosfatbits) / 8;
/* Read one sector of the FAT */
readSectorAligned(ih, readOffset, tmpbuf, 4);
readSector(ih, readOffset, tmpbuf, 4);
switch (msdosfatbits) {
case 32:
branches/azimutz/Chazileon/i386/libsaio/fake_efi.c
273273
274274
275275
276
277
278
279
280
281
282
283
284276
285277
286278
......
633625
634626
635627
636
628
637629
638
639
630
631
640632
641633
642634
643635
644636
645
637
646638
647
648
649
639
640
641
650642
651643
652644
653
654
655
656
645
646
647
657648
658649
659
660
650
651
652
661653
662654
663
664
665
666
655
656
657
667658
668659
669
660
670661
671
662
672663
673664
674665
void setupEfiTables64(void) //Azi:efi32/64
{
// We use the fake_efi_pages struct so that we only need to do one kernel
// memory allocation for all needed EFI data. Otherwise, small allocations
// like the FIRMWARE_VENDOR string would take up an entire page.
// NOTE WELL: Do NOT assume this struct has any particular layout within itself.
// It is absolutely not intended to be publicly exposed anywhere
// We say pages (plural) although right now we are well within the 1 page size
// and probably will stay that way.
struct fake_efi_pages
{
EFI_SYSTEM_TABLE_64 efiSystemTable;
* Load the smbios.plist override config file if any
*/
static void setupSmbiosConfigFile(const char * filename) //Azi:searchalgo
static void setupSmbiosConfigFile(const char *filename)
{
chardirSpecExtraSmbios[128] = ""; //Azi:alloc
const char *override_pathfile = NULL;
chardirSpecSMBIOS[128] = "";
const char *override_pathname = NULL;
intlen = 0, fd = 0;
extern char gMacOSVersion;
extern void scan_mem();
// Take in account user overriding
if (getValueForKey(kSMBIOSKey, &override_pathfile, &len, &bootInfo->bootConfig))
if (getValueForKey(kSMBIOSKey, &override_pathname, &len, &bootInfo->bootConfig))
{
// Specify a path to a file, e.g. /Extra/test.plist
sprintf(dirSpecExtraSmbios, override_pathfile);
fd = loadConfigFile(dirSpecExtraSmbios, &bootInfo->smbiosConfig);
// Specify a path to a file, e.g. SMBIOS=/Extra/macProXY.plist
sprintf(dirSpecSMBIOS, override_pathname);
fd = loadConfigFile(dirSpecSMBIOS, &bootInfo->smbiosConfig);
if (fd >= 0) goto success_fd;
}
// Check drivers.c, LoadDrivers, for more comments on these.
sprintf(dirSpecExtraSmbios, "rd(0,0)/%s", filename);
fd = loadConfigFile(dirSpecExtraSmbios, &bootInfo->smbiosConfig);
// Check rd's root.
sprintf(dirSpecSMBIOS, "rd(0,0)/%s", filename);
fd = loadConfigFile(dirSpecSMBIOS, &bootInfo->smbiosConfig);
if (fd >= 0) goto success_fd;
sprintf(dirSpecExtraSmbios, "bt(0,0)/Extra/%s/%s", &gMacOSVersion, filename);
fd = loadConfigFile(dirSpecExtraSmbios, &bootInfo->smbiosConfig);
// Check booter volume/rdbt for OS specific folders.
sprintf(dirSpecSMBIOS, "bt(0,0)/Extra/%s/%s", &gMacOSVersion, filename);
fd = loadConfigFile(dirSpecSMBIOS, &bootInfo->smbiosConfig);
if (fd >= 0) goto success_fd;
// Removed /Extra path from search algo. If needed can be specified on override key!
sprintf(dirSpecExtraSmbios, "bt(0,0)/Extra/%s", filename);
fd = loadConfigFile(dirSpecExtraSmbios, &bootInfo->smbiosConfig);
// Check booter volume/rdbt Extra.
sprintf(dirSpecSMBIOS, "bt(0,0)/Extra/%s", filename);
fd = loadConfigFile(dirSpecSMBIOS, &bootInfo->smbiosConfig);
if (fd >= 0) goto success_fd;
if (loadConfigFile(dirSpecExtraSmbios, &bootInfo->smbiosConfig) == -1)
if (loadConfigFile(dirSpecSMBIOS, &bootInfo->smbiosConfig) == -1)
{
verbose("No SMBIOS replacement found\n");
verbose("No SMBIOS replacement provided.\n");
}
// get a chance to scan mem dynamically if user asks for it while having the config options loaded as well,
branches/azimutz/Chazileon/i386/boot2/graphics.c
370370
371371
372372
373
373
374
374375
375376
376377
......
474475
475476
476477
478
479
477480
478481
479482
480483
481
482
484
485
483486
484487
485488
unsigned char bitsPerPixel,
unsigned short refreshRate )
{
bool displayInfo = false; //Azi:displayinfo
bool debugInfo = false; //Azi:displayinfo
extern bool showBootBanner; //||
VBEModeInfoBlock minfo;
unsigned short mode;
unsigned short vesaVersion;
bootArgs->Video.v_rowBytes = minfo.BytesPerScanline;
bootArgs->Video.v_baseAddr = VBEMakeUInt32(minfo.PhysBasePtr);
getBoolForKey(kDebugInfoKey, &debugInfo, &bootInfo->bootConfig); //Azi:displayinfo - gui.c, drawDeviceList.
#if AUTORES_DEBUG
gui.screen.mm = minfo.MemoryModel;
gui.screen.attr = minfo.ModeAttributes;
#endif
getBoolForKey(kDisplayInfoKey, &displayInfo, &bootInfo->bootConfig); //Azi:displayinfo - gui.c, drawDeviceList.
if (displayInfo == true)
if (debugInfo && showBootBanner)
{
gui.screen.mm = minfo.MemoryModel;
gui.screen.attr = minfo.ModeAttributes;
branches/azimutz/Chazileon/i386/boot2/boot.c
182182
183183
184184
185
186
187
188
189
190
185
186
187
191188
192
189
193190
194191
195192
......
399396
400397
401398
402
399
403400
404401
405402
......
413410
414411
415412
416
417
418
419
420
413
414
415
416
417
418
419
420
421
421422
422423
423
424
425
426
427
428
429
430
431
432
433
434424
435425
436426
......
503493
504494
505495
506
507496
508497
509498
510
511
512
513
514
515
516
517
499
500
501
502
503
518504
519505
520
521
506
507
522508
523509
524
525
526
527
528
529
530
531
510
532511
533512
534513
535514
536
515
537516
538517
539518
......
624603
625604
626605
627
606
628607
629608
630609
bool dummyVal;
//Azi: Wait=y or any other pause makes my boot hang here, when using UHCIReset fix.
// (see graphics.c 432, AUTORES_DEBUG/patch). (fixed with usb_loop)
// It's also breaking other keys when typed "after them" at boot prompt.
// Works properly if Wait=y is typed in first place or used on Boot.plist.
if (getBoolForKey(kWaitForKeypressKey, &dummyVal, &bootInfo->bootConfig) && dummyVal) {
//Azi: Wait=y is breaking other keys when typed "after them" at boot prompt.
// Works properly if typed in first place or used on Boot.plist.
if (getBoolForKey(kWaitForKeypressKey, &dummyVal, &bootInfo->bootConfig) && dummyVal) {
pause();
}
}
usb_loop();
void*binary = (void *)kLoadAddr;
config_file_t systemVersion;// system.plist of booting partition - Azi:sysversion
charsysVersion[8]; // replaces gMacOSVersion here, for now.
char osxVersion[8]; // replaces gMacOSVersion here, for now.
// additional variable for testing alternate kernel image locations on boot helper partitions.
charbootFileSpec[512]; //Azi:HelperConfig - kernel
firstRun = false;
if ( status == -1 ) continue;
//Azi:sysversion related test
if( bootArgs->Video.v_display == GRAPHICS_MODE )
{
gui.devicelist.draw = false; // Needed for when the verbose flips the screen.
drawBackground();
//Azi: doing this earlier to get the verbose from loadOverrideConfig.
// Draw background, turn off any GUI elements and update VRAM.
if ( bootArgs->Video.v_display == GRAPHICS_MODE )
{
drawBackground(); // order matters!!
gui.devicelist.draw = false; // Needed when verbose "flips" the screen.
gui.bootprompt.draw = false; // ?
gui.menu.draw = false; // ?
gui.infobox.draw = false; // We can't boot with this drawn; most probably it's not needed!?
updateVRAM();
}
// Turn off any GUI elements
/*if ( bootArgs->Video.v_display == GRAPHICS_MODE )
{
gui.devicelist.draw = false;
gui.bootprompt.draw = false; // doesn't seem needed
gui.menu.draw = false; // same as above
gui.infobox.draw = false; // Enter doesn't work with this drawn so...
drawBackground();
updateVRAM(); // don't know about this
}*/
//Azi:autoresolution begin
/*
}
// Other status (e.g. 0) means that we should proceed with boot.
// Found and loaded a config file (Azi: not mandatory anymore).
//Azi:autoresolution old - testing
// Find out which version mac os we're booting. Azi:sysversion
// To avoid call loadOverrideConfig from here too and since moving this before calling
// processBootOptions() (which worked on a brief test) doesn't make sense,
// tried to move it to processBootOptions() on options.c (check there).
if (!loadConfigFile("/System/Library/CoreServices/SystemVersion.plist", &systemVersion))
{ //Azi: shouldn't this path start with / ?
if (getValueForKey(kProductVersion, &val, &len, &systemVersion))
{
//Azi: still calling this here. The call on processBootOptions() gets hidden from verbose and
// for some reason gMacOSVersion doesn't get initialized on boot.c like on the others. Later...
// Find out which version mac os we're booting.
if (!loadConfigFile("System/Library/CoreServices/SystemVersion.plist", &systemVersion)) {
if (getValueForKey(kProductVersion, &val, &len, &systemVersion)) {
// getValueForKey uses const char for val
// so copy it and trim
strncpy(sysVersion, val, MIN(len, 4));
sysVersion[MIN(len, 4)] = '\0';
strncpy(osxVersion, val, MIN(len, 4));
osxVersion[MIN(len, 4)] = '\0';
}
}
//Azi:sysversion - gMacOSVersion is only initialized above so, this call is only to get
// system version so we can override Boot.plist from specific OS folders; another plus is verbose.
// It seems to work fine though i'm not sure how sane is to call it twice?!
// Can't be called only from here! Need advice. Check above.
//loadOverrideConfig(&bootInfo->overrideConfig); // call 2
//Azi: default to x86_64 arch
// If cpu doesn't handle 64 bit instructions,...
if (!platformCPUFeature(CPU_FEATURE_EM64T) ||
// ... user forced i386 kernel architecture on cpu with "em64t"...
getValueForKey(kArchI386Flag, &val, &len, &bootInfo->bootConfig) ||
// ... or forced Legacy Mode... (not needed! but handy for some processors/situations)
// ... or forced Legacy Mode...
getValueForKey(kLegacyModeFlag, &val, &len, &bootInfo->bootConfig))
{
// ... use i386 kernel arch.
(gMKextName[0] == '\0') &&
(gBootKernelCacheFile[0] != '\0'));
verbose("Loading Darwin %s\n", sysVersion); //Azi:sysversion
verbose("Loading Darwin %s\n", osxVersion); //Azi:sysversion
if (trycache) do
{
branches/azimutz/Chazileon/i386/boot2/boot.h
4747
4848
4949
50
5150
5251
5352
......
105104
106105
107106
108
107
109108
110109
111110
......
181180
182181
183182
184
183
185184
186185
187186
#define kPlatformKey"platform"// options.c, processBootArgumentremoved, says on comment
#define kACPIKey"acpi"//not in use, afaics
#define kPCIRootUIDKey"PCIRootUID"// pci_root.c, getValFKremoved by me
#define k32BitModeFlag"-x32" // boot.c, getValFKremoved by me
"-pci0"// pci_root.c, getValFKremoved by me
"-pci1"// pci_root.c, getValFKremoved by me
#define kThemeNameKey"Theme"// gui.c, getValFKoverride default name
#define kGUIKey"GUI"// * boot.c, getBollFK
#define kBootBannerKey"Boot Banner"// * options.c, getBollFK
#define kDisplayInfoKey"DisplayInfo"// #gui.c, graphics.c, getBollFK
#define kDebugInfoKey"DebugInfo"// #gui.c, graphics.c, getBollFK
#define kGraphicsModeKey"Graphics Mode"// * graphics.c, getNumberArrayFromProperty
#define kCDROMPromptKey"CD-ROM Prompt"// options.c, getValFK
#define kCDROMOptionKey"CD-ROM Option Key"// options.c, getIntFK & getValFK
#define kSafeModeFlag"-x"// * options.c, getValueFBK (5) & getValFK
#define kSingleUserModeFlag"-s"// * options.c, getValFK
#define kIgnoreBootFileFlag"-F"// * options.c, getValFBK
// Can't remember if i ever tried -F; had an idea.. make this point to kTestConfigFileKey,
// Can't remember if i ever tried -F; had an idea.. make this point to kTestConfigKey,
// kind of a -config key.. like if "if you have a messed up config file" use -F to ignore it
// and use a "safe default one".. investigate
branches/azimutz/Chazileon/i386/boot2/drivers.c
159159
160160
161161
162
162
163163
164
165
164
165
166166
167
167
168168
169169
170170
......
179179
180180
181181
182
183
184
182
183
184
185185
186186
187187
188188
189189
190190
191
191
192192
193193
194194
195195
196196
197
198
199
200
201
197
198
199
202200
203201
204202
205
206
207
208
209
203
204
205
206
207
210208
211209
212210
213211
214
212
215213
216
214
217215
218216
219217
......
235233
236234
237235
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
254252
255253
256254
257255
258
256
259257
260258
261259
//==========================================================================
// LoadDrivers
long LoadDrivers( char * dirSpec ) //Azi:searchalgo
long LoadDrivers( char * dirSpec )
{
chardirSpecExtra[128]; //Azi:alloc - was 1024 - just testing
const char *override_pathfolder = NULL;
char dirSpecExtra[128];
const char *override_pathfolder = NULL; // full path to a folder.
intfd = 0, len = 0;
extern char gMacOSVersion; // moved here, only function were it's used.
extern char gMacOSVersion;
if ( InitDriverSupport() != 0 )
return 0;
{
if (NetLoadDrivers(dirSpec) != 0)
{
error("Could not load drivers from the network\n");
return -1;
}
error("Could not load drivers from the network\n");
return -1;
}
}
else if ( gBootFileType == kBlockDeviceType )
{
// Take in account user overriding.
if (getValueForKey(kExtensionsKey, &override_pathfolder, &len, &bootInfo->bootConfig))
{
// Specify a path to a folder ending with /, e.g. /Extra/testkext/
// Specify a path to a folder, ending with / e.g. kext=/Extra/testkext/
strcpy(dirSpecExtra, override_pathfolder);
fd = FileLoadDrivers(dirSpecExtra, 0);
if (fd >= 0) goto success_fd;
}
// Assuming we are using "only", bt(0,0) (booter partition) + specific OS folders + ramdisks
// to store and load files, things can be as simple as this:
// If there is a ramdisk mounted that's not aliased as bt(0,0), check it's "root".
strcpy(dirSpecExtra, "rd(0,0)/"); // A little change on the path ;)
// No need to specify (gRAMDiskVolume && !gRAMDiskBTAliased).
// First try to load Extra extensions from a ramdisk if isn't aliased as bt(0,0).
strcpy(dirSpecExtra, "rd(0,0)/"); // check it's "root".
fd = FileLoadDrivers(dirSpecExtra, 0);
if (fd >= 0) goto success_fd;
// Checking paths on a ramdisk aliased as bt(0,0) (ramdiskbt), is the same as checking paths
// on boot volume so, no need to specify (gRAMDiskVolume && gRAMDiskBTAliased);
// in this case the following two rule.
// Check booter volume/ramdiskbt Extra for specific OS files, on specific OS folders.
// Also no need to specify (gRAMDiskVolume && gRAMDiskBTAliased); checking paths on a
// ramdisk aliased as bt(0,0) (rdbt), is the same as checking paths on booter volume.
// In this case the following two apply.
// Check booter volume/rdbt Extra for specific OS files, on specific OS folders.
sprintf(dirSpecExtra, "bt(0,0)/Extra/%s/", &gMacOSVersion);
fd = FileLoadDrivers(dirSpecExtra, 0);
if (fd >= 0) goto success_fd;
// Removed /Extra path from search algo. If needed can be specified on override key! test again!!!
// Removed /Extra path from search algo. If needed can be specified with override key!
// Check booter volume/ramdiskbt Extra in case we don't keep specific OS folders.
// Check booter volume/rdbt Extra in case we don't keep specific OS folders.
strcpy(dirSpecExtra, "bt(0,0)/Extra/");
fd = FileLoadDrivers(dirSpecExtra, 0);
if (fd >= 0) goto success_fd;
success_fd:
if (gMKextName[0] != '\0') // System drivers
{
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);
}
}
if (gMKextName[0] != '\0')
{
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
{
return 0;
}
MatchPersonalities();
MatchLibraries();
branches/azimutz/Chazileon/i386/boot2/gui.c
674674
675675
676676
677
677
678678
679679
680680
......
813813
814814
815815
816
817
818
816
817
818
819
819820
820821
821822
......
873874
874875
875876
876
877
877878
878879
879
880
880881
881882
882
883
883884
884885
885886
......
18511852
18521853
18531854
1854
1855
18551856
18561857
18571858
......
18641865
18651866
18661867
1867
1868
18681869
18691870
18701871
......
18771878
18781879
18791880
1880
1881
18811882
18821883
18831884
/*
* AutoResolution
*/
if (gAutoResolution == TRUE)
if (gAutoResolution == true)
{
// Get Resolution from Graphics Mode key
count = getNumberArrayFromProperty(kGraphicsModeKey, screen_params, 4);
void drawDeviceList (int start, int end, int selection)
{
int i;
bool displayInfo = false; //Azi:displayinfo
position_t p, p_prev, p_next;
inti;
booldebugInfo = false; //Azi:displayinfo
extern boolshowBootBanner;
position_tp, p_prev, p_next;
//uint8_tmaxDevices = MIN( gui.maxdevices, menucount );
drawInfoMenuItems();
//Azi: making this info more accessible. TODO: remove the stuff on graphics.c!
getBoolForKey(kDisplayInfoKey, &displayInfo, &bootInfo->bootConfig);
getBoolForKey(kDebugInfoKey, &debugInfo, &bootInfo->bootConfig);
#ifdef AUTORES_DEBUG //Azi:autoresolution
displayInfo = true;
debugInfo = true;
#endif
if (displayInfo == true)
if (debugInfo && showBootBanner)
{
gui.debug.cursor = pos( 10, 100);
dprintf( &gui.screen, "label: %s\n", param->label );
/*
* AutoResolution
*/
if (gAutoResolution == TRUE)
if (gAutoResolution == true)
{
// Get Resolution from Graphics Mode key
count = getNumberArrayFromProperty(kGraphicsModeKey, screen_params, 4);
}
else
{
// parse display size parameters
// parse display size parameters //Azi: check this stuff!!!...
if (getIntForKey("boot_width", &pos, &bootInfo->themeConfig) && pos > 0)
{
screen_params[0] = pos;
}
// Save current screen resolution.
oldScreenWidth = gui.screen.width;
oldScreenWidth = gui.screen.width; //Azi: ... and this stuff too!!!
oldScreenHeight = gui.screen.height;
gui.screen.width = screen_params[0];
branches/azimutz/Chazileon/i386/boot2/options.c
3434
3535
3636
37
3738
3839
3940
......
877878
878879
879880
880
881
881882
882883
883884
......
10181019
10191020
10201021
1021
1022
10221023
10231024
10241025
......
10621063
10631064
10641065
1065
1066
10661067
10671068
10681069
......
13051306
13061307
13071308
1308
1309
1310
1311
1309
1310
13121311
1313
1312
13141313
13151314
13161315
......
13201319
13211320
13221321
1323
1324
1325
1326
1327
1328
1322
1323
1324
1325
1326
1327
13291328
13301329
13311330
1332
1331
13331332
1334
1335
1336
1333
13371334
13381335
13391336
#include "autoresolution.h" //Azi:autoresolution - "was" included on boot.h, which is everywere!! -> gui.h -> graphics.h
bool showBootBanner = true;
static bool shouldboot = false;
char gMacOSVersion[8]; //Azi:sysversion
gui.devicelist.draw = true;
gui.redraw = true;
if (!(gBootMode & kBootModeQuiet)) {
bool showBootBanner = true;
//bool showBootBanner = true;
// Check if "Boot Banner"=N switch is present in config file.
getBoolForKey(kBootBannerKey, &showBootBanner, &bootInfo->bootConfig);
*/
//get the new Graphics Mode key
processBootOptions();
processBootOptions(); //Azi: calling this just to get the resolution??
if ((gAutoResolution == TRUE) && map)
{
UInt32 params[4];
gui.redraw = true;
if (!(gBootMode & kBootModeQuiet))
{
bool showBootBanner = true;
//bool showBootBanner = true;
// Check if "Boot Banner"=N switch is present in config file.
getBoolForKey(kBootBannerKey, &showBootBanner, &bootInfo->bootConfig);
else
return -1;
// Find out which version mac os we're booting. Azi:sysversion - Ok, if i move this here,
// which seems ideal to me, it gets hidden from verbose and this info been pretty helpful to me;
// plus, for some reason gMacOSVersion doesn't get initialized on boot.c?! i have to call this anyway
// with another variable name so, back to were i was. Need advice! Check below on loadOverrideConfig.
// Needed to enable search for override Boot.plist on OS specific folders
// from loadOverrideConfig(). Find out which version mac os we're booting.
if (!loadConfigFile("/System/Library/CoreServices/SystemVersion.plist", &systemVersion))
{ //Azi: shouldn't this path start with / ?
{
if (getValueForKey(kProductVersion, &value, &len, &systemVersion))
{
// getValueForKey uses const char for val
}
} // doesn't print to screen here!
//Azi: check loadOverrideConfig().
// Load config table specified by the user, or use the default.
/* if (!getValueForBootKey(cp, "config", &val, &cnt)) {
val = 0;
cnt = 0;
}*/
//Azi: implemented at loadOverrideConfig.
// Load config table specified by the user, or use the default.
//if (!getValueForBootKey(cp, "config", &val, &cnt)) {
// val = 0;
// cnt = 0;
//}
// Load com.apple.Boot.plist from the selected volume
// and use its contents to override default bootConfig.
// This is not a mandatory operation anymore. Azi: meaning, it desn't return -1 anymore.
// This is not a mandatory operation anymore.
// About overriding from OS specific folders: gMacOSVersion is not stored at this point;
// placed a "call 2" under common_boot, right after getting system version.
loadOverrideConfig(&bootInfo->overrideConfig); // call 1 - first to print to screen
loadOverrideConfig(&bootInfo->overrideConfig);
// Use the kernel name specified by the user, or fetch the name
// in the config table, or use the default if not specified.

Archive Download the corresponding diff file

Revision: 380