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

Added deb package #67

Merged
merged 6 commits into from
Aug 16, 2023
Merged
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
253 changes: 163 additions & 90 deletions .github/workflows/build.yml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*.swp
*.d
*.clang-tidy
*.deb

build
third-party/cryptopp-CRYPTOPP_7_0_0
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed bug in get\_proto\_access\_log()
- Fixed lint warnings with CLANG 15
- Introduced a workaround for high memory usage when running on QEMU ARM64
- Added deb to release process

### Added

Expand Down
58 changes: 23 additions & 35 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,58 +36,46 @@ COPY third-party third-party
RUN make -j$(nproc) dep

FROM --platform=$TARGETPLATFORM dep-builder as builder
ARG DEB_FILENAME=cartesi-machine.deb

COPY . .
RUN make -j$(nproc) git_commit=$GIT_COMMIT release=$RELEASE coverage=$COVERAGE sanitize=$SANITIZE && \
make -j$(nproc) uarch

FROM --platform=$TARGETPLATFORM builder as installer
FROM --platform=$TARGETPLATFORM builder as debian-packager
RUN make install-uarch debian-package DESTDIR=$PWD/_install

RUN make install
FROM --platform=$TARGETPLATFORM debian-packager as installer
ARG MACHINE_EMULATOR_VERSION=0.0.0
ARG TARGETARCH

