Andrew Scull | 2304204 | 2018-08-22 17:44:56 +0100 | [diff] [blame] | 1 | # Getting started |
| 2 | |
| 3 | ## Getting access |
| 4 | |
| 5 | Read access to the source is provided to all Googlers (members of |
| 6 | `nonconf-mirror@prod`, to be precise). Permission to submit CLs requires |
| 7 | membership of `hafnium-access@prod`. Full administrative rights are only granted |
| 8 | to members of `hafnium-admin@prod`. |
| 9 | |
| 10 | ## Getting the source code |
| 11 | |
| 12 | ``` shell |
Andrew Scull | cd3e77e | 2018-12-19 15:35:40 +0000 | [diff] [blame] | 13 | git 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 Scull | 2304204 | 2018-08-22 17:44:56 +0100 | [diff] [blame] | 14 | ``` |
| 15 | |
| 16 | To upload a commit for review: |
| 17 | |
| 18 | ``` shell |
| 19 | git push origin HEAD:refs/for/master |
| 20 | ``` |
| 21 | Browse source at [go/hafnium-repo](https://goto.google.com/hafnium-repo). |
| 22 | Review CLs at [go/hafnium-review](https://goto.google.com/hafnium-review). |
| 23 | |
| 24 | ## Compiling the hypervisor |
| 25 | |
Andrew Walbran | 1027672 | 2018-09-10 14:33:18 +0100 | [diff] [blame] | 26 | Install prerequisites: |
| 27 | |
| 28 | ``` shell |
| 29 | sudo apt install make binutils-aarch64-linux-gnu |
| 30 | ``` |
| 31 | |
Andrew Scull | 23e93a8 | 2018-10-26 14:56:04 +0100 | [diff] [blame] | 32 | By default, the hypervisor is built with clang for a few target platforms along |
Alfredo Mazzinghi | b2bb1d3 | 2019-02-08 11:12:51 +0000 | [diff] [blame^] | 33 | with tests. Each project in the `project` directory specifies a root |
| 34 | configurations of the build. Adding a project is the preferred way to extend |
| 35 | support to new platforms. The target project that is built is selected by the |
| 36 | `PROJECT` make variable, the default project is 'reference'. |
Andrew Scull | 2304204 | 2018-08-22 17:44:56 +0100 | [diff] [blame] | 37 | |
| 38 | ``` shell |
Alfredo Mazzinghi | b2bb1d3 | 2019-02-08 11:12:51 +0000 | [diff] [blame^] | 39 | make PROJECT=<project_name> |
Andrew Scull | 2304204 | 2018-08-22 17:44:56 +0100 | [diff] [blame] | 40 | ``` |
| 41 | |
Alfredo Mazzinghi | b2bb1d3 | 2019-02-08 11:12:51 +0000 | [diff] [blame^] | 42 | The compiled image can be found under `out/<project>`, for example the QEMU image is at |
| 43 | at `out/reference/qemu_aarch64_clang/hafnium.bin`. |
Andrew Scull | 2304204 | 2018-08-22 17:44:56 +0100 | [diff] [blame] | 44 | |
Andrew Scull | 2304204 | 2018-08-22 17:44:56 +0100 | [diff] [blame] | 45 | ## Running on QEMU |
| 46 | |
| 47 | You will need at least version 2.9 for QEMU. The following command line can be |
| 48 | used to run Hafnium on it: |
| 49 | |
| 50 | ``` shell |
Alfredo Mazzinghi | b2bb1d3 | 2019-02-08 11:12:51 +0000 | [diff] [blame^] | 51 | qemu-system-aarch64 -M virt -cpu cortex-a57 -nographic -machine virtualization=true -kernel out/reference/qemu_aarch64_clang/hafnium.bin |
Andrew Scull | 2304204 | 2018-08-22 17:44:56 +0100 | [diff] [blame] | 52 | ``` |
| 53 | |
| 54 | Though it is admittedly not very useful because it doesn't have any virtual |
| 55 | machines to run. Follow the [Hafnium RAM disk](HafniumRamDisk.md) instructions |
| 56 | to create an initial RAM disk for Hafnium with Linux as the primary VM. |
| 57 | |
| 58 | The following command line will run Hafnium, with the RAM disk just created, |
| 59 | which will then boot into the primary Linux VM: |
| 60 | |
| 61 | ``` shell |
Alfredo Mazzinghi | b2bb1d3 | 2019-02-08 11:12:51 +0000 | [diff] [blame^] | 62 | qemu-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 Scull | 2304204 | 2018-08-22 17:44:56 +0100 | [diff] [blame] | 63 | ``` |
| 64 | |
| 65 | ## Running tests |
| 66 | |
| 67 | After building, presubmit tests can be run with the following command line: |
| 68 | |
| 69 | ``` shell |
| 70 | ./kokoro/ubuntu/test.sh |
| 71 | ``` |
| 72 | |
| 73 | Read about [testing](Testing.md) for more details about the tests. |