Autoformat docs.
Change-Id: Ibc270de8cd6d8535e20847098175d8a00c67abe9
diff --git a/docs/GettingStarted.md b/docs/GettingStarted.md
index eae6a16..dba6365 100644
--- a/docs/GettingStarted.md
+++ b/docs/GettingStarted.md
@@ -2,18 +2,18 @@
## Getting the source code
-``` shell
+```shell
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)
```
To upload a commit for review:
-``` shell
+```shell
git push origin HEAD:refs/for/master
```
-Browse source at https://hafnium.googlesource.com/hafnium.
-Review CLs at https://hafnium-review.googlesource.com/.
+Browse source at https://hafnium.googlesource.com/hafnium. Review CLs at
+https://hafnium-review.googlesource.com/.
See details of [how to contribute](../CONTRIBUTING.md).
@@ -21,7 +21,7 @@
Install prerequisites:
-``` shell
+```shell
sudo apt install make binutils-aarch64-linux-gnu aarch64-linux-gnu-gcc device-tree-compiler libssl-dev flex bison
```
@@ -31,7 +31,7 @@
support to new platforms. The target project that is built is selected by the
`PROJECT` make variable, the default project is 'reference'.
-``` shell
+```shell
make PROJECT=<project_name>
```
@@ -43,7 +43,7 @@
You will need at least version 2.9 for QEMU. The following command line can be
used to run Hafnium on it:
-``` shell
+```shell
qemu-system-aarch64 -M virt,gic_version=3 -cpu cortex-a57 -nographic -machine virtualization=true -kernel out/reference/qemu_aarch64_clang/hafnium.bin
```
@@ -54,7 +54,7 @@
The following command line will run Hafnium, with the RAM disk just created,
which will then boot into the primary Linux VM:
-``` shell
+```shell
qemu-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"
```
@@ -62,7 +62,7 @@
After building, presubmit tests can be run with the following command line:
-``` shell
+```shell
./kokoro/ubuntu/test.sh
```
diff --git a/docs/HafniumRamDisk.md b/docs/HafniumRamDisk.md
index 59925ef..1a537f1 100644
--- a/docs/HafniumRamDisk.md
+++ b/docs/HafniumRamDisk.md
@@ -3,26 +3,27 @@
Hafnium expects to find the following files in the root directory of its RAM
disk:
- * `vmlinuz` -- the kernel of the primary VM.
- * `initrd.img` -- the initial ramdisk of the primary VM.
- * `vms.txt` -- optionally describes the secondary VMs.
- * kernels for the secondary VMs, whose names are described in `vms.txt`.
+* `vmlinuz` -- the kernel of the primary VM.
+* `initrd.img` -- the initial ramdisk of the primary VM.
+* `vms.txt` -- optionally describes the secondary VMs.
+* kernels for the secondary VMs, whose names are described in `vms.txt`.
Follow the [preparing Linux](PreparingLinux.md) instructions to produce
`vmlinuz` and `initrd.img` for a basic Linux primary VM.
## Format of `vms.txt` file
+
The format is currently one line per secondary VM, with the following format:
-``` shell
+```shell
<memory-size-in-bytes> <number-of-cpus> <kernel-filename>
```
For example, the following defines two secondary VMs, the first one with 1MB of
memory, 2 CPUs and kernel image called `kernel0`, while the second one has 2MB
-of memory, 4 CPUs and a kernel image called `kernel1`.
+of memory, 4 CPUs and a kernel image called `kernel1`.
-``` shell
+```shell
1048576 2 kernel0
2097152 4 kernel1
```
diff --git a/docs/HermeticBuild.md b/docs/HermeticBuild.md
index ca1026e..f30de14 100644
--- a/docs/HermeticBuild.md
+++ b/docs/HermeticBuild.md
@@ -8,8 +8,8 @@
Building inside a container is always enabled only for Kokoro pre-submit tests
but can be enabled for local builds too. It is disabled by default as it
-requires the use of Docker which currently supports rootless containers only
-in nightly builds. As rootless container tools mature, Hafnium may change the
+requires the use of Docker which currently supports rootless containers only in
+nightly builds. As rootless container tools mature, Hafnium may change the
default settings. For now, running the hermetic build locally is intended
primarily to reproduce issues in pre-submit tests.
@@ -30,16 +30,17 @@
### Nightly with rootless
The latest nightly version of Docker has support for running containers with
-user namespaces, thus eliminating the need for a daemon with root privileges.
-It can be installed into the local user's `bin` directory with a script:
-``` shell
+user namespaces, thus eliminating the need for a daemon with root privileges. It
+can be installed into the local user's `bin` directory with a script:
+
+```shell
curl -fsSL https://get.docker.com/rootless -o get-docker.sh
sh get-docker.sh
```
-The script will also walk you through the installation of dependencies,
-changes to system configuration files and environment variable values needed
-by the client to discover the rootless daemon.
+The script will also walk you through the installation of dependencies, changes
+to system configuration files and environment variable values needed by the
+client to discover the rootless daemon.
## Enabling for local builds
@@ -48,26 +49,30 @@
container. Any other value disables the feature.
To always enable hermetic builds, put this line in your `~/.bashrc`:
-``` shell
+
+```shell
export HAFNIUM_HERMETIC_BUILD=true
```
When you now run `make`, you should see the following line:
-``` shell
+
+```shell
$ make
Running in container: make all
...
```
+
## Running commands inside the container
An arbitrary command can be executed inside the container with
-`build/run_in_container.sh [-i] <command> ...`. This is done
-automatically inside `Makefile` and `kokoro/ubuntu/build.sh` which
-detect whether they are already running inside the container and respawn
-themselves using `run_in_container.sh` if not.
+`build/run_in_container.sh [-i] <command> ...`. This is done automatically
+inside `Makefile` and `kokoro/ubuntu/build.sh` which detect whether they are
+already running inside the container and respawn themselves using
+`run_in_container.sh` if not.
For example, you can spawn a shell with:
-``` shell
+
+```shell
./build/run_in_container.sh -i bash
```
@@ -75,13 +80,14 @@
The container image is defined in `build/docker/Dockerfile` and can be built
locally:
-``` shell
+
+```shell
./build/docker/build.sh
```
-Owners of the `hafnium-build` GCP repository can publish the new image
-(requires [go/cloud-sdk](https://goto.google.com/cloud-sdk) installed and
-authenticated):
-``` shell
+Owners of the `hafnium-build` GCP repository can publish the new image (requires
+[go/cloud-sdk](https://goto.google.com/cloud-sdk) installed and authenticated):
+
+```shell
./build/docker/publish.sh
```
diff --git a/docs/PreparingLinux.md b/docs/PreparingLinux.md
index 283b9ce..9654960 100644
--- a/docs/PreparingLinux.md
+++ b/docs/PreparingLinux.md
@@ -8,7 +8,7 @@
The Linux kernel for the primary VM can be built using the following
command-line:
-``` shell
+```shell
git clone https://github.com/torvalds/linux.git
cd linux
ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make defconfig
@@ -24,7 +24,7 @@
the kernel module, replacing `<kernel-path>` with the path to the kernel checked
out in the previous section:
-``` shell
+```shell
cd hafnium/driver/linux/
ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- KERNEL_PATH=<kernel-path> make
```
@@ -38,7 +38,7 @@
construct a file system for the Linux RAM disk with the BusyBox shell as the
init process.
-``` shell
+```shell
git clone git://busybox.net/busybox.git
cd busybox
ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make defconfig
@@ -48,7 +48,7 @@
At this point you should ensure that the option `Settings > Build static binary
(no shared libs)` is selected. Then you can proceed with the following commands:
-``` shell
+```shell
ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make -j24
ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make install
cd _install
@@ -71,13 +71,13 @@
section. Assuming the BusyBox root directory is in the same parent directory as
the Hafnium root directory:
-``` shell
+```shell
cp ../../hafnium/driver/linux/hafnium.ko .
```
Then run the following commands:
-``` shell
+```shell
find . | cpio -o -H newc | gzip > ../initrd.img
cd ..
```
diff --git a/docs/Testing.md b/docs/Testing.md
index 1b66e83..b4946c9 100644
--- a/docs/Testing.md
+++ b/docs/Testing.md
@@ -5,16 +5,16 @@
## Presubmit
-Presubmit builds everything, runs all tests and checks the source for
-formatting and lint errors. This can be run locally with:
+Presubmit builds everything, runs all tests and checks the source for formatting
+and lint errors. This can be run locally with:
-``` shell
+```shell
./kokoro/ubuntu/build.sh
```
Or to just run the tests after having built everything manually run:
-``` shell
+```shell
./kokoro/ubuntu/test.sh
```
@@ -28,10 +28,10 @@
Having a framework for tests makes them easier to read and write. `hftest` is a
framework to meet the needs of VM based tests for Hafnium. It consists of:
- * assertions
- * test declarations
- * base VM image
- * driver script
+* assertions
+* test declarations
+* base VM image
+* driver script
Assertions should be familiar from other testing libraries. They make use of
C11's `_Generic` expressions for type genericity.