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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 if [ -z "${FLAGS_to}" ]; then | 84 if [ -z "${FLAGS_to}" ]; then |
85 echo "You must specify a file or device to write to using --to." | 85 echo "You must specify a file or device to write to using --to." |
86 disks=$(list_usb_disks) | 86 disks=$(list_usb_disks) |
87 if [ -n "$disks" ]; then | 87 if [ -n "$disks" ]; then |
88 echo "Available USB disks:" | 88 echo "Available USB disks:" |
89 for disk in $disks; do | 89 for disk in $disks; do |
90 echo " /dev/$disk:" | 90 echo " /dev/$disk:" |
91 echo " Manufacturer: $(get_disk_info $disk manufacturer)" | 91 echo " Manufacturer: $(get_disk_info $disk manufacturer)" |
92 echo " Product: $(get_disk_info $disk product)" | 92 echo " Product: $(get_disk_info $disk product)" |
93 echo " Size: $(cat /sys/block/$disk/size) kBytes" | 93 echo " Size: $[$(cat /sys/block/$disk/size) * 512] bytes" |
94 done | 94 done |
95 fi | 95 fi |
96 exit 1 | 96 exit 1 |
97 fi | 97 fi |
98 | 98 |
99 # Convert args to paths. Need eval to un-quote the string so that shell | 99 # Convert args to paths. Need eval to un-quote the string so that shell |
100 # chars like ~ are processed; just doing FOO=`readlink -f ${FOO}` won't work. | 100 # chars like ~ are processed; just doing FOO=`readlink -f ${FOO}` won't work. |
101 FLAGS_from=`eval readlink -f ${FLAGS_from}` | 101 FLAGS_from=`eval readlink -f ${FLAGS_from}` |
102 FLAGS_to=`eval readlink -f ${FLAGS_to}` | 102 FLAGS_to=`eval readlink -f ${FLAGS_to}` |
103 | 103 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 echo " sudo dd if=${FLAGS_to} of=/dev/sdX bs=4M" | 225 echo " sudo dd if=${FLAGS_to} of=/dev/sdX bs=4M" |
226 echo "where /dev/sdX is the entire drive." | 226 echo "where /dev/sdX is the entire drive." |
227 if [ ${INSIDE_CHROOT} -eq 1 ] | 227 if [ ${INSIDE_CHROOT} -eq 1 ] |
228 then | 228 then |
229 example=$(basename "${FLAGS_to}") | 229 example=$(basename "${FLAGS_to}") |
230 echo "NOTE: Since you are currently inside the chroot, and you'll need to" | 230 echo "NOTE: Since you are currently inside the chroot, and you'll need to" |
231 echo "run dd outside the chroot, the path to the USB image will be" | 231 echo "run dd outside the chroot, the path to the USB image will be" |
232 echo "different (ex: ~/chromeos/trunk/src/build/images/SOME_DIR/$example)." | 232 echo "different (ex: ~/chromeos/trunk/src/build/images/SOME_DIR/$example)." |
233 fi | 233 fi |
234 fi | 234 fi |
OLD | NEW |