Root/
Source at commit 2740 created 8 years 11 months ago. By ifabio, sync with trunk. | |
---|---|
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 | ␉␉bootLog = IORegistryEntryCreateCFProperty(root, CFSTR("boot-log"), kCFAllocatorDefault, 0);␊ |
24 | ␊ |
25 | ␉if (!bootLog)␊ |
26 | ␉{␊ |
27 | ␉␉// Check for Clover boot log␊ |
28 | ␉␉root = IORegistryEntryFromPath(kIOMasterPortDefault, "IODeviceTree:/efi/platform");␊ |
29 | ␊ |
30 | ␉␉if (root)␊ |
31 | ␉␉␉bootLog = IORegistryEntryCreateCFProperty(root, CFSTR("boot-log"), kCFAllocatorDefault, 0);␊ |
32 | ␉}␊ |
33 | ␊ |
34 | ␉if (!bootLog)␊ |
35 | ␉{␊ |
36 | ␉␉printf("\"boot-log\" property not found.\n");␊ |
37 | ␉␉return 0;␊ |
38 | ␉}␊ |
39 | ␊ |
40 | ␉const UInt8 *msglog = CFDataGetBytePtr((CFDataRef)bootLog);␊ |
41 | ␊ |
42 | ␉if (msglog)␊ |
43 | ␉␉printf("%s\n", msglog);␊ |
44 | ␊ |
45 | ␉return 0;␊ |
46 | }␊ |
47 |