2021-11-16 18:18:52 -07:00
|
|
|
# Stockfish for Cartesi RISC-V Machine Emulator
|
|
|
|
This branch contains patchlets to compile a RISC-V 64-bit build of
|
|
|
|
stockfish to run under the Cartesi machine emulator.
|
|
|
|
|
|
|
|
# Setup Cartesi SDK
|
|
|
|
Build using Cartesi GCC. I just copied them from the docker build
|
|
|
|
and put them in my path (outside of the docker).
|
|
|
|
|
|
|
|
```
|
|
|
|
git clone --recursive https://github.com/cartesi/machine-emulator-sdk
|
|
|
|
```
|
|
|
|
|
|
|
|
You should be able
|
|
|
|
to run this command OK before proceeding:
|
|
|
|
|
|
|
|
```
|
|
|
|
riscv64-cartesi-linux-gnu-gcc
|
|
|
|
```
|
|
|
|
|
|
|
|
# Build
|
|
|
|
Note, the Makefile kludge disables things like "tests".
|
|
|
|
|
2021-11-16 18:38:37 -07:00
|
|
|
Run this to build stockfish binary for riscv64 using Cartesi GCC toolchain:
|
2021-11-16 18:18:52 -07:00
|
|
|
|
|
|
|
```
|
2021-11-16 18:38:37 -07:00
|
|
|
cd src
|
2021-11-16 18:18:52 -07:00
|
|
|
make -j build ARCH=riscv64 COMP=riscv64-cartesi-linux-gnu-gcc COMPCXX=riscv64-cartesi-linux-gnu-g++
|
|
|
|
```
|
|
|
|
|
2021-11-16 18:38:37 -07:00
|
|
|
# Build Disk Images for Cartesi Emulator
|
|
|
|
|
|
|
|
```
|
|
|
|
# Go back to top level directory in this git repo:
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
# Copy newly built stockfish for cartesi disk image:
|
|
|
|
cp -p src/stockfish cartesi/img/stockfish
|
|
|
|
|
|
|
|
# Make 64 megabyte ext2 disk image with stockfish and shell script
|
|
|
|
genext2fs -b 65536 -d cartesi/img cartesi/stockfish.ext2
|
|
|
|
```
|
|
|
|
|
2021-11-16 18:18:52 -07:00
|
|
|
# Run Stockfish in Emulator
|
2021-11-16 18:38:37 -07:00
|
|
|
To run the disk images, using upstream rootfs:
|
|
|
|
|
|
|
|
```
|
|
|
|
# XXX too much memory, but default 64 megs isn't enough.
|
|
|
|
# Lower it & test.
|
|
|
|
|
|
|
|
cartesi-machine \
|
|
|
|
--ram-length=512Mi \
|
|
|
|
--flash-drive=label:stockfish,filename:cartesi/stockfish.ext2 \
|
|
|
|
--flash-drive=label:root,filename:/opt/cartesi/share/images/rootfs.ext2 \
|
|
|
|
-- /mnt/stockfish/stockfish.sh
|
|
|
|
|
|
|
|
```
|
2021-11-16 18:18:52 -07:00
|
|
|
|
|
|
|
# Upstream
|
|
|
|
See:
|
|
|
|
|
|
|
|
* README-upstream.md
|
|
|
|
|
|
|
|
* https://github.com/official-stockfish/Stockfish
|
|
|
|
|
|
|
|
* https://stockfishchess.org/
|
|
|
|
|
|
|
|
# Cartesi
|
|
|
|
See:
|
|
|
|
|
|
|
|
* https://cartesi.io/en/docs/intro/
|
|
|
|
|
|
|
|
* https://github.com/cartesi/machine-emulator/
|
|
|
|
|
|
|
|
# Copying
|
|
|
|
Same as upstream Stockfish, GPL v3.
|
2021-11-16 18:38:37 -07:00
|
|
|
|
|
|
|
# Contact
|
|
|
|
```
|
|
|
|
# y@deepcrayon.fish or jebba in Cartesi/Stockfish discord
|
|
|
|
|
|
|
|
```
|
|
|
|
|