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 | ␊ |
15 | int main(int argc, char *argv[])␊ |
16 | {␊ |
17 | ␉io_registry_entry_t root;␊ |
18 | ␉CFTypeRef bootLog = NULL;␊ |
19 | ␊ |
20 | ␉root = IORegistryEntryFromPath(kIOMasterPortDefault, "IOService:/");␊ |
21 | ␊ |
22 | ␉if (root)␊ |
23 | ␉{␊ |
24 | ␉␉bootLog = IORegistryEntryCreateCFProperty(root, CFSTR("boot-log"), kCFAllocatorDefault, 0);␊ |
25 | ␉}␊ |
26 | ␊ |
27 | ␉if (!bootLog)␊ |
28 | ␉{␊ |
29 | ␉␉// Check for Clover boot log␊ |
30 | ␉␉root = IORegistryEntryFromPath(kIOMasterPortDefault, "IODeviceTree:/efi/platform");␊ |
31 | ␊ |
32 | ␉␉if (root)␊ |
33 | ␉␉{␊ |
34 | ␉␉␉bootLog = IORegistryEntryCreateCFProperty(root, CFSTR("boot-log"), kCFAllocatorDefault, 0);␊ |
35 | ␉␉}␊ |
36 | ␉}␊ |
37 | ␊ |
38 | ␉if (!bootLog)␊ |
39 | ␉{␊ |
40 | ␉␉printf("\"boot-log\" property not found.\n");␊ |
41 | ␉␉return 0;␊ |
42 | ␉}␊ |
43 | ␊ |
44 | ␉const UInt8 *msglog = CFDataGetBytePtr((CFDataRef)bootLog);␊ |
45 | ␊ |
46 | ␉if (msglog)␊ |
47 | ␉{␊ |
48 | ␉␉printf("%s\n", msglog);␊ |
49 | ␉}␊ |
50 | ␊ |
51 | ␉CFRelease(bootLog);␊ |
52 | ␊ |
53 | ␉return 0;␊ |
54 | }␊ |
55 | |