From 73e22baca51672adc98da9a8e8cbd37afe59abd1 Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Tue, 22 Oct 2024 17:52:08 -0300 Subject: [PATCH 1/3] refactor: remove references to cartesi/toolchain --- fs/Dockerfile | 2 +- sys-utils/Makefile | 10 +---- sys-utils/hex/Makefile | 63 ++++------------------------ sys-utils/hex/README.md | 41 ------------------ sys-utils/ioctl-echo-loop/Makefile | 67 +++++------------------------- sys-utils/rollup/Makefile | 67 +++++------------------------- sys-utils/xhalt/.gitignore | 2 - sys-utils/xhalt/Makefile | 63 ++++------------------------ sys-utils/xhalt/README.md | 41 ------------------ sys-utils/yield/.gitignore | 2 - sys-utils/yield/Makefile | 67 +++++------------------------- sys-utils/yield/README.md | 41 ------------------ 12 files changed, 48 insertions(+), 418 deletions(-) delete mode 100644 sys-utils/hex/README.md delete mode 100644 sys-utils/xhalt/.gitignore delete mode 100644 sys-utils/xhalt/README.md delete mode 100644 sys-utils/yield/.gitignore delete mode 100644 sys-utils/yield/README.md diff --git a/fs/Dockerfile b/fs/Dockerfile index 06f39b6e..ae3fb6b2 100644 --- a/fs/Dockerfile +++ b/fs/Dockerfile @@ -1,5 +1,5 @@ # Final image -FROM --platform=linux/riscv64 ubuntu:22.04 +FROM ubuntu:22.04 ARG TOOLS_DEB=machine-emulator-tools-v0.16.2.deb ADD ${TOOLS_DEB} /tmp/ RUN apt-get update && \ diff --git a/sys-utils/Makefile b/sys-utils/Makefile index 311fc3e6..aa0c1035 100644 --- a/sys-utils/Makefile +++ b/sys-utils/Makefile @@ -16,21 +16,13 @@ UTILITIES := hex xhalt yield rollup ioctl-echo-loop -UTILITIES_WITH_TOOLCHAIN := $(addsuffix -with-toolchain,$(UTILITIES)) all: $(UTILITIES) $(UTILITIES): @$(MAKE) -C $@ -with-toolchain: - @$(MAKE) $(UTILITIES_WITH_TOOLCHAIN) - -$(UTILITIES_WITH_TOOLCHAIN): - @$(MAKE) -C $@ with-toolchain - clean: @$(foreach utility,$(UTILITIES),$(MAKE) -C $(utility) clean;) - -.PHONY: all with-toolchain $(UTILITIES) $(UTILITIES_WITH_TOOLCHAIN) +.PHONY: all $(UTILITIES) diff --git a/sys-utils/hex/Makefile b/sys-utils/hex/Makefile index 6603d725..8158df9d 100644 --- a/sys-utils/hex/Makefile +++ b/sys-utils/hex/Makefile @@ -14,65 +14,18 @@ # limitations under the License. # -UNAME:=$(shell uname) +TOOLCHAIN_PREFIX ?= riscv64-linux-gnu- -TOOLCHAIN_IMAGE ?= cartesi/toolchain -TOOLCHAIN_TAG ?= 0.16.0 -RISCV_ARCH ?= rv64gc -RISCV_ABI ?= lp64d - -TOOLCHAIN_PREFIX ?= riscv64-cartesi-linux-gnu- - -RVCC = $(TOOLCHAIN_PREFIX)gcc -RVCXX = $(TOOLCHAIN_PREFIX)g++ -RVCOPY = $(TOOLCHAIN_PREFIX)objcopy -RVDUMP = $(TOOLCHAIN_PREFIX)objdump -STRIP = $(TOOLCHAIN_PREFIX)strip -RISCV_CFLAGS :=-march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) - -CONTAINER_MAKE := /usr/bin/make -CONTAINER_BASE := /opt/cartesi/tools -KERNEL_HEADERS_PATH := /opt/riscv/usr/include +CXX = $(TOOLCHAIN_PREFIX)g++ +STRIP = $(TOOLCHAIN_PREFIX)strip +CXXFLAGS = -Wall -Wextra -pedantic -O2 -std=c++20 +LDFLAGS = all: hex -hex.with-toolchain with-toolchain: - $(MAKE) toolchain-exec CONTAINER_COMMAND="$(CONTAINER_MAKE) $@.toolchain" - -extra.ext2.with-toolchain: - $(MAKE) toolchain-exec CONTAINER_COMMAND="$(CONTAINER_MAKE) $@.toolchain" - hex: hex.cpp - $(RVCXX) -O2 -o hex hex.cpp - $(STRIP) hex - -extra.ext2: hex - mkdir -m 0755 ./extra - cp ./hex ./extra/hex - xgenext2fs -i 512 -b 8192 -d extra $(basename $@) - rm -rf ./extra - -toolchain-exec: - @docker run --hostname $@ --rm \ - -e USER=$$(id -u -n) \ - -e GROUP=$$(id -g -n) \ - -e UID=$$(id -u) \ - -e GID=$$(id -g) \ - -v `pwd`:$(CONTAINER_BASE) \ - -w $(CONTAINER_BASE) \ - $(TOOLCHAIN_IMAGE):$(TOOLCHAIN_TAG) $(CONTAINER_COMMAND) - -toolchain-env: - @docker run --hostname toolchain-env -it --rm \ - -e USER=$$(id -u -n) \ - -e GROUP=$$(id -g -n) \ - -e UID=$$(id -u) \ - -e GID=$$(id -g) \ - -v `pwd`:$(CONTAINER_BASE) \ - -w $(CONTAINER_BASE) \ - $(TOOLCHAIN_IMAGE):$(TOOLCHAIN_TAG) + $(CXX) $(CFLAGS) -o $@ $< $(LDFLAGS) + $(STRIP) $@ clean: - @rm -rf hex extra.ext2 extra - -.PHONY: toolchain-exec toolchain-env + @rm -rf hex diff --git a/sys-utils/hex/README.md b/sys-utils/hex/README.md deleted file mode 100644 index 318db161..00000000 --- a/sys-utils/hex/README.md +++ /dev/null @@ -1,41 +0,0 @@ -## hex encode/decode tool - -### Requirements - -- Docker >= 18.x -- GNU Make >= 3.81 - -### Building - -```bash -$ cd sys-utils/hex -$ make -``` - -#### Makefile targets - -The following options are available as `make` targets: - -- **all**: builds the RISC-V hex executable -- **extra.ext2**: builds the extra.ext2 filesystem image with the hex tool inside -- **toolchain-env**: runs the toolchain image with current user UID and GID -- **clean**: clean generated artifacts - -#### Makefile container options - -You can pass the following variables to the make target if you wish to use different docker image tags. - -- TOOLCHAIN\_IMAGE: toolchain image name -- TOOLCHAIN\_TAG: toolchain image tag - -``` -$ make TOOLCHAIN_TAG=mytag -``` - -It's useful when you want to use prebuilt images like `cartesi/toolchain:latest` - -#### Usage - -The purpose of the hex tool please see the emulator documentation. - -The purpose of the `extra.ext2` image is to help the development creating a filesystem that contains the hex tool so it can be used with the emulator. For instructions on how to do that, please see the emulator documentation. diff --git a/sys-utils/ioctl-echo-loop/Makefile b/sys-utils/ioctl-echo-loop/Makefile index 7f03a8ca..b093757f 100644 --- a/sys-utils/ioctl-echo-loop/Makefile +++ b/sys-utils/ioctl-echo-loop/Makefile @@ -14,67 +14,20 @@ # limitations under the License. # -UNAME:=$(shell uname) +TOOLCHAIN_PREFIX ?= riscv64-linux-gnu- +PKG_CONFIG_PATH = /usr/riscv64-linux-gnu/lib/pkgconfig +export PKG_CONFIG_PATH -TOOLCHAIN_IMAGE ?= cartesi/toolchain -TOOLCHAIN_TAG ?= 0.16.0 -RISCV_ARCH ?= rv64gc -RISCV_ABI ?= lp64d - -TOOLCHAIN_PREFIX ?= riscv64-cartesi-linux-gnu- - -RVCC = $(TOOLCHAIN_PREFIX)gcc -RVCXX = $(TOOLCHAIN_PREFIX)g++ -RVCOPY = $(TOOLCHAIN_PREFIX)objcopy -RVDUMP = $(TOOLCHAIN_PREFIX)objdump -STRIP = $(TOOLCHAIN_PREFIX)strip -CFLAGS +=-Wall -Wextra -pedantic -O2 `pkg-config --cflags libcmt` -LDLIBS += `pkg-config --libs libcmt` - -CONTAINER_MAKE := /usr/bin/make -CONTAINER_BASE := /opt/cartesi/tools -KERNEL_HEADERS_PATH := /opt/riscv/usr/include +CC = $(TOOLCHAIN_PREFIX)gcc +STRIP = $(TOOLCHAIN_PREFIX)strip +CFLAGS = -Wall -Wextra -pedantic -O2 `pkg-config --cflags libcmt` +LDFLAGS = `pkg-config --libs libcmt` all: ioctl-echo-loop -ioctl-echo-loop.with-toolchain with-toolchain: - $(MAKE) toolchain-exec CONTAINER_COMMAND="$(CONTAINER_MAKE) $@.toolchain" - -extra.ext2.with-toolchain: - $(MAKE) toolchain-exec CONTAINER_COMMAND="$(CONTAINER_MAKE) $@.toolchain" - -ioctl-echo-loop: export PKG_CONFIG_PATH ?= /usr/riscv64-linux-gnu/lib/pkgconfig ioctl-echo-loop: ioctl-echo-loop.c - $(RVCC) $(CFLAGS) -o ioctl-echo-loop ioctl-echo-loop.c $(LDLIBS) - $(STRIP) ioctl-echo-loop - -extra.ext2: ioctl-echo-loop - mkdir -m 0755 ./extra - cp ./ioctl-echo-loop ./extra/ioctl-echo-loop - xgenext2fs -i 512 -b 8192 -d extra $(basename $@) - rm -rf ./extra - -toolchain-exec: - @docker run --hostname $@ --rm \ - -e USER=$$(id -u -n) \ - -e GROUP=$$(id -g -n) \ - -e UID=$$(id -u) \ - -e GID=$$(id -g) \ - -v `pwd`:$(CONTAINER_BASE) \ - -w $(CONTAINER_BASE) \ - $(TOOLCHAIN_IMAGE):$(TOOLCHAIN_TAG) $(CONTAINER_COMMAND) - -toolchain-env: - @docker run --hostname toolchain-env -it --rm \ - -e USER=$$(id -u -n) \ - -e GROUP=$$(id -g -n) \ - -e UID=$$(id -u) \ - -e GID=$$(id -g) \ - -v `pwd`:$(CONTAINER_BASE) \ - -w $(CONTAINER_BASE) \ - $(TOOLCHAIN_IMAGE):$(TOOLCHAIN_TAG) + $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) + $(STRIP) $@ clean: - @rm -rf ioctl-echo-loop extra.ext2 extra - -.PHONY: toolchain-exec toolchain-env + @rm -f ioctl-echo-loop diff --git a/sys-utils/rollup/Makefile b/sys-utils/rollup/Makefile index bc9fe3f8..aa0f72e7 100644 --- a/sys-utils/rollup/Makefile +++ b/sys-utils/rollup/Makefile @@ -14,67 +14,20 @@ # limitations under the License. # -UNAME:=$(shell uname) +TOOLCHAIN_PREFIX ?= riscv64-linux-gnu- +PKG_CONFIG_PATH ?= /usr/riscv64-linux-gnu/lib/pkgconfig +export PKG_CONFIG_PATH -TOOLCHAIN_IMAGE ?= cartesi/toolchain -TOOLCHAIN_TAG ?= 0.16.0 -RISCV_ARCH ?= rv64gc -RISCV_ABI ?= lp64d - -TOOLCHAIN_PREFIX ?= riscv64-cartesi-linux-gnu- - -RVCC = $(TOOLCHAIN_PREFIX)gcc -RVCXX = $(TOOLCHAIN_PREFIX)g++ -RVCOPY = $(TOOLCHAIN_PREFIX)objcopy -RVDUMP = $(TOOLCHAIN_PREFIX)objdump -STRIP = $(TOOLCHAIN_PREFIX)strip -CXXFLAGS := -Wall -Wextra -pedantic -O2 -std=c++20 `pkg-config --cflags libcmt` -LDLIBS := `pkg-config --libs libcmt` - -CONTAINER_MAKE := /usr/bin/make -CONTAINER_BASE := /opt/cartesi/tools -KERNEL_HEADERS_PATH := /opt/riscv/usr/include +CXX = $(TOOLCHAIN_PREFIX)g++ +STRIP = $(TOOLCHAIN_PREFIX)strip +CXXFLAGS = -Wall -Wextra -pedantic -O2 -std=c++20 `pkg-config --cflags libcmt` +LDFLAGS = `pkg-config --libs libcmt` all: rollup -rollup.with-toolchain with-toolchain: - $(MAKE) toolchain-exec CONTAINER_COMMAND="$(CONTAINER_MAKE) $@.toolchain" - -extra.ext2.with-toolchain: - $(MAKE) toolchain-exec CONTAINER_COMMAND="$(CONTAINER_MAKE) $@.toolchain" - -rollup: export PKG_CONFIG_PATH ?= /usr/riscv64-linux-gnu/lib/pkgconfig rollup: rollup.cpp - $(RVCXX) $(CXXFLAGS) -O2 -o rollup rollup.cpp $(LDLIBS) - $(STRIP) rollup - -extra.ext2: rollup - mkdir -m 0755 ./extra - cp ./rollup ./extra/rollup - xgenext2fs -i 512 -b 8192 -d extra $(basename $@) - rm -rf ./extra - -toolchain-exec: - @docker run --hostname $@ --rm \ - -e USER=$$(id -u -n) \ - -e GROUP=$$(id -g -n) \ - -e UID=$$(id -u) \ - -e GID=$$(id -g) \ - -v `pwd`:$(CONTAINER_BASE) \ - -w $(CONTAINER_BASE) \ - $(TOOLCHAIN_IMAGE):$(TOOLCHAIN_TAG) $(CONTAINER_COMMAND) - -toolchain-env: - @docker run --hostname toolchain-env -it --rm \ - -e USER=$$(id -u -n) \ - -e GROUP=$$(id -g -n) \ - -e UID=$$(id -u) \ - -e GID=$$(id -g) \ - -v `pwd`:$(CONTAINER_BASE) \ - -w $(CONTAINER_BASE) \ - $(TOOLCHAIN_IMAGE):$(TOOLCHAIN_TAG) + $(CXX) $(CXXFLAGS) -o $@ $< $(LDFLAGS) + $(STRIP) $@ clean: - @rm -rf rollup extra.ext2 extra - -.PHONY: toolchain-exec toolchain-env + @rm -f rollup diff --git a/sys-utils/xhalt/.gitignore b/sys-utils/xhalt/.gitignore deleted file mode 100644 index 99593ec3..00000000 --- a/sys-utils/xhalt/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -extra/halt -halt diff --git a/sys-utils/xhalt/Makefile b/sys-utils/xhalt/Makefile index d416378d..81ba3889 100644 --- a/sys-utils/xhalt/Makefile +++ b/sys-utils/xhalt/Makefile @@ -14,65 +14,18 @@ # limitations under the License. # -UNAME:=$(shell uname) +TOOLCHAIN_PREFIX ?= riscv64-linux-gnu- -TOOLCHAIN_IMAGE ?= cartesi/toolchain -TOOLCHAIN_TAG ?= 0.16.0 -RISCV_ARCH ?= rv64gc -RISCV_ABI ?= lp64d - -TOOLCHAIN_PREFIX ?= riscv64-cartesi-linux-gnu- - -RVCC = $(TOOLCHAIN_PREFIX)gcc -RVCXX = $(TOOLCHAIN_PREFIX)g++ -RVCOPY = $(TOOLCHAIN_PREFIX)objcopy -RVDUMP = $(TOOLCHAIN_PREFIX)objdump -STRIP = $(TOOLCHAIN_PREFIX)strip -RISCV_CFLAGS :=-march=$(RISCV_ARCH) -mabi=$(RISCV_ABI) - -CONTAINER_MAKE := /usr/bin/make -CONTAINER_BASE := /opt/cartesi/tools -KERNEL_HEADERS_PATH := /opt/riscv/usr/include +CC = $(TOOLCHAIN_PREFIX)gcc +STRIP = $(TOOLCHAIN_PREFIX)strip +CFLAGS = -Wall -Wextra -pedantic -O2 +LDFLAGS = all: xhalt -xhalt.with-toolchain with-toolchain: - $(MAKE) toolchain-exec CONTAINER_COMMAND="$(CONTAINER_MAKE) $@.toolchain" - -extra.ext2.with-toolchain: - $(MAKE) toolchain-exec CONTAINER_COMMAND="$(CONTAINER_MAKE) $@.toolchain" - xhalt: xhalt.c - $(RVCC) -O2 -o xhalt xhalt.c - $(STRIP) xhalt - -extra.ext2: xhalt - mkdir -m 0755 ./extra - cp ./xhalt ./extra/xhalt - xgenext2fs -i 512 -b 8192 -d extra $(basename $@) - rm -rf ./extra - -toolchain-exec: - @docker run --hostname $@ --rm \ - -e USER=$$(id -u -n) \ - -e GROUP=$$(id -g -n) \ - -e UID=$$(id -u) \ - -e GID=$$(id -g) \ - -v `pwd`:$(CONTAINER_BASE) \ - -w $(CONTAINER_BASE) \ - $(TOOLCHAIN_IMAGE):$(TOOLCHAIN_TAG) $(CONTAINER_COMMAND) - -toolchain-env: - @docker run --hostname toolchain-env -it --rm \ - -e USER=$$(id -u -n) \ - -e GROUP=$$(id -g -n) \ - -e UID=$$(id -u) \ - -e GID=$$(id -g) \ - -v `pwd`:$(CONTAINER_BASE) \ - -w $(CONTAINER_BASE) \ - $(TOOLCHAIN_IMAGE):$(TOOLCHAIN_TAG) + $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) + $(STRIP) $@ clean: - @rm -rf xhalt extra.ext2 extra - -.PHONY: toolchain-exec toolchain-env + @rm -f xhalt diff --git a/sys-utils/xhalt/README.md b/sys-utils/xhalt/README.md deleted file mode 100644 index 16a33a71..00000000 --- a/sys-utils/xhalt/README.md +++ /dev/null @@ -1,41 +0,0 @@ -## HTIF xhalt tool - -### Requirements - -- Docker >= 18.x -- GNU Make >= 3.81 - -### Building - -```bash -$ cd linux/htif -$ make -``` - -#### Makefile targets - -The following options are available as `make` targets: - -- **all**: builds the RISC-V xhalt executable -- **extra.ext2**: builds the extra.ext2 filesystem image with the xhalt tool inside -- **toolchain-env**: runs the toolchain image with current user UID and GID -- **clean**: clean generated artifacts - -#### Makefile container options - -You can pass the following variables to the make target if you wish to use different docker image tags. - -- TOOLCHAIN\_IMAGE: toolchain image name -- TOOLCHAIN\_TAG: toolchain image tag - -``` -$ make TOOLCHAIN_TAG=mytag -``` - -It's useful when you want to use prebuilt images like `cartesi/toolchain:latest` - -#### Usage - -The purpose of the xhalt tool please see the emulator documentation. - -The purpose of the `extra.ext2` image is to help the development creating a filesystem that contains the xhalt tool so it can be used with the emulator. For instructions on how to do that, please see the emulator documentation. diff --git a/sys-utils/yield/.gitignore b/sys-utils/yield/.gitignore deleted file mode 100644 index 99593ec3..00000000 --- a/sys-utils/yield/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -extra/halt -halt diff --git a/sys-utils/yield/Makefile b/sys-utils/yield/Makefile index f9eb5f21..951f63b5 100644 --- a/sys-utils/yield/Makefile +++ b/sys-utils/yield/Makefile @@ -14,67 +14,20 @@ # limitations under the License. # -UNAME:=$(shell uname) +TOOLCHAIN_PREFIX ?= riscv64-linux-gnu- +PKG_CONFIG_PATH ?= /usr/riscv64-linux-gnu/lib/pkgconfig +export PKG_CONFIG_PATH -TOOLCHAIN_IMAGE ?= cartesi/toolchain -TOOLCHAIN_TAG ?= 0.16.0 -RISCV_ARCH ?= rv64gc -RISCV_ABI ?= lp64d - -TOOLCHAIN_PREFIX ?= riscv64-cartesi-linux-gnu- - -RVCC = $(TOOLCHAIN_PREFIX)gcc -RVCXX = $(TOOLCHAIN_PREFIX)g++ -RVCOPY = $(TOOLCHAIN_PREFIX)objcopy -RVDUMP = $(TOOLCHAIN_PREFIX)objdump -STRIP = $(TOOLCHAIN_PREFIX)strip -CFLAGS :=-Wall -Wextra -pedantic -O2 `pkg-config --cflags libcmt` -LDLIBS := `pkg-config --libs libcmt` - -CONTAINER_MAKE := /usr/bin/make -CONTAINER_BASE := /opt/cartesi/tools -KERNEL_HEADERS_PATH := /opt/riscv/usr/include +CC = $(TOOLCHAIN_PREFIX)gcc +STRIP = $(TOOLCHAIN_PREFIX)strip +CFLAGS = -Wall -Wextra -pedantic -O2 `pkg-config --cflags libcmt` +LDFLAGS = `pkg-config --libs libcmt` all: yield -yield.with-toolchain with-toolchain: - $(MAKE) toolchain-exec CONTAINER_COMMAND="$(CONTAINER_MAKE) $@.toolchain" - -extra.ext2.with-toolchain: - $(MAKE) toolchain-exec CONTAINER_COMMAND="$(CONTAINER_MAKE) $@.toolchain" - -yield: export PKG_CONFIG_PATH ?= /usr/riscv64-linux-gnu/lib/pkgconfig yield: yield.c - $(RVCC) $(CFLAGS) -O2 -o yield yield.c $(LDLIBS) - $(STRIP) yield - -extra.ext2: yield - mkdir -m 0755 ./extra - cp ./yield ./extra/yield - xgenext2fs -i 512 -b 8192 -d extra $(basename $@) - rm -rf ./extra - -toolchain-exec: - @docker run --hostname $@ --rm \ - -e USER=$$(id -u -n) \ - -e GROUP=$$(id -g -n) \ - -e UID=$$(id -u) \ - -e GID=$$(id -g) \ - -v `pwd`:$(CONTAINER_BASE) \ - -w $(CONTAINER_BASE) \ - $(TOOLCHAIN_IMAGE):$(TOOLCHAIN_TAG) $(CONTAINER_COMMAND) - -toolchain-env: - @docker run --hostname toolchain-env -it --rm \ - -e USER=$$(id -u -n) \ - -e GROUP=$$(id -g -n) \ - -e UID=$$(id -u) \ - -e GID=$$(id -g) \ - -v `pwd`:$(CONTAINER_BASE) \ - -w $(CONTAINER_BASE) \ - $(TOOLCHAIN_IMAGE):$(TOOLCHAIN_TAG) + $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) + $(STRIP) $@ clean: - @rm -rf yield extra.ext2 extra - -.PHONY: toolchain-exec toolchain-env + @rm -f yield diff --git a/sys-utils/yield/README.md b/sys-utils/yield/README.md deleted file mode 100644 index b656be16..00000000 --- a/sys-utils/yield/README.md +++ /dev/null @@ -1,41 +0,0 @@ -## HTIF yield tool - -### Requirements - -- Docker >= 18.x -- GNU Make >= 3.81 - -### Building - -```bash -$ cd linux/htif -$ make -``` - -#### Makefile targets - -The following options are available as `make` targets: - -- **all**: builds the RISC-V yield executable -- **extra.ext2**: builds the extra.ext2 filesystem image with the yield tool inside -- **toolchain-env**: runs the toolchain image with current user UID and GID -- **clean**: clean generated artifacts - -#### Makefile container options - -You can pass the following variables to the make target if you wish to use different docker image tags. - -- TOOLCHAIN\_IMAGE: toolchain image name -- TOOLCHAIN\_TAG: toolchain image tag - -``` -$ make TOOLCHAIN_TAG=mytag -``` - -It's useful when you want to use prebuilt images like `cartesi/toolchain:latest` - -#### Usage - -The purpose of the yield tool please see the emulator documentation. - -The purpose of the `extra.ext2` image is to help the development creating a filesystem that contains the yield tool so it can be used with the emulator. For instructions on how to do that, please see the emulator documentation. From de6d42a33045058c86da1b028a5df7d7fc144df0 Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Tue, 22 Oct 2024 18:10:03 -0300 Subject: [PATCH 2/3] feat: bump to Ubuntu 24.04 --- Dockerfile | 24 +++++++----------------- Makefile | 2 +- fs/Dockerfile | 29 +++++++++++++++-------------- rollup-http/.cargo/config.toml | 2 +- 4 files changed, 24 insertions(+), 33 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4cf117d1..b9513135 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ # limitations under the License. # -FROM ubuntu:22.04 AS tools-env +FROM ubuntu:24.04 AS tools-env ARG IMAGE_KERNEL_VERSION=v0.20.0 ARG LINUX_VERSION=6.5.13-ctsi-1 ARG 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 @@ -32,38 +32,28 @@ apt-get update apt-get upgrade -y apt-get install -y --no-install-recommends \ dpkg-dev \ - g++-12 \ - gcc-12 \ + g++ \ + gcc \ make \ ca-certificates \ git \ wget \ + adduser \ libclang-dev \ pkg-config \ dpkg-cross \ - gcc-12-riscv64-linux-gnu \ - g++-12-riscv64-linux-gnu - -for tool in cpp g++ gcc gcc-ar gcc-nm gcc-ranlib gcov gcov-dump gcov-tool; do - update-alternatives --install /usr/bin/riscv64-linux-gnu-$tool riscv64-linux-gnu-$tool /usr/bin/riscv64-linux-gnu-$tool-12 12 - update-alternatives --install /usr/bin/$tool $tool /usr/bin/$tool-12 12 -done -update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-12 12 + gcc-riscv64-linux-gnu \ + g++-riscv64-linux-gnu wget -O ${LINUX_HEADERS_FILEPATH} ${LINUX_HEADERS_URLPATH} echo "2723435e8b45d8fb7a79e9344f6dc517b3dbc08e03ac17baab311300ec475c08 ${LINUX_HEADERS_FILEPATH}" | sha256sum --check -apt-get install -y --no-install-recommends ${LINUX_HEADERS_FILEPATH} +apt-get install -y --no-install-recommends --allow-downgrades ${LINUX_HEADERS_FILEPATH} adduser developer -u 499 --gecos ",,," --disabled-password mkdir -p ${BUILD_BASE}/tools && chown -R developer:developer ${BUILD_BASE}/tools rm -rf /var/lib/apt/lists/* ${LINUX_HEADERS_FILEPATH} EOF -ENV RISCV_ARCH="rv64gc" -ENV RISCV_ABI="lp64d" -ENV CFLAGS="-march=$RISCV_ARCH -mabi=$RISCV_ABI" -ENV TOOLCHAIN_PREFIX="riscv64-linux-gnu-" - FROM tools-env AS builder COPY --chown=developer:developer sys-utils/ ${BUILD_BASE}/tools/sys-utils/ diff --git a/Makefile b/Makefile index 1d157a00..171b5a0b 100644 --- a/Makefile +++ b/Makefile @@ -62,7 +62,7 @@ $(TOOLS_ROOTFS): $(TOOLS_DEB) --output type=tar,dest=rootfs.tar \ --file fs/Dockerfile \ . && \ - xgenext2fs -fzB 4096 -b 25600 -i 4096 -a rootfs.tar -L rootfs $(TOOLS_ROOTFS) && \ + xgenext2fs -fzB 4096 -i 4096 -r +4096 -a rootfs.tar -L rootfs $(TOOLS_ROOTFS) && \ rm -f rootfs.tar fs-license: diff --git a/fs/Dockerfile b/fs/Dockerfile index ae3fb6b2..946cad7f 100644 --- a/fs/Dockerfile +++ b/fs/Dockerfile @@ -1,22 +1,23 @@ # Final image -FROM ubuntu:22.04 +FROM ubuntu:24.04 ARG TOOLS_DEB=machine-emulator-tools-v0.16.2.deb ADD ${TOOLS_DEB} /tmp/ RUN apt-get update && \ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ - busybox-static=1:1.30.1-7ubuntu3 \ - coreutils=8.32-4.1ubuntu1.2 \ - bash=5.1-6ubuntu1.1 \ - psmisc=23.4-2build3 \ - bc=1.07.1-3build1 \ - curl=7.81.0-1ubuntu1.18 \ - device-tree-compiler=1.6.1-1 \ - jq=1.6-2.1ubuntu3 \ - lua5.4=5.4.4-1 \ - lua-socket=3.0~rc1+git+ac3201d-6 \ - xxd=2:8.2.3995-1ubuntu2.19 \ - file=1:5.41-3ubuntu0.1 \ - stress-ng=0.13.12-2ubuntu1 \ + busybox-static=1:1.36.1-6ubuntu3.1 \ + coreutils=9.4-3ubuntu6 \ + bash=5.2.21-2ubuntu4 \ + psmisc=23.7-1build1 \ + bc=1.07.1-3ubuntu4 \ + curl=8.5.0-2ubuntu10.4 \ + device-tree-compiler=1.7.0-2build1 \ + jq=1.7.1-3build1 \ + lua5.4=5.4.6-3build2 \ + lua-socket=3.1.0-1 \ + xxd=2:9.1.0016-1ubuntu7.3 \ + file=1:5.45-3build1 \ + stress-ng=0.17.06-1build1 \ + libatomic1=14.2.0-4ubuntu2~24.04 \ /tmp/${TOOLS_DEB} \ && \ rm -rf /var/lib/apt/lists/* /tmp/${TOOLS_DEB} diff --git a/rollup-http/.cargo/config.toml b/rollup-http/.cargo/config.toml index b7f2f7bf..0f7bbea4 100644 --- a/rollup-http/.cargo/config.toml +++ b/rollup-http/.cargo/config.toml @@ -1,5 +1,5 @@ [target.riscv64gc-unknown-linux-gnu] -linker = "riscv64-linux-gnu-gcc-12" +linker = "riscv64-linux-gnu-gcc" [net] git-fetch-with-cli = true From e605d9b0211e3258bf687df81c8ada4786c4e4b4 Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Tue, 22 Oct 2024 18:38:10 -0300 Subject: [PATCH 3/3] feat: strip libcmt libraries to reduce its size --- sys-utils/libcmt/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys-utils/libcmt/Makefile b/sys-utils/libcmt/Makefile index 52484e88..a6c07d56 100644 --- a/sys-utils/libcmt/Makefile +++ b/sys-utils/libcmt/Makefile @@ -19,6 +19,7 @@ TARGET_PREFIX ?= $(PREFIX) TOOLCHAIN_PREFIX ?= riscv64-linux-gnu- TARGET_CC := $(TOOLCHAIN_PREFIX)gcc TARGET_AR := $(TOOLCHAIN_PREFIX)ar +TARGET_STRIP := $(TOOLCHAIN_PREFIX)strip COMMON_CFLAGS := -Wvla -O2 -g -Wall -pedantic -Wextra -Iinclude \ -fno-strict-aliasing -fno-strict-overflow -fPIC TARGET_CFLAGS := $(COMMON_CFLAGS) -ftrivial-auto-var-init=zero -Wstrict-aliasing=3 @@ -77,10 +78,12 @@ libcmt: $(libcmt_LIB) $(libcmt_SO) install-run: $(libcmt_SO) mkdir -p $(TARGET_DESTDIR)$(TARGET_PREFIX)/lib cp -f $(libcmt_SO) $(TARGET_DESTDIR)$(TARGET_PREFIX)/lib + $(TARGET_STRIP) -S -x $(TARGET_DESTDIR)$(TARGET_PREFIX)/lib/libcmt.so install: $(libcmt_LIB) build/ffi.h mkdir -p $(TARGET_DESTDIR)$(TARGET_PREFIX)/lib cp -f $(libcmt_LIB) $(TARGET_DESTDIR)$(TARGET_PREFIX)/lib + $(TARGET_STRIP) -S $(TARGET_DESTDIR)$(TARGET_PREFIX)/lib/libcmt.a mkdir -p $(TARGET_DESTDIR)$(TARGET_PREFIX)/include/libcmt/ cp -f include/libcmt/*.h $(TARGET_DESTDIR)$(TARGET_PREFIX)/include/libcmt/ cp -f build/ffi.h $(TARGET_DESTDIR)$(TARGET_PREFIX)/include/libcmt/