diff --git a/Dockerfile b/Dockerfile index 45791ce6..4002b8e8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,12 +31,13 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ ca-certificates \ git \ wget \ + pkg-config \ crossbuild-essential-riscv64 \ gcc-12-riscv64-linux-gnu \ g++-12-riscv64-linux-gnu \ && \ wget -O ${LINUX_HEADERS_FILEPATH} ${LINUX_HEADERS_URLPATH} && \ - echo "efdb2243d9b6828e90c826be0f178110f0cc590cb00e8fa588cb20723126c2a4 ${LINUX_HEADERS_FILEPATH}" | sha256sum --check && \ + echo "4ef81562b1d85220bde9fd4ff01d149469a500f22cc319a02c32bfd1c0698ae1 ${LINUX_HEADERS_FILEPATH}" | sha256sum --check && \ apt-get install -y --no-install-recommends ${LINUX_HEADERS_FILEPATH} && \ adduser developer -u 499 --gecos ",,," --disabled-password && \ mkdir -p ${BUILD_BASE}/tools && chown -R developer:developer ${BUILD_BASE}/tools && \ @@ -80,57 +81,57 @@ RUN make -C ${BUILD_BASE}/tools/sys-utils/libcmt/ -j$(nproc) ioctl.install mock. USER developer RUN make -C ${BUILD_BASE}/tools/sys-utils/ -j$(nproc) all -# build rust tools -# ------------------------------------------------------------------------------ -FROM tools-env as rust-env -ENV PATH="/home/developer/.cargo/bin:${PATH}" - -USER developer - -RUN cd && \ - wget https://github.com/rust-lang/rustup/archive/refs/tags/1.26.0.tar.gz && \ - echo "6f20ff98f2f1dbde6886f8d133fe0d7aed24bc76c670ea1fca18eb33baadd808 1.26.0.tar.gz" | sha256sum --check && \ - tar -xzf 1.26.0.tar.gz && \ - bash rustup-1.26.0/rustup-init.sh \ - -y \ - --default-toolchain 1.74.0 \ - --profile minimal \ - --target riscv64gc-unknown-linux-gnu && \ - rm -rf rustup-1.26.0 1.26.0.tar.gz - -FROM rust-env as rust-builder -COPY --chown=developer:developer rollup-http/rollup-init ${BUILD_BASE}/tools/rollup-http/rollup-init -COPY --chown=developer:developer rollup-http/rollup-http-client ${BUILD_BASE}/tools/rollup-http/rollup-http-client -COPY --chown=developer:developer rollup-http/.cargo ${BUILD_BASE}/tools/rollup-http/.cargo - -# build rollup-http-server dependencies -FROM rust-builder as http-server-dep-builder -COPY --chown=developer:developer rollup-http/rollup-http-server/Cargo.toml rollup-http/rollup-http-server/Cargo.lock ${BUILD_BASE}/tools/rollup-http/rollup-http-server/ -RUN cd ${BUILD_BASE}/tools/rollup-http/rollup-http-server && \ - mkdir src/ && \ - echo "fn main() {}" > src/main.rs && \ - echo "pub fn dummy() {}" > src/lib.rs && \ - cargo build --target riscv64gc-unknown-linux-gnu --release - -# build rollup-http-server -FROM http-server-dep-builder as http-server-builder -COPY --chown=developer:developer rollup-http/rollup-http-server/build.rs ${BUILD_BASE}/tools/rollup-http/rollup-http-server/ -COPY --chown=developer:developer rollup-http/rollup-http-server/src ${BUILD_BASE}/tools/rollup-http/rollup-http-server/src -RUN cd ${BUILD_BASE}/tools/rollup-http/rollup-http-server && touch build.rs src/* && \ - cargo build --target riscv64gc-unknown-linux-gnu --release - -# build echo-dapp dependencies -FROM rust-builder as echo-dapp-dep-builder -COPY --chown=developer:developer rollup-http/echo-dapp/Cargo.toml rollup-http/echo-dapp/Cargo.lock ${BUILD_BASE}/tools/rollup-http/echo-dapp/ -RUN cd ${BUILD_BASE}/tools/rollup-http/echo-dapp && \ - mkdir src/ && echo "fn main() {}" > src/main.rs && \ - cargo build --target riscv64gc-unknown-linux-gnu --release - -# build echo-dapp -FROM echo-dapp-dep-builder as echo-dapp-builder -COPY --chown=developer:developer rollup-http/echo-dapp/src ${BUILD_BASE}/tools/rollup-http/echo-dapp/src -RUN cd ${BUILD_BASE}/tools/rollup-http/echo-dapp && touch src/* && \ - cargo build --target riscv64gc-unknown-linux-gnu --release +## build rust tools +## ------------------------------------------------------------------------------ +#FROM tools-env as rust-env +#ENV PATH="/home/developer/.cargo/bin:${PATH}" +# +#USER developer +# +#RUN cd && \ +# wget https://github.com/rust-lang/rustup/archive/refs/tags/1.26.0.tar.gz && \ +# echo "6f20ff98f2f1dbde6886f8d133fe0d7aed24bc76c670ea1fca18eb33baadd808 1.26.0.tar.gz" | sha256sum --check && \ +# tar -xzf 1.26.0.tar.gz && \ +# bash rustup-1.26.0/rustup-init.sh \ +# -y \ +# --default-toolchain 1.74.0 \ +# --profile minimal \ +# --target riscv64gc-unknown-linux-gnu && \ +# rm -rf rustup-1.26.0 1.26.0.tar.gz +# +#FROM rust-env as rust-builder +#COPY --chown=developer:developer rollup-http/rollup-init ${BUILD_BASE}/tools/rollup-http/rollup-init +#COPY --chown=developer:developer rollup-http/rollup-http-client ${BUILD_BASE}/tools/rollup-http/rollup-http-client +#COPY --chown=developer:developer rollup-http/.cargo ${BUILD_BASE}/tools/rollup-http/.cargo +# +## build rollup-http-server dependencies +#FROM rust-builder as http-server-dep-builder +#COPY --chown=developer:developer rollup-http/rollup-http-server/Cargo.toml rollup-http/rollup-http-server/Cargo.lock ${BUILD_BASE}/tools/rollup-http/rollup-http-server/ +#RUN cd ${BUILD_BASE}/tools/rollup-http/rollup-http-server && \ +# mkdir src/ && \ +# echo "fn main() {}" > src/main.rs && \ +# echo "pub fn dummy() {}" > src/lib.rs && \ +# cargo build --target riscv64gc-unknown-linux-gnu --release +# +## build rollup-http-server +#FROM http-server-dep-builder as http-server-builder +#COPY --chown=developer:developer rollup-http/rollup-http-server/build.rs ${BUILD_BASE}/tools/rollup-http/rollup-http-server/ +#COPY --chown=developer:developer rollup-http/rollup-http-server/src ${BUILD_BASE}/tools/rollup-http/rollup-http-server/src +#RUN cd ${BUILD_BASE}/tools/rollup-http/rollup-http-server && touch build.rs src/* && \ +# cargo build --target riscv64gc-unknown-linux-gnu --release +# +## build echo-dapp dependencies +#FROM rust-builder as echo-dapp-dep-builder +#COPY --chown=developer:developer rollup-http/echo-dapp/Cargo.toml rollup-http/echo-dapp/Cargo.lock ${BUILD_BASE}/tools/rollup-http/echo-dapp/ +#RUN cd ${BUILD_BASE}/tools/rollup-http/echo-dapp && \ +# mkdir src/ && echo "fn main() {}" > src/main.rs && \ +# cargo build --target riscv64gc-unknown-linux-gnu --release +# +## build echo-dapp +#FROM echo-dapp-dep-builder as echo-dapp-builder +#COPY --chown=developer:developer rollup-http/echo-dapp/src ${BUILD_BASE}/tools/rollup-http/echo-dapp/src +#RUN cd ${BUILD_BASE}/tools/rollup-http/echo-dapp && touch src/* && \ +# cargo build --target riscv64gc-unknown-linux-gnu --release # pack tools (deb) # ------------------------------------------------------------------------------ @@ -149,13 +150,12 @@ COPY control ${STAGING_DEBIAN}/control COPY --from=builder ${BUILD_BASE}/tools/sys-utils/cartesi-init/cartesi-init ${STAGING_SBIN} COPY --from=c-builder ${BUILD_BASE}/tools/sys-utils/xhalt/xhalt ${STAGING_SBIN} -COPY --from=c-builder ${BUILD_BASE}/tools/sys-utils/yield/yield ${STAGING_SBIN} COPY --from=c-builder ${BUILD_BASE}/tools/sys-utils/rollup/rollup ${STAGING_SBIN} COPY --from=c-builder ${BUILD_BASE}/tools/sys-utils/ioctl-echo-loop/ioctl-echo-loop ${STAGING_BIN} COPY --from=c-builder ${BUILD_BASE}/tools/sys-utils/misc/* ${STAGING_BIN} -COPY --from=rust-builder ${BUILD_BASE}/tools/rollup-http/rollup-init/rollup-init ${STAGING_SBIN} -COPY --from=http-server-builder ${BUILD_BASE}/tools/rollup-http/rollup-http-server/target/riscv64gc-unknown-linux-gnu/release/rollup-http-server ${STAGING_BIN} -COPY --from=echo-dapp-builder ${BUILD_BASE}/tools/rollup-http/echo-dapp/target/riscv64gc-unknown-linux-gnu/release/echo-dapp ${STAGING_BIN} +#COPY --from=rust-builder ${BUILD_BASE}/tools/rollup-http/rollup-init/rollup-init ${STAGING_SBIN} +#COPY --from=http-server-builder ${BUILD_BASE}/tools/rollup-http/rollup-http-server/target/riscv64gc-unknown-linux-gnu/release/rollup-http-server ${STAGING_BIN} +#COPY --from=echo-dapp-builder ${BUILD_BASE}/tools/rollup-http/echo-dapp/target/riscv64gc-unknown-linux-gnu/release/echo-dapp ${STAGING_BIN} RUN dpkg-deb -Zxz --root-owner-group --build ${STAGING_BASE} ${BUILD_BASE}/${TOOLS_DEB} COPY --from=c-builder ${BUILD_BASE}/${CMT_TAR_GZ} ${BUILD_BASE}/${CMT_TAR_GZ} diff --git a/Makefile b/Makefile index 4923d13b..f188b569 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ MAJOR := 0 MINOR := 14 PATCH := 1 -LABEL := +LABEL :=-dev VERSION := $(MAJOR).$(MINOR).$(PATCH)$(LABEL) TOOLS_DEB := machine-emulator-tools-v$(VERSION).deb @@ -25,7 +25,7 @@ TOOLS_IMAGE := cartesi/machine-emulator-tools:$(VERSION) TOOLS_ROOTFS := rootfs-tools-v$(VERSION).ext2 CMT_TAR_GZ := libcmt-$(VERSION).tar.gz -IMAGE_KERNEL_VERSION ?= v0.19.1 +IMAGE_KERNEL_VERSION ?= v0.20.0-output-unification-rc1 LINUX_VERSION ?= 6.5.9-ctsi-1 LINUX_HEADERS_URLPATH := https://github.com/cartesi/image-kernel/releases/download/${IMAGE_KERNEL_VERSION}/linux-libc-dev-riscv64-cross-${LINUX_VERSION}-${IMAGE_KERNEL_VERSION}.deb diff --git a/sys-utils/Makefile b/sys-utils/Makefile index 327a0549..ed615246 100644 --- a/sys-utils/Makefile +++ b/sys-utils/Makefile @@ -15,7 +15,7 @@ # -UTILITIES := xhalt yield rollup ioctl-echo-loop +UTILITIES := xhalt rollup ioctl-echo-loop UTILITIES_WITH_TOOLCHAIN := $(addsuffix -with-toolchain,$(UTILITIES)) all: $(UTILITIES) diff --git a/sys-utils/ioctl-echo-loop/Makefile b/sys-utils/ioctl-echo-loop/Makefile index b22064f6..6319e654 100644 --- a/sys-utils/ioctl-echo-loop/Makefile +++ b/sys-utils/ioctl-echo-loop/Makefile @@ -29,9 +29,9 @@ RVCOPY = $(TOOLCHAIN_PREFIX)objcopy RVDUMP = $(TOOLCHAIN_PREFIX)objdump STRIP = $(TOOLCHAIN_PREFIX)strip CFLAGS :=-Wall -Wextra -pedantic -O2 \ - `PKG_CONFIG_PATH=$(HOME)/.local/libcmt/lib/pkgconfig pkg-config --cflags libcmt_mock` + `PKG_CONFIG_PATH=/usr/riscv64-linux-gnu/lib/pkgconfig pkg-config --cflags libcmt` LDLIBS := \ - `PKG_CONFIG_PATH=$(HOME)/.local/libcmt/lib/pkgconfig pkg-config --libs libcmt_mock` + `PKG_CONFIG_PATH=/usr/riscv64-linux-gnu/lib/pkgconfig pkg-config --libs libcmt` CONTAINER_MAKE := /usr/bin/make CONTAINER_BASE := /opt/cartesi/tools diff --git a/sys-utils/rollup/Makefile b/sys-utils/rollup/Makefile index 984e7ee3..0b8488ab 100644 --- a/sys-utils/rollup/Makefile +++ b/sys-utils/rollup/Makefile @@ -29,9 +29,9 @@ RVCOPY = $(TOOLCHAIN_PREFIX)objcopy RVDUMP = $(TOOLCHAIN_PREFIX)objdump STRIP = $(TOOLCHAIN_PREFIX)strip CXXFLAGS :=-Wall -Wextra -pedantic -O2 -std=c++17 \ - `PKG_CONFIG_PATH=$(HOME)/dev/libcmt/lib/pkgconfig pkg-config --cflags libcmt_mock` + `PKG_CONFIG_PATH=/usr/riscv64-linux-gnu/lib/pkgconfig pkg-config --cflags libcmt` LDLIBS := \ - `PKG_CONFIG_PATH=$(HOME)/dev/libcmt/lib/pkgconfig pkg-config --libs libcmt_mock` + `PKG_CONFIG_PATH=/usr/riscv64-linux-gnu/lib/pkgconfig pkg-config --libs libcmt` CONTAINER_MAKE := /usr/bin/make CONTAINER_BASE := /opt/cartesi/tools