OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 # | 5 # |
6 # Usage: dev_debug_vboot [ --cleanup | DIRECTORY ] | 6 # Usage: dev_debug_vboot [ --cleanup | DIRECTORY ] |
7 # | 7 # |
8 # This extracts some useful debugging information about verified boot. A short | 8 # This extracts some useful debugging information about verified boot. A short |
9 # summary is printed on stdout, more detailed information and working files are | 9 # summary is printed on stdout, more detailed information and working files are |
10 # left in a log directory. | 10 # left in a log directory. |
(...skipping 25 matching lines...) Expand all Loading... |
36 infon() { | 36 infon() { |
37 echo -n "$@" | 37 echo -n "$@" |
38 echo "#" "$@" >> "$LOGFILE" | 38 echo "#" "$@" >> "$LOGFILE" |
39 } | 39 } |
40 | 40 |
41 log() { | 41 log() { |
42 echo "+" "$@" >> "$LOGFILE" | 42 echo "+" "$@" >> "$LOGFILE" |
43 "$@" >> "$LOGFILE" 2>&1 | 43 "$@" >> "$LOGFILE" 2>&1 |
44 } | 44 } |
45 | 45 |
| 46 loghead() { |
| 47 echo "+" "$@" "| head" >> "$LOGFILE" |
| 48 "$@" | head >> "$LOGFILE" 2>&1 |
| 49 } |
46 logdie() { | 50 logdie() { |
47 echo "+" "$@" >> "$LOGFILE" | 51 echo "+" "$@" >> "$LOGFILE" |
48 "$@" >> "$LOGFILE" 2>&1 | 52 "$@" >> "$LOGFILE" 2>&1 |
49 die "$@" | 53 die "$@" |
50 } | 54 } |
51 | 55 |
52 result() { | 56 result() { |
53 if [ "$?" = "0" ]; then | 57 if [ "$?" = "0" ]; then |
54 info "OK" | 58 info "OK" |
55 else | 59 else |
56 info "FAILED" | 60 info "FAILED" |
57 fi | 61 fi |
58 } | 62 } |
59 | 63 |
60 require_chromeos_bios() { | 64 require_chromeos_bios() { |
61 log cgpt show "${HD}" | 65 log cgpt show "${HD}" |
62 log rootdev -s | 66 log rootdev -s |
63 if [ ! -e "${ACPI}/HWID" ]; then | 67 if [ ! -e "${ACPI}/HWID" ]; then |
64 info "Not running Chrome OS BIOS, no further information available" | 68 info "Not running Chrome OS BIOS, no further information available" |
65 exit 0 | 69 exit 0 |
66 fi | 70 fi |
67 # including /dev/null just to get final "\n" | 71 # including /dev/null just to get final "\n" |
68 log head "${ACPI}"/*ID "${ACPI}"/BINF* "${ACPI}"/CHSW /dev/null | 72 log head "${ACPI}"/*ID "${ACPI}"/BINF* "${ACPI}"/CHSW /dev/null |
| 73 log reboot_mode |
| 74 log ls -a /mnt/stateful_partition |
| 75 log ls -a /root |
69 } | 76 } |
70 | 77 |
71 # Here we go... | 78 # Here we go... |
72 umask 022 | 79 umask 022 |
73 trap cleanup EXIT | 80 trap cleanup EXIT |
74 | 81 |
75 # Parse args | 82 # Parse args |
76 if [ -n "$1" ]; then | 83 if [ -n "$1" ]; then |
77 if [ "$1" = "--cleanup" ]; then | 84 if [ "$1" = "--cleanup" ]; then |
78 CLEANUP=1 | 85 CLEANUP=1 |
(...skipping 11 matching lines...) Expand all Loading... |
90 echo "Saving verbose log as $(pwd)/$LOGFILE" | 97 echo "Saving verbose log as $(pwd)/$LOGFILE" |
91 | 98 |
92 BIOS=bios.rom | 99 BIOS=bios.rom |
93 | 100 |
94 # Find BIOS and kernel images | 101 # Find BIOS and kernel images |
95 if [ -n "$USE_EXISTING" ]; then | 102 if [ -n "$USE_EXISTING" ]; then |
96 info "Using images in $(pwd)/" | 103 info "Using images in $(pwd)/" |
97 else | 104 else |
98 require_chromeos_bios | 105 require_chromeos_bios |
99 info "Extracting BIOS image from flash..." | 106 info "Extracting BIOS image from flash..." |
| 107 log flashrom --wp-status |
100 log flashrom -r ${BIOS} | 108 log flashrom -r ${BIOS} |
101 | 109 |
102 HD_KERN_A="${HD}2" | 110 HD_KERN_A="${HD}2" |
103 HD_KERN_B="${HD}4" | 111 HD_KERN_B="${HD}4" |
104 tmp=$(rootdev -s -d)2 | 112 tmp=$(rootdev -s -d)2 |
105 if [ "$tmp" != "$HD_KERN_A" ]; then | 113 if [ "$tmp" != "$HD_KERN_A" ]; then |
106 USB_KERN_A="$tmp" | 114 USB_KERN_A="$tmp" |
107 fi | 115 fi |
108 | 116 |
109 info "Extracting kernel images from drives..." | 117 info "Extracting kernel images from drives..." |
(...skipping 25 matching lines...) Expand all Loading... |
135 --fv Firmware_B_Data --kernelkey kernel_subkey_b.vbpubk ; result | 143 --fv Firmware_B_Data --kernelkey kernel_subkey_b.vbpubk ; result |
136 | 144 |
137 for key in kernel_subkey_a.vbpubk kernel_subkey_b.vbpubk; do | 145 for key in kernel_subkey_a.vbpubk kernel_subkey_b.vbpubk; do |
138 infon "Test $key... " | 146 infon "Test $key... " |
139 log vbutil_key --unpack $key ; result | 147 log vbutil_key --unpack $key ; result |
140 done | 148 done |
141 | 149 |
142 for keyblock in *kern*.blob; do | 150 for keyblock in *kern*.blob; do |
143 infon "Test $keyblock... " | 151 infon "Test $keyblock... " |
144 log vbutil_keyblock --unpack $keyblock ; result | 152 log vbutil_keyblock --unpack $keyblock ; result |
| 153 loghead od -Ax -tx1 $keyblock |
145 done | 154 done |
146 | 155 |
147 # Test each kernel with each key | 156 # Test each kernel with each key |
148 for key in kernel_subkey_a.vbpubk kernel_subkey_b.vbpubk recoverykey.vbpubk; do | 157 for key in kernel_subkey_a.vbpubk kernel_subkey_b.vbpubk recoverykey.vbpubk; do |
149 for kern in *kern*.blob; do | 158 for kern in *kern*.blob; do |
150 infon "Verify $kern with $key... " | 159 infon "Verify $kern with $key... " |
151 log vbutil_kernel --verify $kern --signpubkey $key ; result | 160 log vbutil_kernel --verify $kern --signpubkey $key ; result |
152 done | 161 done |
153 done | 162 done |
OLD | NEW |