Skip to content

Latest commit

 

History

History
61 lines (42 loc) · 2.61 KB

prepare_environment.md

File metadata and controls

61 lines (42 loc) · 2.61 KB

Tutorial: Prepare your Environment

Before starting this tutorial, you will need to setup your development machine. These instructions were tested on an x86_64 based machine using Ubuntu 20.04.

Install Tools

These tools are required for building both the toolkit and the images built from the toolkit. These are the same prerequisites needed for building CBL-Mariner.

# Add a backports repo in order to install the necessary version of Go.
sudo add-apt-repository ppa:longsleep/golang-backports
sudo apt-get update

# Install required dependencies.
sudo apt -y install git make tar wget curl rpm qemu-utils golang-1.20-go genisoimage python bison gawk

# Recommended but not required: `pigz` for faster compression operations.
sudo apt -y install pigz

# Fix go 1.17 link
sudo ln -vsf /usr/lib/go-1.17/bin/go /usr/bin/go

# Install Docker.
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER

You will need to log out and lock back in for user changes to take effect.

Clone CBL-Mariner and Build the Toolkit

To build the CBL-MarinerTutorials repository you will need the same toolkit and makefile from the CBL-Mariner repository. So, first clone CBL-Mariner, and then checkout the stable release of interest (e.g. 2.0-stable), then build the toolkit.

Example for CBL-Mariner 2.0 Toolkit

git clone https://github.com/microsoft/CBL-Mariner.git
pushd CBL-Mariner/toolkit
git checkout 2.0-stable
sudo make package-toolkit REBUILD_TOOLS=y
popd

Clone CBL-MarinerTutorials Repo and Extract the Toolkit

Now clone the CBL-MarinerTutorials repo and extract the toolkit to the CBL-MarinerTutorials repository.

git clone https://github.com/microsoft/CBL-MarinerTutorials.git
pushd CBL-MarinerTutorials
cp ../CBL-Mariner/out/toolkit-*.tar.gz ./
tar -xzvf toolkit-*.tar.gz

The toolkit folder now contains the makefile, support scripts and the go tools compiled from the section. The toolkit will preserve the previously compiled tool binaries, however the toolkit is also able to rebuild them if desired. (Not recommended: set REBUILD_TOOLS=y to use locally rebuilt tool binaries during a build). For more information on our toolkit see How The Build System Works in the CBL-Mariner repo.