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

@@ -1,36 +1,102 @@
#!/bin/bash
# Print script commands.
set -x
# Exit on errors.
set -e
# Bmv2
git clone https://github.com/p4lang/behavioral-model
cd behavioral-model
./install_deps.sh
./autogen.sh
./configure
make
sudo make install
cd ..
BMV2_COMMIT="ae84c2f6d5bc3dd6873a62e351f26c39038804da"
PI_COMMIT="f06a4df7d56413849dbe9ab8f9441321ff140bca"
P4C_COMMIT="3ad8d93f334a34d181e8d9d83100d797bac3f65a"
PROTOBUF_COMMIT="tags/v3.0.2"
GRPC_COMMIT="tags/v1.3.0"
NUM_CORES=`grep -c ^processor /proc/cpuinfo`
# Protobuf
git clone https://github.com/google/protobuf.git
cd protobuf
git checkout v3.0.2
git checkout ${PROTOBUF_COMMIT}
export CFLAGS="-Os"
export CXXFLAGS="-Os"
export LDFLAGS="-Wl,-s"
./autogen.sh
./configure
make
./configure --prefix=/usr
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 ldconfig
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
git clone --recursive https://github.com/p4lang/p4c
git clone https://github.com/p4lang/p4c
cd p4c
mkdir build
git checkout ${P4C_COMMIT}
git submodule update --init --recursive
mkdir -p build
cd build
cmake ..
make -j4
make -j${NUM_CORES}
sudo make install
sudo ldconfig
cd ..
cd ..