Skip to content
This repository was archived by the owner on Nov 17, 2022. It is now read-only.

Add document on testing RISC-V in qemu #49

Closed
wants to merge 1 commit into from
Closed

Conversation

laanwj
Copy link
Member

@laanwj laanwj commented Jun 11, 2019

(don't know if this is the right place, I usually use gists for things like this, this is an experiment in actually using the docs repo)

@maflcko
Copy link

maflcko commented Jun 11, 2019

An alternative would be to use the https://github.com/bitcoin-core/bitcoin-devwiki/wiki

@laanwj
Copy link
Member Author

laanwj commented Jun 11, 2019

The wiki can be edited by everyone; I considered that, but found that too scary as long as it encourages downloading something.

@maflcko
Copy link

maflcko commented Jun 11, 2019

Good point.

Approach ACK

@fanquake
Copy link
Member

Concept ACK, thanks for writing this up. I will read through shortly, and actually install / test in a day or two.

tar -zxvf qemu-riscv64-libs.tar.gz
```

(TODO: get this files directly from the packages instead of from wumpus' server)
Copy link
Member Author

@laanwj laanwj Jun 11, 2019

Choose a reason for hiding this comment

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

Some distributions might even already have a package that provides these, for cross-architecture. e.g. https://wiki.debian.org/RISC-V mentions:

$ sudo dpkg --add-architecture riscv64
$ sudo apt-get install gcc-riscv64-linux-gnu g++-riscv64-linux-gnu
$ sudo sh -c "cat >/etc/ld.so.conf.d/riscv64-linux-gnu.conf <<EOF
/usr/local/lib/riscv64-linux-gnu
/lib/riscv64-linux-gnu
/usr/lib/riscv64-linux-gnu
/usr/riscv64-linux-gnu/lib/
EOF
"
$ sudo ln -s /usr/riscv64-linux-gnu/lib/ld-linux-riscv64-lp64d.so.1 /lib

I haven't tried this.
The advantage would be that it allows for "does it work on $DISTRO" (e.g. the specific libc libm etc versions) testing.

Copy link
Member

@fanquake fanquake left a comment

Choose a reason for hiding this comment

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

Added a few general comments. Setup and compiling QEMU on debian:buster works as expected. Having issues with shared libraries when running bitcoind, will investigate soon.

Dependencies for debian:

```bash
apt install libglib2.0-dev
Copy link
Member

Choose a reason for hiding this comment

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

I know it's probably assumed, but could add clang, git, make & wget here if testing on a slim/minimal install.

```bash
mkdir -p /usr/gnemul
cd /usr/gnemul
wget https://dev.visucore.com/bitcoin/qemu-riscv64-libs.tar.gz
Copy link
Member

Choose a reason for hiding this comment

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

Whilst we are still downloading from wumpus's server, should we atleast have a sha256sum to check against?

RISC-V shared libraries
------------------------

As bitcoin doesn't distribute fully static executables you need part of the
Copy link
Member

Choose a reason for hiding this comment

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

s/bitcoin/Bitcoin Core


This is efficient for testing because it makes it unnecessary to install a whole VM.

It also makes it possible to control extactly what libraries are available to prevent
Copy link
Member

Choose a reason for hiding this comment

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

nit: s/extactly/exactly

Launching bitcoin
------------------

After this, bitcoin, or the unit tests, can be launched as normal with:
Copy link
Member

Choose a reason for hiding this comment

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

nit: s/bitcoin/bitcoind

libgcc_s.so.1 -> libgcc_s-9-20190503.so.1
libc.so.6 -> libc-2.29.9000.so

To make them available you could download the archive of previous section and do:
Copy link
Member

Choose a reason for hiding this comment

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

nit: s/of/from the

@maflcko
Copy link

maflcko commented Oct 13, 2019

Closing due to inactivity

@maflcko maflcko closed this Oct 13, 2019
@maflcko maflcko deleted the 2019_06_riscv branch October 13, 2019 15:07
@laanwj
Copy link
Member Author

laanwj commented Oct 14, 2019

I'm fine with closing inactive PRs (though in this case a reminder would have been helpful too, I just forgot about this). But why do you delete my branch too?

@laanwj
Copy link
Member Author

laanwj commented Oct 14, 2019

Also there are two older PRs open, which have been inactive for longer, and you didn't close those.

@Sjors
Copy link
Member

Sjors commented Oct 14, 2019

Yeah, please don't delete branches. I recently almost lost a WIP branch that I didn't have on a new computer (though fortunately it was still on Github). It also make it easier for others to take over if the branch is still there. Though weirdly Github still shows the changed files, so nothing is really lost in this case.

@maflcko maflcko restored the 2019_06_riscv branch October 14, 2019 12:54
@maflcko maflcko reopened this Oct 14, 2019
@maflcko
Copy link

maflcko commented Oct 14, 2019

Sorry for closing without warning, reopened for now. (Branches that were in a pull request can be restored on GitHub)


Many distributions don't provide packages for a qemu that supports RISC-V
as upstream support for this has been merged somewhat recently. Here are some steps
to build one from source.
Copy link

Choose a reason for hiding this comment

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

It is available on cosmic and newer, right?

@laanwj
Copy link
Member Author

laanwj commented Aug 2, 2020

I don't have motivation to work on this anymore, so closing. Anyone interested in picking this up, feel free.

@laanwj laanwj closed this Aug 2, 2020
@maflcko maflcko deleted the 2019_06_riscv branch January 5, 2022 18:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants