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 # Script to sync your checkout, build a Chromium OS image, and test it all | 7 # Script to sync your checkout, build a Chromium OS image, and test it all |
8 # with one command. Can also check out a new Chromium OS checkout and | 8 # with one command. Can also check out a new Chromium OS checkout and |
9 # perform a subset of the above operations. | 9 # perform a subset of the above operations. |
10 # | 10 # |
(...skipping 28 matching lines...) Expand all Loading... |
39 # BUILDBOT_URI - default value for --buildbot_uri | 39 # BUILDBOT_URI - default value for --buildbot_uri |
40 # CHROMIUM_REPO - default value for --repo | 40 # CHROMIUM_REPO - default value for --repo |
41 # CHRONOS_PASSWD - default value for --chronos_passwd | 41 # CHRONOS_PASSWD - default value for --chronos_passwd |
42 # | 42 # |
43 | 43 |
44 # Load common constants. This should be the first executable line. | 44 # Load common constants. This should be the first executable line. |
45 # The path to common.sh should be relative to your script's location. | 45 # The path to common.sh should be relative to your script's location. |
46 . "$(dirname "$0")/common.sh" | 46 . "$(dirname "$0")/common.sh" |
47 | 47 |
48 | 48 |
49 DEFINE_string top "" \ | 49 DEFINE_string board "x86-generic" "Board setting" |
50 "Root directory of your checkout (defaults to determining from your cwd)" | |
51 DEFINE_string repo "${CHROMIUMOS_REPO}" "gclient repo for chromiumos" | |
52 DEFINE_boolean sync ${FLAGS_TRUE} "Sync the checkout" | |
53 DEFINE_boolean force_make_chroot ${FLAGS_FALSE} "Run make_chroot indep of sync" | |
54 DEFINE_boolean build ${FLAGS_TRUE} \ | 50 DEFINE_boolean build ${FLAGS_TRUE} \ |
55 "Build all code (but not necessarily master image)" | 51 "Build all code (but not necessarily master image)" |
56 DEFINE_boolean master ${FLAGS_TRUE} "Master an image from built code" | 52 DEFINE_boolean build_autotest ${FLAGS_FALSE} "Build autotest" |
| 53 DEFINE_string buildbot_uri "${BUILDBOT_URI}" \ |
| 54 "Base URI to buildbot build location which contains LATEST file" |
| 55 DEFINE_string chronos_passwd "${CHRONOS_PASSWD}" \ |
| 56 "Use this as the chronos user passwd (defaults to \$CHRONOS_PASSWD)" |
| 57 DEFINE_string chroot "" "Chroot to build/use" |
| 58 DEFINE_boolean force_make_chroot ${FLAGS_FALSE} "Run make_chroot indep of sync" |
57 DEFINE_string grab_buildbot "" \ | 59 DEFINE_string grab_buildbot "" \ |
58 "Instead of building, grab this full image.zip URI generated by the \ | 60 "Instead of building, grab this full image.zip URI generated by the \ |
59 buildbot" | 61 buildbot" |
60 DEFINE_string chronos_passwd "${CHRONOS_PASSWD}" \ | |
61 "Use this as the chronos user passwd (defaults to \$CHRONOS_PASSWD)" | |
62 DEFINE_boolean mod_image_for_test ${FLAGS_FALSE} "Modify the image for testing" | |
63 DEFINE_boolean build_autotest ${FLAGS_FALSE} "Build autotest" | |
64 DEFINE_boolean image_to_live ${FLAGS_FALSE} \ | 62 DEFINE_boolean image_to_live ${FLAGS_FALSE} \ |
65 "Put the resulting image on live instance (requires --remote)" | 63 "Put the resulting image on live instance (requires --remote)" |
| 64 DEFINE_string image_to_usb "" \ |
| 65 "Treat this device as USB and put the image on it after build" |
| 66 # You can set jobs > 1 but then your build may break and you may need |
| 67 # to retry. Setting it to 1 is best for non-interactive sessions. |
| 68 DEFINE_boolean interactive ${FLAGS_FALSE} \ |
| 69 "Tell user what we plan to do and wait for input to proceed" i |
| 70 DEFINE_integer jobs -1 "Concurrent build jobs" |
| 71 DEFINE_boolean master ${FLAGS_TRUE} "Master an image from built code" |
| 72 DEFINE_boolean mod_image_for_test ${FLAGS_FALSE} "Modify the image for testing" |
66 DEFINE_string remote "" \ | 73 DEFINE_string remote "" \ |
67 "Use this hostname/IP for live updating and running tests" | 74 "Use this hostname/IP for live updating and running tests" |
68 DEFINE_string image_to_usb "" \ | 75 DEFINE_string repo "${CHROMIUMOS_REPO}" "gclient repo for chromiumos" |
69 "Treat this device as USB and put the image on it after build" | 76 DEFINE_boolean sync ${FLAGS_TRUE} "Sync the checkout" |
70 DEFINE_string test "" \ | 77 DEFINE_string test "" \ |
71 "Test the built image with the given params to run_remote_tests" | 78 "Test the built image with the given params to run_remote_tests" |
72 DEFINE_string buildbot_uri "${BUILDBOT_URI}" \ | 79 DEFINE_string top "" \ |
73 "Base URI to buildbot build location which contains LATEST file" | 80 "Root directory of your checkout (defaults to determining from your cwd)" |
| 81 DEFINE_boolean withdev ${FLAGS_TRUE} "Build development packages" |
74 DEFINE_boolean unittest ${FLAGS_TRUE} "Run unit tests" | 82 DEFINE_boolean unittest ${FLAGS_TRUE} "Run unit tests" |
75 DEFINE_boolean interactive ${FLAGS_FALSE} \ | 83 |
76 "Tell user what we plan to do and wait for input to proceed" i | |
77 DEFINE_boolean portage ${FLAGS_TRUE} "Use portage-based build" | |
78 DEFINE_string board "x86-generic" "Board setting (portage)" | |
79 DEFINE_string toolchain "i686-pc-linux-gnu" "Toolchain setting (portage)" | |
80 # You can set build_jobs > 1 but then your build may break and you may need | |
81 # to retry. Setting it to 1 is best for non-interactive sessions. | |
82 DEFINE_integer build_jobs 1 "Concurrent build jobs (portage)" | |
83 | 84 |
84 # Returns a heuristic indicating if we believe this to be a google internal | 85 # Returns a heuristic indicating if we believe this to be a google internal |
85 # development environment. | 86 # development environment. |
86 # Returns: | 87 # Returns: |
87 # 0 if so, 1 otherwise | 88 # 0 if so, 1 otherwise |
88 function is_google_environment() { | 89 function is_google_environment() { |
89 hostname | egrep -q .google.com\$ | 90 hostname | egrep -q .google.com\$ |
90 return $? | 91 return $? |
91 } | 92 } |
92 | 93 |
(...skipping 11 matching lines...) Expand all Loading... |
104 test_dir=$(dirname "${test_dir}") | 105 test_dir=$(dirname "${test_dir}") |
105 done | 106 done |
106 fi | 107 fi |
107 | 108 |
108 if [[ -z "${FLAGS_top}" ]]; then | 109 if [[ -z "${FLAGS_top}" ]]; then |
109 # Use the top directory based on where this script runs from | 110 # Use the top directory based on where this script runs from |
110 FLAGS_top=$(dirname $(dirname $(dirname $0))) | 111 FLAGS_top=$(dirname $(dirname $(dirname $0))) |
111 fi | 112 fi |
112 | 113 |
113 # Canonicalize any symlinks | 114 # Canonicalize any symlinks |
114 FLAGS_top=$(readlink -f "${FLAGS_top}") | 115 if [[ -d "${FLAGS_top}" ]]; then |
| 116 FLAGS_top=$(readlink -f "${FLAGS_top}") |
| 117 fi |
| 118 |
| 119 if [[ -z "${FLAGS_chroot}" ]]; then |
| 120 FLAGS_chroot="${FLAGS_top}/chroot" |
| 121 fi |
| 122 |
| 123 # If chroot does not exist, force making it |
| 124 if [[ ! -d "${FLAGS_chroot}" ]]; then |
| 125 FLAGS_force_make_chroot=${FLAGS_TRUE} |
| 126 fi |
115 | 127 |
116 if [[ -z "${FLAGS_repo}" ]]; then | 128 if [[ -z "${FLAGS_repo}" ]]; then |
117 if is_google_environment; then | 129 if is_google_environment; then |
118 FLAGS_repo="ssh://git@chromiumos-git//chromeos" | 130 FLAGS_repo="ssh://git@chromiumos-git//chromeos" |
119 else | 131 else |
120 FLAGS_repo="http://src.chromium.org/git/chromiumos.git" | 132 FLAGS_repo="http://src.chromium.org/git/chromiumos.git" |
121 fi | 133 fi |
122 fi | 134 fi |
123 | 135 |
124 if [[ -n "${FLAGS_test}" ]]; then | 136 if [[ -n "${FLAGS_test}" ]]; then |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 fi | 175 fi |
164 | 176 |
165 if [[ ${FLAGS_mod_image_for_test} -eq ${FLAGS_TRUE} ]]; then | 177 if [[ ${FLAGS_mod_image_for_test} -eq ${FLAGS_TRUE} ]]; then |
166 # Override any specified chronos password with the test one | 178 # Override any specified chronos password with the test one |
167 local test_file=$(dirname $0)"/mod_for_test_scripts/test_account.passwd" | 179 local test_file=$(dirname $0)"/mod_for_test_scripts/test_account.passwd" |
168 FLAGS_chronos_passwd=$(head -1 "${test_file}") | 180 FLAGS_chronos_passwd=$(head -1 "${test_file}") |
169 # Default to building autotests whenever we mod image for test. | 181 # Default to building autotests whenever we mod image for test. |
170 # TODO(kmixter): Make this more efficient by either doing incremental | 182 # TODO(kmixter): Make this more efficient by either doing incremental |
171 # building, or only building if the tests we're running needs to be. | 183 # building, or only building if the tests we're running needs to be. |
172 FLAGS_build_autotest=${FLAGS_TRUE} | 184 FLAGS_build_autotest=${FLAGS_TRUE} |
173 fi | 185 # If you're modding for test, you also want developer packages. |
174 | 186 FLAGS_withdev=${FLAGS_TRUE} |
175 if [[ -e "${FLAGS_top}/src/scripts/new_make_env.sh" ]]; then | |
176 if [[ ${FLAGS_portage} -ne ${FLAGS_TRUE} ]]; then | |
177 echo "WARNING: It looks like you wanted to pass --portage to " | |
178 echo "build with the portage method" | |
179 fi | |
180 fi | 187 fi |
181 | 188 |
182 if [[ -n "${FLAGS_image_to_usb}" ]]; then | 189 if [[ -n "${FLAGS_image_to_usb}" ]]; then |
183 local device=${FLAGS_image_to_usb#/dev/} | 190 local device=${FLAGS_image_to_usb#/dev/} |
184 if [[ -z "${device}" ]]; then | 191 if [[ -z "${device}" ]]; then |
185 echo "Expected --image_to_usb option of /dev/* format" | 192 echo "Expected --image_to_usb option of /dev/* format" |
186 exit 1 | 193 exit 1 |
187 fi | 194 fi |
188 local is_removable=$(cat /sys/block/${device}/removable) | 195 local is_removable=$(cat /sys/block/${device}/removable) |
189 if [[ "${is_removable}" != "1" ]]; then | 196 if [[ "${is_removable}" != "1" ]]; then |
190 echo "Could not verify that ${device} for image_to_usb is removable" | 197 echo "Could not verify that ${device} for image_to_usb is removable" |
191 exit 1 | 198 exit 1 |
192 fi | 199 fi |
193 fi | 200 fi |
194 } | 201 } |
195 | 202 |
196 | 203 |
197 # Prints a description of what we are doing or did | 204 # Prints a description of what we are doing or did |
198 function describe_steps() { | 205 function describe_steps() { |
199 if [[ ${FLAGS_sync} -eq ${FLAGS_TRUE} ]]; then | 206 if [[ ${FLAGS_sync} -eq ${FLAGS_TRUE} ]]; then |
200 echo " * Sync client (gclient sync)" | 207 echo " * Sync client (gclient sync)" |
201 if is_google_environment; then | 208 if is_google_environment; then |
202 echo " * Create proper src/scripts/.chromeos_dev" | 209 echo " * Create proper src/scripts/.chromeos_dev" |
203 fi | 210 fi |
204 fi | 211 fi |
205 if [[ ${FLAGS_force_make_chroot} -eq ${FLAGS_TRUE} ]]; then | 212 if [[ ${FLAGS_force_make_chroot} -eq ${FLAGS_TRUE} ]]; then |
206 echo " * (Re-)create development chroot (make_chroot.sh)" | 213 echo " * Rebuild chroot (make_chroot) in ${FLAGS_chroot}" |
207 fi | 214 fi |
208 local set_passwd=${FLAGS_FALSE} | 215 local set_passwd=${FLAGS_FALSE} |
209 if [[ ${FLAGS_build} -eq ${FLAGS_TRUE} ]]; then | 216 if [[ ${FLAGS_build} -eq ${FLAGS_TRUE} ]]; then |
210 echo " * Build image (build_platform_packages.sh, build_kernel.sh)" | 217 local withdev="" |
| 218 local jobs=" single job (slow but safe)" |
| 219 if [[ ${FLAGS_jobs} -gt 1 ]]; then |
| 220 jobs=" ${FLAGS_jobs} jobs (may cause build failure)" |
| 221 fi |
| 222 if [[ ${FLAGS_withdev} -eq ${FLAGS_TRUE} ]]; then |
| 223 withdev=" with dev packages" |
| 224 fi |
| 225 echo " * Build image${withdev}${jobs}" |
211 set_passwd=${FLAGS_TRUE} | 226 set_passwd=${FLAGS_TRUE} |
212 fi | 227 fi |
213 if [[ ${FLAGS_master} -eq ${FLAGS_TRUE} ]]; then | 228 if [[ ${FLAGS_master} -eq ${FLAGS_TRUE} ]]; then |
214 echo " * Master image (build_image.sh)" | 229 echo " * Master image (build_image)" |
215 fi | 230 fi |
216 if [[ -n "${FLAGS_grab_buildbot}" ]]; then | 231 if [[ -n "${FLAGS_grab_buildbot}" ]]; then |
217 if [[ "${FLAGS_grab_buildbot}" == "LATEST" ]]; then | 232 if [[ "${FLAGS_grab_buildbot}" == "LATEST" ]]; then |
218 echo " * Grab latest buildbot image under ${FLAGS_buildbot_uri}" | 233 echo " * Grab latest buildbot image under ${FLAGS_buildbot_uri}" |
219 else | 234 else |
220 echo " * Grab buildbot image zip at URI ${FLAGS_grab_buildbot}" | 235 echo " * Grab buildbot image zip at URI ${FLAGS_grab_buildbot}" |
221 fi | 236 fi |
222 fi | 237 fi |
223 if [[ ${FLAGS_mod_image_for_test} -eq ${FLAGS_TRUE} ]]; then | 238 if [[ ${FLAGS_mod_image_for_test} -eq ${FLAGS_TRUE} ]]; then |
224 echo " * Make image able to run tests (mod_image_for_test)" | 239 echo " * Make image able to run tests (mod_image_for_test)" |
225 set_passwd=${FLAGS_TRUE} | 240 set_passwd=${FLAGS_TRUE} |
226 fi | 241 fi |
227 if [[ ${set_passwd} -eq ${FLAGS_TRUE} ]]; then | 242 if [[ ${set_passwd} -eq ${FLAGS_TRUE} ]]; then |
228 if [[ -n "${FLAGS_chronos_passwd}" ]]; then | 243 if [[ -n "${FLAGS_chronos_passwd}" ]]; then |
229 echo " * Set chronos password to ${FLAGS_chronos_passwd}" | 244 echo " * Set chronos password to ${FLAGS_chronos_passwd}" |
230 else | 245 else |
231 echo " * Set chronos password randomly" | 246 echo " * Set chronos password randomly" |
232 fi | 247 fi |
233 fi | 248 fi |
234 if [[ ${FLAGS_build_autotest} -eq ${FLAGS_TRUE} ]]; then | 249 if [[ ${FLAGS_build_autotest} -eq ${FLAGS_TRUE} ]]; then |
235 echo " * Build autotest" | 250 echo " * Cross-build autotest client tests (build_autotest)" |
236 fi | 251 fi |
237 if [[ -n "${FLAGS_image_to_usb}" ]]; then | 252 if [[ -n "${FLAGS_image_to_usb}" ]]; then |
238 echo " * Write the image to USB device ${FLAGS_image_to_usb}" | 253 echo " * Write the image to USB device ${FLAGS_image_to_usb}" |
239 fi | 254 fi |
240 if [[ ${FLAGS_image_to_live} -eq ${FLAGS_TRUE} ]]; then | 255 if [[ ${FLAGS_image_to_live} -eq ${FLAGS_TRUE} ]]; then |
241 echo " * Reimage live test Chromium OS instance at ${FLAGS_remote}" | 256 echo " * Reimage live test Chromium OS instance at ${FLAGS_remote}" |
242 fi | 257 fi |
243 if [[ -n "${FLAGS_test}" ]]; then | 258 if [[ -n "${FLAGS_test}" ]]; then |
244 echo " * Run tests (${FLAGS_test}) on machine at ${FLAGS_remote}" | 259 echo " * Run tests (${FLAGS_test}) on machine at ${FLAGS_remote}" |
245 fi | 260 fi |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 } | 337 } |
323 | 338 |
324 | 339 |
325 # Runs a phase, similar to run_phase, but runs within the chroot. | 340 # Runs a phase, similar to run_phase, but runs within the chroot. |
326 # Arguments: | 341 # Arguments: |
327 # $1 - phase description | 342 # $1 - phase description |
328 # $2.. - command/params to run in chroot | 343 # $2.. - command/params to run in chroot |
329 function run_phase_in_chroot() { | 344 function run_phase_in_chroot() { |
330 local desc="$1" | 345 local desc="$1" |
331 shift | 346 shift |
332 run_phase "${desc}" ./enter_chroot.sh -- "$@" | 347 run_phase "${desc}" ./enter_chroot.sh "--chroot=${FLAGS_chroot}" -- "$@" |
333 } | 348 } |
334 | 349 |
335 | 350 |
336 # Record start time. | 351 # Record start time. |
337 function set_start_time() { | 352 function set_start_time() { |
338 START_TIME=$(date '+%s') | 353 START_TIME=$(date '+%s') |
339 } | 354 } |
340 | 355 |
341 | 356 |
342 # Display duration | 357 # Display duration |
(...skipping 18 matching lines...) Expand all Loading... |
361 local base_dir=$(dirname $(dirname "${FLAGS_top}")) | 376 local base_dir=$(dirname $(dirname "${FLAGS_top}")) |
362 echo <<EOF > src/scripts/.chromeos_dev | 377 echo <<EOF > src/scripts/.chromeos_dev |
363 # Use internal chromeos-deb repository | 378 # Use internal chromeos-deb repository |
364 CHROMEOS_EXT_MIRROR="http://chromeos-deb/ubuntu" | 379 CHROMEOS_EXT_MIRROR="http://chromeos-deb/ubuntu" |
365 CHROMEOS_EXT_SUITE="karmic" | 380 CHROMEOS_EXT_SUITE="karmic" |
366 | 381 |
367 # Assume Chrome is checked out nearby | 382 # Assume Chrome is checked out nearby |
368 CHROMEOS_CHROME_DIR="${base_dir}/chrome" | 383 CHROMEOS_CHROME_DIR="${base_dir}/chrome" |
369 EOF | 384 EOF |
370 fi | 385 fi |
371 if [[ ${FLAGS_portage} -eq ${FLAGS_TRUE} ]]; then | |
372 chdir_relative src/third_party | |
373 chromiumos-overlay/chromeos/scripts/setup_source_tree.sh | |
374 fi | |
375 } | 386 } |
376 | 387 |
377 | 388 |
378 function check_rootfs_validity() { | 389 function check_rootfs_validity() { |
379 echo "Checking rootfs validity" | 390 echo "Checking rootfs validity" |
380 local device=$(sudo losetup -f) | 391 local device=$(sudo losetup -f) |
381 local invalid=0 | 392 local invalid=0 |
382 sudo losetup "${device}" rootfs.image | 393 sudo losetup "${device}" rootfs.image |
383 sudo mount "${device}" rootfs | 394 sudo mount "${device}" rootfs |
384 if [[ ! -e rootfs/boot/vmlinuz ]]; then | 395 if [[ ! -e rootfs/boot/vmlinuz ]]; then |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 | 448 |
438 # Cache up sudo status | 449 # Cache up sudo status |
439 sudo -v | 450 sudo -v |
440 | 451 |
441 if [[ ${FLAGS_interactive} -eq ${FLAGS_TRUE} ]]; then | 452 if [[ ${FLAGS_interactive} -eq ${FLAGS_TRUE} ]]; then |
442 interactive | 453 interactive |
443 fi | 454 fi |
444 | 455 |
445 set_start_time | 456 set_start_time |
446 | 457 |
| 458 local withdev_param="" |
| 459 if [[ ${FLAGS_withdev} -eq ${FLAGS_TRUE} ]]; then |
| 460 withdev_param="--withdev" |
| 461 fi |
| 462 |
| 463 local jobs_param="" |
| 464 if [[ ${FLAGS_jobs} -gt 1 ]]; then |
| 465 jobs_param="--jobs=${FLAGS_jobs}" |
| 466 fi |
| 467 |
| 468 local board_param="--board=${FLAGS_board}" |
| 469 |
447 if [[ ! -e "${FLAGS_top}" ]]; then | 470 if [[ ! -e "${FLAGS_top}" ]]; then |
448 config_new_checkout | 471 config_new_checkout |
449 fi | 472 fi |
450 | 473 |
451 if [[ ${FLAGS_sync} -eq ${FLAGS_TRUE} ]]; then | 474 if [[ ${FLAGS_sync} -eq ${FLAGS_TRUE} ]]; then |
452 sync | 475 sync |
453 # The package repository is now potentially out of date, so | |
454 # reflect that. | |
455 run_phase "Removing existing package repo" sudo rm -rf repo | |
456 FLAGS_force_make_chroot=${FLAGS_TRUE} | |
457 fi | 476 fi |
458 | 477 |
459 if [[ -n "${FLAGS_grab_buildbot}" ]]; then | 478 if [[ -n "${FLAGS_grab_buildbot}" ]]; then |
460 grab_buildbot | 479 grab_buildbot |
461 fi | 480 fi |
462 | 481 |
463 if [[ ${FLAGS_force_make_chroot} -eq ${FLAGS_TRUE} ]]; then | 482 if [[ ${FLAGS_force_make_chroot} -eq ${FLAGS_TRUE} ]]; then |
464 chdir_relative src/scripts | 483 chdir_relative src/scripts |
465 if [[ ${FLAGS_portage} -eq ${FLAGS_TRUE} ]]; then | 484 run_phase "Replacing chroot" ./make_chroot --replace \ |
466 run_phase "Replacing chroot" ./new_make_env.sh --replace | 485 "--chroot=${FLAGS_chroot}" ${jobs_param} |
467 else | |
468 run_phase "Replacing chroot" ./make_chroot.sh --replace | |
469 fi | |
470 fi | 486 fi |
471 | 487 |
472 if [[ ${FLAGS_build} -eq ${FLAGS_TRUE} ]]; then | 488 if [[ ${FLAGS_build} -eq ${FLAGS_TRUE} ]]; then |
473 chdir_relative src/scripts | 489 chdir_relative src/scripts |
474 if [[ ${FLAGS_portage} -eq ${FLAGS_TRUE} ]]; then | 490 # Only setup board target if the directory does not exist |
475 # Only setup board target if the directory does not exist | 491 if [[ ! -d "${FLAGS_top}/chroot/build/${FLAGS_board}" ]]; then |
476 if [[ ! -d "${DEFAULT_CHROOT_DIR}/build/${FLAGS_board}" ]]; then | 492 run_phase_in_chroot "Setting up board target" \ |
477 run_phase_in_chroot "Setting up board target" \ | 493 ./setup_board "${board_param}" |
478 ./setup_board "--board=${FLAGS_board}" \ | |
479 "--toolchain=${FLAGS_toolchain}" | |
480 fi | |
481 run_phase_in_chroot "Building packages" \ | |
482 ./new_build_pkgs.sh "--board=${FLAGS_board}" \ | |
483 "--jobs=${FLAGS_build_jobs}" | |
484 else | |
485 run_phase_in_chroot "Building platform packages and kernel" \ | |
486 "./build_platform_packages.sh && ./build_kernel.sh" | |
487 fi | 494 fi |
| 495 run_phase_in_chroot "Building packages" \ |
| 496 ./build_packages "${board_param}" \ |
| 497 ${jobs_param} ${withdev_param} |
488 | 498 |
489 # TODO(kmixter): Enable this once build_tests works, but even | 499 # TODO(kmixter): Enable this once build_tests works, but even |
490 # then only do it when not cross compiling. | 500 # then only do it when not cross compiling. |
491 if [[ ${FLAGS_portage} -eq ${FLAGS_FALSE} ]]; then | 501 if [[ '' ]]; then |
492 run_phase_in_chroot "Building and running unit tests" \ | 502 run_phase_in_chroot "Building and running unit tests" \ |
493 "./build_tests.sh && ./run_tests.sh" | 503 "./build_tests.sh && ./run_tests.sh" |
494 fi | 504 fi |
495 fi | 505 fi |
496 | 506 |
497 if [[ ${FLAGS_master} -eq ${FLAGS_TRUE} ]]; then | 507 if [[ ${FLAGS_master} -eq ${FLAGS_TRUE} ]]; then |
498 chdir_relative src/scripts | 508 chdir_relative src/scripts |
499 if [[ -n "${FLAGS_chronos_passwd}" ]]; then | 509 if [[ -n "${FLAGS_chronos_passwd}" ]]; then |
500 run_phase_in_chroot "Setting default chronos password" \ | 510 run_phase_in_chroot "Setting default chronos password" \ |
501 ./enter_chroot.sh "echo '${FLAGS_chronos_passwd}' | \ | 511 ./enter_chroot.sh "echo '${FLAGS_chronos_passwd}' | \ |
502 ~/trunk/src/scripts/set_shared_user_password.sh" | 512 ~/trunk/src/scripts/set_shared_user_password.sh" |
503 fi | 513 fi |
504 if [[ ${FLAGS_portage} -eq ${FLAGS_TRUE} ]]; then | 514 run_phase_in_chroot "Mastering image" ./build_image \ |
505 run_phase_in_chroot "Mastering image" ./new_build_image.sh \ | 515 "${board_param}" --replace ${withdev_param} \ |
506 "--board=${FLAGS_board}" --replace | 516 ${jobs_param} |
507 else | |
508 run_phase_in_chroot "Mastering image" ./build_image.sh --replace | |
509 fi | |
510 fi | |
511 | |
512 local board_param="" | |
513 if [[ ${FLAGS_portage} -eq ${FLAGS_TRUE} ]]; then | |
514 board_param="--board=${FLAGS_board}" | |
515 fi | 517 fi |
516 | 518 |
517 if [[ ${FLAGS_mod_image_for_test} -eq ${FLAGS_TRUE} ]]; then | 519 if [[ ${FLAGS_mod_image_for_test} -eq ${FLAGS_TRUE} ]]; then |
518 chdir_relative src/scripts | 520 chdir_relative src/scripts |
519 run_phase_in_chroot "Modifying image for test" \ | 521 run_phase_in_chroot "Modifying image for test" \ |
520 "./mod_image_for_test.sh" ${board_param} | 522 "./mod_image_for_test.sh" "${board_param}" --yes |
521 fi | 523 fi |
522 | 524 |
523 if [[ -n "${FLAGS_image_to_usb}" ]]; then | 525 if [[ -n "${FLAGS_image_to_usb}" ]]; then |
524 chdir_relative src/scripts | 526 chdir_relative src/scripts |
525 run_phase "Installing image to USB" \ | 527 run_phase "Installing image to USB" \ |
526 ./image_to_usb.sh --yes "--to=${FLAGS_image_to_usb}" ${board_param} | 528 ./image_to_usb.sh --yes "--to=${FLAGS_image_to_usb}" "${board_param}" |
527 fi | 529 fi |
528 | 530 |
529 if [[ ${FLAGS_image_to_live} -eq ${FLAGS_TRUE} ]]; then | 531 if [[ ${FLAGS_image_to_live} -eq ${FLAGS_TRUE} ]]; then |
530 chdir_relative src/scripts | 532 chdir_relative src/scripts |
531 run_phase "Re-imaging live Chromium OS machine ${FLAGS_remote}" \ | 533 run_phase "Re-imaging live Chromium OS machine ${FLAGS_remote}" \ |
532 ./image_to_live.sh "--remote=${FLAGS_remote}" --update_known_hosts | 534 ./image_to_live.sh "--remote=${FLAGS_remote}" --update_known_hosts |
533 fi | 535 fi |
534 | 536 |
535 if [[ ${FLAGS_build_autotest} -eq ${FLAGS_TRUE} ]]; then | 537 if [[ ${FLAGS_build_autotest} -eq ${FLAGS_TRUE} ]]; then |
536 chdir_relative src/scripts | 538 chdir_relative src/scripts |
537 run_phase_in_chroot "Building autotest" "./build_autotest.sh" ${board_param} | 539 run_phase_in_chroot "Building autotest" "./build_autotest.sh" \ |
| 540 --noprompt "${board_param}" |
538 fi | 541 fi |
539 | 542 |
540 if [[ -n "${FLAGS_test}" ]]; then | 543 if [[ -n "${FLAGS_test}" ]]; then |
541 chdir_relative src/scripts | 544 chdir_relative src/scripts |
542 # We purposefully do not quote FLAGS_test below as we expect it may | 545 # We purposefully do not quote FLAGS_test below as we expect it may |
543 # have multiple parameters | 546 # have multiple parameters |
544 run_phase "Running tests on Chromium OS machine ${FLAGS_remote}" \ | 547 run_phase "Running tests on Chromium OS machine ${FLAGS_remote}" \ |
545 ./run_remote_tests.sh "--remote=${FLAGS_remote}" ${FLAGS_test} \ | 548 ./run_remote_tests.sh "--remote=${FLAGS_remote}" ${FLAGS_test} \ |
546 ${board_param} | 549 "${board_param}" |
547 fi | 550 fi |
548 | 551 |
549 echo "Successfully used ${FLAGS_top} to:" | 552 echo "Successfully used ${FLAGS_top} to:" |
550 describe_steps | 553 describe_steps |
551 show_duration | 554 show_duration |
552 } | 555 } |
553 | 556 |
554 | 557 |
555 main $@ | 558 main $@ |
OLD | NEW |