Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qemu build #53

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hugo/content/devapp/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ We also provide a linker script there in `apps.lds` which shows the
linker the memory layout.

Minimal compilation of the above program would look something like
this if `tkey-libs` is cloned in the directory next to this one:
this if `tkey-libs` is in the directory next to this one:

```
clang -g -target riscv32-unknown-none-elf -march=rv32iczmmul -mabi=ilp32 \
Expand Down
35 changes: 27 additions & 8 deletions hugo/content/tools/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ choco install make llvm clang go
We provide a container image which has all the above packages and
tools already installed for use with Podman or Docker.

You should probably always use the image with the tag "latest", but if
you're trying to do a reproducible build you should of course use the
tag possibly mentioned in the release.

{{< tabs >}}
{{< tab "Linux" >}}

Expand Down Expand Up @@ -136,7 +140,7 @@ https://github.com/containers/podman/blob/main/docs/tutorials/podman-for-windows
You can use the following command to fetch the image:

```
podman pull ghcr.io/tillitis/tkey-builder:2
podman pull ghcr.io/tillitis/tkey-builder
```

**Note well**: This image is really large (~ 2 GiB) because it also
Expand All @@ -149,7 +153,25 @@ Libraries for development of TKey device apps are available in:

https://github.com/tillitis/tkey-libs

Build the tkey-libs first, typically just:
Pre-compiled versions are available under:

https://github.com/tillitis/tkey-libs/releases

Unpack the tar file somewhere and point clang to where they are,
typically with `-L tkey-libs` and `-I tkey-libs/include.`

In many device app projects it will be sufficient to set `LIBDIR`:

```
make LIBDIR=/path/to/tkey-libs
```

Note that your `lld` might complain if it's not the same version that
was used to produce the libraries. You might want to build the
libraries yourself if that happens, or use the tkey-builder container
image.

To build tkey-libs, typically you just:

```
git clone https://github.com/tillitis/tkey-libs.git
Expand Down Expand Up @@ -226,7 +248,7 @@ Or use podman directly if you haven't got `make` installed, typically
specifying where your `tkey-libs` are:

```
podman run --rm --mount type=bind,source=.,target=/src --mount type=bind,source=../tkey-libs,target=/tkey-libs -w /src -it ghcr.io/tillitis/tkey-builder:1 make -j
podman run --rm --mount type=bind,source=.,target=/src --mount type=bind,source=../tkey-libs,target=/tkey-libs -w /src -it ghcr.io/tillitis/tkey-builder make -j
```
## QEMU Emulator

Expand Down Expand Up @@ -272,13 +294,10 @@ repository](https://github.com/tillitis/qemu):
git clone -b tk1 https://github.com/tillitis/qemu
mkdir qemu/build
cd qemu/build
../configure --target-list=riscv32-softmmu --disable-werror
make -j $(nproc)
../configure --target-list=riscv32-softmmu
make -j $(nproc) qemu-system-riscv32
```

(Built with warnings-as-errors disabled, see [this
issue](https://github.com/tillitis/qemu/issues/3).)

Then execute the following commands to fetch and build the firmware:

```
Expand Down
6 changes: 3 additions & 3 deletions hugo/content/unlocked/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ make -C contrib run
```
or use this podman command
```
podman run --rm --mount type=bind,source="$(pwd)",target=/src -w /src -it ghcr.io/tillitis/tkey-builder:4 /usr/bin/bash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I agree about removing the tkey-builder number under devtools, I wonder if it is correct to do so under the unlocked pages.

These instructions are for building a specific tag, as of now TK1-24.03, to be able to build it as we intended and infact released, the :4 needs to stay. Otherwise we may, implicitly, change the release build of an earlier tag when we release newer version of tkey-builder - a build that we may not have tested.

podman run --rm --mount type=bind,source="$(pwd)",target=/src -w /src -it ghcr.io/tillitis/tkey-builder /usr/bin/bash
```

{{< /tab >}}
Expand All @@ -77,13 +77,13 @@ make -C contrib run
```
or use this podman command
```
podman run --rm --mount type=bind,source="$(pwd)",target=/src -w /src -it ghcr.io/tillitis/tkey-builder:4 /usr/bin/bash
podman run --rm --mount type=bind,source="$(pwd)",target=/src -w /src -it ghcr.io/tillitis/tkey-builder /usr/bin/bash
```
{{< /tab >}}
{{< tab "Windows" >}}

```
podman run --rm --mount type=bind,source="./",target=/src -w /src -it ghcr.io/tillitis/tkey-builder:4 /usr/bin/bash
podman run --rm --mount type=bind,source="./",target=/src -w /src -it ghcr.io/tillitis/tkey-builder /usr/bin/bash
```

{{< /tab >}}
Expand Down
2 changes: 1 addition & 1 deletion hugo/content/unlocked/spiflash.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ this succeeds you are done and can skip the remaining steps.
Otherwise start the container using:

```
podman run --rm --device /dev/bus/usb/$(lsusb | grep -m 1 1209:8886 | awk '{ printf "%s/%s", $2, substr($4,1,3) }') -v .:/build:Z -w /build -it ghcr.io/tillitis/tkey-builder:4 /usr/bin/bash
podman run --rm --device /dev/bus/usb/$(lsusb | grep -m 1 1209:8886 | awk '{ printf "%s/%s", $2, substr($4,1,3) }') -v .:/build:Z -w /build -it ghcr.io/tillitis/tkey-builder /usr/bin/bash
```

### Programming
Expand Down
1 change: 0 additions & 1 deletion hugo/themes/hugo-book-9/layouts/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ <h3>
</main>

{{ partial "docs/inject/body" . }}
{{ template "_internal/google_analytics_async.html" . }}
</body>

</html>
2 changes: 0 additions & 2 deletions hugo/themes/hugo-book-9/layouts/partials/docs/html-head.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
<script defer src="{{ $swJS.RelPermalink }}" integrity="{{ $swJS.Data.Integrity }}"></script>
{{ end -}}

{{- template "_internal/google_analytics_async.html" . -}}

<!-- RSS -->
{{- with .OutputFormats.Get "rss" -}}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
Expand Down