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

Side by Side Diff: mod_image_for_recovery.sh

Issue 5404001: Copy recovery kernel to syslinux path only on x86. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crosutils.git@master
Patch Set: encase set +e and -e along with code that uses it 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 | « no previous file | 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
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 # This script modifies a base image to act as a recovery installer. 7 # This script modifies a base image to act as a recovery installer.
8 # If no kernel image is supplied, it will build a devkeys signed recovery 8 # If no kernel image is supplied, it will build a devkeys signed recovery
9 # kernel. Alternatively, a signed recovery kernel can be used to 9 # kernel. Alternatively, a signed recovery kernel can be used to
10 # create a Chromium OS recovery image. 10 # create a Chromium OS recovery image.
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 conv=notrunc 285 conv=notrunc
286 286
287 # Set the 'Success' flag to 1 (to prevent the firmware from updating 287 # Set the 'Success' flag to 1 (to prevent the firmware from updating
288 # the 'Tries' flag). 288 # the 'Tries' flag).
289 sudo $GPT add -i 2 -S 1 "$RECOVERY_IMAGE" 289 sudo $GPT add -i 2 -S 1 "$RECOVERY_IMAGE"
290 290
291 # Repeat for the legacy bioses. 291 # Repeat for the legacy bioses.
292 # Replace vmlinuz.A with the recovery version 292 # Replace vmlinuz.A with the recovery version
293 local sysroot="${FLAGS_build_root}/${FLAGS_board}" 293 local sysroot="${FLAGS_build_root}/${FLAGS_board}"
294 local vmlinuz="$sysroot/boot/vmlinuz" 294 local vmlinuz="$sysroot/boot/vmlinuz"
295 local esp_offset=$(partoffset "$RECOVERY_IMAGE" 12)
296 local esp_mnt=$(mktemp -d)
297 set +e
298 local failed=0 295 local failed=0
299 sudo mount -o loop,offset=$((esp_offset * 512)) "$RECOVERY_IMAGE" "$esp_mnt" 296
300 sudo cp "$vmlinuz" "$esp_mnt/syslinux/vmlinuz.A" || failed=1 297 if [ "$ARCH" == "x86" ]; then
Will Drewry 2010/11/29 23:37:16 I'm pretty sure this should be a single '='.
dhendrix 2010/11/29 23:51:37 Done. I always get confused here since bash allows
Will Drewry 2010/11/30 19:13:05 Yup - == should be fine, but = is the more cross-s
301 sudo umount -d "$esp_mnt" 298 # There is no syslinux on ARM, so this copy only makes sense for x86.
302 rmdir "$esp_mnt" 299 set +e
303 set -e 300 local esp_offset=$(partoffset "$RECOVERY_IMAGE" 12)
301 local esp_mnt=$(mktemp -d)
302 sudo mount -o loop,offset=$((esp_offset * 512)) "$RECOVERY_IMAGE" "$esp_mnt"
303 sudo cp "$vmlinuz" "$esp_mnt/syslinux/vmlinuz.A" || failed=1
304 sudo umount -d "$esp_mnt"
305 rmdir "$esp_mnt"
306 set -e
307 fi
308
304 if [ $failed -eq 1 ]; then 309 if [ $failed -eq 1 ]; then
305 echo "Failed to copy recovery kernel to ESP" 310 echo "Failed to copy recovery kernel to ESP"
306 return 1 311 return 1
307 fi 312 fi
308 return 0 313 return 0
309 } 314 }
310 315
311 maybe_resize_stateful() { 316 maybe_resize_stateful() {
312 # If we're not minimizing, then just copy and go. 317 # If we're not minimizing, then just copy and go.
313 if [ $FLAGS_minimize_image -eq $FLAGS_FALSE ]; then 318 if [ $FLAGS_minimize_image -eq $FLAGS_FALSE ]; then
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 420
416 trap cleanup EXIT 421 trap cleanup EXIT
417 422
418 maybe_resize_stateful # Also copies the image if needed. 423 maybe_resize_stateful # Also copies the image if needed.
419 424
420 install_recovery_kernel 425 install_recovery_kernel
421 426
422 echo "Recovery image created at $RECOVERY_IMAGE" 427 echo "Recovery image created at $RECOVERY_IMAGE"
423 print_time_elapsed 428 print_time_elapsed
424 trap - EXIT 429 trap - EXIT
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698