Randall Spangler | a51e35b | 2010-08-20 23:37:54 | [diff] [blame] | 1 | #!/bin/sh -ue |
| 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 |
| 4 | # found in the LICENSE file. |
| 5 | # |
| 6 | # A script to mark the current kernel partition as successfully booted. |
| 7 | |
| 8 | # Load functions and constants for chromeos-install. |
| 9 | . "$(dirname "$0")/chromeos-common.sh" || exit 1 |
| 10 | |
| 11 | if [ "0" = $(id -u) ]; then |
| 12 | local sudo="" |
| 13 | else |
| 14 | local sudo=sudo |
| 15 | fi |
| 16 | |
| 17 | # Extract the kernel partition's UniqueGuid from the command line. |
| 18 | guid=$(sed 's/.*kern_guid=\([0-9a-fA-F-]\+\).*/\1/' /proc/cmdline) |
| 19 | |
| 20 | # Look through all the known devices to find that one partition. |
| 21 | kern_dev=$($sudo cgpt find -1 -u $guid) |
| 22 | |
| 23 | # Split the kernel device in the base device and paritition number. |
| 24 | base_dev=$(get_block_dev_from_partition_dev $kern_dev) |
| 25 | kern_num=$(get_partition_number $kern_dev) |
| 26 | |
| 27 | # Mark the kernel as successfully booted (success=1, tries=0). |
| 28 | $sudo cgpt add $base_dev -i $kern_num -S1 -T0 |
Bill Richardson | 93778b0 | 2010-12-01 16:27:37 | [diff] [blame] | 29 | # Mark the kernel as highest priority |
| 30 | $sudo cgpt prioritize $base_dev -i $kern_num |
Bill Richardson | f3a8d95 | 2010-10-29 19:17:27 | [diff] [blame] | 31 | |
| 32 | # Run the verified boot debugging tool now, because we won't be able to run it |
| 33 | # manually if there's a problem (no root shell). It leaves a log file that we |
| 34 | # can look at. |
| 35 | $sudo dev_debug_vboot --cleanup |
Stefan Reinauer | 27e0e66 | 2011-03-10 05:11:28 | [diff] [blame^] | 36 | |
| 37 | # Run the firmware updater |
| 38 | FIRMWARE_UPDATE_SCRIPT='/usr/sbin/chromeos-firmwareupdate' |
| 39 | if [ -x "$FIRMWARE_UPDATE_SCRIPT" ]; then |
| 40 | "$FIRMWARE_UPDATE_SCRIPT" --mode=bootok |
| 41 | fi |
| 42 | |