docker: crate docker host setup

readme: standardize keyboard input notation to the format: Ctrl-C
This commit is contained in:
Ciro Santilli
2018-04-07 20:47:20 +01:00
parent ecf2f3b29e
commit 294a8c2424
7 changed files with 215 additions and 53 deletions

76
configure vendored
View File

@@ -18,42 +18,23 @@ while getopts gpqt OPT; do
;;
t)
interactive_pkgs=
y='-y'
y=-y
;;
esac
done
shift $(($OPTIND - 1))
## Submodules
if "$qemu"; then
submodules="$submodules qemu"
fi
if "$gem5"; then
submodules="$submodules gem5/gem5"
fi
(
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
if "$qemu"; then
cd qemu
git submodule update --init
fi
) &
wait $! || git submodule update --init -- $submodules
## apt-get
pkgs="\
automake \
bc \
build-essential \
coreutils \
cpio \
git \
unzip \
wget \
"
if "$gem5"; then
pkgs="$pkgs \
@@ -61,6 +42,8 @@ gcc-aarch64-linux-gnu \
gcc-arm-linux-gnueabi \
libgoogle-perftools-dev \
protobuf-compiler \
python-dev \
scons \
"
fi
command -v apt-get >/dev/null 2>&1 || {
@@ -78,16 +61,53 @@ EOF
# Makefile:932: *** "Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel". Stop.
pkgs="$pkgs libelf-dev"
sudo apt-get update $y
# https://stackoverflow.com/questions/20010199/determining-if-a-process-runs-inside-lxc-docker
if [ -f /.dockerenv ]; then
# --jobs is not available in git 2.7.4 from Ubuntu 16.04.
gitjobs=
mysudo=
# https://askubuntu.com/questions/496549/error-you-must-put-some-source-uris-in-your-sources-list
sed -Ei 's/^# deb-src/deb-src/' /etc/apt/sources.list
y=-y
else
gitjobs="--jobs $(nproc)"
mysudo=sudo
fi
$mysudo apt-get update $y
# Building SDL for QEMU in Buildroot was rejected upstream because it adds many dependencies:
# https://patchwork.ozlabs.org/patch/770684/
# We are just using the host SDL for now, if it causes too much problems we might remove it.
# libsdl2-dev needs to be installed separatedly from sudo apt-get build-dep qemu
# because Ubuntu 16.04's QEMU uses SDL 1.
sudo apt-get install $y \
$mysudo apt-get install $y \
$pkgs \
$interactive_pkgs \
;
if "$qemu"; then
sudo apt-get build-dep $y qemu
$mysudo apt-get build-dep $y qemu
fi
## Submodules
if "$qemu"; then
submodules="$submodules qemu"
fi
if "$gem5"; then
submodules="$submodules gem5/gem5"
fi
(
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 $gitjobs --init -- $submodules
if "$qemu"; then
cd qemu
git submodule update --init
fi
) &
wait $! || git submodule update --init -- $submodules