mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 10:15:57 +01:00
Get rid of br2_parsec, since there are just too many possible variations on that file. Blow up the gem5 vs qemu table to make it saner, add missing aarch64 entries. Make sections titles describing number of cores and memory size emulator agnostic.
96 lines
2.3 KiB
Bash
Executable File
96 lines
2.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -e
|
|
interactive_pkgs=libsdl2-dev
|
|
gem5=false
|
|
qemu=true
|
|
submodules='buildroot linux'
|
|
y=''
|
|
while getopts gpqt OPT; do
|
|
case "$OPT" in
|
|
g)
|
|
gem5=true
|
|
;;
|
|
p)
|
|
submodules="$submodules parsec-benchmark/parsec-benchmark"
|
|
;;
|
|
q)
|
|
qemu=false
|
|
;;
|
|
t)
|
|
interactive_pkgs=''
|
|
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 \
|
|
build-essential \
|
|
coreutils \
|
|
"
|
|
if "$gem5"; then
|
|
pkgs="$pkgs \
|
|
g++-6 \
|
|
gcc-6 \
|
|
gcc-aarch64-linux-gnu \
|
|
gcc-arm-linux-gnueabi \
|
|
libgoogle-perftools-dev \
|
|
protobuf-compiler \
|
|
"
|
|
fi
|
|
command -v apt-get >/dev/null 2>&1 || {
|
|
cat <<EOF
|
|
apt-get not found. You're on your own for installing dependencies.
|
|
|
|
On Ubuntu they are:
|
|
|
|
$pkgs
|
|
EOF
|
|
exit 0
|
|
}
|
|
|
|
# Without this started failing in kernel 4.15 with:
|
|
# 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
|
|
# 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 \
|
|
$pkgs \
|
|
$interactive_pkgs \
|
|
;
|
|
if "$qemu"; then
|
|
sudo apt-get build-dep $y qemu
|
|
fi
|