1#!/bin/bash 2# 3# Copyright 2016 Google Inc. All Rights Reserved. 4# 5# This is a generic ChromeOS package/image test setup script. It is meant to 6# be used for the package bisection tool, in particular when there is a booting 7# issue with the image, so the image MUST be 'flashed' via USB. 8# 9# This script is intended to be used by binary_search_state.py, as 10# part of the binary search triage on ChromeOS objects and packages. It should 11# return '0' if the setup succeeds; and '1' if the setup fails (the image 12# could not built or be flashed). 13# 14 15export PYTHONUNBUFFERED=1 16 17source common/common.sh 18 19echo "BUILDING IMAGE" 20pushd ~/trunk/src/scripts 21./build_image test --board=${BISECT_BOARD} --noenable_rootfs_verification --noeclean 22build_status=$? 23popd 24 25if [[ ${build_status} -eq 0 ]] ; then 26 echo 27 echo "INSTALLING IMAGE VIA USB (requires some manual intervention)" 28 echo 29 echo "Insert a usb stick into the current machine" 30 echo "Note: The cros flash will take time and doesn't give much output." 31 echo " Be patient. If your usb access light is flashing it's working." 32 sleep 1 33 read -p "Press enter to continue" notused 34 35 cros flash --board=${BISECT_BOARD} --clobber-stateful usb:// ~/trunk/src/build/images/${BISECT_BOARD}/latest/chromiumos_test_image.bin 36 37 echo 38 echo "Flash to usb complete!" 39 echo "Plug the usb into your chromebook and install the image." 40 echo "Refer to the ChromiumOS Developer's Handbook for more details." 41 echo "http://www.chromium.org/chromium-os/developer-guide#TOC-Boot-from-your-USB-disk" 42 while true; do 43 sleep 1 44 read -p "Was the installation of the image successful? " choice 45 case $choice in 46 [Yy]*) exit 0;; 47 [Nn]*) exit 1;; 48 *) echo "Please answer y or n.";; 49 esac 50 done 51else 52 echo "build_image returned a non-zero status: ${build_status}" 53 exit 1 54fi 55 56exit 0 57