Chameleon

Chameleon Commit Details

Date:2010-08-18 06:17:39 (13 years 8 months ago)
Author:Azimutz
Commit:381
Parents: 380
Message:Trunk it, revs 369 through 377.
Changes:
M/branches/azimutz/Chazileon/doc/BootHelp.txt
M/branches/azimutz/Chazileon/i386/boot2/graphics.c
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/boot2/boot.h
M/branches/azimutz/Chazileon/CHANGES
M/branches/azimutz/Chazileon/i386/boot2/gui.h
M/branches/azimutz/Chazileon/i386/boot2/options.c

File differences

branches/azimutz/Chazileon/doc/BootHelp.txt
1818
1919
2020
21
22
21
22
2323
2424
2525
kernel: kernel name (e.g. "mach_kernel" - must be in "/" )
flags: -v (verbose) -s (single user mode),
-x (safe mode) -F (ignore boot configuration file)
flags: -v (verbose) -s (single user mode) -x (safe mode)
-F (ignore "Kernel Flags" specified in boot configuration file)
32 (i386 arch) -legacy (no 64 bit apps - kernel flag)
64 (x86_64 arch)
branches/azimutz/Chazileon/CHANGES
1
2
13
24
35
- Removed obsolete -f option, use -x instead
- Removed -x32 option, use arch=i386 instead
- Added automatic SMBusspeed detection for lga1156 core i5/7 cpus
- Added new iMac11,1 sbios default model for lga1156 core i5/17 mobos
- md0 code. Notified xnu when an md ramdisk is specified
branches/azimutz/Chazileon/i386/libsaio/msdos.c
5454
5555
5656
57
57
5858
5959
6060
#include "msdos.h"
#define LABEL_LENGTH11
#define MSDOS_CACHE_BLOCKSIZE BPS * 2
#define MSDOS_CACHE_BLOCKSIZE BPS
#defineCLUST_FIRST2/* reserved cluster range */
#defineCLUST_RSRVD320x0ffffff8/* reserved cluster range */
branches/azimutz/Chazileon/i386/boot2/graphics.c
12161216
12171217
12181218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
12341237
12351238
12361239
return;
}
if (gVerboseMode) {
currentTickTime = time18(); // late binding
if (currentTickTime < lastTickTime + MIN_TICKS) {
return;
} else {
lastTickTime = currentTickTime;
}
if (getVideoMode() == VGA_TEXT_MODE) {
if (currentIndicator >= sizeof(indicator)) {
currentIndicator = 0;
}
printf("%c\b", indicator[currentIndicator++]);
}
}
currentTickTime = time18(); // late binding
if (currentTickTime < lastTickTime + MIN_TICKS)
{
return;
}
else
{
lastTickTime = currentTickTime;
}
if (getVideoMode() == VGA_TEXT_MODE)
{
if (currentIndicator >= sizeof(indicator))
{
currentIndicator = 0;
}
printf("%c\b", indicator[currentIndicator++]);
}
}
void
branches/azimutz/Chazileon/i386/boot2/boot.c
419419
420420
421421
422
422423
423424
424425
......
488489
489490
490491
492
491493
492494
493495
......
701703
702704
703705
704
705
706
707
708
709
710
711
712
706
707
708
713709
714710
715711
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!?
gui.logo.draw = false;
updateVRAM();
}
bvChain = newFilteredBVChain(0x80, 0xFF, allowBVFlags, denyBVFlags, &gDeviceCount);
setBootGlobals(bvChain);
setupDeviceList(&bootInfo->themeConfig); //Azi: check this - position test!!!
}
continue;
}
if (ret <= 0)
{
printf("Can't find %s\n", bootFile);
if(gui.initialised)
{
sleep(1);
drawBackground();
gui.devicelist.draw = true;
gui.redraw = true;
}
sleep(1);
if (gBootFileType == kNetworkDeviceType) {
// Return control back to PXE. Don't unload PXE base code.
gUnloadPXEOnExit = false;
branches/azimutz/Chazileon/i386/boot2/boot.h
176176
177177
178178
179
180179
181180
182181
#define kArchX86_64Flag"64"// # boot.c, getValFK
//----------
#define kVerboseModeFlag"-v"// * options.c, getValFK
#define kOldSafeModeFlag"-f"// kIgnoreCacheModeFlag***, options.c, getValFK
#define kSafeModeFlag"-x"// * options.c, getValueFBK (5) & getValFK
#define kSingleUserModeFlag"-s"// * options.c, getValFK
#define kIgnoreBootFileFlag"-F"// * options.c, getValFBK
branches/azimutz/Chazileon/i386/boot2/gui.c
417417
418418
419419
420
421
422
423
424
425
426
427
428
429
430
431
420432
421433
422434
......
439451
440452
441453
442
454
455
456
457
443458
444459
445460
446461
447
462
448463
449
450
451464
452465
453466
454467
455468
456469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
457535
458536
459537
......
502580
503581
504582
505
583
506584
507585
508
509
586
510587
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557588
558589
559590
......
719750
720751
721752
722
753
723754
724755
725756
......
729760
730761
731762
732
763
764
733765
734766
735767
return 0;
}
int freeWindowBuffer( window_t *window )
{
if (window->pixmap && window->pixmap->pixels)
{
free(window->pixmap->pixels);
free(window->pixmap);
return 0;
}
return 1;
}
void fillPixmapWithColor(pixmap_t *pm, uint32_t color)
{
int x,y;
blend( images[iBackground].image, gui.screen.pixmap, gui.background.pos );
// draw logo.png into background buffer
blend( images[iLogo].image, gui.screen.pixmap, gui.logo.pos);
if (gui.logo.draw)
{
blend( images[iLogo].image, gui.screen.pixmap, gui.logo.pos);
}
memcpy( gui.backbuffer->pixels, gui.screen.pixmap->pixels, gui.backbuffer->width * gui.backbuffer->height * 4 );
}
void loadThemeValues(config_file_t *theme, bool overide)
void setupDeviceList(config_file_t *theme)
{
unsigned int screen_width = gui.screen.width;
unsigned int screen_height = gui.screen.height;
unsigned int pixel;
intalpha;// transparency level 0 (obligue) - 255 (transparent)
uint32_t color;// color value formatted RRGGBB
int val, len;
const char *string;
if(getIntForKey("devices_max_visible", &val, theme ))
gui.maxdevices = MIN( val, gDeviceCount );
if(getIntForKey("devices_iconspacing", &val, theme ))
gui.devicelist.iconspacing = val;
// check layout for horizontal or vertical
gui.layout = HorizontalLayout;
if(getValueForKey( "devices_layout", &string, &len, theme)) {
if (!strcmp (string, "vertical")) {
gui.layout = VerticalLayout;
}
}
switch (gui.layout) {
case VerticalLayout:
gui.devicelist.height = ((images[iSelection].image->height + font_console.chars[0]->height + gui.devicelist.iconspacing) * MIN(gui.maxdevices, gDeviceCount) + (images[iDeviceScrollPrev].image->height + images[iDeviceScrollNext].image->height) + gui.devicelist.iconspacing);
gui.devicelist.width = (images[iSelection].image->width + gui.devicelist.iconspacing);
if(getDimensionForKey("devices_pos_x", &pixel, theme, gui.screen.width , images[iSelection].image->width ) )
gui.devicelist.pos.x = pixel;
if(getDimensionForKey("devices_pos_y", &pixel, theme, gui.screen.height , gui.devicelist.height ) )
gui.devicelist.pos.y = pixel;
break;
case HorizontalLayout:
default:
gui.devicelist.width = ((images[iSelection].image->width + gui.devicelist.iconspacing) * MIN(gui.maxdevices, gDeviceCount) + (images[iDeviceScrollPrev].image->width + images[iDeviceScrollNext].image->width) + gui.devicelist.iconspacing);
gui.devicelist.height = (images[iSelection].image->height + font_console.chars[0]->height + gui.devicelist.iconspacing);
if(getDimensionForKey("devices_pos_x", &pixel, theme, gui.screen.width , gui.devicelist.width ) )
gui.devicelist.pos.x = pixel;
else
gui.devicelist.pos.x = ( gui.screen.width - gui.devicelist.width ) / 2;
if(getDimensionForKey("devices_pos_y", &pixel, theme, gui.screen.height , images[iSelection].image->height ) )
gui.devicelist.pos.y = pixel;
else
gui.devicelist.pos.y = ( gui.screen.height - gui.devicelist.height ) / 2;
break;
}
if(getColorForKey("devices_bgcolor", &color, theme))
gui.devicelist.bgcolor = (color & 0x00FFFFFF);
if(getIntForKey("devices_transparency", &alpha, theme))
gui.devicelist.bgcolor = gui.devicelist.bgcolor | (( 255 - ( alpha & 0xFF) ) << 24);
if (gui.devicelist.pixmap)
{
freeWindowBuffer(&gui.devicelist);
createWindowBuffer(&gui.devicelist);
}
}
void loadThemeValues(config_file_t *theme)
{
unsigned int screen_width = gui.screen.width;
unsigned int screen_height = gui.screen.height;
unsigned int pixel;
intalpha;// transparency level 0 (obligue) - 255 (transparent)
uint32_t color;// color value formatted RRGGBB
int val;
/*
* Parse screen parameters
*/
if(getDimensionForKey("countdown_pos_y", &pixel, theme, screen_height , 0 ) )
gui.countdown.pos.y = pixel;
/*
/*
* Parse devicelist parameters
*/
if(getIntForKey("devices_max_visible", &val, theme ))
gui.maxdevices = MIN( val, gDeviceCount );
setupDeviceList(theme);
if(getIntForKey("devices_iconspacing", &val, theme ))
gui.devicelist.iconspacing = val;
// check layout for horizontal or vertical
gui.layout = HorizontalLayout;
if(getValueForKey( "devices_layout", &string, &len, theme)) {
if (!strcmp (string, "vertical")) {
gui.layout = VerticalLayout;
}
}
switch (gui.layout) {
case VerticalLayout:
gui.devicelist.height = ((images[iSelection].image->height + font_console.chars[0]->height + gui.devicelist.iconspacing) * MIN(gui.maxdevices, gDeviceCount) + (images[iDeviceScrollPrev].image->height + images[iDeviceScrollNext].image->height) + gui.devicelist.iconspacing);
gui.devicelist.width = (images[iSelection].image->width + gui.devicelist.iconspacing);
if(getDimensionForKey("devices_pos_x", &pixel, theme, gui.screen.width , images[iSelection].image->width ) )
gui.devicelist.pos.x = pixel;
if(getDimensionForKey("devices_pos_y", &pixel, theme, gui.screen.height , gui.devicelist.height ) )
gui.devicelist.pos.y = pixel;
break;
case HorizontalLayout:
default:
gui.devicelist.width = ((images[iSelection].image->width + gui.devicelist.iconspacing) * MIN(gui.maxdevices, gDeviceCount) + (images[iDeviceScrollPrev].image->width + images[iDeviceScrollNext].image->width) + gui.devicelist.iconspacing);
gui.devicelist.height = (images[iSelection].image->height + font_console.chars[0]->height + gui.devicelist.iconspacing);
if(getDimensionForKey("devices_pos_x", &pixel, theme, gui.screen.width , gui.devicelist.width ) )
gui.devicelist.pos.x = pixel;
else
gui.devicelist.pos.x = ( gui.screen.width - gui.devicelist.width ) / 2;
if(getDimensionForKey("devices_pos_y", &pixel, theme, gui.screen.height , images[iSelection].image->height ) )
gui.devicelist.pos.y = pixel;
else
gui.devicelist.pos.y = ( gui.screen.height - gui.devicelist.height ) / 2;
break;
}
if(getColorForKey("devices_bgcolor", &color, theme))
gui.devicelist.bgcolor = (color & 0x00FFFFFF);
if(getIntForKey("devices_transparency", &alpha, theme))
gui.devicelist.bgcolor = gui.devicelist.bgcolor | (( 255 - ( alpha & 0xFF) ) << 24);
/*
* Parse infobox parameters
*/
// load graphics otherwise fail and return
if (loadGraphics() == 0) {
loadThemeValues(&bootInfo->themeConfig, true);
loadThemeValues(&bootInfo->themeConfig);
colorFont(&font_small, gui.screen.font_small_color);
colorFont(&font_console, gui.screen.font_console_color);
if (createWindowBuffer(&gui.devicelist) == 0) {
if (createWindowBuffer(&gui.bootprompt) == 0) {
if (createWindowBuffer(&gui.infobox) == 0) {
if (createWindowBuffer(&gui.menu) == 0) {
if (createWindowBuffer(&gui.menu) == 0) {
gui.logo.draw = true;
#ifdef AUTORES_DEBUG
printf("Press Any Key...\n");
branches/azimutz/Chazileon/i386/boot2/gui.h
146146
147147
148148
149
149150
150151
151152
int initGUI();
void drawBackground();
void setupDeviceList(config_file_t *theme);
void drawDeviceIcon(BVRef device, pixmap_t *buffer, position_t p, bool isSelected);
void drawDeviceList(int start, int end, int selection);
void drawProgressBar(pixmap_t *blendInto, uint16_t width, position_t p, uint8_t progress);
branches/azimutz/Chazileon/i386/boot2/options.c
450450
451451
452452
453
453
454454
455455
456456
......
874874
875875
876876
877
877878
878879
879880
......
14491450
14501451
14511452
1452
1453
1454
1455
1453
1454
1455
1456
1457
1458
1459
1460
14561461
1457
1458
1462
1463
1464
1465
14591466
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
14701467
14711468
14721469
gVerboseMode = false;
gBootMode = kBootModeNormal;
*gBootArgsPtr++ = '-';
*gBootArgsPtr++ = 'f';
*gBootArgsPtr++ = 'x';
break;
case BOOT_SINGLEUSER:
if (bootArgs->Video.v_display == GRAPHICS_MODE) {
// redraw the background buffer
gui.logo.draw = true;
drawBackground();
gui.devicelist.draw = true;
gui.redraw = true;
strncpy(&argP[cnt], cp, userCnt);
argP[cnt+userCnt] = '\0';
if(!shouldboot)
{
gVerboseMode = getValueForKey( kVerboseModeFlag, &val, &cnt, &bootInfo->bootConfig ) ||
getValueForKey( kSingleUserModeFlag, &val, &cnt, &bootInfo->bootConfig );
if(!shouldboot)
{
gVerboseMode = getValueForKey( kVerboseModeFlag, &val, &cnt, &bootInfo->bootConfig ) ||
getValueForKey( kSingleUserModeFlag, &val, &cnt, &bootInfo->bootConfig );
gBootMode = ( getValueForKey( kSafeModeFlag, &val, &cnt, &bootInfo->bootConfig ) ) ?
kBootModeSafe : kBootModeNormal;
}
gBootMode = ( getValueForKey( kSafeModeFlag, &val, &cnt, &bootInfo->bootConfig ) ) ?
kBootModeSafe : kBootModeNormal;
if ( getValueForKey( kMKextCacheKey, &val, &cnt, &bootInfo->bootConfig ) )
{
strlcpy(gMKextName, val, cnt + 1);
}
if ( getValueForKey( kOldSafeModeFlag, &val, &cnt, &bootInfo->bootConfig ) ) {
gBootMode = kBootModeSafe;
}
if ( getValueForKey( kMKextCacheKey, &val, &cnt, &bootInfo->bootConfig ) ) {
strlcpy(gMKextName, val, cnt + 1);
}
}
free(configKernelFlags);
free(valueBuffer);

Archive Download the corresponding diff file

Revision: 381