Add dependencies for ROM_EXT signer

This change adds the following dependencies required to build ROM_EXT signer to CI
configuration files, Docker container, and documentation:
- Perl
- Cmake
- Go
- Rust

Signed-off-by: Alphan Ulusoy <alphan@google.com>
diff --git a/apt-requirements.txt b/apt-requirements.txt
index dea1e6c..1e7664d 100644
--- a/apt-requirements.txt
+++ b/apt-requirements.txt
@@ -17,11 +17,13 @@
 bison
 build-essential
 clang-format
+cmake
 curl
 doxygen
 flex
 g++
 git
+golang
 libelf1
 libelf-dev
 libftdi1-2
@@ -33,6 +35,7 @@
 lsb-release
 make
 ninja-build
+perl
 pkgconf
 python3
 python3-pip
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 3493f46..71b3483 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -7,13 +7,14 @@
 
 variables:
   #
-  # If updating VERILATOR_VERSION, OPENOCD_VERSION or TOOLCHAIN_VERSION, update
-  # the definitions in util/container/Dockerfile as well.
+  # If updating VERILATOR_VERSION, OPENOCD_VERSION, TOOLCHAIN_VERSION or RUST_VERSION
+  # update the definitions in util/container/Dockerfile as well.
   #
   VERILATOR_VERSION: 4.104
   OPENOCD_VERSION: 0.11.0
   TOOLCHAIN_PATH: /opt/buildcache/riscv
   VERIBLE_VERSION: v0.0-1213-g9e5c085
+  RUST_VERSION: 1.52.1
   # Release tag from https://github.com/lowRISC/lowrisc-toolchains/releases
   TOOLCHAIN_VERSION: 20210412-1
   # This controls where builds happen, and gets picked up by build_consts.sh.
diff --git a/ci/install-package-dependencies.sh b/ci/install-package-dependencies.sh
index 0e772d5..a3cc3b7 100755
--- a/ci/install-package-dependencies.sh
+++ b/ci/install-package-dependencies.sh
@@ -10,6 +10,7 @@
     echo "Usage: install-package-dependencies.sh --verilator-version V"
     echo "                                       --openocd-version V"
     echo "                                       --verible-version V"
+    echo "                                       --rust-version V"
     exit 1
 }
 
@@ -19,7 +20,7 @@
     exit 1
 }
 
-long="verilator-version:,openocd-version:,verible-version:"
+long="verilator-version:,openocd-version:,verible-version:,rust-version:"
 ARGS="$(getopt -o "" -l "$long" -- "$@")" || usage
 
 VERILATOR_VERSION=
@@ -33,6 +34,7 @@
         --verilator-version) VERILATOR_VERSION="$2"; shift 2 ;;
         --openocd-version)   OPENOCD_VERSION="$2";   shift 2 ;;
         --verible-version)   VERIBLE_VERSION="$2";   shift 2 ;;
+        --rust-version)      RUST_VERSION="$2";      shift 2 ;;
         --) shift; break ;;
         *)  error "getopt / case statement mismatch"
     esac
@@ -42,6 +44,7 @@
 test -n "$VERILATOR_VERSION" || error "Missing --verilator-version"
 test -n "$OPENOCD_VERSION"   || error "Missing --openocd-version"
 test -n "$VERIBLE_VERSION"   || error "Missing --verible-version"
+test -n "$RUST_VERSION"      || error "Missing --rust-version"
 
 # Check that there aren't any positional arguments
 test $# = 0 || error "Unexpected positional arguments"
@@ -134,3 +137,8 @@
 
 # Propagate PATH changes to all subsequent steps of the job
 echo "##vso[task.setvariable variable=PATH]/tools/verible/bin:$PATH"
+
+# Install Rust
+sw/vendor/rustup/rustup-init.sh -y \
+    --default-toolchain "${RUST_VERSION}"
+export PATH="$HOME/.cargo/bin:$PATH"
diff --git a/ci/install-package-dependencies.yml b/ci/install-package-dependencies.yml
index 64faae0..620a127 100644
--- a/ci/install-package-dependencies.yml
+++ b/ci/install-package-dependencies.yml
@@ -27,5 +27,6 @@
       ci/install-package-dependencies.sh \
         --verilator-version $(VERILATOR_VERSION) \
         --openocd-version $(OPENOCD_VERSION) \
