]> git.wh0rd.org Git - home.git/commitdiff
cros-board: vm updates
authorMike Frysinger <vapier@gentoo.org>
Fri, 27 Sep 2019 17:50:19 +0000 (13:50 -0400)
committerMike Frysinger <vapier@gentoo.org>
Fri, 27 Sep 2019 17:50:19 +0000 (13:50 -0400)
.bin/cros-board

index e6743cee0a914d9ada14657da3cab609b0ebea39..58a7870a53ea6c27007cca3104b6e09e58c50fcc 100755 (executable)
@@ -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 <<EOF
 
@@ -139,8 +149,7 @@ 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"