Chameleon

Chameleon Svn Source Tree

Root/branches/chucko/i386/util/bdmesg.c

1/*
2 * BooterLog Dump Tool, part of the Chameleon Boot Loader Project
3 *
4 * Copyright 2010 by Islam M. Ahmed Zaid. All rights reserved.
5 *
6 */
7
8#include <stdio.h>
9#include <stdint.h>
10#include <string.h>
11#include <stdlib.h>
12
13#include "IOKit/IOKitLib.h"
14
15int main(int argc, char *argv[])
16{
17io_registry_entry_t root;
18CFTypeRef bootLog = NULL;
19
20root = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/");
21
22if (root)
23bootLog = IORegistryEntryCreateCFProperty(root, CFSTR("boot-log"), kCFAllocatorDefault, 0);
24
25if (!bootLog)
26{
27// Check for Clover boot log
28root = IORegistryEntryFromPath(kIOMasterPortDefault, "IODeviceTree:/efi/platform");
29
30if (root)
31bootLog = IORegistryEntryCreateCFProperty(root, CFSTR("boot-log"), kCFAllocatorDefault, 0);
32}
33
34if (!bootLog)
35{
36printf("\"boot-log\" property not found.\n");
37return 0;
38}
39
40const UInt8 *msglog = CFDataGetBytePtr((CFDataRef)bootLog);
41
42if (msglog)
43printf("%s\n", msglog);
44
45 CFRelease(bootLog);
46
47return 0;
48}
49

Archive Download this file

Revision: HEAD