[go: nahoru, domu]

Ubuntu dependencies in INSTALL files

Added Dockerfile to allow for building in a container to
help those who are running on a system with hard to find
packages.

Signed-off-by: John Andersen <john.s.andersen@intel.com>
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..36295f0
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,37 @@
+FROM ubuntu:trusty
+
+RUN apt -y update && \
+  apt -y install \
+    autoconf-archive \
+    libcmocka0 \
+    libcmocka-dev \
+    build-essential \
+    wget \
+    git \
+    libssl-dev \
+    pkg-config \
+    gcc \
+    g++ \
+    m4 \
+    libtool \
+    automake \
+    autoconf
+
+RUN wget https://downloads.sourceforge.net/project/ibmswtpm2/ibmtpm532.tar && \
+  sha256sum ibmtpm532.tar | grep -q ^abc0b420257917ccb42a9750588565d5e84a2b4e99a6f9f46c3dad1f9912864f && \
+  mkdir ibmtpm532 && \
+  tar axf ibmtpm532.tar -C ibmtpm532 && \
+  make -C ibmtpm532/src -j$(nproc)
+
+RUN git clone https://github.com/01org/TPM2.0-TSS && \
+  cd TPM2.0-TSS && \
+  ./bootstrap && \
+  mkdir ./build && \
+  cd ./build && \
+  ../configure --enable-unit --with-simulatorbin=$(pwd)/../../ibmtpm532/src/tpm_server && \
+  make -j$(nproc) && \
+  make simulator-build && \
+  make -j$(nproc) check && \
+  make simulator-start && \
+  test/tpmclient/tpmclient && \
+  make simulator-stop
diff --git a/INSTALL b/INSTALL
index 61d17ea..65956be 100644
--- a/INSTALL
+++ b/INSTALL
@@ -10,6 +10,23 @@
 cmocka unit test framework
 pkg-config
 
+On Ubuntu these packages can be installed with the following commands.
+
+$ sudo apt -y update
+$ sudo apt -y install \
+  autoconf-archive \
+  libcmocka0 \
+  libcmocka-dev \
+  build-essential \
+  git \
+  pkg-config \
+  gcc \
+  g++ \
+  m4 \
+  libtool \
+  automake \
+  autoconf
+
 Currently the tpm2.0-tss is only distributed via GitHub as we have not yet
 produced an official source release. To obtain the tpm2.0-tss sources you
 must clone them from the 01.org GitHub organization TPM2.0-TSS git repository:
@@ -63,3 +80,13 @@
 $ CONFIG_SITE=$(pwd)/../TPM2.0-TSS/lib/debug_config.site \
   ../TPM2.0-TSS/configure
 $ make
+
+If you are having trouble installing the dependencies on your machine you can
+build in a container.
+
+$ docker build -t tpm2 .
+$ docker run --name temp tpm2 /bin/true
+$ docker cp temp:/TPM2.0-TSS TPM2.0-TSS
+$ docker rm temp
+
+TPM2.0-TSS is now in your working directory and contains all the built files.
diff --git a/INSTALL.md b/INSTALL.md
index 74fb815..e45b7ef 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -15,6 +15,24 @@
 Most users will not need to install these dependencies:
 * cmocka unit test framework
 
+## Ubuntu
+```
+$ sudo apt -y update
+$ sudo apt -y install \
+  autoconf-archive \
+  libcmocka0 \
+  libcmocka-dev \
+  build-essential \
+  git \
+  pkg-config \
+  gcc \
+  g++ \
+  m4 \
+  libtool \
+  automake \
+  autoconf
+```
+
 # Building From Source
 ## Bootstrapping the Build
 To configure the tpm2.0-tss source code first run the bootstrap script, which
@@ -53,3 +71,17 @@
 ```
 $ sudo ldconfig
 ```
+
+## Building In A Container
+
+If you are having trouble installing the dependencies on your machine you can
+build in a container.
+
+```
+$ docker build -t tpm2 .
+$ docker run --name temp tpm2 /bin/true
+$ docker cp temp:/TPM2.0-TSS TPM2.0-TSS
+$ docker rm temp
+```
+
+TPM2.0-TSS is now in your working directory and contains all the built files.