2 . /etc/init.d/functions.sh || exit 1
3 die() { eerror "$*"; exit 1; }
6 cd "${HOME}/trunk/src/scripts/"
8 : ${BOARD:=`cat .default_board 2>/dev/null`}
9 if [[ -z ${BOARD} ]] ; then
12 IMAGES="${HOME}/trunk/src/build/images/${BOARD}"
13 BUILD="/build/${BOARD}"
24 while [[ $# -ne 0 ]] ; do
26 --clean) ARG_CLEAN=true;;
27 -p) ARG_PRETEND=true;;
28 -Y) ARG_DEV_USER=true;;
29 -y) shift; ARG_DEV=$1; ARG_DEV_USER=true;;
30 -v) ARG_VERBOSE=true;;
32 --nousepkg) ARG_NOPKG=true;;
33 --autotest) ARG_AUTOTEST=true;;
34 --factory) ARG_FACTORY=true;;
35 -h) exec sed -n '/^while/,/^done/p' "$0";;
36 *) echo "unknown opt: $*"; exit 1;;
41 piperet() { set -- ${PIPESTATUS[@]/0}; [[ $# -eq 0 ]]; }
44 if ! ${ARG_PRETEND} ; then
46 local log="${IMAGES}"/log.${1##*/}
47 if ${ARG_VERBOSE} ; then
60 tfe() { ($1 && echo $2 || echo $3); }
63 rm -f "${IMAGES}"/log.*
65 einfo "Log root: ${IMAGES}/log."
67 run ./update_chroot --toolchain_boards=${BOARD}
69 if ${ARG_CLEAN} || [[ ! -d ${BUILD} ]] ; then
70 run sudo rm -rf "${BUILD}"
71 run ./setup_board --board=${BOARD} --skip_chroot_upgrade
72 if [ $? -ne 0 ] ; then
73 run sudo rm -rf "${BUILD}"
78 run ./build_packages \
81 --skip_chroot_upgrade \
82 $(tfe ${ARG_AUTOTEST} --{,no}withautotest) \
83 $(tfe ${ARG_FACTORY} --{,no}withfactory) \
84 $(tfe ${ARG_NOPKG} --{no,}usepkg) \
85 $(tfe ${ARG_TEST} --{,no}withtest)
86 BUILD_IMG="./build_image --board=${BOARD} --noenable_rootfs_verification $(tfe ${ARG_TEST} test) dev"
89 IMG_TO_USB="cros flash --yes usb://${ARG_DEV} xbuddy://local/${BOARD}/latest/dev"
90 if ${ARG_DEV_USER} ; then
96 rm -rf $(ls -td1R `find -mindepth 1 -maxdepth 1 -type d` | sed -e 1d -e 2d)
98 d="~/trunk/src/scripts"
99 BUILD_IMG="${d}/${BUILD_IMG#./}"
106 ${d}/image_to_vm.sh --board=${BOARD} --from=../build/images/${BOARD}/latest
107 ${d}/image_to_vm.sh --board=${BOARD} --from=../build/images/${BOARD}/latest --test_image
108 ~/chromiumos/src/scripts/bin/cros_start_vm --no_graphics --image_path=\${HOME}/chromiumos/src/build/images/${BOARD}/latest/chromiumos_qemu_image.bin
109 kvm -m 1024 -vga std -net nic,model=virtio -net user,hostfwd=tcp::9222-:22 -hda ~/chromiumos/src/build/images/${BOARD}/latest/chromiumos_qemu_image.bin
112 ${d}/mod_image_for_recovery.sh --board=${BOARD}
113 ${IMG_TO_USB} --image_name=recovery_image.bin
116 ${BUILD_IMG} --factory_install
117 ${IMG_TO_USB} -i factory_install_shim.bin