Skip to content

Commit

Permalink
qemu: add Dockerfile.qemu
Browse files Browse the repository at this point in the history
Make it simpler to run the qemu emulator in ci and web modes
  • Loading branch information
jkauffman1 authored and JamieDriver committed Jun 3, 2024
1 parent 335f652 commit 4003a8b
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
28 changes: 28 additions & 0 deletions Dockerfile.qemu
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM blockstream/verde@sha256:d75cbbf0d0af640216be07d202bbb4af3c86c5cc908761a4c0bd897e75b5023a as builder

ARG SDK_CONFIG=configs/sdkconfig_qemu_psram.defaults

WORKDIR /jade

COPY . .
RUN cp ${SDK_CONFIG} sdkconfig.defaults
RUN . /root/esp/esp-idf/export.sh && idf.py all
RUN ./tools/fwprep.py build/jade.bin build

ENV PATH=$PATH:/jade/main/qemu
RUN make-flash-img.sh

FROM debian:bookworm@sha256:1aadfee8d292f64b045adb830f8a58bfacc15789ae5f489a0fedcd517a862cb9

RUN apt-get update -yqq && apt-get install -yqq libpixman-1-dev libglib2.0-dev libslirp-dev libncurses-dev

COPY --from=builder /flash_image.bin /flash_image.bin
COPY --from=builder /qemu_efuse.bin /qemu_efuse.bin

COPY --from=builder /opt/bin/qemu-system-xtensa /opt/bin/qemu-system-xtensa
COPY --from=builder /opt/share/qemu /opt/share/qemu
COPY --from=builder /jade/main/qemu/ /jade/main/qemu/

ENV PATH=$PATH:/jade/main/qemu

CMD [ "qemu_run.sh" ]
5 changes: 5 additions & 0 deletions Dockerfile.qemu.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Dockerfile.qemu
sdkconfig.defaults
sdkconfig
mananged_components
build
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,23 @@ deactivate

# Emulator/Virtualizer (qemu in Docker)

Run these commands inside the jade source repo root directory, it will enter a docker container
The following will build a docker image running the headless ci-test (approves every request):
```
docker build -t jade-qemu-ci -f Dockerfile.qemu .
docker run --rm -p 30121:30121 -it jade-qemu-ci
```
The python 'jadepy' api can talk to it as if it were a serial interface, if given the device string 'tcp:localhost:30121'.
```
python -c "from jadepy.jade import JadeAPI; jade = JadeAPI.create_serial(device='tcp:localhost:30121'); jade.connect(); print(jade.get_version_info()); jade.disconnect()"
```

Similarly, for a manually driven web-enabled 'virtual jade' (at 'http://localhost:30122/'):
```
docker build -t jade-qemu-web -f Dockerfile.qemu --build-arg="SDK_CONFIG=configs/sdkconfig_qemu_psram_webdisplay.defaults" .
docker run --rm -p 30121:30121 -p 30122:30122 -it jade-qemu-web
```

For more 'hands-on' development with qemu, run these commands inside the jade source repo root directory, it will enter a docker container

```
DOCKER_BUILDKIT=1 docker build . -t testjadeqemu
Expand Down

0 comments on commit 4003a8b

Please sign in to comment.