Skip to content

Commit

Permalink
build static qemu for riscv
Browse files Browse the repository at this point in the history
  • Loading branch information
shawn committed Sep 23, 2020
1 parent 9e8ac5e commit 58f9303
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@ RUN ./configure --target-list=riscv32-softmmu,riscv64-softmmu \
&& make install \
&& make clean

# TODO: Build qemu with user mode and we would like it to be statically linked
# DONE: Build qemu with user mode and we would like it to be statically linked
RUN mkdir -p /opt/qemu-riscv-static \
&& ./configure --target-list=riscv32-linux-user,riscv64-linux-user \
--static \
--disable-system \
--enable-linux-user \
--prefix=/opt/qemu-riscv-static \
&& make -j $(nproc) \
&& make install \
&& make clean

# DONE: Clean all pulled and generated files
RUN rm -rf /tmp/riscv-qemu-linux && rm -rf /tmp/riscv-gnu-toolchain

# TODO: Clean all pulled and generated files
WORKDIR /root
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ I was working on a RISC-V ELF CTF challenge. The provided ELF itself was compile
for SiFive and can be emulated by QEMU, e.g., `qemu-system-riscv32 -nographic -machine sifive_e -kernel xxx.elf`.
Of course QEMU can be used as GDB server so I can remote into emulated environment
and trace the execution but my GDB just does not support such architecture. I tried
to tap into RISC-V brew repository, compile their toolchian and perform and quick
to tap into RISC-V brew repository, compile their toolchian and perform a quick
remote debug but it just failed. So I looked into rene-fonseca's [docker version RISC-V
toolchain](https://github.com/rene-fonseca/docker-riscv) and rewrote into my version.

Expand Down

0 comments on commit 58f9303

Please sign in to comment.