Chameleon

Chameleon Svn Source Tree

Root/branches/ErmaC/Enoch/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 = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/");
18if (!root)
19{
20printf("IORegistryEntry \"IOIOService:/\" not found.\n");
21return 0;
22}
23
24CFTypeRef bootLog = IORegistryEntryCreateCFProperty(root, CFSTR("boot-log"), kCFAllocatorDefault, 0);
25if (!bootLog)
26{
27printf("\"boot-log\" property not found.\n");
28return 0;
29}
30
31const UInt8 *msglog = CFDataGetBytePtr((CFDataRef)bootLog);
32if (msglog)
33printf("%s\n", msglog);
34
35CFRelease(bootLog);
36return 0;
37}
38
39

Archive Download this file

Revision: 2323