| OLD | NEW |
| 1 #!/bin/sh -x | 1 #!/bin/sh -x |
| 2 | 2 |
| 3 # Copyright (c) 2011 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 # This runs from the factory install/reset shim. This MUST be run | 7 # This runs from the factory install/reset shim. This MUST be run |
| 8 # from USB, in developer mode. This script will wipe OQC activity and | 8 # from USB, in developer mode. This script will wipe OQC activity and |
| 9 # put the system back into factory fresh/shippable state. | 9 # put the system back into factory fresh/shippable state. |
| 10 echo "Factory reset" | 10 echo "Factory reset" |
| 11 | 11 |
| 12 # TODO: How do we know what this is for the general case? | 12 # TODO: How do we know what this is for the general case? |
| 13 if [ -b /dev/sda ]; then | 13 if [ -b /dev/sda ]; then |
| 14 STATE_DEV="/dev/sda1" | 14 STATE_DEV="/dev/sda1" |
| 15 elif [ -b /dev/mmcblk0 ]; then | 15 elif [ -b /dev/mmcblk0 ]; then |
| 16 STATE_DEV="/dev/mmcblk01" | 16 STATE_DEV="/dev/mmcblk0p1" |
| 17 else | 17 else |
| 18 echo "Failed to find root SSD." | 18 echo "Failed to find root SSD." |
| 19 exit 1 | 19 exit 1 |
| 20 fi | 20 fi |
| 21 | 21 |
| 22 # Tcsd will bring up the tpm and de-own it, | 22 # Tcsd will bring up the tpm and de-own it, |
| 23 # as we are in developer/recovery mode. | 23 # as we are in developer/recovery mode. |
| 24 start tcsd | 24 start tcsd |
| 25 | 25 |
| 26 # Just wipe the start of the partition and remake the fs on | 26 # Just wipe the start of the partition and remake the fs on |
| 27 # the stateful partition. | 27 # the stateful partition. |
| 28 dd bs=4M count=1 if=/dev/zero of=${STATE_DEV} | 28 dd bs=4M count=1 if=/dev/zero of=${STATE_DEV} |
| 29 /sbin/mkfs.ext3 "$STATE_DEV" | 29 /sbin/mkfs.ext3 "$STATE_DEV" |
| 30 | 30 |
| 31 # Do any board specific resetting here. | 31 # Do any board specific resetting here. |
| 32 # board_factory_reset.sh will be installed by the board overlay if necessary. | 32 # board_factory_reset.sh will be installed by the board overlay if necessary. |
| 33 BOARD_RESET=/usr/sbin/board_factory_reset.sh | 33 BOARD_RESET=/usr/sbin/board_factory_reset.sh |
| 34 if [ -x "${BOARD_RESET}" ]; then | 34 if [ -x "${BOARD_RESET}" ]; then |
| 35 echo "Running board specific factory reset: ${BOARD_RESET}" | 35 echo "Running board specific factory reset: ${BOARD_RESET}" |
| 36 ${BOARD_RESET} || exit 1 | 36 ${BOARD_RESET} || exit 1 |
| 37 fi | 37 fi |
| 38 | 38 |
| 39 echo "Done" | 39 echo "Done" |
| OLD | NEW |