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 # 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 seek=$kern_b_offset \ | 277 seek=$kern_b_offset \ |
278 conv=notrunc | 278 conv=notrunc |
279 fi | 279 fi |
280 | 280 |
281 # Install the recovery kernel as primary. | 281 # Install the recovery kernel as primary. |
282 dd if="$RECOVERY_KERNEL_IMAGE" of="$RECOVERY_IMAGE" bs=512 \ | 282 dd if="$RECOVERY_KERNEL_IMAGE" of="$RECOVERY_IMAGE" bs=512 \ |
283 seek=$kern_a_offset \ | 283 seek=$kern_a_offset \ |
284 count=$kern_a_size \ | 284 count=$kern_a_size \ |
285 conv=notrunc | 285 conv=notrunc |
286 | 286 |
| 287 # Set the 'Success' flag to 1 (to prevent the firmware from updating |
| 288 # the 'Tries' flag). |
| 289 sudo $GPT add -i 2 -S 1 "$RECOVERY_IMAGE" |
| 290 |
287 # Repeat for the legacy bioses. | 291 # Repeat for the legacy bioses. |
288 # Replace vmlinuz.A with the recovery version | 292 # Replace vmlinuz.A with the recovery version |
289 local sysroot="${FLAGS_build_root}/${FLAGS_board}" | 293 local sysroot="${FLAGS_build_root}/${FLAGS_board}" |
290 local vmlinuz="$sysroot/boot/vmlinuz" | 294 local vmlinuz="$sysroot/boot/vmlinuz" |
291 local esp_offset=$(partoffset "$RECOVERY_IMAGE" 12) | 295 local esp_offset=$(partoffset "$RECOVERY_IMAGE" 12) |
292 local esp_mnt=$(mktemp -d) | 296 local esp_mnt=$(mktemp -d) |
293 set +e | 297 set +e |
294 local failed=0 | 298 local failed=0 |
295 sudo mount -o loop,offset=$((esp_offset * 512)) "$RECOVERY_IMAGE" "$esp_mnt" | 299 sudo mount -o loop,offset=$((esp_offset * 512)) "$RECOVERY_IMAGE" "$esp_mnt" |
296 sudo cp "$vmlinuz" "$esp_mnt/syslinux/vmlinuz.A" || failed=1 | 300 sudo cp "$vmlinuz" "$esp_mnt/syslinux/vmlinuz.A" || failed=1 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 | 415 |
412 trap cleanup EXIT | 416 trap cleanup EXIT |
413 | 417 |
414 maybe_resize_stateful # Also copies the image if needed. | 418 maybe_resize_stateful # Also copies the image if needed. |
415 | 419 |
416 install_recovery_kernel | 420 install_recovery_kernel |
417 | 421 |
418 echo "Recovery image created at $RECOVERY_IMAGE" | 422 echo "Recovery image created at $RECOVERY_IMAGE" |
419 print_time_elapsed | 423 print_time_elapsed |
420 trap - EXIT | 424 trap - EXIT |
OLD | NEW |