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 |
| 13 | git clone --recurse-submodules sso://hafnium/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) |
| 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 | 2304204 | 2018-08-22 17:44:56 +0100 | [diff] [blame] | 32 | By default, the hypervisor is built with clang for an aarch64 QEMU target by |
| 33 | running: |
| 34 | |
| 35 | ``` shell |
| 36 | make |
| 37 | ``` |
| 38 | |
| 39 | The compiled image can be found at `out/aarch64/qemu/clang_aarch64/hafnium.bin`. |
| 40 | |
| 41 | To build for the HiKey board, change the target platform: |
| 42 | |
| 43 | ``` shell |
| 44 | PLATFORM=hikey make |
| 45 | ``` |
| 46 | |
| 47 | To build using gcc instead of clang, the aarch64 variant must be installed: |
| 48 | |
| 49 | ``` shell |
| 50 | sudo apt install gcc-aarch64-linux-gnu |
| 51 | GCC=true make |
| 52 | ``` |
| 53 | ## Running on QEMU |
| 54 | |
| 55 | You will need at least version 2.9 for QEMU. The following command line can be |
| 56 | used to run Hafnium on it: |
| 57 | |
| 58 | ``` shell |
| 59 | qemu-system-aarch64 -M virt -cpu cortex-a57 -nographic -machine virtualization=true -kernel out/aarch64/qemu/clang_aarch64/hafnium.bin |
| 60 | ``` |
| 61 | |
| 62 | Though it is admittedly not very useful because it doesn't have any virtual |
| 63 | machines to run. Follow the [Hafnium RAM disk](HafniumRamDisk.md) instructions |
| 64 | to create an initial RAM disk for Hafnium with Linux as the primary VM. |
| 65 | |
| 66 | The following command line will run Hafnium, with the RAM disk just created, |
| 67 | which will then boot into the primary Linux VM: |
| 68 | |
| 69 | ``` shell |
| 70 | qemu-system-aarch64 -M virt -cpu cortex-a57 -nographic -machine virtualization=true -kernel out/aarch64/qemu/clang_aarch64/hafnium.bin -initrd initrd.img -append "rdinit=/sbin/init" |
| 71 | ``` |
| 72 | |
| 73 | ## Running tests |
| 74 | |
| 75 | After building, presubmit tests can be run with the following command line: |
| 76 | |
| 77 | ``` shell |
| 78 | ./kokoro/ubuntu/test.sh |
| 79 | ``` |
| 80 | |
| 81 | Read about [testing](Testing.md) for more details about the tests. |