|
| 1 | +# Build containers for Project ACRN |
| 2 | + |
| 3 | +## Introduction |
| 4 | + |
| 5 | +This repository contains a number of Dockerfile that include |
| 6 | +all the build tools and dependencies to build the ACRN Project |
| 7 | +components, i.e. the `acrn-hypervisor` and `acrn-devicemodel` |
| 8 | + |
| 9 | +The workflow is pretty simple and can be summarized in these few steps: |
| 10 | + |
| 11 | +1. Build the *build containers* based on your preferred OS |
| 12 | +1. Clone the Project ACRN repositories |
| 13 | +1. Start the build container and give it the repositories |
| 14 | +1. Build the Project ACRN components |
| 15 | + |
| 16 | +The pre-requisite is that you have Docker installed on your machine. |
| 17 | +Explaining how to install it on your system is beyond the scope of this |
| 18 | +document, please visit https://www.docker.com for detailed instructions. |
| 19 | + |
| 20 | +## Build the *build containers* |
| 21 | + |
| 22 | +Each `Dockerfile` in this repo has an extension that tells what Linux |
| 23 | +distribution it is based on. To build a container using any of those, |
| 24 | +use this command: |
| 25 | +``` |
| 26 | +$ sudo docker build -t <container-name> -f Dockerfile.<baseos> . |
| 27 | +``` |
| 28 | + |
| 29 | +As an example, to build a container based on CentOS 7, do: |
| 30 | +``` |
| 31 | +$ sudo docker build -t centos7 -f Dockerfile.centos7 . |
| 32 | +``` |
| 33 | + |
| 34 | +## Clone Project ACRN |
| 35 | + |
| 36 | +Follow these simple steps to clone the Project ACRN repositories |
| 37 | +``` |
| 38 | +$ mkdir ~/acrn |
| 39 | +$ cd ~/acrn |
| 40 | +$ git clone https://github.com/projectacrn/acrn-hypervisor |
| 41 | +$ git clone https://github.com/projectacrn/acrn-devicemodel |
| 42 | +``` |
| 43 | + |
| 44 | +## Start the build container |
| 45 | + |
| 46 | +Use this `~/acrn` folder and pass it on to your build container: |
| 47 | +``` |
| 48 | +$ cd ~/acrn |
| 49 | +$ sudo docker run -ti -v $PWD:/root/acrn <container-name> |
| 50 | +``` |
| 51 | + |
| 52 | +Using CentOS 7 again as an example, that gives us: |
| 53 | +``` |
| 54 | +$ cd ~/acrn |
| 55 | +$ sudo docker run -ti -v $PWD:/root/acrn centos7 |
| 56 | +``` |
| 57 | + |
| 58 | +**Note:** if you encounter permission issues within the container (as it |
| 59 | +happens on a Fedora 27 host), try adding the `:z` parameter to the mount option. |
| 60 | +This will unlock the permission restriction (that comes from SElinux). Your |
| 61 | +command-line would then be: |
| 62 | +``` |
| 63 | +$ cd ~/acrn |
| 64 | +$ sudo docker run -ti -v $PWD:/root/acrn:z centos7 |
| 65 | +``` |
| 66 | + |
| 67 | +## Build the ACRN components |
| 68 | + |
| 69 | +The steps above place you inside the container and give you access to |
| 70 | +the Project ACRN repositories you cloned earlier. You can now build any |
| 71 | +of the components. Here is an example: |
| 72 | +``` |
| 73 | +# cd acrn-hypervisor |
| 74 | +# make PLATFORM=uefi RELEASE=1 |
| 75 | +``` |
| 76 | + |
| 77 | +You can do this for all build combinations and also try to build the `acrn-devicemodel`. |
| 78 | +All the build dependencies and tools are pre-installed in the container as well as a |
| 79 | +couple of useful tools (`git` and `vim`) so you can directly edit files to experiment |
| 80 | +from within the container. |
0 commit comments