From 3905519157d95566b58d67de5309fe7cf44dc268 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 27 Sep 2019 13:50:19 -0400 Subject: [PATCH] cros-board: vm updates --- .bin/cros-board | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/.bin/cros-board b/.bin/cros-board index e6743ce..58a7870 100755 --- a/.bin/cros-board +++ b/.bin/cros-board @@ -3,13 +3,16 @@ 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() { @@ -24,6 +27,7 @@ Options: --autotest Build & install autotest packages. --factory Build factory packages & image. --nousepkg Force build from source. + --vm Create VM image. --clean ? @@ -56,6 +60,7 @@ ARG_AUTOTEST=false ARG_FACTORY=false ARG_VERBOSE=false ARG_TEST=false +ARG_VM=false while [[ $# -ne 0 ]] ; do case $1 in --clean) ARG_CLEAN=true;; @@ -67,6 +72,7 @@ while [[ $# -ne 0 ]] ; do --nousepkg) ARG_NOPKG=true;; --autotest) ARG_AUTOTEST=true;; --factory) ARG_FACTORY=true;; + --vm) ARG_VM=true;; -h) usage;; *) echo "unknown opt: $*"; exit 1;; esac @@ -103,7 +109,7 @@ run ./update_chroot --toolchain_boards=${BOARD} 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 @@ -114,7 +120,7 @@ run ./build_packages \ --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) \ @@ -128,10 +134,14 @@ if ${ARG_DEV_USER} ; then 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 <