OLD | NEW |
1 #!/bin/sh -ex | 1 #!/bin/sh -ex |
2 | 2 |
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 . "$(dirname "$0")/chromeos-common.sh" | 7 . "$(dirname "$0")/chromeos-common.sh" |
8 . "/opt/google/memento_updater/memento_updater_logging.sh" | 8 . "/opt/google/memento_updater/memento_updater_logging.sh" |
9 . "/opt/google/memento_updater/find_omaha.sh" | 9 . "/opt/google/memento_updater/find_omaha.sh" |
10 | 10 |
11 if [ $(id -u) -ne 0 ]; then | 11 if [ $(id -u) -ne 0 ]; then |
12 echo "You must run this as root." | 12 echo "You must run this as root." |
13 exit 1 | 13 exit 1 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 log "Starting Factory Installer." | 83 log "Starting Factory Installer." |
84 | 84 |
85 log "Checking for Firmware Write Protect" | 85 log "Checking for Firmware Write Protect" |
86 | 86 |
87 # Only ChromeOS machines have meaninful output here. | 87 # Only ChromeOS machines have meaninful output here. |
88 if crossystem hwid >/dev/null; then | 88 if crossystem hwid >/dev/null; then |
89 # Check for physical firmware write protect. We'll only | 89 # Check for physical firmware write protect. We'll only |
90 # clear this stuff if the case is open. | 90 # clear this stuff if the case is open. |
91 if [ "$(crossystem wpsw_cur)" = "0" ]; then | 91 if [ "$(crossystem wpsw_cur)" = "0" ]; then |
92 # Ensure that flash chips are in a known good state. | 92 # Clear software firmware write protect. |
93 clear_fwwp | 93 clear_fwwp |
| 94 fi |
94 | 95 |
| 96 # Check for software firmware write protect. We only clear the TPM if |
| 97 # software write protect is disabled. |
| 98 if flashrom -p internal:bus=spi --wp-status 2>/dev/null | |
| 99 grep -q "write protect is disabled"; then |
95 # Ensure that we can wipe TPM if necessary. | 100 # Ensure that we can wipe TPM if necessary. |
96 clear_tpm | 101 clear_tpm |
97 fi | 102 fi |
98 fi | 103 fi |
99 | 104 |
100 # | 105 # |
101 # factory_install.sh implements two operations for assembly line | 106 # factory_install.sh implements two operations for assembly line |
102 # operators: install (obviously) and reset. | 107 # operators: install (obviously) and reset. |
103 # | 108 # |
104 # Somehow the way that operators switch between the two operations | 109 # Somehow the way that operators switch between the two operations |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 dd if=/dev/zero of=$DST_RELEASE | 276 dd if=/dev/zero of=$DST_RELEASE |
272 dd if=/dev/zero of=$DST_FACTORY | 277 dd if=/dev/zero of=$DST_FACTORY |
273 exit 1 | 278 exit 1 |
274 fi | 279 fi |
275 | 280 |
276 log "All done installing." | 281 log "All done installing." |
277 | 282 |
278 sleep 3 | 283 sleep 3 |
279 shutdown -r now | 284 shutdown -r now |
280 sleep 1d # sleep indefinitely to avoid respawning rather than shutting down | 285 sleep 1d # sleep indefinitely to avoid respawning rather than shutting down |
OLD | NEW |