#!/usr/bin/env bash set -e interactive_pkgs=libsdl2-dev submodules='buildroot linux qemu gem5/gem5' y='' while getopts pt OPT; do case "$OPT" in p) submodules="$submodules parsec-benchmark/parsec-benchmark" ;; t) interactive_pkgs='' y='-y' ;; esac done shift $(($OPTIND - 1)) ( set -e # Shallow cloning saves a considerable amount of time, specially because of the linux kernel. # However, git submodules are buggy as usual, and this is the best way I've found to get it done: # https://stackoverflow.com/questions/2144406/git-shallow-submodules/47374702#47374702 # In particular: # - `shallow = true` on the submodule has no effect for the non default educational branches of our submodules # - QEMU's submodules point to commits that are neither under branches nor tags, and so `--shallow-submodules` fails git submodule update --depth 1 --jobs 4 --init -- $submodules cd qemu git submodule update --init ) & wait $! || git submodule update --init -- $submodules pkgs="\ automake \ build-essential \ coreutils \ " # GEM5 pkgs="$pkgs \ g++-6 \ gcc-6 \ gcc-aarch64-linux-gnu \ gcc-arm-linux-gnueabi \ libgoogle-perftools-dev \ protobuf-compiler \ " command -v apt-get >/dev/null 2>&1 || { cat <