Updated P4D2 2017 Fall vm scripts to build and install P4Runtime (#65)

* Updated vm provisioning scripts to build and install P4Runtime

Also, hardcoded commit ID for each tool to improve reproducibility
of exercises (the P4Runtime API could change in the future).

TODO: there is a permission error at line 114 of user-bootstrap.sh that
needs to be fixed.

* Removed unnecessary compiler flags when bulding PI

* Fixed permission error and updated BMv2 and PI commit IDs
This commit is contained in:
Carmelo Cascone 2017-10-25 16:41:53 -07:00 committed by Robert Soule
parent 7738341012
commit 37d1632865
2 changed files with 125 additions and 35 deletions

View File

@ -9,36 +9,60 @@ apt-get update
DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
apt-get install -y \ apt-get install -y --no-install-recommends \
lubuntu-desktop \
git \
vim \
emacs24 \
xcscope-el \
sublime-text-installer \
atom \ atom \
xterm \
mininet \
autoconf \ autoconf \
automake \ automake \
libtool \
curl \
make \
g++ \
unzip \
libgc-dev \
bison \ bison \
build-essential \
ca-certificates \
cmake \
cpp \
curl \
emacs24 \
flex \ flex \
libfl-dev \ git \
libgmp-dev \
libboost-dev \ libboost-dev \
libboost-iostreams-dev \ libboost-filesystem-dev \
libboost-iostreams1.58-dev \
libboost-program-options-dev \
libboost-system-dev \
libboost-test-dev \
libboost-thread-dev \
libc6-dev \
libevent-dev \
libffi-dev \
libfl-dev \
libgc-dev \
libgc1c2 \
libgflags-dev \
libgmp-dev \
libgmp10 \
libgmpxx4ldbl \
libjudy-dev \
libpcap-dev \
libreadline6 \
libreadline6-dev \
libssl-dev \
libtool \
lubuntu-desktop \
make \
mininet \
mktemp \
pkg-config \ pkg-config \
python \ python \
python-scapy \ python-dev \
python-ipaddr \ python-ipaddr \
python-pip \
python-scapy \
python-setuptools \
sublime-text-installer \
tcpdump \ tcpdump \
cmake unzip \
vim \
wget \
xcscope-el \
xterm
useradd -m -d /home/p4 -s /bin/bash p4 useradd -m -d /home/p4 -s /bin/bash p4
echo "p4:p4" | chpasswd echo "p4:p4" | chpasswd

View File

@ -1,36 +1,102 @@
#!/bin/bash #!/bin/bash
# Print script commands.
set -x set -x
# Exit on errors.
set -e
# Bmv2 BMV2_COMMIT="ae84c2f6d5bc3dd6873a62e351f26c39038804da"
git clone https://github.com/p4lang/behavioral-model PI_COMMIT="f06a4df7d56413849dbe9ab8f9441321ff140bca"
cd behavioral-model P4C_COMMIT="3ad8d93f334a34d181e8d9d83100d797bac3f65a"
./install_deps.sh PROTOBUF_COMMIT="tags/v3.0.2"
./autogen.sh GRPC_COMMIT="tags/v1.3.0"
./configure
make NUM_CORES=`grep -c ^processor /proc/cpuinfo`
sudo make install
cd ..
# Protobuf # Protobuf
git clone https://github.com/google/protobuf.git git clone https://github.com/google/protobuf.git
cd protobuf cd protobuf
git checkout v3.0.2 git checkout ${PROTOBUF_COMMIT}
export CFLAGS="-Os"
export CXXFLAGS="-Os"
export LDFLAGS="-Wl,-s"
./autogen.sh ./autogen.sh
./configure ./configure --prefix=/usr
make make -j${NUM_CORES}
sudo make install
sudo ldconfig
unset CFLAGS CXXFLAGS LDFLAGS
cd ..
# gRPC
git clone https://github.com/grpc/grpc.git
cd grpc
git checkout ${GRPC_COMMIT}
git submodule update --init
export LDFLAGS="-Wl,-s"
make -j${NUM_CORES}
sudo make install
sudo ldconfig
unset LDFLAGS
cd ..
# BMv2 deps (needed by PI)
git clone https://github.com/p4lang/behavioral-model.git
cd behavioral-model
git checkout ${BMV2_COMMIT}
# From bmv2's install_deps.sh, we can skip apt-get install.
# Nanomsg is required by p4runtime, p4runtime is needed by BMv2...
tmpdir=`mktemp -d -p .`
cd ${tmpdir}
bash ../travis/install-thrift.sh
bash ../travis/install-nanomsg.sh
sudo ldconfig
bash ../travis/install-nnpy.sh
cd ..
sudo rm -rf $tmpdir
cd ..
# PI/P4Runtime
git clone https://github.com/p4lang/PI.git
cd PI
git checkout ${PI_COMMIT}
git submodule update --init --recursive
./autogen.sh
./configure --with-proto
make -j${NUM_CORES}
sudo make install sudo make install
sudo ldconfig sudo ldconfig
cd .. cd ..
# Bmv2
cd behavioral-model
./autogen.sh
./configure --enable-debugger --with-pi
make -j${NUM_CORES}
sudo make install
sudo ldconfig
# Simple_switch_grpc target
cd targets/simple_switch_grpc
./autogen.sh
./configure
make -j${NUM_CORES}
sudo make install
sudo ldconfig
cd ..
cd ..
cd ..
# P4C # P4C
git clone --recursive https://github.com/p4lang/p4c git clone https://github.com/p4lang/p4c
cd p4c cd p4c
mkdir build git checkout ${P4C_COMMIT}
git submodule update --init --recursive
mkdir -p build
cd build cd build
cmake .. cmake ..
make -j4 make -j${NUM_CORES}
sudo make install sudo make install
sudo ldconfig
cd .. cd ..
cd .. cd ..