die() { eerror "$*"; exit 1; }
set -e
-cd "${HOME}/trunk/src/scripts/"
+BASE="/mnt/host/source"
+d="${BASE}/src/scripts"
+BUILD_DIR="${BASE}/src/build"
+cd "${BASE}/src/scripts/"
: "${BOARD:="$(cat .default_board 2>/dev/null)"}"
if [[ -z ${BOARD} ]] ; then
die "missing BOARD"
fi
-IMAGES="${HOME}/trunk/src/build/images/${BOARD}"
+IMAGES="${BASE}/src/build/images/${BOARD}"
BUILD="/build/${BOARD}"
usage() {
--autotest Build & install autotest packages.
--factory Build factory packages & image.
--nousepkg Force build from source.
+ --vm Create VM image.
--clean ?
ARG_FACTORY=false
ARG_VERBOSE=false
ARG_TEST=false
+ARG_VM=false
while [[ $# -ne 0 ]] ; do
case $1 in
--clean) ARG_CLEAN=true;;
--nousepkg) ARG_NOPKG=true;;
--autotest) ARG_AUTOTEST=true;;
--factory) ARG_FACTORY=true;;
+ --vm) ARG_VM=true;;
-h) usage;;
*) echo "unknown opt: $*"; exit 1;;
esac
if ${ARG_CLEAN} || [[ ! -d ${BUILD} ]] ; then
run sudo rm -rf "${BUILD}"
- run ./setup_board --board=${BOARD} --skip_chroot_upgrade
+ run setup_board --board=${BOARD} --skip-chroot-upgrade
if [ $? -ne 0 ] ; then
run sudo rm -rf "${BUILD}"
exit 1
--board=${BOARD} \
--nowithdebug \
--nowithrevdeps \
- --skip_chroot_upgrade \
+ --skip-chroot-upgrade \
$(tfe ${ARG_AUTOTEST} --{,no}withautotest) \
$(tfe ${ARG_FACTORY} --{,no}withfactory) \
$(tfe ${ARG_NOPKG} --{no,}usepkg) \
sync &
fi
+IMG_TO_VM=( ${d}/image_to_vm.sh --board=${BOARD} --from=${BUILD_DIR}/images/${BOARD}/latest --test_image )
+if ${ARG_VM} ; then
+ run "${IMG_TO_VM[@]}"
+fi
+
cd "${IMAGES}"
rm -rf $(ls -td1R `find -mindepth 1 -maxdepth 1 -type d` | sed -e 1d -e 2d)
-d="~/trunk/src/scripts"
BUILD_IMG="${d}/${BUILD_IMG#./}"
cat <<EOF
${IMG_TO_USB}
### KVM
-${d}/image_to_vm.sh --board=${BOARD} --from=../build/images/${BOARD}/latest
-${d}/image_to_vm.sh --board=${BOARD} --from=../build/images/${BOARD}/latest --test_image
+${IMG_TO_VM[*]}
~/chromiumos/chromite/bin/cros_vm --start --no-display --image-path=\${HOME}/chromiumos/src/build/images/${BOARD}/latest/chromiumos_qemu_image.bin
#--kvm_cpu "max,vmx=on"