# For testing purposes
ENV PATH="/opt/cartesi/bin:${PATH}"
ENV CARTESI_IMAGES_PATH=/opt/cartesi/share/images
ENV CARTESI_TESTS_PATH=/opt/cartesi/share/tests
ENV LUA_PATH_5_4="/opt/cartesi/share/lua/5.4/?.lua;;"
ENV LUA_CPATH_5_4="/opt/cartesi/lib/lua/5.4/?.so;;"
RUN make install-tests
RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt install -y \
./cartesi-machine-v${MACHINE_EMULATOR_VERSION}_${TARGETARCH}.deb \
&& rm -rf /var/lib/apt/lists/*

ENV CARTESI_TESTS_PATH="/usr/share/cartesi-machine/tests"
ENV CARTESI_IMAGES_PATH="/usr/share/cartesi-machine/images"

FROM --platform=$TARGETPLATFORM debian:bookworm-20230725-slim
ARG MACHINE_EMULATOR_VERSION=0.0.0
ARG TARGETARCH

RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt-get install -y \
libboost-coroutine1.74.0 \
libboost-context1.74.0 \
libboost-filesystem1.74.0 \
libreadline8 \
openssl \
libc-ares2 \
zlib1g \
ca-certificates \
libgomp1 \
lua5.4 \
genext2fs \
libb64-0d \
libcrypto++8 \
libgrpc++1.51 \
&& rm -rf /var/lib/apt/lists/*
COPY --from=installer \
/usr/src/emulator/cartesi-machine-v${MACHINE_EMULATOR_VERSION}_${TARGETARCH}.deb \
cartesi-machine.deb
RUN apt-get update && DEBIAN_FRONTEND="noninteractive" apt install -y \
./cartesi-machine.deb \
&& rm -rf /var/lib/apt/lists/* \
&& rm cartesi-machine.deb

RUN addgroup --system --gid 102 cartesi && \
adduser --system --uid 102 --ingroup cartesi --disabled-login --no-create-home --home /nonexistent --gecos "cartesi user" --shell /bin/false cartesi

COPY --from=installer /opt/cartesi /opt/cartesi
COPY --from=installer /usr/local/lib/lua /usr/local/lib/lua
COPY --from=installer /usr/local/share/lua /usr/local/share/lua

ENV PATH="/opt/cartesi/bin:${PATH}"
ENV CARTESI_IMAGES_PATH=/opt/cartesi/share/images
ENV CARTESI_TESTS_PATH=/opt/cartesi/share/tests
ENV LUA_PATH_5_4="/opt/cartesi/share/lua/5.4/?.lua;;"
ENV LUA_CPATH_5_4="/opt/cartesi/lib/lua/5.4/?.so;;"

WORKDIR /opt/cartesi

EXPOSE 5002

USER cartesi

CMD [ "/opt/cartesi/bin/remote-cartesi-machine", "--server-address=0.0.0.0:5002"]
CMD [ "/usr/bin/remote-cartesi-machine", "--server-address=0.0.0.0:5002"]
128 changes: 92 additions & 36 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,44 @@
UNAME:=$(shell uname)

# Install settings
PREFIX= /opt/cartesi
BIN_INSTALL_PATH= $(PREFIX)/bin
LIB_INSTALL_PATH= $(PREFIX)/lib
SHARE_INSTALL_PATH= $(PREFIX)/share
IMAGES_INSTALL_PATH= $(SHARE_INSTALL_PATH)/images
UARCH_INSTALL_PATH= $(SHARE_INSTALL_PATH)/uarch
LUA_INSTALL_CPATH= $(PREFIX)/lib/lua/5.4
LUA_INSTALL_PATH= $(PREFIX)/share/lua/5.4
INC_INSTALL_PATH= $(PREFIX)/include/machine-emulator
ARCH:= $(shell dpkg --print-architecture 2>/dev/null || echo amd64)
PREFIX= /usr
MACHINE_EMULATOR_VERSION:= $(shell make -sC src version)
MACHINE_EMULATOR_SO_VERSION:= $(shell make -sC src so-version)
DEB_FILENAME= cartesi-machine-v$(MACHINE_EMULATOR_VERSION)_$(ARCH).deb
BIN_RUNTIME_PATH= $(PREFIX)/bin
LIB_RUNTIME_PATH= $(PREFIX)/lib
DOC_RUNTIME_PATH= $(PREFIX)/doc/cartesi-machine
SHARE_RUNTIME_PATH= $(PREFIX)/share/cartesi-machine
IMAGES_RUNTIME_PATH= $(SHARE_RUNTIME_PATH)/images
LUA_RUNTIME_CPATH= $(PREFIX)/lib/lua/5.4
LUA_RUNTIME_PATH= $(PREFIX)/share/lua/5.4
INSTALL_PLAT = install-$(UNAME)

LIBCARTESI_Darwin=libcartesi.dylib
LIBCARTESI_Linux=libcartesi.so
LIBCARTESI_PROTOBUF_Darwin=libcartesi_protobuf.dylib
LIBCARTESI_PROTOBUF_Linux=libcartesi_protobuf.so
LIBCARTESI_GRPC_Darwin=libcartesi_grpc.dylib
LIBCARTESI_GRPC_Linux=libcartesi_grpc.so

LIBCARTESI_SO_Darwin:=libcartesi-$(MACHINE_EMULATOR_SO_VERSION).dylib
LIBCARTESI_SO_Linux:=libcartesi-$(MACHINE_EMULATOR_SO_VERSION).so
LIBCARTESI_SO_PROTOBUF_Darwin:=libcartesi_protobuf-$(MACHINE_EMULATOR_SO_VERSION).dylib
LIBCARTESI_SO_PROTOBUF_Linux:=libcartesi_protobuf-$(MACHINE_EMULATOR_SO_VERSION).so
LIBCARTESI_SO_GRPC_Darwin:=libcartesi_grpc-$(MACHINE_EMULATOR_SO_VERSION).dylib
LIBCARTESI_SO_GRPC_Linux:=libcartesi_grpc-$(MACHINE_EMULATOR_SO_VERSION).so

BIN_INSTALL_PATH:= $(DESTDIR)$(BIN_RUNTIME_PATH)
LIB_INSTALL_PATH:= $(DESTDIR)$(LIB_RUNTIME_PATH)
DOC_INSTALL_PATH:= $(DESTDIR)$(DOC_RUNTIME_PATH)
SHARE_INSTALL_PATH:= $(DESTDIR)$(SHARE_RUNTIME_PATH)
IMAGES_INSTALL_PATH:= $(DESTDIR)$(IMAGES_RUNTIME_PATH)
UARCH_INSTALL_PATH:= $(SHARE_INSTALL_PATH)/uarch
LUA_INSTALL_CPATH:= $(DESTDIR)$(LUA_RUNTIME_CPATH)
LUA_INSTALL_PATH:= $(DESTDIR)$(LUA_RUNTIME_PATH)
INC_INSTALL_PATH:= $(DESTDIR)$(PREFIX)/include/cartesi-machine

INSTALL= cp -RP
CHMOD_EXEC= chmod 0755
CHMOD_DATA= chmod 0644
Expand All @@ -42,12 +63,14 @@ STRIP_EXEC= strip -x
DEP_TO_BIN=
DEP_TO_LIB=
EMU_TO_BIN= jsonrpc-remote-cartesi-machine remote-cartesi-machine remote-cartesi-machine-proxy merkle-tree-hash
EMU_TO_LIB= $(LIBCARTESI_$(UNAME)) $(LIBCARTESI_PROTOBUF_$(UNAME)) $(LIBCARTESI_GRPC_$(UNAME))
EMU_LUA_TO_BIN= cartesi-machine-tests.lua cartesi-machine.lua cartesi-machine-stored-hash.lua rollup-memory-range.lua uarch-riscv-tests.lua
EMU_TO_LUA_PATH= cartesi/util.lua cartesi/proof.lua
EMU_TO_LIB= $(LIBCARTESI_SO_$(UNAME)) $(LIBCARTESI_SO_PROTOBUF_$(UNAME)) $(LIBCARTESI_SO_GRPC_$(UNAME))
EMU_LUA_TO_BIN= cartesi-machine.lua cartesi-machine-stored-hash.lua rollup-memory-range.lua
EMU_LUA_TEST_TO_BIN= cartesi-machine-tests.lua uarch-riscv-tests.lua
EMU_TO_LUA_PATH= cartesi/util.lua cartesi/proof.lua cartesi/gdbstub.lua
EMU_TO_LUA_CPATH= cartesi.so
EMU_TO_LUA_CARTESI_CPATH= cartesi/grpc.so cartesi/jsonrpc.so
EMU_TO_INC= pma-defines.h rtc-defines.h
EMU_TO_INC= $(addprefix lib/machine-emulator-defines/,pma-defines.h rtc-defines.h) \
$(addprefix src/,jsonrpc-machine-c-api.h grpc-machine-c-api.h machine-c-api.h machine-c-defines.h machine-c-version.h)
UARCH_TO_SHARE= uarch-ram.bin

# Build settings
Expand All @@ -61,11 +84,11 @@ DEPDIRS := $(addprefix $(DEPDIR)/,mongoose-7.9)
DEPCLEAN := $(addsuffix .clean,$(DEPDIRS))
COREPROTO := lib/grpc-interfaces/core.proto
LUASOCKET_VERSION ?= 5b18e475f38fcf28429b1cc4b17baee3b9793a62
LUA_DEFAULT_PATHS = $(LUA_INSTALL_PATH)/?.lua
LUA_DEFAULT_C_PATHS = $(LUA_INSTALL_CPATH)/?.so

# Docker image tag
TAG ?= devel
DEBIAN_IMG ?= cartesi/machine-emulator:$(TAG).deb

# Docker image platform
BUILD_PLATFORM ?=

Expand Down Expand Up @@ -144,9 +167,11 @@ help:
@echo ' distclean - depclean + profile information and downloads'
@echo 'Docker targets:'
@echo ' build-debian-image - Build the machine-emulator debian based docker image'
@echo ' build-debian-package - BUild the cartesi-machine.deb package from image'
@echo 'Generic targets:'
@echo '* all - build the src/ code. To build from a clean clone, run: make submodules downloads dep all'
@echo ' doc - build the doxygen documentation (requires doxygen to be installed)'
@echo ' copy - copy generated artifacts out of a docker image'
@echo ' uarch - build microarchitecture'
@echo ' uarch-with-linux-env - build microarchitecture using the linux-env docker image'
@echo ' uarch-tests - build and run microarchitecture rv64i instruction tests'
Expand Down Expand Up @@ -174,6 +199,9 @@ grpc: | $(COREPROTO)
hash luacartesi grpc test lint coverage-report check-format format check-format-lua check-lua format-lua:
@eval $$($(MAKE) -s --no-print-directory env); $(MAKE) -C $(SRCDIR) $@

version:
@eval $$($(MAKE) -s --no-print-directory env); $(MAKE) -sC $(SRCDIR) $@

test-%:
@eval $$($(MAKE) -s --no-print-directory env); $(MAKE) -C $(SRCDIR) $@

Expand Down Expand Up @@ -205,7 +233,16 @@ build-linux-env:
docker build $(DOCKER_PLATFORM) --target linux-env -t cartesi/linux-env:$(TAG) -f Dockerfile .

build-debian-image:
docker build $(DOCKER_PLATFORM) --build-arg RELEASE=$(release) --build-arg COVERAGE=$(coverage) --build-arg SANITIZE=$(sanitize) -t cartesi/machine-emulator:$(TAG) -f Dockerfile .
docker build $(DOCKER_PLATFORM) --build-arg RELEASE=$(release) --build-arg COVERAGE=$(coverage) --build-arg SANITIZE=$(sanitize) --build-arg MACHINE_EMULATOR_VERSION=$(MACHINE_EMULATOR_VERSION) -t cartesi/machine-emulator:$(TAG) -f Dockerfile .

build-debian-package:
docker build $(DOCKER_PLATFORM) --target debian-packager --build-arg RELEASE=$(release) --build-arg COVERAGE=$(coverage) --build-arg SANITIZE=$(sanitize) --build-arg MACHINE_EMULATOR_VERSION=$(MACHINE_EMULATOR_VERSION=) -t $(DEBIAN_IMG) -f Dockerfile .

copy:
ID=`docker create $(DOCKER_PLATFORM) $(DEBIAN_IMG)` && \
docker cp $$ID:/usr/src/emulator/$(DEB_FILENAME) . && \
docker cp $$ID:/usr/src/emulator/uarch/uarch-ram.bin . && \
docker rm $$ID

check-linux-env:
@if docker images $(DOCKER_PLATFORM) -q cartesi/linux-env:$(TAG)$(image_name) 2>/dev/null | grep -q .; then \
Expand Down Expand Up @@ -242,43 +279,62 @@ uarch-tests-with-linux-env:
@$(MAKE) linux-env-exec CONTAINER_COMMAND="make uarch-tests"

install-Darwin:
install_name_tool -delete_rpath $(BUILDDIR)/lib -delete_rpath $(SRCDIR) -add_rpath $(LIB_INSTALL_PATH) $(LUA_INSTALL_CPATH)/cartesi.so
install_name_tool -delete_rpath $(BUILDDIR)/lib -delete_rpath $(SRCDIR) -add_rpath $(LIB_INSTALL_PATH) $(LUA_INSTALL_CPATH)/cartesi/grpc.so
install_name_tool -delete_rpath $(BUILDDIR)/lib -delete_rpath $(SRCDIR) -add_rpath $(LIB_INSTALL_PATH) $(LUA_INSTALL_CPATH)/cartesi/jsonrpc.so
install_name_tool -delete_rpath $(BUILDDIR)/lib -delete_rpath $(SRCDIR) -add_rpath $(LIB_RUNTIME_PATH) $(LUA_INSTALL_CPATH)/cartesi.so
install_name_tool -delete_rpath $(BUILDDIR)/lib -delete_rpath $(SRCDIR) -add_rpath $(LIB_RUNTIME_PATH) $(LUA_INSTALL_CPATH)/cartesi/grpc.so
install_name_tool -delete_rpath $(BUILDDIR)/lib -delete_rpath $(SRCDIR) -add_rpath $(LIB_RUNTIME_PATH) $(LUA_INSTALL_CPATH)/cartesi/jsonrpc.so
cd $(BIN_INSTALL_PATH) && \
for x in $(DEP_TO_BIN) $(EMU_TO_BIN); do \
install_name_tool -delete_rpath $(BUILDDIR)/lib -delete_rpath $(SRCDIR) -add_rpath $(LIB_INSTALL_PATH) $$x ;\
install_name_tool -delete_rpath $(BUILDDIR)/lib -delete_rpath $(SRCDIR) -add_rpath $(LIB_RUNTIME_PATH) $$x ;\
done

install-Linux:
cd $(BIN_INSTALL_PATH) && for x in $(DEP_TO_BIN) $(EMU_TO_BIN); do patchelf --set-rpath $(LIB_INSTALL_PATH) $$x ; done
cd $(LIB_INSTALL_PATH) && for x in `find . -maxdepth 1 -type f -name "*.so*"`; do patchelf --set-rpath $(LIB_INSTALL_PATH) $$x ; done
cd $(LUA_INSTALL_CPATH) && for x in `find . -maxdepth 2 -type f -name "*.so"`; do patchelf --set-rpath $(LIB_INSTALL_PATH) $$x ; done

install-emulator: $(BIN_INSTALL_PATH) $(LUA_INSTALL_CPATH)/cartesi $(LUA_INSTALL_PATH)/cartesi $(INC_INSTALL_PATH) $(IMAGES_INSTALL_PATH) $(UARCH_INSTALL_PATH)
cd $(BIN_INSTALL_PATH) && for x in $(DEP_TO_BIN) $(EMU_TO_BIN); do patchelf --set-rpath $(LIB_RUNTIME_PATH) $$x ; done
cd $(LIB_INSTALL_PATH) && for x in `find . -maxdepth 1 -type f -name "*.so*"`; do patchelf --set-rpath $(LIB_RUNTIME_PATH) $$x ; done
cd $(LUA_INSTALL_CPATH) && for x in `find . -maxdepth 2 -type f -name "*.so"`; do patchelf --set-rpath $(LIB_RUNTIME_PATH) $$x ; done

install-tests: install
cd src && $(INSTALL) $(EMU_LUA_TEST_TO_BIN) $(LUA_INSTALL_PATH)
cd src && $(INSTALL) tests/test-merkle-tree-hash tests/test-machine-c-api $(BIN_INSTALL_PATH)
cat tools/template/cartesi-machine-tests.template | sed 's|ARG_LUA_PATH|$(LUA_RUNTIME_PATH)/?.lua|g;s|ARG_LUA_CPATH|$(LUA_RUNTIME_CPATH)/?.so|g;s|ARG_LUA_RUNTIME_PATH|$(LUA_RUNTIME_PATH)|g' > $(BIN_INSTALL_PATH)/cartesi-machine-tests
cat tools/template/uarch-riscv-tests.template | sed 's|ARG_LUA_PATH|$(LUA_RUNTIME_PATH)/?.lua|g;s|ARG_LUA_CPATH|$(LUA_RUNTIME_CPATH)/?.so|g;s|ARG_LUA_RUNTIME_PATH|$(LUA_RUNTIME_PATH)|g' > $(BIN_INSTALL_PATH)/uarch-riscv-tests
cd $(LUA_INSTALL_PATH) && $(CHMOD_DATA) $(EMU_LUA_TEST_TO_BIN)
cd $(BIN_INSTALL_PATH) && $(CHMOD_EXEC) cartesi-machine-tests uarch-riscv-tests
patchelf --set-rpath $(LIB_RUNTIME_PATH) src/tests/test-merkle-tree-hash
patchelf --set-rpath $(LIB_RUNTIME_PATH) src/tests/test-machine-c-api

install-emulator: $(BIN_INSTALL_PATH) $(LIB_INSTALL_PATH) $(LUA_INSTALL_CPATH)/cartesi $(LUA_INSTALL_PATH)/cartesi $(INC_INSTALL_PATH) $(IMAGES_INSTALL_PATH)
cd src && $(INSTALL) $(EMU_TO_BIN) $(BIN_INSTALL_PATH)
cd src && $(INSTALL) $(EMU_TO_LIB) $(LIB_INSTALL_PATH)
cd src && $(INSTALL) $(EMU_LUA_TO_BIN) $(BIN_INSTALL_PATH)
cd src && $(INSTALL) $(EMU_LUA_TO_BIN) $(LUA_INSTALL_PATH)
cd src && $(INSTALL) $(EMU_TO_LUA_CPATH) $(LUA_INSTALL_CPATH)
cd src && $(INSTALL) $(EMU_TO_LUA_CARTESI_CPATH) $(LUA_INSTALL_CPATH)/cartesi
cd src && $(INSTALL) $(EMU_TO_LUA_PATH) $(LUA_INSTALL_PATH)/cartesi
cd uarch && $(INSTALL) $(UARCH_TO_SHARE) $(UARCH_INSTALL_PATH)
cat tools/template/cartesi-machine.template | sed 's|ARG_LUA_PATH|${LUA_DEFAULT_PATHS}|g;s|ARG_LUA_CPATH|${LUA_DEFAULT_C_PATHS}|g;s|ARG_INSTALL_PATH|${IMAGES_INSTALL_PATH}|g;s|ARG_BIN_INSTALL_PATH|${BIN_INSTALL_PATH}|g' > $(BIN_INSTALL_PATH)/cartesi-machine
cat tools/template/cartesi-machine-tests.template | sed 's|ARG_LUA_PATH|${LUA_DEFAULT_PATHS}|g;s|ARG_LUA_CPATH|${LUA_DEFAULT_C_PATHS}|g;s|ARG_BIN_INSTALL_PATH|${BIN_INSTALL_PATH}|g' > $(BIN_INSTALL_PATH)/cartesi-machine-tests
cat tools/template/cartesi-machine-stored-hash.template | sed 's|ARG_LUA_PATH|${LUA_DEFAULT_PATHS}|g;s|ARG_LUA_CPATH|${LUA_DEFAULT_C_PATHS}|g;s|ARG_BIN_INSTALL_PATH|${BIN_INSTALL_PATH}|g' > $(BIN_INSTALL_PATH)/cartesi-machine-stored-hash
cat tools/template/rollup-memory-range.template | sed 's|ARG_LUA_PATH|${LUA_DEFAULT_PATHS}|g;s|ARG_LUA_CPATH|${LUA_DEFAULT_C_PATHS}|g;s|ARG_BIN_INSTALL_PATH|${BIN_INSTALL_PATH}|g' > $(BIN_INSTALL_PATH)/rollup-memory-range
cat tools/template/uarch-riscv-tests.template | sed 's|ARG_LUA_PATH|${LUA_DEFAULT_PATHS}|g;s|ARG_LUA_CPATH|${LUA_DEFAULT_C_PATHS}|g;s|ARG_BIN_INSTALL_PATH|${BIN_INSTALL_PATH}|g' > $(BIN_INSTALL_PATH)/uarch-riscv-tests
cd $(BIN_INSTALL_PATH) && $(CHMOD_EXEC) $(EMU_TO_BIN) cartesi-machine cartesi-machine-tests cartesi-machine-stored-hash rollup-memory-range uarch-riscv-tests
cd $(BIN_INSTALL_PATH) && $(CHMOD_DATA) $(EMU_LUA_TO_BIN)
cd lib/machine-emulator-defines && $(INSTALL) $(EMU_TO_INC) $(INC_INSTALL_PATH)
cat tools/template/cartesi-machine.template | sed 's|ARG_LUA_PATH|$(LUA_RUNTIME_PATH)/?.lua|g;s|ARG_LUA_CPATH|$(LUA_RUNTIME_CPATH)/?.so|g;s|ARG_INSTALL_PATH|$(IMAGES_RUNTIME_PATH)|g;s|ARG_LUA_RUNTIME_PATH|$(LUA_RUNTIME_PATH)|g' > $(BIN_INSTALL_PATH)/cartesi-machine
cat tools/template/cartesi-machine-stored-hash.template | sed 's|ARG_LUA_PATH|$(LUA_RUNTIME_PATH)/?.lua|g;s|ARG_LUA_CPATH|$(LUA_RUNTIME_CPATH)/?.so|g;s|ARG_LUA_RUNTIME_PATH|$(LUA_RUNTIME_PATH)|g' > $(BIN_INSTALL_PATH)/cartesi-machine-stored-hash
cat tools/template/rollup-memory-range.template | sed 's|ARG_LUA_PATH|$(LUA_RUNTIME_PATH)/?.lua|g;s|ARG_LUA_CPATH|$(LUA_RUNTIME_CPATH)/?.so|g;s|ARG_LUA_RUNTIME_PATH|$(LUA_RUNTIME_PATH)|g' > $(BIN_INSTALL_PATH)/rollup-memory-range
cd $(BIN_INSTALL_PATH) && $(CHMOD_EXEC) $(EMU_TO_BIN) cartesi-machine cartesi-machine-stored-hash rollup-memory-range
cd $(LIB_INSTALL_PATH) && ln -sf $(LIBCARTESI_SO_$(UNAME)) $(LIBCARTESI_$(UNAME))
cd $(LIB_INSTALL_PATH) && ln -sf $(LIBCARTESI_SO_PROTOBUF_$(UNAME)) $(LIBCARTESI_PROTOBUF_$(UNAME))
cd $(LIB_INSTALL_PATH) && ln -sf $(LIBCARTESI_SO_GRPC_$(UNAME)) $(LIBCARTESI_GRPC_$(UNAME))
cd $(LUA_INSTALL_PATH) && $(CHMOD_DATA) $(EMU_LUA_TO_BIN)
$(INSTALL) $(EMU_TO_INC) $(INC_INSTALL_PATH)
$(INSTALL) tools/gdb $(SHARE_INSTALL_PATH)/gdb
cd $(LUA_INSTALL_CPATH) && $(CHMOD_EXEC) $(EMU_TO_LUA_CPATH)

install-strip:
install-uarch: install $(UARCH_INSTALL_PATH)
$(INSTALL) uarch/$(UARCH_TO_SHARE) $(UARCH_INSTALL_PATH)

install-strip: install-emulator
cd $(BIN_INSTALL_PATH) && $(STRIP_EXEC) $(EMU_TO_BIN) $(DEP_TO_BIN)
cd $(LIB_INSTALL_PATH) && $(STRIP_EXEC) $(DEP_TO_LIB)
cd $(LUA_INSTALL_CPATH) && $(STRIP_EXEC) *.so

install: install-emulator install-strip $(INSTALL_PLAT)
debian-package: install
mkdir -p $(DESTDIR)/DEBIAN $(DOC_INSTALL_PATH)
$(INSTALL) COPYING $(DOC_INSTALL_PATH)/copyright
cat tools/template/control.template | sed 's|ARG_VERSION|$(MACHINE_EMULATOR_VERSION)|g;s|ARG_ARCH|$(ARCH)|g' > $(DESTDIR)/DEBIAN/control
dpkg-deb -Zxz --root-owner-group --build $(DESTDIR) $(DEB_FILENAME)

.SECONDARY: $(DOWNLOADDIR) $(DEPDIRS) $(COREPROTO)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Cartesi Machine Emulator

The Cartesi Machine Emulator is the reference off-chain implementation of the Cartesi Machine Specification. It's written in C/C++ with POSIX dependencies restricted to the terminal, process, and memory-mapping facilites. It is distributed as a library and scriptable in the Lua programming language.
The Cartesi Machine Emulator is the reference off-chain implementation of the Cartesi Machine Specification. It's written in C/C++ with POSIX dependencies restricted to the terminal, process, and memory-mapping facilities. It is distributed as a library and scriptable in the Lua programming language.

The emulator implements RISC-V's RV64IMASU ISA. The letters after RV specify the extension set. This selection corresponds to a 64-bit machine, Integer arithmetic with Multiplication and division, Atomic operations, as well as the optional Supervisor and User privilege levels. In addition, Cartesi Machines support the Sv48 mode of address translation and memory protection.

Expand Down
Loading