OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2009 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 convert the output of build_image.sh to a usb image. | 7 # Script to convert the output of build_image.sh to a usb image. |
8 | 8 |
9 # Load common constants. This should be the first executable line. | 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. | 10 # The path to common.sh should be relative to your script's location. |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 echo "device manually from outside the chroot and try again." | 230 echo "device manually from outside the chroot and try again." |
231 echo | 231 echo |
232 exit 1 | 232 exit 1 |
233 fi | 233 fi |
234 done | 234 done |
235 sleep 3 | 235 sleep 3 |
236 | 236 |
237 if [ ${FLAGS_install} -ne ${FLAGS_TRUE} ]; then | 237 if [ ${FLAGS_install} -ne ${FLAGS_TRUE} ]; then |
238 echo "Copying ${SRC_IMAGE} to ${FLAGS_to}..." | 238 echo "Copying ${SRC_IMAGE} to ${FLAGS_to}..." |
239 if type pv >/dev/null 2>&1; then | 239 if type pv >/dev/null 2>&1; then |
240 sudo pv -ptre "${SRC_IMAGE}" | sudo dd of="${FLAGS_to}" bs=4M oflag=sync | 240 # pv displays file size in k=1024 while dd uses k=1000. |
| 241 # To prevent confusion, we suppress the summary report from dd. |
| 242 sudo pv -ptreb -B 4m "${SRC_IMAGE}" | |
| 243 sudo dd of="${FLAGS_to}" bs=4M oflag=sync status=noxfer |
241 else | 244 else |
242 sudo dd if="${SRC_IMAGE}" of="${FLAGS_to}" bs=4M oflag=sync | 245 sudo dd if="${SRC_IMAGE}" of="${FLAGS_to}" bs=4M oflag=sync |
243 fi | 246 fi |
244 sync | 247 sync |
245 else | 248 else |
246 if [ ${INSIDE_CHROOT} -ne 1 ]; then | 249 if [ ${INSIDE_CHROOT} -ne 1 ]; then |
247 echo "Installation must be done from inside the chroot." | 250 echo "Installation must be done from inside the chroot." |
248 exit 1 | 251 exit 1 |
249 fi | 252 fi |
250 | 253 |
251 echo "Installing ${SRC_IMAGE} to ${FLAGS_to}..." | 254 echo "Installing ${SRC_IMAGE} to ${FLAGS_to}..." |
252 "${FLAGS_build_root}/${FLAGS_board}/usr/sbin/chromeos-install" \ | 255 "${FLAGS_build_root}/${FLAGS_board}/usr/sbin/chromeos-install" \ |
253 --yes \ | 256 --yes \ |
254 --skip_src_removable \ | 257 --skip_src_removable \ |
255 --skip_dst_removable \ | 258 --skip_dst_removable \ |
256 --arch="${FLAGS_arch}" \ | 259 --arch="${FLAGS_arch}" \ |
257 --payload_image="${SRC_IMAGE}" \ | 260 --payload_image="${SRC_IMAGE}" \ |
258 --dst="${FLAGS_to}" | 261 --dst="${FLAGS_to}" |
259 fi | 262 fi |
260 echo "Done." | 263 echo "Done." |
261 else | 264 else |
262 # Output to a file, so just make a copy. | 265 # Output to a file, so just make a copy. |
263 echo "Copying ${SRC_IMAGE} to ${FLAGS_to}..." | 266 echo "Copying ${SRC_IMAGE} to ${FLAGS_to}..." |
264 cp -f "${SRC_IMAGE}" "${FLAGS_to}" | 267 cp -f "${SRC_IMAGE}" "${FLAGS_to}" |
265 | 268 |
266 echo "Done. To copy to a USB drive, do something like:" | 269 echo "Done. To copy to a USB drive, do something like:" |
267 echo " sudo dd if=${FLAGS_to} of=/dev/sdX bs=4M oflag=sync" | 270 echo " sudo dd if=${FLAGS_to} of=/dev/sdX bs=4M oflag=sync" |
268 echo "where /dev/sdX is the entire drive." | 271 echo "where /dev/sdX is the entire drive." |
269 fi | 272 fi |
OLD | NEW |