blob: ff9023e7e956ec40760ee49c7b88549205964f95 [file] [log] [blame] [view]
Andrew Scull23042042018-08-22 17:44:56 +01001# Getting started
2
Andrew Scull23042042018-08-22 17:44:56 +01003## Getting the source code
4
5``` shell
Andrew Scullcd3e77e2018-12-19 15:35:40 +00006git 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 +01007```
8
9To upload a commit for review:
10
11``` shell
12git push origin HEAD:refs/for/master
13```
Andrew Walbran0ba13bb2019-05-13 10:57:25 +010014
15Browse source at https://hafnium.googlesource.com/hafnium.
16Review CLs at https://hafnium-review.googlesource.com/.
17
18See details of [how to contribute](CONTRIBUTING.md).
Andrew Scull23042042018-08-22 17:44:56 +010019
20## Compiling the hypervisor
21
Andrew Walbran10276722018-09-10 14:33:18 +010022Install prerequisites:
23
24``` shell
Andrew Walbran972ba672019-05-21 15:02:37 +010025sudo apt install make binutils-aarch64-linux-gnu device-tree-compiler libssl-dev
Andrew Walbran10276722018-09-10 14:33:18 +010026```
27
Andrew Scull23e93a82018-10-26 14:56:04 +010028By default, the hypervisor is built with clang for a few target platforms along
Alfredo Mazzinghib2bb1d32019-02-08 11:12:51 +000029with tests. Each project in the `project` directory specifies a root
30configurations of the build. Adding a project is the preferred way to extend
31support to new platforms. The target project that is built is selected by the
32`PROJECT` make variable, the default project is 'reference'.
Andrew Scull23042042018-08-22 17:44:56 +010033
34``` shell
Alfredo Mazzinghib2bb1d32019-02-08 11:12:51 +000035make PROJECT=<project_name>
Andrew Scull23042042018-08-22 17:44:56 +010036```
37
Alfredo Mazzinghib2bb1d32019-02-08 11:12:51 +000038The compiled image can be found under `out/<project>`, for example the QEMU image is at
39at `out/reference/qemu_aarch64_clang/hafnium.bin`.
Andrew Scull23042042018-08-22 17:44:56 +010040
Andrew Scull23042042018-08-22 17:44:56 +010041## Running on QEMU
42
43You will need at least version 2.9 for QEMU. The following command line can be
44used to run Hafnium on it:
45
46``` shell
Andrew Scull25d897e2019-06-27 12:57:02 +010047qemu-system-aarch64 -M virt,gic_version=3 -cpu cortex-a57 -nographic -machine virtualization=true -kernel out/reference/qemu_aarch64_clang/hafnium.bin
Andrew Scull23042042018-08-22 17:44:56 +010048```
49
50Though it is admittedly not very useful because it doesn't have any virtual
51machines to run. Follow the [Hafnium RAM disk](HafniumRamDisk.md) instructions
52to create an initial RAM disk for Hafnium with Linux as the primary VM.
53
54The following command line will run Hafnium, with the RAM disk just created,
55which will then boot into the primary Linux VM:
56
57``` shell
Andrew Scull25d897e2019-06-27 12:57:02 +010058qemu-system-aarch64 -M virt,gic_version=3 -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 +010059```
60
61## Running tests
62
63After building, presubmit tests can be run with the following command line:
64
65``` shell
66./kokoro/ubuntu/test.sh
67```
68
69Read about [testing](Testing.md) for more details about the tests.