Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: update_kernel.sh

Issue 5550001: Create a new command update_kernel.sh (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Fix comment. Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remote_access.sh ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/bin/bash
2
3 # Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 # Script to update the kernel on a live running ChromiumOS instance.
8
9 # Load common constants. This should be the first executable line.
10 # The path to common.sh should be relative to your script's location.
11
12 . "$(dirname $0)/common.sh"
13 . "$(dirname $0)/remote_access.sh"
14
15 DEFINE_string board "" "Override board reported by target"
16 DEFINE_string partition "" "Override kernel partition reported by target"
17
18 function cleanup {
19 cleanup_remote_access
20 rm -rf "${TMP}"
21 }
22
23 # Ask the target what the kernel partition is
24 function learn_partition() {
25 [ -n "${FLAGS_partition}" ] && return
26 remote_sh cat /proc/cmdline
Sameer Nanda 2010/12/02 17:22:41 probably simpler to use "rootdev" instead.
27 if echo "${REMOTE_OUT}" | grep -q "/dev/sda3"; then
28 FLAGS_partition="/dev/sda2"
29 else
30 FLAGS_partition="/dev/sda4"
31 fi
32 if [ -z "${FLAGS_partition}" ]; then
33 error "Partition required"
34 exit 1
35 fi
36 info "Target reports kernel partition is ${FLAGS_partition}"
37 }
38
39 function main() {
40 assert_outside_chroot
41
42 cd $(dirname "$0")
43
44 FLAGS "$@" || exit 1
45 eval set -- "${FLAGS_ARGV}"
46
47 set -e
48
49 trap cleanup EXIT
50
51 TMP=$(mktemp -d /tmp/image_to_live.XXXX)
52
53 remote_access_init
54
55 learn_board
56
57 remote_sh uname -r -v
58
59 old_kernel="${REMOTE_OUT}"
60
61 cmd="vbutil_kernel --pack new_kern.bin \
62 --keyblock /usr/share/vboot/devkeys/kernel.keyblock \
63 --signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk \
64 --version 1 \
65 --config ../build/images/${FLAGS_board}/latest/config.txt \
66 --bootloader /lib64/bootstub/bootstub.efi \
67 --vmlinuz /build/${FLAGS_board}/boot/vmlinuz"
68
69 ./enter_chroot.sh -- "${cmd}"
70
71 learn_partition
72
73 remote_cp_to new_kern.bin /tmp
74
75 remote_sh dd if=/tmp/new_kern.bin of="${FLAGS_partition}"
76
77 remote_reboot
78
79 remote_sh uname -r -v
80
81 info "old kernel: ${old_kernel}"
82
83 info "new kernel: ${REMOTE_OUT}"
84 }
85
86 main $@
OLDNEW
« no previous file with comments | « remote_access.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698