Chameleon

Chameleon Commit Details

Date:2010-08-18 23:23:28 (10 years 3 months ago)
Author:Azimutz
Commit:386
Parents: 385
Message:Trunk it, revs 383, 384. Revert drawBackground to it's original position; not needed anymore and breaks Logo disabling.
Changes:
A/branches/azimutz/Chazileon/i386/util/bdmesg.c
M/branches/azimutz/Chazileon/i386/libsaio/console.c
M/branches/azimutz/Chazileon/i386/boot2/boot.c
M/branches/azimutz/Chazileon/i386/libsaio/cpu.c
M/branches/azimutz/Chazileon/i386/util/Makefile
M/branches/azimutz/Chazileon/CHANGES
M/branches/azimutz/Chazileon/i386/libsaio/saio_internal.h

File differences

branches/azimutz/Chazileon/CHANGES
1
2
13
24
35
- Added Booter Log Dump Tool
- Added Booter message Logging (":/boot-log" ioreg property)
- Removed obsolete -f option, use -x instead
- Removed -x32 option, use arch=i386 instead
- Added automatic SMBusspeed detection for lga1156 core i5/7 cpus
branches/azimutz/Chazileon/i386/libsaio/console.c
5252
5353
5454
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
55117
56118
57119
......
103165
104166
105167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
106185
107186
108187
......
111190
112191
113192
193
114194
115195
116
117196
118197
119198
120199
121
122200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
123219
124220
125221
bool gVerboseMode;
bool gErrors;
/* Kabyl: BooterLog */
#define BOOTER_LOG_SIZE(64 * 1024)
#define SAFE_LOG_SIZE80
char *msgbuf = 0;
char *cursor = 0;
struct putc_info {
char * str;
char * last_str;
};
static void sputc(int c, struct putc_info * pi)
{
if (pi->last_str)
if (pi->str == pi->last_str)
{
*(pi->str) = '\0';
return;
}
*(pi->str)++ = c;
}
void initBooterLog(void)
{
msgbuf = malloc(BOOTER_LOG_SIZE);
bzero(msgbuf, BOOTER_LOG_SIZE);
cursor = msgbuf;
}
void msglog(const char * fmt, ...)
{
va_list ap;
struct putc_info pi;
if (!msgbuf)
return;
if (((cursor - msgbuf) > (BOOTER_LOG_SIZE - SAFE_LOG_SIZE)))
return;
va_start(ap, fmt);
pi.str = cursor;
pi.last_str = 0;
prf(fmt, ap, sputc, &pi);
*pi.str = '\0';
va_end(ap);
cursor += (pi.str - cursor);
}
void setupBooterLog(void)
{
if (!msgbuf)
return;
Node *node = DT__FindNode("/", false);
if (node)
DT__AddProperty(node, "boot-log", strlen((char *)msgbuf) + 1, msgbuf);
}
/* Kabyl: !BooterLog */
/*
* write one character to console
*/
prf(fmt, ap, putchar, 0);
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);
*pi.str = '\0';
cursor += (pi.str - cursor);
}
va_end(ap);
return 0;
}
{
va_list ap;
va_start(ap, fmt);
if (gVerboseMode)
{
va_start(ap, fmt);
if (bootArgs->Video.v_display == VGA_TEXT_MODE)
prf(fmt, ap, putchar, 0);
else
vprf(fmt, ap);
va_end(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);
*pi.str = '\0';
cursor += (pi.str - cursor);
}
va_end(ap);
return(0);
}
branches/azimutz/Chazileon/i386/libsaio/cpu.c
1414
1515
1616
17
17
1818
1919
2020
......
310310
311311
312312
313
313
314314
315315
316316
......
320320
321321
322322
323
323324
324325
325326
#if DEBUG_CPU
#define DBG(x...)printf(x)
#else
#define DBG(x...)
#define DBG(x...)msglog(x)
#endif
/*
p->CPU.TSCFrequency = tscFrequency;
p->CPU.FSBFrequency = fsbFrequency;
p->CPU.CPUFrequency = cpuFrequency;
#if DEBUG_CPU
DBG("CPU: Vendor/Model/ExtModel: 0x%x/0x%x/0x%x\n", p->CPU.Vendor, p->CPU.Model, p->CPU.ExtModel);
DBG("CPU: Family/ExtFamily: 0x%x/0x%x\n", p->CPU.Family, p->CPU.ExtFamily);
DBG("CPU: MaxCoef/CurrCoef: 0x%x/0x%x\n", p->CPU.MaxCoef, p->CPU.CurrCoef);
DBG("CPU: CPUFreq: %dMHz\n", p->CPU.CPUFrequency / 1000000);
DBG("CPU: NoCores/NoThreads: %d/%d\n", p->CPU.NoCores, p->CPU.NoThreads);
DBG("CPU: Features: 0x%08x\n", p->CPU.Features);
#if DEBUG_CPU
pause();
#endif
}
branches/azimutz/Chazileon/i386/libsaio/saio_internal.h
8989
9090
9191
92
93
9294
9395
96
9497
9598
9699
/* console.c */
extern bool gVerboseMode;
extern bool gErrors;
extern void initBooterLog(void);
extern void setupBooterLog(void);
extern void putchar(int ch);
extern int getchar(void);
extern void msglog(const char * format, ...);
extern int printf(const char *format, ...);
extern int error(const char *format, ...);
extern int verbose(const char *format, ...);
branches/azimutz/Chazileon/i386/boot2/boot.c
199199
200200
201201
202
203
202204
203205
204206
......
253255
254256
255257
258
259
256260
257261
258262
......
411415
412416
413417
414
418
415419
416
417
418
419
420
421
420
421
422
423
424
422425
426
423427
424428
425429
else
drawBootGraphics();
setupBooterLog();
finalizeBootStruct();
// Jump to kernel's entry point. There's no going back now.
// 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.
if ( status == -1 ) continue;
//Azi: doing this earlier to get the verbose from loadOverrideConfig.
// Draw background, turn off any GUI elements and update VRAM.
// Turn off any GUI elements, draw background and update VRAM.
if ( bootArgs->Video.v_display == GRAPHICS_MODE )
{
drawBackground(); // order matters!!
gui.devicelist.draw = false; // Needed when the verbose "flips" the screen.
gui.bootprompt.draw = false; // ?
gui.menu.draw = false; // ?
gui.infobox.draw = false; // Enter doesn't work with this drawn; most probably it's not needed!?
{
gui.devicelist.draw = false;
gui.bootprompt.draw = false;
gui.menu.draw = false;
gui.infobox.draw = false;
gui.logo.draw = false;
drawBackground();
updateVRAM();
}
branches/azimutz/Chazileon/i386/util/bdmesg.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
* BooterLog Dump Tool, part of the Chameleon Boot Loader Project
*
* Copyright 2010 by Islam M. Ahmed Zaid. All rights reserved.
*
*/
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include "IOKit/IOKitLib.h"
int main(int argc, char *argv[])
{
io_registry_entry_t root = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/");
if (!root)
{
printf("IORegistryEntry \"IOIOService:/\" not found.\n");
return 0;
}
CFTypeRef bootLog = IORegistryEntryCreateCFProperty(root, CFSTR("boot-log"), kCFAllocatorDefault, 0);
if (!bootLog)
{
printf("\"boot-log\" property not found.\n");
return 0;
}
//CFShow(bootLog);
const UInt8 *msglog = CFDataGetBytePtr((CFDataRef)bootLog);
if (msglog)
printf("%s\n", msglog);
return 0;
}
branches/azimutz/Chazileon/i386/util/Makefile
1818
1919
2020
21
21
2222
2323
2424
......
3030
3131
3232
33
34
35
3336
3437
3538
CFILES = machOconv.c
ALLSRC = $(CFILES) $(MFILES) $(HFILES) $(EXPORT_HFILES)
PROGRAMS = machOconv
PROGRAMS = machOconv bdmesg
OUTFILES = $(PROGRAMS)
machOconv: machOconv.o
$(CC) $(CFLAGS) $(LDFLAGS) $(DEFINES) -o $(SYMROOT)/$(@F) machOconv.o
bdmesg: bdmesg.o
$(CC) $(CFLAGS) $(LDFLAGS) -framework IOKit -framework CoreFoundation -o $(SYMROOT)/$(@F) bdmesg.o
include ../MakeInc.dir
#dependencies

Archive Download the corresponding diff file

Revision: 386