-        --verible-version $(VERIBLE_VERSION)
+        --verible-version $(VERIBLE_VERSION) \
+        --rust-version $(RUST_VERSION)
     displayName: 'Install package dependencies'
diff --git a/doc/ug/install_instructions/index.md b/doc/ug/install_instructions/index.md
index 57a9a34..4497dae 100644
--- a/doc/ug/install_instructions/index.md
+++ b/doc/ug/install_instructions/index.md
@@ -55,6 +55,10 @@
 * libusb 1.0 (called libusbx in older distributions)
 * OpenOCD 0.11.0
 * [Verible](https://github.com/google/verible) {{< tool_version "verible" >}}
+* Cmake 2.8.11
+* Perl 5.6.1
+* [Go](https://golang.org/) 1.10
+* [Rust](https://www.rust-lang.org/) 1.52.1
 
 To synthesize and simulate the hardware components of OpenTitan multiple EDA tools are supported.
 Depending on how you interact with the OpenTitan hardware code, one of more of the following tools need to be available.
diff --git a/util/container/Dockerfile b/util/container/Dockerfile
index abfecb9..8c3337b 100644
--- a/util/container/Dockerfile
+++ b/util/container/Dockerfile
@@ -8,15 +8,16 @@
 # Global configuration options.
 ARG VERILATOR_VERSION=4.104
 ARG OPENOCD_VERSION=0.11.0
-
 # The RISCV toolchain version should match the release tag used in GitHub.
 ARG RISCV_TOOLCHAIN_TAR_VERSION=20210412-1
+ARG RUST_VERSION=1.52.1
 
 # Main container image.
 FROM ubuntu:18.04 AS opentitan
 ARG VERILATOR_VERSION
 ARG OPENOCD_VERSION
 ARG RISCV_TOOLCHAIN_TAR_VERSION
+ARG RUST_VERSION
 
 LABEL version="1.0"
 LABEL description="OpenTitan container for hardware development."
@@ -77,11 +78,22 @@
 RUN /tmp/get-toolchain.py -r ${RISCV_TOOLCHAIN_TAR_VERSION}
 RUN rm /tmp/python-requirements.txt /tmp/get-toolchain.py
 
+COPY sw/vendor/rustup/rustup-init.sh /tmp/rustup-init.sh
+# This file does not create a user, so we install rustup and cargo under
+# /tools.
+ENV RUSTUP_HOME /tools/.rustup 
+ENV CARGO_HOME /tools/.cargo 
+# Permissions are relaxed so that the container user can also download
+# dependencies during build.
+RUN /tmp/rustup-init.sh -y \
+    --default-toolchain ${RUST_VERSION} && \
+    chmod -R o=u ${RUSTUP_HOME} ${CARGO_HOME}
+
 # Use bash as default shell
 RUN ln -sf /bin/bash /bin/sh
 
 # Include tools in PATH.
-ENV PATH "/tools/verilator/${VERILATOR_VERSION}/bin:${PATH}"
+ENV PATH "/tools/verilator/${VERILATOR_VERSION}/bin:${CARGO_HOME}/bin:${PATH}"
 
 # Configures default container user.
 ENV USER ot
diff --git a/yum-requirements.txt b/yum-requirements.txt
index 0cc37a6..a90763e 100644
--- a/yum-requirements.txt
+++ b/yum-requirements.txt
@@ -13,11 +13,13 @@
 bison
 build-essential
 clang-format
+cmake
 curl
 doxygen
 flex
 g++
 git
+golang
 libelf1
 libelf-dev
 libftdi1-2
@@ -31,6 +33,7 @@
 ninja-build
 openssl11-libs
 openssl11-devel
+perl
 pkgconf
 python3
 python3-pip