blob: caf3cb4a731d47e4f8fa0a7cd332f43e563f5135 [file] [log] [blame] [view]
Andrew Scull23042042018-08-22 17:44:56 +01001# Getting started
2
3## Getting access
4
5Read access to the source is provided to all Googlers (members of
6`nonconf-mirror@prod`, to be precise). Permission to submit CLs requires
7membership of `hafnium-access@prod`. Full administrative rights are only granted
8to members of `hafnium-admin@prod`.
9
10## Getting the source code
11
12``` shell
Andrew Scullcd3e77e2018-12-19 15:35:40 +000013git clone --recurse-submodules https://hafnium.googlesource.com/hafnium && (cd hafnium && f=`git rev-parse --git-dir`/hooks/commit-msg ; curl -Lo $f https://gerrit-review.googlesource.com/tools/hooks/commit-msg ; chmod +x $f)
Andrew Scull23042042018-08-22 17:44:56 +010014```
15
16To upload a commit for review:
17
18``` shell
19git push origin HEAD:refs/for/master
20```
21Browse source at [go/hafnium-repo](https://goto.google.com/hafnium-repo).
22Review CLs at [go/hafnium-review](https://goto.google.com/hafnium-review).
23
24## Compiling the hypervisor
25
Andrew Walbran10276722018-09-10 14:33:18 +010026Install prerequisites:
27
28``` shell
29sudo apt install make binutils-aarch64-linux-gnu
30```
31
Andrew Scull23e93a82018-10-26 14:56:04 +010032By default, the hypervisor is built with clang for a few target platforms along
Alfredo Mazzinghib2bb1d32019-02-08 11:12:51 +000033with tests. Each project in the `project` directory specifies a root
34configurations of the build. Adding a project is the preferred way to extend
35support to new platforms. The target project that is built is selected by the
36`PROJECT` make variable, the default project is 'reference'.
Andrew Scull23042042018-08-22 17:44:56 +010037
38``` shell
Alfredo Mazzinghib2bb1d32019-02-08 11:12:51 +000039make PROJECT=<project_name>
Andrew Scull23042042018-08-22 17:44:56 +010040```
41
Alfredo Mazzinghib2bb1d32019-02-08 11:12:51 +000042The compiled image can be found under `out/<project>`, for example the QEMU image is at
43at `out/reference/qemu_aarch64_clang/hafnium.bin`.
Andrew Scull23042042018-08-22 17:44:56 +010044
Andrew Scull23042042018-08-22 17:44:56 +010045## Running on QEMU
46
47You will need at least version 2.9 for QEMU. The following command line can be
48used to run Hafnium on it:
49
50``` shell
Alfredo Mazzinghib2bb1d32019-02-08 11:12:51 +000051qemu-system-aarch64 -M virt -cpu cortex-a57 -nographic -machine virtualization=true -kernel out/reference/qemu_aarch64_clang/hafnium.bin
Andrew Scull23042042018-08-22 17:44:56 +010052```
53
54Though it is admittedly not very useful because it doesn't have any virtual
55machines to run. Follow the [Hafnium RAM disk](HafniumRamDisk.md) instructions
56to create an initial RAM disk for Hafnium with Linux as the primary VM.
57
58The following command line will run Hafnium, with the RAM disk just created,
59which will then boot into the primary Linux VM:
60
61``` shell
Alfredo Mazzinghib2bb1d32019-02-08 11:12:51 +000062qemu-system-aarch64 -M virt -cpu cortex-a57 -nographic -machine virtualization=true -kernel out/reference/qemu_aarch64_clang/hafnium.bin -initrd initrd.img -append "rdinit=/sbin/init"
Andrew Scull23042042018-08-22 17:44:56 +010063```
64
65## Running tests
66
67After building, presubmit tests can be run with the following command line:
68
69``` shell
70./kokoro/ubuntu/test.sh
71```
72
73Read about [testing](Testing.md) for more details about the tests.