From 6ace083d2183e0285b6ff08b51540c284f6f2c44 Mon Sep 17 00:00:00 2001 From: "Ian A. Mason" Date: Mon, 7 May 2018 09:41:38 -0700 Subject: [PATCH] Beter build from tarballs. --- examples/linux-kernel/README.md | 39 ++++++++++++------- examples/linux-kernel/bash_profile | 2 + examples/linux-kernel/bootstrap.sh | 2 + .../linux-kernel/build_linux_gllvm_git.sh | 2 + .../linux-kernel/build_linux_gllvm_tarball.sh | 2 + .../linux-kernel/build_linux_wllvm_git.sh | 2 + .../linux-kernel/build_linux_wllvm_tarball.sh | 2 + 7 files changed, 38 insertions(+), 13 deletions(-) diff --git a/examples/linux-kernel/README.md b/examples/linux-kernel/README.md index cddbe0f..e438a03 100644 --- a/examples/linux-kernel/README.md +++ b/examples/linux-kernel/README.md @@ -31,6 +31,8 @@ end ```bash #!/usr/bin/env bash +# vagrant bootstrapping file + sudo apt-get update sudo apt-get install -y emacs24 dbus-x11 @@ -46,6 +48,8 @@ echo ". /vagrant/bash_profile" >> /home/vagrant/.bashrc ## Shell Settings ```bash +#### /vagrant/bash_profile + #### llvm export LLVM_HOME=/usr/lib/llvm-5.0 export GOPATH=/vagrant/go @@ -64,7 +68,7 @@ export PATH=${GOPATH}/bin:${LLVM_HOME}/bin:${PATH} The file `tinyconfig64` is generated ... -## The Build with gllvm +## The Tarball Build with gllvm The build process is carried out by running the `build_linux_gllvm.sh` script. @@ -72,15 +76,15 @@ script. ```bash #!/usr/bin/env bash -mkdir -p ${GOPATH} +### building from a tarball with gllvm + go get github.com/SRI-CSL/gllvm/cmd/... -mkdir ${HOME}/linux_kernel -cd ${HOME}/linux_kernel -git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git +cd ${HOME} +wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.14.39.tar.xz +tar xvf linux-4.14.39.tar.xz +cd linux-4.14.39 -cd linux-stable -git checkout tags/v4.14.34 cp /vagrant/tinyconfig64 .config make CC=gclang HOSTCC=gclang @@ -89,7 +93,7 @@ get-bc -m -b built-in.o get-bc -m vmlinux ``` -## The Build with wllvm +## The Tarball Build with wllvm The build process is carried out by running the `build_linux_wllvm.sh` script. @@ -97,14 +101,15 @@ script. ```bash #!/usr/bin/env bash +### building from a tarball with wllvm + sudo pip install wllvm -mkdir ${HOME}/linux_kernel -cd ${HOME}/linux_kernel -git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git +cd ${HOME} +wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.14.39.tar.xz +tar xvf linux-4.14.39.tar.xz +cd linux-4.14.39 -cd linux-stable -git checkout tags/v4.14.34 cp /vagrant/tinyconfig64 .config @@ -114,5 +119,13 @@ extract-bc -m -b built-in.o extract-bc -m vmlinux ``` +## Building from a git clone + +You can also build from a [git clone using gllvm,](https://github.com/SRI-CSL/gllvm/blob/master/examples/linux-kernel/build_linux_gllvm_git.sh) +or build from a [git clone using wllvm.](https://github.com/SRI-CSL/gllvm/blob/master/examples/linux-kernel/build_linux_wllvm_git.sh) +Though using a tarball is faster, and seemingly more reliable. + + + ## Extracting the bitcode diff --git a/examples/linux-kernel/bash_profile b/examples/linux-kernel/bash_profile index ef424b3..dacb2c6 100644 --- a/examples/linux-kernel/bash_profile +++ b/examples/linux-kernel/bash_profile @@ -1,3 +1,5 @@ +#### /vagrant/bash_profile + #### llvm export LLVM_HOME=/usr/lib/llvm-5.0 export GOPATH=/vagrant/go diff --git a/examples/linux-kernel/bootstrap.sh b/examples/linux-kernel/bootstrap.sh index 8568800..a4537e5 100644 --- a/examples/linux-kernel/bootstrap.sh +++ b/examples/linux-kernel/bootstrap.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +# vagrant bootstrapping file + sudo apt-get update sudo apt-get install -y emacs24 dbus-x11 diff --git a/examples/linux-kernel/build_linux_gllvm_git.sh b/examples/linux-kernel/build_linux_gllvm_git.sh index 7414485..60b38d1 100755 --- a/examples/linux-kernel/build_linux_gllvm_git.sh +++ b/examples/linux-kernel/build_linux_gllvm_git.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +### building from a git clone with gllvm + go get github.com/SRI-CSL/gllvm/cmd/... cd ${HOME} diff --git a/examples/linux-kernel/build_linux_gllvm_tarball.sh b/examples/linux-kernel/build_linux_gllvm_tarball.sh index 721675c..901f714 100644 --- a/examples/linux-kernel/build_linux_gllvm_tarball.sh +++ b/examples/linux-kernel/build_linux_gllvm_tarball.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +### building from a tarball with gllvm + go get github.com/SRI-CSL/gllvm/cmd/... cd ${HOME} diff --git a/examples/linux-kernel/build_linux_wllvm_git.sh b/examples/linux-kernel/build_linux_wllvm_git.sh index 39ebcdc..89bdd2a 100755 --- a/examples/linux-kernel/build_linux_wllvm_git.sh +++ b/examples/linux-kernel/build_linux_wllvm_git.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +### building from a git clone with wllvm + sudo pip install wllvm cd ${HOME} diff --git a/examples/linux-kernel/build_linux_wllvm_tarball.sh b/examples/linux-kernel/build_linux_wllvm_tarball.sh index 6e6d0b1..701a467 100644 --- a/examples/linux-kernel/build_linux_wllvm_tarball.sh +++ b/examples/linux-kernel/build_linux_wllvm_tarball.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +### building from a tarball with wllvm + sudo pip install wllvm cd ${HOME}