Chameleon

Chameleon Commit Details

Date:2010-09-21 05:24:21 (13 years 7 months ago)
Author:Evan Lojewski
Commit:535
Parents: 534
Message:Removed unneeded code when embeded in an option rom
Changes:
M/branches/meklort/i386/boot2/prompt.c
M/branches/meklort/i386/libsa/Makefile
M/branches/meklort/i386/boot2/boot.c
M/branches/meklort/i386/libsaio/disk.c
M/branches/meklort/i386/libsaio/Makefile
M/branches/meklort/i386/boot0/Makefile
M/branches/meklort/i386/boot2/ramdisk.c
M/branches/meklort/i386/boot1/Makefile
M/branches/meklort/i386/boot2/options.c
M/branches/meklort/i386/libsaio/sys.c
M/branches/meklort/i386/boot2/Makefile
M/branches/meklort/i386/libsaio/nbp.c

File differences

branches/meklort/i386/libsaio/Makefile
3737
3838
3939
40
40
4141
4242
43
43
4444
4545
4646
......
6565
6666
6767
68
68
6969
70
71
7072
7173
7274
disk.o sys.o cache.o bootstruct.o \
stringTable.o load.o pci.o allocate.o misc.o \
ufs.o ufs_byteorder.o \
vbe.o nbp.o hfs.o hfs_compare.o \
vbe.o nbp.o smbios_patcher.o hfs.o hfs_compare.o \
xml.o ntfs.o msdos.o md5c.o device_tree.o \
cpu.o platform.o \
smbios_patcher.o fake_efi.o ext2fs.o \
fake_efi.o ext2fs.o \
hpet.o usb.o pci_setup.o \
device_inject.o pci_root.o \
convert.o
#SIG = $(SYMROOT)/sig
all embedtheme: $(DIRS_NEEDED) libsaio.h $(LIBS)
optionrom: CFLAGS += -DOPTION_ROM
all embedtheme optionrom: $(DIRS_NEEDED) libsaio.h $(LIBS)
#libsaio_static.a: $(SAIO_OBJS)
#rm -f $(SYMROOT)/$@
#ar q $(SYMROOT)/$@ $(SAIO_OBJS)
branches/meklort/i386/libsaio/sys.c
771771
772772
773773
774
774775
775776
776777
777778
778779
780
779781
780782
781783
bvr = diskScanBootVolumes(biosdev, count);
if (bvr == NULL)
{
#ifndef OPTION_ROM
bvr = nbpScanBootVolumes(biosdev, count);
if (bvr != NULL)
{
gBootFileType = kNetworkDeviceType;
}
#endif
}
else
{
branches/meklort/i386/libsaio/nbp.c
134134
135135
136136
137
137138
138139
139140
......
143144
144145
145146
147
return gNetBVR;
}
#else
#ifndef OPTION_ROM
BVRef nbpScanBootVolumes( int biosdev, int * countPtr )
{
return NULL;
return 0;
}
#endif
#endif
branches/meklort/i386/libsaio/disk.c
14451445
14461446
14471447
1448
1448
14491449
14501450
14511451
......
14541454
14551455
14561456
1457
14571458
14581459
14591460
}
}
#ifndef OPTION_ROM
void rescanBIOSDevice(int biosdev)
{
struct DiskBVMap *oldMap = diskResetBootVolumes(biosdev);
oldMap = NULL;
scanBootVolumes(biosdev, 0);
}
#endif
struct DiskBVMap* diskResetBootVolumes(int biosdev)
{
branches/meklort/i386/boot0/Makefile
66
77
88
9
9
1010
1111
1212
INSTALLDIR = $(DSTROOT)/usr/standalone/i386
DIRS_NEEDED = $(SYMROOT)
all embedtheme: $(DIRS_NEEDED) boot0 boot0hfs chain0
all embedtheme optionrom: $(DIRS_NEEDED) boot0 boot0hfs chain0
boot0: boot0.s Makefile $(NASM)
$(NASM) boot0.s -o $(SYMROOT)/$@
branches/meklort/i386/boot1/Makefile
1717
1818
1919
20
20
2121
2222
2323
MKDIRS = /bin/mkdir -p
endif
all embedtheme: $(DIRS_NEEDED) $(VERSIONED_FILES)
all embedtheme optionrom: $(DIRS_NEEDED) $(VERSIONED_FILES)
boot1h: boot1.s Makefile
$(NASM) boot1.s -o $(SYMROOT)/boot1h
branches/meklort/i386/boot2/boot.c
6767
6868
6969
70
7071
7172
73
7274
7375
7476
......
164166
165167
166168
167
168
169
169
170170
171
171
172172
173173
174174
......
178178
179179
180180
181
181
182182
183183
184184
......
247247
248248
249249
250
250251
252
251253
252254
253255
256
254257
255258
256259
260
257261
258262
259263
......
294298
295299
296300
297
301
298302
299303
300304
301305
302306
303307
304
308
309
305310
306
311
312
313
314
307315
308316
309317
......
319327
320328
321329
322
330
323331
324332
325333
......
336344
337345
338346
347
339348
340349
341350
......
384393
385394
386395
387
396
388397
389398
399
390400
391401
392402
......
561571
562572
563573
564
574
565575
566576
567577
568578
569579
580
570581
571582
572583
......
581592
582593
583594
584
595
585596
586597
587598
599
588600
589601
590602
char gRootDevice[512];
char gMKextName[512];
char gMacOSVersion[8];
#ifndef OPTION_ROM
bool gEnableCDROMRescan;
bool gScanSingleDrive;
#endif
int bvCount = 0;
//intmenucount = 0;
md0Ramdisk();
setupFakeEfi();
md0Ramdisk();
verbose("Starting Darwin %s\n",( archCpuType == CPU_TYPE_I386 ) ? "x86" : "x86_64");
#ifndef OPTION_ROM
// Cleanup the PXE base code.
if ( (gBootFileType == kNetworkDeviceType) && gUnloadPXEOnExit ) {
sleep(2);
}
}
#endif
bool dummyVal;
if (getBoolForKey(kWaitForKeypressKey, &dummyVal, &bootInfo->bootConfig) && dummyVal) {
printf("Press any key to continue...");
bool quiet;
bool firstRun = true;
bool instantMenu;
#ifndef OPTION_ROM
bool rescanPrompt;
#endif
unsigned int allowBVFlags = kBVFlagSystemVolume|kBVFlagForeignBoot;
unsigned int denyBVFlags = kBVFlagEFISystem;
#ifndef OPTION_ROM
// Set reminder to unload the PXE base code. Neglect to unload
// the base code will result in a hang or kernel panic.
gUnloadPXEOnExit = true;
#endif
// Record the device that the booter was loaded from.
gBIOSDev = biosdev & kBIOSDevMask;
firstRun = false;
}
#ifndef OPTION_ROM
// Enable touching a single BIOS device only if "Scan Single Drive"=y is set in system config.
if (getBoolForKey(kScanSingleDriveKey, &gScanSingleDrive, &bootInfo->bootConfig) && gScanSingleDrive) {
gScanSingleDrive = true;
}
// Create a list of partitions on device(s).
if (gScanSingleDrive) {
if (gScanSingleDrive)
{
scanBootVolumes(gBIOSDev, &bvCount);
} else {
}
else
#endif
{
scanDisks(gBIOSDev, &bvCount);
}
}
#ifndef OPTION_ROM
// Loading preboot ramdisk if exists.
loadPrebootRAMDisk();
if (getBoolForKey(kRescanPromptKey, &rescanPrompt , &bootInfo->bootConfig) && rescanPrompt && biosDevIsCDROM(gBIOSDev)) {
gEnableCDROMRescan = promptForRescanOption();
}
#endif
if(gBootVolume == NULL)
{
freeFilteredBVChain(bvChain);
#ifndef OPTION_ROM
if (gEnableCDROMRescan)
rescanBIOSDevice(gBIOSDev);
#endif
bvChain = newFilteredBVChain(0x80, 0xFF, allowBVFlags, denyBVFlags, &gDeviceCount);
setBootGlobals(bvChain);
printf("Can't find %s\n", bootFile);
sleep(1);
#ifndef OPTION_ROM
if (gBootFileType == kNetworkDeviceType) {
// Return control back to PXE. Don't unload PXE base code.
gUnloadPXEOnExit = false;
break;
}
#endif
} else {
/* Won't return if successful. */
// Notify modules that ExecKernel is about to be called
setVideoMode(VGA_TEXT_MODE, 0);// switch back to text mode
}
}
#ifndef OPTION_ROM
if ((gBootFileType == kNetworkDeviceType) && gUnloadPXEOnExit) {
nbpUnloadBaseCode();
}
#endif
}
/*!
branches/meklort/i386/boot2/prompt.c
3838
3939
4040
41
4142
4243
4344
4445
4546
4647
48
" Type ? and press Enter to learn about advanced startup options\n\n"
"boot: ";
#ifndef OPTION_ROM
char bootRescanPrompt[] =
"Press Enter to start up Darwin/x86 with no options, or you can:\n"
" Press F5 after you swapped the media. The drive will be rescanned.\n"
" Type -v and press Enter to start up with diagnostic messages\n"
" Type ? and press Enter to learn about advanced startup options\n\n"
"boot: ";
#endif
branches/meklort/i386/boot2/ramdisk.c
9494
9595
9696
97
97
9898
9999
100100
......
314314
315315
316316
317
}
}
#ifndef OPTION_ROM
void umountRAMDisk()
{
if (gRAMDiskMI != NULL)
setActiveDisplayPage(0);
}
}
#endif
branches/meklort/i386/boot2/options.c
2727
2828
2929
30
3130
3231
3332
33
34
35
3436
37
3538
3639
3740
......
164167
165168
166169
170
167171
172
168173
169174
170175
......
172177
173178
174179
175
180
181
182
176183
177
184
185
186
187
178188
179189
180190
......
524534
525535
526536
537
527538
539
528540
529541
530542
......
725737
726738
727739
728
740
741
729742
730743
731744
732745
733
746
747
734748
735749
736750
......
747761
748762
749763
750
764
765
751766
752
767
768
769
753770
754
771
772
773
755774
756
775
776
777
778
757779
758
780
781
782
759783
760
761
784
785
786
787
788
762789
763790
764791
765
792
793
794
766795
767796
797
768798
769799
770800
......
777807
778808
779809
780
810
781811
782812
783813
......
795825
796826
797827
798
828
799829
800830
801831
......
10871117
10881118
10891119
1120
10901121
10911122
10921123
......
11831214
11841215
11851216
1217
11861218
11871219
11881220
11891221
1190
1222
11911223
11921224
11931225
......
12471279
12481280
12491281
1282
12501283
1284
12511285
12521286
12531287
......
12571291
12581292
12591293
1294
#include "graphics.h"
#include "fdisk.h"
#include "ramdisk.h"
#include "embedded.h"
#include "pci.h"
#include "options.h"
#ifndef OPTION_ROM
#include "embedded.h"
#endif
bool shouldboot = false;
#ifdef UNUSED
static void showBootPrompt(int row, bool visible)
{
extern char bootPrompt[];
#ifndef OPTION_ROM
extern char bootRescanPrompt[];
#endif
changeCursor( 0, row, kCursorTypeUnderline, 0 );
clearScreenRows( row, kScreenLastRow );
clearBootArgs();
if (visible) {
if (gEnableCDROMRescan) {
#ifndef OPTION_ROM
if (gEnableCDROMRescan)
{
printf( bootRescanPrompt );
} else {
}
else
#endif
{
printf( bootPrompt );
}
} else {
int key;
int nextRow;
int timeout;
#ifndef OPTION_ROM
int bvCount;
#endif
BVRef bvr;
BVRef menuBVR;
bool showPrompt, newShowPrompt, isCDROM;
updateMenu( key, (void **) &menuBVR );
newShowPrompt = (gDeviceCount == 0) || (menuBVR->flags & kBVFlagNativeBoot);
if (newShowPrompt != showPrompt) {
if (newShowPrompt != showPrompt)
{
showPrompt = newShowPrompt;
showBootPrompt( nextRow, showPrompt );
}
if (showPrompt) {
if (showPrompt)
{
updateBootArgs(key);
}
/*
* TODO: this needs to be refactored.
*/
if (strcmp( booterCommand, "video" ) == 0) {
if (strcmp( booterCommand, "video" ) == 0)
{
printVBEModeInfo();
} else if ( strcmp( booterCommand, "memory" ) == 0) {
}
else if ( strcmp( booterCommand, "memory" ) == 0)
{
printMemoryInfo();
} else if (strcmp(booterCommand, "lspci") == 0) {
}
else if (strcmp(booterCommand, "lspci") == 0)
{
lspci();
} else if (strcmp(booterCommand, "more") == 0) {
}
#ifndef OPTION_ROM
else if (strcmp(booterCommand, "more") == 0)
{
showTextFile(booterParam);
} else if (strcmp(booterCommand, "rd") == 0) {
}
else if (strcmp(booterCommand, "rd") == 0)
{
processRAMDiskCommand(&argPtr, booterParam);
} else if (strcmp(booterCommand, "norescan") == 0) {
if (gEnableCDROMRescan) {
}
else if (strcmp(booterCommand, "norescan") == 0)
{
if (gEnableCDROMRescan)
{
gEnableCDROMRescan = false;
break;
}
} else {
}
else
{
showHelp();
}
#endif
key = 0;
showBootPrompt(nextRow, showPrompt);
break;
case kEscapeKey:
clearBootArgs();
break;
#ifndef OPTION_ROM
case kF5Key:
// New behavior:
// Clear gBootVolume to restart the loop
gBootVolume = NULL;
clearBootArgs();
break;
#endif
default:
key = 0;
break;
return 0;
}
#ifndef OPTION_ROM
//==========================================================================
// Load the help file and display the file contents on the screen.
showTextBuffer(buf, size);
free(buf);
}
#endif
// This is a very simplistic prompting scheme that just grabs two hex characters
// Eventually we need to do something more user-friendly like display a menu
// based off of the Multiboot device list
#ifdef UNUSED
int selectAlternateBootDevice(int bootdevice)
{
int key;
return bootdevice;
}
#endif
#ifdef OPTION_ROM
bool promptForRescanOption(void)
{
printf("\nWould you like to enable media rescan option?\nPress ENTER to enable or any key to skip.\n");
return false;
}
}
#endif
branches/meklort/i386/boot2/Makefile
5454
5555
5656
57
5857
58
59
60
61
5962
6063
6164
BOOT2ADDR = 20200
MAXBOOTSIZE = 458240
all embedtheme: $(DIRS_NEEDED) boot
optionrom: CFLAGS += -DOPTION_ROM
all embedtheme optionrom: $(DIRS_NEEDED) boot
boot: machOconv embedded.h $(OBJS) $(LIBDEP)
$(LD) -static -Wl,-preload -Wl,-segaddr,__INIT,$(BOOT2ADDR) \
-nostdlib -arch i386 -Wl,-segalign,20 \
branches/meklort/i386/libsa/Makefile
4242
4343
4444
45
45
4646
47
48
4749
4850
4951
LIBS = libsa.a
DIRS_NEEDED = $(OBJROOT) $(SYMROOT)
all embedtheme: $(DIRS_NEEDED) $(LIBS)
optionrom: CFLAGS += -DOPTION_ROM
all embedtheme optionrom: $(DIRS_NEEDED) $(LIBS)
libsa.a: $(SA_OBJS)
rm -f $(SYMROOT)/$(@F)
ar q $(SYMROOT)/$(@F) $^

Archive Download the corresponding diff file

Revision: 535