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 modify a keyfob-based chromeos system image for testability. | 7 # Script to modify a keyfob-based chromeos system image for testability. |
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 14 matching lines...) Expand all Loading... | |
25 "Modify the image for factory install shim" | 25 "Modify the image for factory install shim" |
26 DEFINE_string image "" "Location of the rootfs raw image file" i | 26 DEFINE_string image "" "Location of the rootfs raw image file" i |
27 DEFINE_boolean installmask $FLAGS_TRUE \ | 27 DEFINE_boolean installmask $FLAGS_TRUE \ |
28 "Use INSTALL_MASK to shrink the resulting image." m | 28 "Use INSTALL_MASK to shrink the resulting image." m |
29 DEFINE_integer jobs -1 \ | 29 DEFINE_integer jobs -1 \ |
30 "How many packages to build in parallel at maximum." j | 30 "How many packages to build in parallel at maximum." j |
31 DEFINE_string qualdb "" "Location of qualified component file" d | 31 DEFINE_string qualdb "" "Location of qualified component file" d |
32 DEFINE_boolean yes $FLAGS_FALSE "Answer yes to all prompts" y | 32 DEFINE_boolean yes $FLAGS_FALSE "Answer yes to all prompts" y |
33 DEFINE_string build_root "/build" \ | 33 DEFINE_string build_root "/build" \ |
34 "The root location for board sysroots." | 34 "The root location for board sysroots." |
35 DEFINE_boolean fast ${FLAGS_FALSE} "Call many emerges in parallel" | |
Nick Sanders
2010/07/20 07:30:16
can you add passthough to image_to_usb? not necess
| |
35 | 36 |
36 | 37 |
37 # Parse command line | 38 # Parse command line |
38 FLAGS "$@" || exit 1 | 39 FLAGS "$@" || exit 1 |
39 eval set -- "${FLAGS_ARGV}" | 40 eval set -- "${FLAGS_ARGV}" |
40 | 41 |
41 EMERGE_CMD="emerge" | 42 EMERGE_CMD="emerge" |
42 EMERGE_BOARD_CMD="emerge-${FLAGS_board}" | 43 EMERGE_BOARD_CMD="emerge-${FLAGS_board}" |
43 TOP_SCRIPTS_DIR="$(dirname $0)" | 44 if [ "${FLAGS_fast}" -eq "${FLAGS_TRUE}" ]; then |
44 if [ -e "${TOP_SCRIPTS_DIR}/.emerge" ]; then | 45 echo "Using alternate emerge" |
45 . "${TOP_SCRIPTS_DIR}/.emerge" | 46 EMERGE_CMD="${SCRIPTS_DIR}/parallel_emerge" |
47 EMERGE_BOARD_CMD="${EMERGE_CMD} --board=${FLAGS_board}" | |
46 fi | 48 fi |
47 | 49 |
48 # No board, no default and no image set then we can't find the image | 50 # No board, no default and no image set then we can't find the image |
49 if [ -z $FLAGS_image ] && [ -z $FLAGS_board ] ; then | 51 if [ -z $FLAGS_image ] && [ -z $FLAGS_board ] ; then |
50 setup_board_warning | 52 setup_board_warning |
51 die "mod_image_for_test failed. No board set and no image set" | 53 die "mod_image_for_test failed. No board set and no image set" |
52 fi | 54 fi |
53 | 55 |
54 # We have a board name but no image set. Use image at default location | 56 # We have a board name but no image set. Use image at default location |
55 if [ -z $FLAGS_image ] ; then | 57 if [ -z $FLAGS_image ] ; then |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
88 # Emerges chromeos-test onto the image. | 90 # Emerges chromeos-test onto the image. |
89 emerge_chromeos_test() { | 91 emerge_chromeos_test() { |
90 INSTALL_MASK="" | 92 INSTALL_MASK="" |
91 if [[ $FLAGS_installmask -eq ${FLAGS_TRUE} ]]; then | 93 if [[ $FLAGS_installmask -eq ${FLAGS_TRUE} ]]; then |
92 INSTALL_MASK="$DEFAULT_INSTALL_MASK" | 94 INSTALL_MASK="$DEFAULT_INSTALL_MASK" |
93 fi | 95 fi |
94 | 96 |
95 # Determine the root dir for test packages. | 97 # Determine the root dir for test packages. |
96 ROOT_DEV_DIR="$ROOT_FS_DIR/usr/local" | 98 ROOT_DEV_DIR="$ROOT_FS_DIR/usr/local" |
97 | 99 |
98 INSTALL_MASK="$INSTALL_MASK" $EMERGE_BOARD_CMD \ | 100 sudo INSTALL_MASK="$INSTALL_MASK" $EMERGE_BOARD_CMD \ |
99 --root="$ROOT_DEV_DIR" --root-deps=rdeps \ | 101 --root="$ROOT_DEV_DIR" --root-deps=rdeps \ |
100 --usepkgonly chromeos-test $EMERGE_JOBS | 102 --usepkgonly chromeos-test $EMERGE_JOBS |
101 } | 103 } |
102 | 104 |
103 | 105 |
104 install_autotest() { | 106 install_autotest() { |
105 SYSROOT="${FLAGS_build_root}/${FLAGS_board}" | 107 SYSROOT="${FLAGS_build_root}/${FLAGS_board}" |
106 AUTOTEST_SRC="${SYSROOT}/usr/local/autotest" | 108 AUTOTEST_SRC="${SYSROOT}/usr/local/autotest" |
107 stateful_root="${ROOT_FS_DIR}/usr/local" | 109 stateful_root="${ROOT_FS_DIR}/usr/local" |
108 autotest_client="/autotest" | 110 autotest_client="/autotest" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 bash | 205 bash |
204 popd | 206 popd |
205 fi | 207 fi |
206 | 208 |
207 cleanup | 209 cleanup |
208 | 210 |
209 print_time_elapsed | 211 print_time_elapsed |
210 | 212 |
211 trap - EXIT | 213 trap - EXIT |
212 | 214 |
OLD | NEW |