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 # Load common constants. This should be the first executable line. | 7 # Load common constants. This should be the first executable line. |
8 # The path to common.sh should be relative to your script's location. | 8 # The path to common.sh should be relative to your script's location. |
9 . "$(dirname "$0")/common.sh" | 9 . "$(dirname "$0")/common.sh" |
10 | 10 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
73 fi | 73 fi |
74 | 74 |
75 # Only now can we die on error. shflags functions leak non-zero error codes, | 75 # Only now can we die on error. shflags functions leak non-zero error codes, |
76 # so will die prematurely if 'set -e' is specified before now. | 76 # so will die prematurely if 'set -e' is specified before now. |
77 set -e | 77 set -e |
78 # Die on uninitialized variables. | 78 # Die on uninitialized variables. |
79 set -u | 79 set -u |
80 | 80 |
81 # Check for missing parts. | 81 # Check for missing parts. |
82 # For recovery image, only populate ROOT-A and KERN-A | 82 # For recovery image, only populate ROOT-A and KERN-A |
83 # TODO(tgao): write a script to populate ROOT-B and KERN-B | |
84 ROOTFS_IMG="${IMAGEDIR}/rootfs.image" | 83 ROOTFS_IMG="${IMAGEDIR}/rootfs.image" |
85 if [[ ! -s ${ROOTFS_IMG} ]]; then | 84 if [[ ! -s ${ROOTFS_IMG} ]]; then |
86 error "Can't find ${ROOTFS_IMG}" | 85 error "Can't find ${ROOTFS_IMG}" |
87 exit 1 | 86 exit 1 |
88 fi | 87 fi |
89 | 88 |
90 KERNEL_IMG="${IMAGEDIR}/vmlinuz.image" | 89 KERNEL_IMG="${IMAGEDIR}/vmlinuz.image" |
91 if [[ ! -s ${KERNEL_IMG} ]]; then | 90 if [[ ! -s ${KERNEL_IMG} ]]; then |
92 error "Can't find ${KERNEL_IMG}" | 91 error "Can't find ${KERNEL_IMG}" |
93 exit 1 | 92 exit 1 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 echo "Copying stateful partition..." | 142 echo "Copying stateful partition..." |
144 $sudo dd if=${STATEFUL_IMG} of=${OUTDEV} conv=notrunc bs=512 \ | 143 $sudo dd if=${STATEFUL_IMG} of=${OUTDEV} conv=notrunc bs=512 \ |
145 seek=${START_STATEFUL} | 144 seek=${START_STATEFUL} |
146 | 145 |
147 echo "Copying kernel..." | 146 echo "Copying kernel..." |
148 $sudo dd if=${KERNEL_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_KERN_A} | 147 $sudo dd if=${KERNEL_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_KERN_A} |
149 | 148 |
150 echo "Copying rootfs..." | 149 echo "Copying rootfs..." |
151 $sudo dd if=${ROOTFS_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_ROOTFS_A } | 150 $sudo dd if=${ROOTFS_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_ROOTFS_A } |
152 | 151 |
152 # TODO(tgao): write a script to populate ROOT-B and KERN-B with user-specified | |
153 # rootfs and kernel. Do NOT remove if block below until then (otherwise | |
154 # chromeos-installer will fail b/c it expects to install from partition B) | |
155 if [ ${FLAGS_recovery} -eq $FLAGS_TRUE ]; then | |
156 echo "Copying kernel B..." | |
157 $sudo dd if=${KERNEL_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_KERN_B } | |
adlr
2010/05/20 20:41:22
wrap this and the next line to 80 cols (you'll nee
Tan Gao
2010/05/20 20:50:41
good style! fixed START_KERN_A line above as well
| |
158 | |
159 echo "Copying rootfs B..." | |
160 $sudo dd if=${ROOTFS_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_ROOTFS _B} | |
161 fi | |
162 | |
153 echo "Copying EFI system partition..." | 163 echo "Copying EFI system partition..." |
154 $sudo dd if=${ESP_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_ESP} | 164 $sudo dd if=${ESP_IMG} of=${OUTDEV} conv=notrunc bs=512 seek=${START_ESP} |
155 | 165 |
156 # Clean up temporary files. | 166 # Clean up temporary files. |
157 if [[ -n "${MBR_IMG:-}" ]]; then | 167 if [[ -n "${MBR_IMG:-}" ]]; then |
158 rm "${MBR_IMG}" | 168 rm "${MBR_IMG}" |
159 fi | 169 fi |
OLD | NEW |