-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mock: components can be compiled natively: 1. make mock tests ioctl: require the cartesi headers and a riscv compiler: 1. Build or download a compatible kernel and `.deb` headers 2. Setup a cross compilation debian environment by running the setup[1] script. 3. `make ioctl CROSS_COMPILE=riscv64-linux-gnu-` [1] setup.sh ``` apt update && \ DEBIAN_FRONTEND="noninteractive" apt-get install --no-install-recommends --allow-downgrades -y \ bc \ bison \ build-essential \ flex \ genext2fs \ rsync \ gcc-riscv64-linux-gnu \ libc6-dev-riscv64-cross \ ./linux-libc-dev-riscv64-cross-6.5.9-ctsi-1-v0.0.0.deb ```
- Loading branch information
Showing
44 changed files
with
5,886 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
CC := $(CROSS_COMPILE)gcc | ||
AR := $(CROSS_COMPILE)ar | ||
CFLAGS := -O2 -g -Wall -pedantic | ||
|
||
#all: mock tests | ||
#mock: libmock.a $(mock_BINS) | ||
#ioctl: libioctl.a $(ioctl_BINS) | ||
#tests: tests/abi tests/keccak tests/merkle | ||
#tools: tools/merkle-zero-table tools/funsel | ||
|
||
help: | ||
@echo "Cleaning targets:" | ||
@echo " clean - remove the binaries and objects." | ||
@echo " mock - build a reference mock library and examples for running in host mode." | ||
@echo " ioctl - build the actual ioctl library and examples." | ||
@echo " tools - build additional utilities for development." | ||
@echo " with CROSS_COMPILE=" | ||
|
||
mock: libmock.a mock/yield mock/rollup-driver mock/rollup | ||
ioctl: libioctl.a ioctl/yield ioctl/rollup-driver ioctl/rollup | ||
tests: tests/abi tests/keccak tests/merkle | ||
tests/abi | ||
tests/keccak | ||
tests/merkle | ||
|
||
base_SRC := \ | ||
base/buf.c \ | ||
base/abi.c \ | ||
base/keccak.c \ | ||
base/merkle.c \ | ||
base/rollup.c | ||
|
||
libmock_SRC := \ | ||
mock/rollup-driver.c \ | ||
mock/yield-driver.c \ | ||
$(base_SRC) | ||
|
||
libioctl_SRC := \ | ||
ioctl/rollup-driver.c \ | ||
ioctl/yield-driver.c \ | ||
$(base_SRC) | ||
|
||
libmock_OBJDIR := build/libmock/ | ||
libioctl_OBJDIR := build/libioctl/ | ||
|
||
libmock_OBJ := $(patsubst %.c,$(libmock_OBJDIR)%.o,$(libmock_SRC)) | ||
libioctl_OBJ := $(patsubst %.c,$(libioctl_OBJDIR)%.o,$(libioctl_SRC)) | ||
|
||
OBJ := $(libmock_OBJ) $(libioctl_OBJ) | ||
|
||
$(libmock_OBJ): $(libmock_OBJDIR)%.o: %.c | ||
@mkdir -p $(@D) | ||
$(CC) $(CFLAGS) -Imock -MT $@ -MMD -MP -MF $(@:.o=.d) -c -o $@ $< | ||
|
||
$(libioctl_OBJ): $(libioctl_OBJDIR)%.o: %.c | ||
@mkdir -p $(@D) | ||
$(CC) $(CFLAGS) -Iioctl -MT $@ -MMD -MP -MF $(@:.o=.d) -c -o $@ $< | ||
|
||
libmock.a: $(libmock_OBJ) | ||
$(AR) rcs $@ $^ | ||
|
||
libioctl.a: $(libioctl_OBJ) | ||
$(AR) rcs $@ $^ | ||
|
||
ioctl/yield-driver: examples/yield-driver.c libioctl.a | ||
$(CC) $(CFLAGS) -Iioctl -o $@ $^ | ||
ioctl/merkle: examples/merkle.c libmock.a | ||
$(CC) $(CFLAGS) -Iioctl -o $@ $^ | ||
ioctl/rollup-driver: examples/rollup-driver.c libioctl.a | ||
$(CC) $(CFLAGS) -Iioctl -o $@ $^ | ||
|
||
mock/yield-driver: examples/yield-driver.c libmock.a | ||
$(CC) $(CFLAGS) -Imock -o $@ $^ | ||
mock/rollup-driver: examples/rollup-driver.c libmock.a | ||
$(CC) $(CFLAGS) -Imock -o $@ $^ | ||
mock/rollup: examples/rollup.c libmock.a | ||
$(CC) $(CFLAGS) -Imock -o $@ $^ | ||
|
||
tests/abi: tests/abi.c libmock.a | ||
$(CC) $(CFLAGS) -Imock -o $@ $^ | ||
tests/keccak: tests/keccak.c libmock.a | ||
$(CC) $(CFLAGS) -Imock -o $@ $^ | ||
tests/merkle: tests/merkle.c libmock.a | ||
$(CC) $(CFLAGS) -Imock -o $@ $^ | ||
|
||
tools/merkle-zero-table: tools/merkle-zero-table.c base/keccak.o | ||
$(CC) $(CFLAGS) -Imock -o $@ $^ | ||
tools/funsel: tools/funsel.c base/keccak.o | ||
$(CC) $(CFLAGS) -Imock -o $@ $^ | ||
|
||
doc: doc/theme | ||
doxygen doc/Doxyfile | ||
doc/theme: | ||
git clone --depth=1 --branch=v2.2.1 \ | ||
[email protected]:jothepro/doxygen-awesome-css.git $@ | ||
clean: | ||
rm -f libmock.a $(mock_BINS) libioctl.a $(ioctl_BINS) $(OBJ) $(OBJ:%.o=%.d) | ||
rm -rf doc/html | ||
distclean: | ||
rm -rf doc/theme | ||
.PHONY: doc | ||
|
||
-include $(OBJ:%.o=%.d) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Utility functions for rollup interaction. | ||
|
||
- @ref libevm\_rollup | ||
- @ref libevm\_abi | ||
- @ref libevm\_buf | ||
- @ref libevm\_keccak | ||
- @ref libevm\_merkle | ||
|
||
Thin wrappers to the cartesi kernel drivers | ||
|
||
- @ref rollup\_driver | ||
- @ref yield\_driver | ||
|
||
# Getting Started | ||
|
||
Download the static library from [cartesi tools](https://github.com/cartesi/machine-emulator-tools/). |
Oops, something went wrong.