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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 local set_passwd=${FLAGS_FALSE} | 193 local set_passwd=${FLAGS_FALSE} |
194 if [[ ${FLAGS_build} -eq ${FLAGS_true} ]]; then | 194 if [[ ${FLAGS_build} -eq ${FLAGS_true} ]]; then |
195 echo " * Build image (build_platform_packages.sh, build_kernel.sh)" | 195 echo " * Build image (build_platform_packages.sh, build_kernel.sh)" |
196 set_passwd=${FLAGS_TRUE} | 196 set_passwd=${FLAGS_TRUE} |
197 fi | 197 fi |
198 if [[ ${FLAGS_master} -eq ${FLAGS_true} ]]; then | 198 if [[ ${FLAGS_master} -eq ${FLAGS_true} ]]; then |
199 echo " * Master image (build_image.sh)" | 199 echo " * Master image (build_image.sh)" |
200 fi | 200 fi |
201 if [[ -n "${FLAGS_grab_buildbot}" ]]; then | 201 if [[ -n "${FLAGS_grab_buildbot}" ]]; then |
202 if [[ "${FLAGS_grab_buildbot}" == "LATEST" ]]; then | 202 if [[ "${FLAGS_grab_buildbot}" == "LATEST" ]]; then |
203 echo " * Grabbing latest buildbot image under ${FLAGS_buildbot_uri}" | 203 echo " * Grab latest buildbot image under ${FLAGS_buildbot_uri}" |
204 else | 204 else |
205 echo " * Grabbing buildbot image zip at URI ${FLAGS_grab_buildbot}" | 205 echo " * Grab buildbot image zip at URI ${FLAGS_grab_buildbot}" |
206 fi | 206 fi |
207 fi | 207 fi |
208 if [[ ${FLAGS_mod_image_for_test} -eq ${FLAGS_TRUE} ]]; then | 208 if [[ ${FLAGS_mod_image_for_test} -eq ${FLAGS_TRUE} ]]; then |
209 echo " * Make image able to run tests (mod_image_for_test)" | 209 echo " * Make image able to run tests (mod_image_for_test)" |
210 set_passwd=${FLAGS_TRUE} | 210 set_passwd=${FLAGS_TRUE} |
211 fi | 211 fi |
212 if [[ ${set_passwd} -eq ${FLAGS_TRUE} ]]; then | 212 if [[ ${set_passwd} -eq ${FLAGS_TRUE} ]]; then |
213 if [[ -n "${FLAGS_chronos_passwd}" ]]; then | 213 if [[ -n "${FLAGS_chronos_passwd}" ]]; then |
214 echo " * Set chronos password to ${FLAGS_chronos_passwd}" | 214 echo " * Set chronos password to ${FLAGS_chronos_passwd}" |
215 else | 215 else |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 CHROMEOS_EXT_MIRROR="http://chromeos-deb/ubuntu" | 319 CHROMEOS_EXT_MIRROR="http://chromeos-deb/ubuntu" |
320 CHROMEOS_EXT_SUITE="karmic" | 320 CHROMEOS_EXT_SUITE="karmic" |
321 | 321 |
322 # Assume Chrome is checked out nearby | 322 # Assume Chrome is checked out nearby |
323 CHROMEOS_CHROME_DIR="${base_dir}/chrome" | 323 CHROMEOS_CHROME_DIR="${base_dir}/chrome" |
324 EOF | 324 EOF |
325 fi | 325 fi |
326 } | 326 } |
327 | 327 |
328 | 328 |
| 329 function check_rootfs_validity() { |
| 330 echo "Checking rootfs validity" |
| 331 local device=$(sudo losetup -f) |
| 332 local invalid=0 |
| 333 sudo losetup "${device}" rootfs.image |
| 334 sudo mount "${device}" rootfs |
| 335 if [[ ! -e rootfs/boot/vmlinuz ]]; then |
| 336 echo "This image has no kernel" |
| 337 invalid=1 |
| 338 fi |
| 339 sudo umount rootfs |
| 340 sudo losetup -d "${device}" |
| 341 return ${invalid} |
| 342 } |
| 343 |
| 344 |
329 # Downloads a buildbot image | 345 # Downloads a buildbot image |
330 function grab_buildbot() { | 346 function grab_buildbot() { |
331 if [[ "${FLAGS_grab_buildbot}" == "LATEST" ]]; then | 347 if [[ "${FLAGS_grab_buildbot}" == "LATEST" ]]; then |
332 local latest=$(curl "${FLAGS_buildbot_uri}/LATEST") | 348 local latest=$(curl "${FLAGS_buildbot_uri}/LATEST") |
333 if [[ -z "${latest}" ]]; then | 349 if [[ -z "${latest}" ]]; then |
334 echo "Error finding latest." | 350 echo "Error finding latest." |
335 exit 1 | 351 exit 1 |
336 fi | 352 fi |
337 FLAGS_grab_buildbot="${FLAGS_buildbot_uri}/${latest}/image.zip" | 353 FLAGS_grab_buildbot="${FLAGS_buildbot_uri}/${latest}/image.zip" |
338 fi | 354 fi |
339 local dl_dir=$(mktemp -d "/tmp/image.XXXX") | 355 local dl_dir=$(mktemp -d "/tmp/image.XXXX") |
340 echo "Grabbing image from ${FLAGS_grab_buildbot} to ${dl_dir}" | 356 echo "Grabbing image from ${FLAGS_grab_buildbot} to ${dl_dir}" |
341 run_phase "Downloading image" curl "${FLAGS_grab_buildbot}" \ | 357 run_phase "Downloading image" curl "${FLAGS_grab_buildbot}" \ |
342 -o "${dl_dir}/image.zip" | 358 -o "${dl_dir}/image.zip" |
343 cd "${dl_dir}" | 359 cd "${dl_dir}" |
344 unzip image.zip | 360 unzip image.zip |
| 361 check_rootfs_validity |
345 echo "Copying in local_repo/local_packages" | 362 echo "Copying in local_repo/local_packages" |
346 # TODO(kmixter): Make this architecture indep once buildbot is. | 363 # TODO(kmixter): Make this architecture indep once buildbot is. |
347 mv -f local_repo/local_packages/* "${FLAGS_top}/src/build/x86/local_packages" | 364 mv -f local_repo/local_packages/* "${FLAGS_top}/src/build/x86/local_packages" |
348 local image_basename=$(basename $(dirname "${FLAGS_grab_buildbot}")) | 365 local image_basename=$(basename $(dirname "${FLAGS_grab_buildbot}")) |
349 local image_dir="${FLAGS_top}/src/build/images/${image_basename}" | 366 local image_dir="${FLAGS_top}/src/build/images/${image_basename}" |
350 echo "Copying in build image to ${image_dir}" | 367 echo "Copying in build image to ${image_dir}" |
351 rm -rf "${image_dir}" | 368 rm -rf "${image_dir}" |
352 mkdir -p "${image_dir}" | 369 mkdir -p "${image_dir}" |
353 # Note that if mbr.image does not exist, this image was not successful. | 370 # Note that if mbr.image does not exist, this image was not successful. |
354 mv mbr.image rootfs.image "${image_dir}" | 371 mv mbr.image rootfs.image "${image_dir}" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 run_phase "Running tests on Chromium OS machine ${FLAGS_remote}" \ | 467 run_phase "Running tests on Chromium OS machine ${FLAGS_remote}" \ |
451 ./run_remote_tests.sh --remote="${FLAGS_remote}" ${FLAGS_test} | 468 ./run_remote_tests.sh --remote="${FLAGS_remote}" ${FLAGS_test} |
452 fi | 469 fi |
453 | 470 |
454 echo "Successfully used ${FLAGS_top} to:" | 471 echo "Successfully used ${FLAGS_top} to:" |
455 describe_steps | 472 describe_steps |
456 } | 473 } |
457 | 474 |
458 | 475 |
459 main $@ | 476 main $@ |
OLD | NEW |