blob: 5e342131118624937606cd01143f8e115c92a63d [file] [log] [blame]
Randall Spanglera51e35b2010-08-20 23:37:541#!/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
11if [ "0" = $(id -u) ]; then
12 local sudo=""
13else
14 local sudo=sudo
15fi
16
17# Extract the kernel partition's UniqueGuid from the command line.
18guid=$(sed 's/.*kern_guid=\([0-9a-fA-F-]\+\).*/\1/' /proc/cmdline)
19
20# Look through all the known devices to find that one partition.
21kern_dev=$($sudo cgpt find -1 -u $guid)
22
23# Split the kernel device in the base device and paritition number.
24base_dev=$(get_block_dev_from_partition_dev $kern_dev)
25kern_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 Richardson93778b02010-12-01 16:27:3729# Mark the kernel as highest priority
30$sudo cgpt prioritize $base_dev -i $kern_num
Bill Richardsonf3a8d952010-10-29 19:17:2731
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 Reinauer27e0e662011-03-10 05:11:2836
37# Run the firmware updater
38FIRMWARE_UPDATE_SCRIPT='/usr/sbin/chromeos-firmwareupdate'
39if [ -x "$FIRMWARE_UPDATE_SCRIPT" ]; then
40 "$FIRMWARE_UPDATE_SCRIPT" --mode=bootok
41fi
42