| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 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 # Script to generate a Chromium OS update for use by the update engine. | 7 # Script to generate a Chromium OS update for use by the update engine. |
| 8 # If a source .bin is specified, the update is assumed to be a delta update. | 8 # If a source .bin is specified, the update is assumed to be a delta update. |
| 9 | 9 |
| 10 # Load common constants. This should be the first executable line. | 10 # Load common constants. This should be the first executable line. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 patch_kernel() { | 80 patch_kernel() { |
| 81 local IMAGE="$1" | 81 local IMAGE="$1" |
| 82 local KERN_FILE="$2" | 82 local KERN_FILE="$2" |
| 83 | 83 |
| 84 STATE_LOOP_DEV=$(sudo losetup -f) | 84 STATE_LOOP_DEV=$(sudo losetup -f) |
| 85 [ -n "$STATE_LOOP_DEV" ] || die "no free loop device" | 85 [ -n "$STATE_LOOP_DEV" ] || die "no free loop device" |
| 86 local offset=$(partoffset "${IMAGE}" 1) | 86 local offset=$(partoffset "${IMAGE}" 1) |
| 87 offset=$(($offset * 512)) | 87 offset=$(($offset * 512)) |
| 88 sudo losetup -o "$offset" "$STATE_LOOP_DEV" "$IMAGE" | 88 sudo losetup -o "$offset" "$STATE_LOOP_DEV" "$IMAGE" |
| 89 STATE_MNT=$(mktemp -d /tmp/state.XXXXXX) | 89 STATE_MNT=$(mktemp -d /tmp/state.XXXXXX) |
| 90 sudo mount "$STATE_LOOP_DEV" "$STATE_MNT" | 90 sudo mount --read-only "$STATE_LOOP_DEV" "$STATE_MNT" |
| 91 dd if="$STATE_MNT"/vmlinuz_hd.vblock of="$KERN_FILE" conv=notrunc | 91 dd if="$STATE_MNT"/vmlinuz_hd.vblock of="$KERN_FILE" conv=notrunc |
| 92 sudo umount "$STATE_MNT" | 92 sudo umount "$STATE_MNT" |
| 93 STATE_MNT="" | 93 STATE_MNT="" |
| 94 sudo losetup -d "$STATE_LOOP_DEV" | 94 sudo losetup -d "$STATE_LOOP_DEV" |
| 95 STATE_LOOP_DEV="" | 95 STATE_LOOP_DEV="" |
| 96 } | 96 } |
| 97 | 97 |
| 98 extract_kern_root() { | 98 extract_kern_root() { |
| 99 local bin_file="$1" | 99 local bin_file="$1" |
| 100 local kern_out="$2" | 100 local kern_out="$2" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 | 238 |
| 239 GENERATOR="$(dirname "$0")/mk_memento_images.sh" | 239 GENERATOR="$(dirname "$0")/mk_memento_images.sh" |
| 240 | 240 |
| 241 CROS_GENERATE_UPDATE_PAYLOAD_CALLED=1 "$GENERATOR" "$DST_KERNEL" "$DST_ROOT" | 241 CROS_GENERATE_UPDATE_PAYLOAD_CALLED=1 "$GENERATOR" "$DST_KERNEL" "$DST_ROOT" |
| 242 mv "$(dirname "$DST_KERNEL")/update.gz" "$FLAGS_output" | 242 mv "$(dirname "$DST_KERNEL")/update.gz" "$FLAGS_output" |
| 243 | 243 |
| 244 trap - INT TERM EXIT | 244 trap - INT TERM EXIT |
| 245 cleanup noexit | 245 cleanup noexit |
| 246 echo "Done generating full update." | 246 echo "Done generating full update." |
| 247 fi | 247 fi |
| OLD | NEW |