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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 FLAGS_test_image=${FLAGS_TRUE} | 44 FLAGS_test_image=${FLAGS_TRUE} |
45 fi | 45 fi |
46 | 46 |
47 # Inside the chroot, so output to usb.img in the same dir as the other | 47 # Inside the chroot, so output to usb.img in the same dir as the other |
48 # Script can be run either inside or outside the chroot. | 48 # Script can be run either inside or outside the chroot. |
49 if [ ${INSIDE_CHROOT} -eq 1 ] | 49 if [ ${INSIDE_CHROOT} -eq 1 ] |
50 then | 50 then |
51 SYSROOT="${FLAGS_build_root}/${FLAGS_board}" | 51 SYSROOT="${FLAGS_build_root}/${FLAGS_board}" |
52 else | 52 else |
53 SYSROOT="${DEFAULT_CHROOT_DIR}${FLAGS_build_root}/${FLAGS_board}" | 53 SYSROOT="${DEFAULT_CHROOT_DIR}${FLAGS_build_root}/${FLAGS_board}" |
| 54 echo "Caching sudo authentication" |
| 55 sudo -v |
| 56 echo "Done" |
54 fi | 57 fi |
55 AUTOTEST_SRC="${SYSROOT}/usr/local/autotest" | 58 AUTOTEST_SRC="${SYSROOT}/usr/local/autotest" |
56 | 59 |
57 # Die on any errors. | 60 # Die on any errors. |
58 set -e | 61 set -e |
59 | 62 |
60 # No board, no default and no image set then we can't find the image | 63 # No board, no default and no image set then we can't find the image |
61 if [ -z ${FLAGS_from} ] && [ -z ${FLAGS_board} ] ; then | 64 if [ -z ${FLAGS_from} ] && [ -z ${FLAGS_board} ] ; then |
62 setup_board_warning | 65 setup_board_warning |
63 exit 1 | 66 exit 1 |
(...skipping 23 matching lines...) Expand all Loading... |
87 # Outside the chroot, so output to the default device for a usb key. | 90 # Outside the chroot, so output to the default device for a usb key. |
88 FLAGS_to="/dev/sdb" | 91 FLAGS_to="/dev/sdb" |
89 fi | 92 fi |
90 fi | 93 fi |
91 | 94 |
92 # Convert args to paths. Need eval to un-quote the string so that shell | 95 # Convert args to paths. Need eval to un-quote the string so that shell |
93 # chars like ~ are processed; just doing FOO=`readlink -f ${FOO}` won't work. | 96 # chars like ~ are processed; just doing FOO=`readlink -f ${FOO}` won't work. |
94 FLAGS_from=`eval readlink -f ${FLAGS_from}` | 97 FLAGS_from=`eval readlink -f ${FLAGS_from}` |
95 FLAGS_to=`eval readlink -f ${FLAGS_to}` | 98 FLAGS_to=`eval readlink -f ${FLAGS_to}` |
96 | 99 |
97 # Done evaluating arguments, lets go! | |
98 echo "Caching sudo authentication" | |
99 sudo -v | |
100 echo "Done" | |
101 | |
102 # Use this image as the source image to copy | 100 # Use this image as the source image to copy |
103 SRC_IMAGE="${FLAGS_from}/chromiumos_image.bin" | 101 SRC_IMAGE="${FLAGS_from}/chromiumos_image.bin" |
104 | 102 |
105 # If we're asked to modify the image for test, then let's make a copy and | 103 # If we're asked to modify the image for test, then let's make a copy and |
106 # modify that instead. | 104 # modify that instead. |
107 if [ ${FLAGS_test_image} -eq ${FLAGS_TRUE} ] ; then | 105 if [ ${FLAGS_test_image} -eq ${FLAGS_TRUE} ] ; then |
108 if [ ! -f "${FLAGS_from}/chromiumos_test_image.bin" ] || \ | 106 if [ ! -f "${FLAGS_from}/chromiumos_test_image.bin" ] || \ |
109 [ ${FLAGS_force_copy} -eq ${FLAGS_TRUE} ] ; then | 107 [ ${FLAGS_force_copy} -eq ${FLAGS_TRUE} ] ; then |
110 # Copy it. | 108 # Copy it. |
111 echo "Creating test image from original..." | 109 echo "Creating test image from original..." |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 echo " sudo dd if=${FLAGS_to} of=/dev/sdb bs=4M" | 240 echo " sudo dd if=${FLAGS_to} of=/dev/sdb bs=4M" |
243 echo "where /dev/sdb is the entire keyfob." | 241 echo "where /dev/sdb is the entire keyfob." |
244 if [ ${INSIDE_CHROOT} -eq 1 ] | 242 if [ ${INSIDE_CHROOT} -eq 1 ] |
245 then | 243 then |
246 example=$(basename "${FLAGS_to}") | 244 example=$(basename "${FLAGS_to}") |
247 echo "NOTE: Since you are currently inside the chroot, and you'll need to" | 245 echo "NOTE: Since you are currently inside the chroot, and you'll need to" |
248 echo "run dd outside the chroot, the path to the USB image will be" | 246 echo "run dd outside the chroot, the path to the USB image will be" |
249 echo "different (ex: ~/chromeos/trunk/src/build/images/SOME_DIR/$example)." | 247 echo "different (ex: ~/chromeos/trunk/src/build/images/SOME_DIR/$example)." |
250 fi | 248 fi |
251 fi | 249 fi |
OLD | NEW |